diff --git a/src/handlers/gasPriceManager.ts b/src/handlers/gasPriceManager.ts index 342d566b..d5964ea8 100644 --- a/src/handlers/gasPriceManager.ts +++ b/src/handlers/gasPriceManager.ts @@ -5,7 +5,6 @@ import { type ChainType } from "@alto/types" import { maxBigInt, minBigInt, type Logger } from "@alto/utils" -// biome-ignore lint/style/noNamespaceImport: explicitly make it clear when sentry is used import * as sentry from "@sentry/node" import { parseGwei, type Chain, type PublicClient } from "viem" import { @@ -86,7 +85,7 @@ export class GasPriceManager { } } - public async init() { + public init() { return Promise.all([ this.updateGasPrice(), this.legacyTransactions === false @@ -453,7 +452,7 @@ export class GasPriceManager { return baseFee } - public async getBaseFee(): Promise { + public getBaseFee() { if (this.legacyTransactions) { throw new RpcError( "baseFee is not available for legacy transactions" @@ -484,8 +483,7 @@ export class GasPriceManager { return gasPrice } - // biome-ignore lint/suspicious/useAwait: - public async getGasPrice(): Promise { + public getGasPrice() { if (this.gasPriceRefreshIntervalInSeconds === 0) { return this.updateGasPrice() } diff --git a/src/utils/validation.ts b/src/utils/validation.ts index b43cef18..1c8c6a76 100644 --- a/src/utils/validation.ts +++ b/src/utils/validation.ts @@ -514,8 +514,11 @@ export async function calcOptimismPreVerificationGas( } }) - const { result: l1Fee } = await opGasPriceOracle.simulate.getL1Fee([ - serializedTx + const [{ result: l1Fee }, baseFeePerGas] = await Promise.all([ + opGasPriceOracle.simulate.getL1Fee([serializedTx]), + verify + ? gasPriceManager.getMaxBaseFeePerGas() + : gasPriceManager.getBaseFee() ]) if (op.maxFeePerGas <= 1n || op.maxPriorityFeePerGas <= 1n) { @@ -527,12 +530,6 @@ export async function calcOptimismPreVerificationGas( const l2MaxFee = op.maxFeePerGas - let baseFeePerGas = 0n - if (verify) { - baseFeePerGas = await gasPriceManager.getMaxBaseFeePerGas() - } else { - baseFeePerGas = await gasPriceManager.getBaseFee() - } const l2PriorityFee = baseFeePerGas + op.maxPriorityFeePerGas const l2price = minBigInt(l2MaxFee, l2PriorityFee)