Skip to content

Commit

Permalink
don't depend on user's input
Browse files Browse the repository at this point in the history
  • Loading branch information
plusminushalf committed Nov 22, 2023
1 parent 752334e commit 27f8b31
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions packages/utils/src/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 = [
Expand Down

0 comments on commit 27f8b31

Please sign in to comment.