diff --git a/src/cli/config/bundler.ts b/src/cli/config/bundler.ts index ff5cd886..b899948f 100644 --- a/src/cli/config/bundler.ts +++ b/src/cli/config/bundler.ts @@ -141,7 +141,8 @@ export const compatibilityArgsSchema = z.object({ "fixed-gas-limit-for-estimation": z .string() .transform((val) => BigInt(val)) - .optional() + .optional(), + "use-gas-fees-during-estimation": z.boolean().default(true) }) export const serverArgsSchema = z.object({ diff --git a/src/cli/config/options.ts b/src/cli/config/options.ts index 32848d87..e2cc24cc 100644 --- a/src/cli/config/options.ts +++ b/src/cli/config/options.ts @@ -238,6 +238,12 @@ export const compatibilityOptions: CliCommandOptions = type: "string", require: true, default: "110" + }, + "use-gas-fees-during-estimation": { + description: "Use maxFeePerGas during estimation", + type: "boolean", + require: false, + default: true } } diff --git a/src/cli/setupServer.ts b/src/cli/setupServer.ts index 3fa61974..0031f94a 100644 --- a/src/cli/setupServer.ts +++ b/src/cli/setupServer.ts @@ -238,7 +238,8 @@ const getExecutor = ({ parsedArgs["legacy-transactions"], parsedArgs["fixed-gas-limit-for-estimation"], parsedArgs["block-tag-support"], - parsedArgs["local-gas-limit-calculation"] + parsedArgs["local-gas-limit-calculation"], + parsedArgs["use-gas-fees-during-estimation"] ) } diff --git a/src/executor/executor.ts b/src/executor/executor.ts index b00c61b4..f76c117b 100644 --- a/src/executor/executor.ts +++ b/src/executor/executor.ts @@ -125,6 +125,7 @@ export class Executor { blockTagSupport: boolean mutex: Mutex eventManager: EventManager + sendGasFees: boolean constructor( publicClient: PublicClient, @@ -141,7 +142,8 @@ export class Executor { legacyTransactions = false, fixedGasLimitForEstimation?: bigint, blockTagSupport = true, - localGasLimitCalculation = false + localGasLimitCalculation = false, + sendGasFees = true ) { this.publicClient = publicClient this.walletClient = walletClient @@ -158,6 +160,7 @@ export class Executor { this.eventManager = eventManager this.blockTagSupport = blockTagSupport this.entryPoints = entryPoints + this.sendGasFees = sendGasFees this.mutex = new Mutex() } @@ -279,7 +282,8 @@ export class Executor { this.legacyTransactions, this.fixedGasLimitForEstimation, this.reputationManager, - this.logger + this.logger, + this.sendGasFees ) const childLogger = this.logger.child({ @@ -616,7 +620,8 @@ export class Executor { this.legacyTransactions, this.fixedGasLimitForEstimation, this.reputationManager, - childLogger + childLogger, + this.sendGasFees ) if (simulatedOps.length === 0) { @@ -912,7 +917,8 @@ export class Executor { this.legacyTransactions, this.fixedGasLimitForEstimation, this.reputationManager, - childLogger + childLogger, + this.sendGasFees ) gasLimit += 10_000n diff --git a/src/executor/utils.ts b/src/executor/utils.ts index e262c1c4..209b3b4c 100644 --- a/src/executor/utils.ts +++ b/src/executor/utils.ts @@ -132,7 +132,8 @@ export async function filterOpsAndEstimateGas( onlyPre1559: boolean, fixedGasLimitForEstimation: bigint | undefined, reputationManager: InterfaceReputationManager, - logger: Logger + logger: Logger, + sendGasFees: boolean ) { const simulatedOps: { owh: UserOperationWithHash @@ -148,9 +149,11 @@ export async function filterOpsAndEstimateGas( callContext.type !== "default" || // All compressed ops are v6 by default isVersion06(simulatedOps[0].owh.mempoolUserOperation as UserOperation) - const gasOptions = onlyPre1559 - ? { gasPrice: maxFeePerGas } - : { maxFeePerGas, maxPriorityFeePerGas } + const gasOptions = sendGasFees + ? onlyPre1559 + ? { gasPrice: maxFeePerGas } + : { maxFeePerGas, maxPriorityFeePerGas } + : {} let fixedEstimationGasLimit: bigint | undefined = fixedGasLimitForEstimation let retriesLeft = 5