Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

always fetch gasPrice from network when bundling #347

Merged
merged 1 commit into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/executor/executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ export class Executor {
): Promise<ReplaceTransactionResult> {
const newRequest = { ...transactionInfo.transactionRequest }

const gasPriceParameters = await this.gasPriceManager.getGasPrice()
const gasPriceParameters =
await this.gasPriceManager.getNetworkGasPrice()

newRequest.maxFeePerGas = maxBigInt(
gasPriceParameters.maxFeePerGas,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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({
Expand Down Expand Up @@ -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({
Expand Down
3 changes: 2 additions & 1 deletion src/executor/executorManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion src/executor/senderManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down
4 changes: 4 additions & 0 deletions src/handlers/gasPriceManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,10 @@ export class GasPriceManager {
}
}

public async getNetworkGasPrice(): Promise<GasPriceParameters> {
return await this.innerGetGasPrice()
}

public async getMaxBaseFeePerGas(): Promise<bigint> {
let maxBaseFeePerGas = this.baseFeePerGasQueue.getMaxValue()
if (!maxBaseFeePerGas) {
Expand Down
Loading