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

Add sliding window to arbitrum preVerificationGas calculation #303

Merged
merged 3 commits into from
Sep 26, 2024
Merged
Changes from 1 commit
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
10 changes: 9 additions & 1 deletion src/utils/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ export async function calcPreVerificationGas(
preVerificationGas = await calcArbitrumPreVerificationGas(
publicClient,
userOperation,
validate,
entryPoint,
preVerificationGas
)
Expand Down Expand Up @@ -582,6 +583,7 @@ const getArbitrumL1FeeAbi = [
export async function calcArbitrumPreVerificationGas(
publicClient: PublicClient<Transport, Chain | undefined>,
op: UserOperation,
validate: boolean,
entryPoint: Address,
staticFee: bigint
) {
Expand Down Expand Up @@ -649,7 +651,13 @@ export async function calcArbitrumPreVerificationGas(
serializedTx
])

return result[0] + staticFee
let gasForL1 = result[0]

if (validate) {
gasForL1 = (gasForL1 * 80n) / 100n
}

return staticFee + gasForL1
}

export function parseViemError(err: unknown) {
Expand Down
Loading