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

Fix the calculation for estimated gas price #3117

Merged
merged 5 commits into from
Jan 8, 2025

Conversation

piersy
Copy link
Contributor

@piersy piersy commented Dec 12, 2024

Updates estimateFeesPerGas to handle both the values
returned by the Celo L1 and also the values that will be returned
by the L2 Celo implementation.

Also removes the use of the viem multiplier for Celo L1 gas
calculations since the Celo L1 node already doubles the base fee.

Changes explained in detail:

Note the default viemMultiplier is 1.2 and the default celoMultiplier is 2.

The current gas maxFeePerGas suggested by viem (before this PR) is this:

  • Celo L1 - ((baseFee * celoMultiplier) * viemMultiplier) + suggestedTip
  • Op L2 stack - ((baseFee+suggestedTip) * viemMultiplier) + suggestedTip

With this PR we get:

  • Celo L1 - (baseFee * celoMultiplier) + suggestedTip
  • Op L2 stack - (baseFee * viemMultiplier) + suggestedTip

Copy link

changeset-bot bot commented Dec 12, 2024

🦋 Changeset detected

Latest commit: 7249a73

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
viem Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Dec 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
viem ✅ Ready (Inspect) Visit Preview Dec 12, 2024 1:30pm

Copy link

vercel bot commented Dec 12, 2024

@piersy is attempting to deploy a commit to the Wevm Team on Vercel.

A member of the Team first needs to authorize it.

piersy and others added 4 commits January 9, 2025 07:48
The gas price returned by the rpc is base_fee + max_priority_fee.
So we shouldn't add the max_priority_fee onto that value since it's
already included. Also the logic used by viem for applying the
multiplier is to only apply the multiplier to the base fee and not the
priority fee, so we match that approach here.
@jxom jxom force-pushed the piersy/fix_gas_price_estimation branch from 5cb2631 to b7163c2 Compare January 8, 2025 20:57
@jxom jxom merged commit 99706e7 into wevm:main Jan 8, 2025
2 of 3 checks passed
@github-actions github-actions bot mentioned this pull request Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants