verificationGasLimit calculation unnecessarily includes preVerificationGas
voltrevo opened this issue · 1 comments
Hi
On this line:
const verificationGasLimit = BigNumber.from(preOpGas).toNumber()
preOpGas
is used for the verificationGasLimit
for the response.
However, preOpGas
includes preVerificationGas
:
outOpInfo.preOpGas = preGas - gasleft() + userOp.preVerificationGas;
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.
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.