diff --git a/packages/utils/src/validation.ts b/packages/utils/src/validation.ts index 0800a2fa..f14828ab 100644 --- a/packages/utils/src/validation.ts +++ b/packages/utils/src/validation.ts @@ -227,6 +227,8 @@ export async function calcOptimismPreVerificationGas( throw new RpcError("block does not have baseFeePerGas") } + const maxPriorityFeePerGas = await publicClient.estimateMaxPriorityFeePerGas() + const serializedTx = serializeTransaction( { to: entryPoint, @@ -251,12 +253,9 @@ export async function calcOptimismPreVerificationGas( const { result: l1Fee } = await opGasPriceOracle.simulate.getL1Fee([serializedTx]) - const l2MaxFee = op.maxFeePerGas - const l2PriorityFee = latestBlock.baseFeePerGas + op.maxPriorityFeePerGas - - const l2price = l2MaxFee < l2PriorityFee ? l2MaxFee : l2PriorityFee + const l2PriorityFee = latestBlock.baseFeePerGas + maxPriorityFeePerGas - return l1Fee / l2price + return l1Fee / l2PriorityFee } const getArbitrumL1FeeAbi = [