From 62b6d2d11bfffcf534aff21164bfc75bc371035b Mon Sep 17 00:00:00 2001 From: mouseless <97399882+mouseless-eth@users.noreply.github.com> Date: Wed, 30 Oct 2024 14:57:04 +0000 Subject: [PATCH] always fetch gasPrice from network when bundling --- src/executor/executor.ts | 11 +++++++---- src/executor/executorManager.ts | 3 ++- src/executor/senderManager.ts | 2 +- src/handlers/gasPriceManager.ts | 4 ++++ 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/executor/executor.ts b/src/executor/executor.ts index bcce3a66..003133c0 100644 --- a/src/executor/executor.ts +++ b/src/executor/executor.ts @@ -147,7 +147,8 @@ export class Executor { ): Promise { const newRequest = { ...transactionInfo.transactionRequest } - const gasPriceParameters = await this.gasPriceManager.getGasPrice() + const gasPriceParameters = + await this.gasPriceManager.getNetworkGasPrice() newRequest.maxFeePerGas = maxBigInt( gasPriceParameters.maxFeePerGas, @@ -489,7 +490,7 @@ export class Executor { const wallets = Array.from(allWallets) - const gasPrice = await this.gasPriceManager.getGasPrice() + const gasPrice = await this.gasPriceManager.getNetworkGasPrice() const promises = wallets.map((wallet) => { flushStuckTransaction( this.config.publicClient, @@ -648,7 +649,8 @@ export class Executor { }) childLogger.debug("bundling user operation") - const gasPriceParameters = await this.gasPriceManager.getGasPrice() + const gasPriceParameters = + await this.gasPriceManager.getNetworkGasPrice() childLogger.debug({ gasPriceParameters }, "got gas price") const nonce = await this.config.publicClient.getTransactionCount({ @@ -927,7 +929,8 @@ export class Executor { }) childLogger.debug("bundling compressed user operation") - const gasPriceParameters = await this.gasPriceManager.getGasPrice() + const gasPriceParameters = + await this.gasPriceManager.getNetworkGasPrice() childLogger.debug({ gasPriceParameters }, "got gas price") const nonce = await this.config.publicClient.getTransactionCount({ diff --git a/src/executor/executorManager.ts b/src/executor/executorManager.ts index 96a26d2b..6fcf22b6 100644 --- a/src/executor/executorManager.ts +++ b/src/executor/executorManager.ts @@ -775,7 +775,8 @@ export class ExecutorManager { await this.refreshUserOperationStatuses() // for all still not included check if needs to be replaced (based on gas price) - const gasPriceParameters = await this.gasPriceManager.getGasPrice() + const gasPriceParameters = + await this.gasPriceManager.getNetworkGasPrice() this.logger.trace( { gasPriceParameters }, "fetched gas price parameters" diff --git a/src/executor/senderManager.ts b/src/executor/senderManager.ts index b804919e..35dfa07a 100644 --- a/src/executor/senderManager.ts +++ b/src/executor/senderManager.ts @@ -138,7 +138,7 @@ export class SenderManager { if (Object.keys(balancesMissing).length > 0) { const { maxFeePerGas, maxPriorityFeePerGas } = - await this.gasPriceManager.getGasPrice() + await this.gasPriceManager.getNetworkGasPrice() if (this.config.refillHelperContract) { const instructions = [] diff --git a/src/handlers/gasPriceManager.ts b/src/handlers/gasPriceManager.ts index c5b4c171..a1ee7861 100644 --- a/src/handlers/gasPriceManager.ts +++ b/src/handlers/gasPriceManager.ts @@ -417,6 +417,10 @@ export class GasPriceManager { } } + public async getNetworkGasPrice(): Promise { + return await this.innerGetGasPrice() + } + public async getMaxBaseFeePerGas(): Promise { let maxBaseFeePerGas = this.baseFeePerGasQueue.getMaxValue() if (!maxBaseFeePerGas) {