-
Notifications
You must be signed in to change notification settings - Fork 476
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
[SDK] expose estimateUserOpGasCost #6370
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
🦋 Changeset detectedLatest commit: 46bbfb7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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 |
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
fee5d83
to
70b96fb
Compare
size-limit report 📦
|
Codecov ReportAttention: Patch coverage is
❌ Your patch status has failed because the patch coverage (57.65%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #6370 +/- ##
==========================================
+ Coverage 54.60% 54.71% +0.11%
==========================================
Files 874 874
Lines 54525 54617 +92
Branches 3682 3719 +37
==========================================
+ Hits 29774 29885 +111
+ Misses 24656 24637 -19
Partials 95 95
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM minus lint failures
ad087ba
to
db7490d
Compare
gasLimit = | ||
BigInt(userOp.paymasterVerificationGasLimit ?? 0) + | ||
BigInt(userOp.paymasterPostOpGasLimit ?? 0) + | ||
BigInt(userOp.verificationGasLimit ?? 0) + | ||
BigInt(userOp.preVerificationGas ?? 0) + | ||
BigInt(userOp.preVerificationGas ?? 0) + | ||
BigInt(userOp.callGasLimit ?? 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There appears to be a duplicate addition of preVerificationGas
in the gas limit calculation, which will result in an inflated total gas cost estimate. The line BigInt(userOp.preVerificationGas ?? 0)
appears twice in the sum. Removing one instance will provide more accurate gas estimates.
Spotted by Graphite Reviewer
Is this helpful? React 👍 or 👎 to let us know.
gasLimit = | ||
BigInt(userOp.paymasterVerificationGasLimit ?? 0) + | ||
BigInt(userOp.paymasterPostOpGasLimit ?? 0) + | ||
BigInt(userOp.verificationGasLimit ?? 0) + | ||
BigInt(userOp.preVerificationGas ?? 0) + | ||
BigInt(userOp.preVerificationGas ?? 0) + | ||
BigInt(userOp.callGasLimit ?? 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
preVerificationGas
is being added twice in this calculation, which will result in an inflated gas cost estimate. Consider removing one of these duplicate additions to ensure accurate gas cost estimation.
Spotted by Graphite Reviewer
Is this helpful? React 👍 or 👎 to let us know.
db7490d
to
46bbfb7
Compare
Fixes TOOL-3521
PR-Codex overview
This PR introduces a new utility function to estimate the gas cost of user operations, enhances existing functions for better async handling, and updates tests to validate the new functionality.
Detailed summary
estimateUserOpGasCost()
for estimating gas costs of user operations.getEntrypointFromFactory
to be exported.isOpStackChain
to an async function with additional checks.