diff --git a/packages/executor/src/entities/MempoolEntry.ts b/packages/executor/src/entities/MempoolEntry.ts index 15c805d9..0c37f316 100644 --- a/packages/executor/src/entities/MempoolEntry.ts +++ b/packages/executor/src/entities/MempoolEntry.ts @@ -123,6 +123,7 @@ export class MempoolEntry implements IMempoolEntry { * @returns boolaen */ canReplace(existingEntry: MempoolEntry): boolean { + if (existingEntry.status > MempoolEntryStatus.OnChain) return true; if (!this.isEqual(existingEntry)) return false; if ( BigNumber.from(this.userOp.maxPriorityFeePerGas).lt( diff --git a/packages/executor/src/modules/eth.ts b/packages/executor/src/modules/eth.ts index 333551a0..48939854 100644 --- a/packages/executor/src/modules/eth.ts +++ b/packages/executor/src/modules/eth.ts @@ -60,7 +60,7 @@ export class Eth { } // mantle - if ([5000, 5001].includes(this.chainId)) { + if ([5000, 5001, 5003].includes(this.chainId)) { this.pvgEstimator = estimateMantlePVG(this.provider); } diff --git a/packages/executor/src/services/BundlingService/relayers/base.ts b/packages/executor/src/services/BundlingService/relayers/base.ts index d2f6ff41..68d7e56a 100644 --- a/packages/executor/src/services/BundlingService/relayers/base.ts +++ b/packages/executor/src/services/BundlingService/relayers/base.ts @@ -183,7 +183,7 @@ export abstract class BaseRelayer implements IRelayingMode { if (this.networkConfig.skipBundleValidation) return true; try { // eslint-disable-next-line @typescript-eslint/no-unused-vars - const { gasLimit, ...txWithoutGasLimit } = transactionRequest; + const { gasLimit: _, ...txWithoutGasLimit } = transactionRequest; // some chains, like Bifrost, don't allow setting gasLimit in estimateGas await relayer.estimateGas(txWithoutGasLimit); return true; diff --git a/packages/executor/src/services/BundlingService/relayers/classic.ts b/packages/executor/src/services/BundlingService/relayers/classic.ts index a67178b2..45531127 100644 --- a/packages/executor/src/services/BundlingService/relayers/classic.ts +++ b/packages/executor/src/services/BundlingService/relayers/classic.ts @@ -87,10 +87,15 @@ export class ClassicRelayer extends BaseRelayer { if (!this.config.testingMode) { // check for execution revert - if ( - !(await this.validateBundle(relayer, entries, transactionRequest)) - ) { - return; + if (this.chainId == 5003) { + const { gasLimit: _, ...txWithoutGasLimit } = transactionRequest; + transaction.gasLimit = await relayer.estimateGas(txWithoutGasLimit); + } else { + if ( + !(await this.validateBundle(relayer, entries, transactionRequest)) + ) { + return; + } } this.logger.debug( diff --git a/packages/executor/src/services/UserOpValidation/validators/estimation.ts b/packages/executor/src/services/UserOpValidation/validators/estimation.ts index 7ca7ebec..f3b42fcf 100644 --- a/packages/executor/src/services/UserOpValidation/validators/estimation.ts +++ b/packages/executor/src/services/UserOpValidation/validators/estimation.ts @@ -53,13 +53,17 @@ export class EstimationService { this.provider ); - const errorResult = await entryPointContract.callStatic - .simulateHandleOp(userOp, AddressZero, BytesZero, { - gasLimit: getUserOpGasLimit( + const gasLimit = this.networkConfig.gasFeeInSimulation + ? getUserOpGasLimit( userOp, constants.Zero, this.networkConfig.estimationGasLimit - ), + ) + : undefined; + + const errorResult = await entryPointContract.callStatic + .simulateHandleOp(userOp, AddressZero, BytesZero, { + gasLimit, }) .catch((e: any) => nonGethErrorHandler(entryPointContract, e)); @@ -97,17 +101,22 @@ export class EstimationService { forwarderABI, this.provider ); + + const gasLimit = this.networkConfig.gasFeeInSimulation + ? getUserOpGasLimit( + userOp, + constants.Zero, + this.networkConfig.estimationGasLimit + ) + : undefined; + const data = await this.provider.call({ to: this.networkConfig.entryPointForwarder, data: forwarder.interface.encodeFunctionData("forward", [ entryPoint, simulateData, ]), - gasLimit: getUserOpGasLimit( - userOp, - BigNumber.from(105000), - this.networkConfig.estimationGasLimit - ), + gasLimit, }); const error = entryPointContract.interface.parseError(data); diff --git a/packages/executor/src/services/UserOpValidation/validators/unsafe.ts b/packages/executor/src/services/UserOpValidation/validators/unsafe.ts index 9d63ae8a..d3aefe43 100644 --- a/packages/executor/src/services/UserOpValidation/validators/unsafe.ts +++ b/packages/executor/src/services/UserOpValidation/validators/unsafe.ts @@ -21,13 +21,18 @@ export class UnsafeValidationService { entryPoint, this.provider ); - const errorResult = await entryPointContract.callStatic - .simulateValidation(userOp, { - gasLimit: getUserOpGasLimit( + + const gasLimit = this.networkConfig.gasFeeInSimulation + ? getUserOpGasLimit( userOp, constants.Zero, this.networkConfig.estimationGasLimit - ), + ) + : undefined; + + const errorResult = await entryPointContract.callStatic + .simulateValidation(userOp, { + gasLimit, }) .catch((e: any) => nonGethErrorHandler(entryPointContract, e)); return parseErrorResult(userOp, errorResult); @@ -52,17 +57,22 @@ export class UnsafeValidationService { forwarderABI, this.provider ); + + const gasLimit = this.networkConfig.gasFeeInSimulation + ? getUserOpGasLimit( + userOp, + constants.Zero, + this.networkConfig.estimationGasLimit + ) + : undefined; + const data = await this.provider.call({ to: this.networkConfig.entryPointForwarder, data: forwarder.interface.encodeFunctionData("forward", [ entryPoint, validationData, ]), - gasLimit: getUserOpGasLimit( - userOp, - constants.Zero, - this.networkConfig.estimationGasLimit - ), + gasLimit, }); const error = entryPointContract.interface.parseError(data); return parseErrorResult(userOp, { diff --git a/packages/params/src/gas-price-oracles/oracles/index.ts b/packages/params/src/gas-price-oracles/oracles/index.ts index 38881455..b4899909 100644 --- a/packages/params/src/gas-price-oracles/oracles/index.ts +++ b/packages/params/src/gas-price-oracles/oracles/index.ts @@ -23,4 +23,5 @@ export const oracles: { 8453: getBaseGasFee, 888888888: getAncient8GasFee, 59144: getEthGasPrice, + 5003: getMantleGasFee, };