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

verificationGasLimit calculation unnecessarily includes preVerificationGas #189

Closed
voltrevo opened this issue Apr 3, 2024 · 1 comment
Closed

Comments

@voltrevo
Copy link

voltrevo commented Apr 3, 2024

Hi

On this line:

    const verificationGasLimit = BigNumber.from(preOpGas).toNumber()

https://github.com/eth-infinitism/bundler/blob/26e4f4c/packages/bundler/src/UserOpMethodHandler.ts#L157

preOpGas is used for the verificationGasLimit for the response.

However, preOpGas includes preVerificationGas:

            outOpInfo.preOpGas = preGas - gasleft() + userOp.preVerificationGas;

https://github.com/eth-infinitism/account-abstraction/blob/8fae866/contracts/core/EntryPoint.sol#L672

In addition to this seeming to be unnecessary (since the gas needed for verification should be unrelated to preVerificationGas), this caused me confusion because I was setting high values for all gas fields when calling eth_estimateUserOperationGas so that I could then follow with the appropriate values returned by this call. This caused the bundler to respond with an unreasonably high value for verificationGas, which is supposed to be only the amount necessary for the operation. In my case, it was higher than the hardcoded 10e6 overall gas limit, causing bundle failure.

@drortirosh
Copy link
Contributor

Yes, the verfiicationGas calculation is currently incorrect. We are in the process of fixing and standarizing gas limit calculations.
It is indeed a complex issue, and affect more than just this method.

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

No branches or pull requests

3 participants
@voltrevo @drortirosh and others