diff --git a/ops/testnet/prod/core/config.tf b/ops/testnet/prod/core/config.tf index 83568bceb0..c28a26baef 100644 --- a/ops/testnet/prod/core/config.tf +++ b/ops/testnet/prod/core/config.tf @@ -401,7 +401,8 @@ locals { providers = ["https://base-goerli.g.alchemy.com/v2/${var.basegoerli_alchemy_key_0}", "https://lb.drpc.org/ogrpc?network=base-goerli&dkey=${var.drpc_key}", "https://goerli.base.org"] } "2016506996" = { - providers = ["https://testrpc.x1.tech", "https://x1testrpc.okx.com/"] + providers = ["https://testrpc.x1.tech", "https://x1testrpc.okx.com/"], + minGasPrice = "300000000000" } } environment = var.stage diff --git a/packages/agents/relayer/src/bindings/relays/index.ts b/packages/agents/relayer/src/bindings/relays/index.ts index 21dd0f1f34..63a09aa77c 100644 --- a/packages/agents/relayer/src/bindings/relays/index.ts +++ b/packages/agents/relayer/src/bindings/relays/index.ts @@ -103,10 +103,16 @@ export const pollCache = async () => { // TODO: For `proveAndProcess` calls, we should be providing: // gas limit = expected gas cost + PROCESS_GAS + RESERVE_GAS // We need to read those values from on-chain IFF this is a `proveAndProcess` call. - const gasPrice = await rpcProvider.getGasPrice(); + let gasPrice = await rpcProvider.getGasPrice(); + const minGasPrice = config.chains[domain].minGasPrice; + if (minGasPrice) { + gasPrice = gasPrice.lt(minGasPrice) ? BigNumber.from(minGasPrice) : gasPrice; + } + logger.debug(`Got the gasPrice for domain: ${domain}`, requestContext, methodContext, { gasPrice: gasPrice.toString(), }); + const gasLimit = await txservice.getGasEstimate(+domain, transaction); logger.debug(`Got the gasLimit for domain: ${domain}`, requestContext, methodContext, { gasLimit: gasLimit.toString(), diff --git a/packages/agents/relayer/src/lib/entities/config.ts b/packages/agents/relayer/src/lib/entities/config.ts index 09ed429de1..38eab0fbc8 100644 --- a/packages/agents/relayer/src/lib/entities/config.ts +++ b/packages/agents/relayer/src/lib/entities/config.ts @@ -1,9 +1,10 @@ import { Type, Static } from "@sinclair/typebox"; -import { TAddress } from "@connext/nxtp-utils"; +import { TAddress, TIntegerString } from "@connext/nxtp-utils"; export const TChainConfig = Type.Object({ providers: Type.Array(Type.String()), confirmations: Type.Integer({ minimum: 1 }), // What we consider the "safe confirmations" number for this chain. + minGasPrice: Type.Optional(TIntegerString), // minimun gas price in wei deployments: Type.Object({ connext: TAddress, }),