fix(l2): prover_server eth_estimateGas reverts #1573
+33
−18
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
There was a bug with block 288 while using the
prover_server
indev
mode. While debugging the problem, i faced with several possible problems regarding gas estimations.At the end, the problem was caused by how the calldata was structured. I am not fully aware of the root cause, since it happened just with blocks higher than 288 == 0x120.
To replicate the issue, we can send an
eth_estimateGas
request:If we change the
123
with a number <=120
we will get a custom error message triggered by therequire
statements in the OnChainProposer.sol, otherwise we will get a message that says: "reverted: unknown reason".Description
min
withmax
in thecalc_gas_limit()
functionas_u64()
after checking the number to avoid panicsgas
in aneth_estimateGas
request is optional, if we set it to0
in the request, thehighest_gas_limit
would have been 0, now with the change, if thegas
is 0, thehighest_gas_limit
is equal to theblock.gas_limit
.