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(evm): The estimated gas and the gas used for executing the message are not consistent #1943
Conversation
61c0249
to
03835d2
Compare
Codecov Report
@@ Coverage Diff @@
## main #1943 +/- ##
==========================================
+ Coverage 69.70% 69.99% +0.28%
==========================================
Files 331 327 -4
Lines 24514 24292 -222
==========================================
- Hits 17088 17003 -85
+ Misses 6543 6417 -126
+ Partials 883 872 -11
|
5a53c87
to
616dc9e
Compare
Thanks for the contribution @cuiweixie!! We appreciate you reporting this. However, this is actually not a solution to the issue. The Test with the changes proposed here:
Test with current code on main:
The difference in both cases is 10500 |
I will try to fix it in right way. If you know the right way to fix this, please tell me. I will update my pr. |
616dc9e
to
a95227f
Compare
65d42fa
to
9b7f160
Compare
@GAtom22 in the new codebase, the nix_tests(test_staking in test_precompiles.py) can passed now. |
c12b3b7
to
2ca0c9f
Compare
d5ed251
to
c79378d
Compare
c79378d
to
3c86240
Compare
Please add a changelog entry |
3c86240
to
2b5cb37
Compare
6c46706
to
b9ff714
Compare
Added a new test where there's a smart contract that calls the staking EVM extension, and in this case we're still having the same issue. The gas estimation is higher than the gas used:
|
Co-authored-by: Tom <54514587+GAtom22@users.noreply.github.com>
Co-authored-by: Tom <54514587+GAtom22@users.noreply.github.com>
Co-authored-by: Tom <54514587+GAtom22@users.noreply.github.com>
Co-authored-by: Tom <54514587+GAtom22@users.noreply.github.com>
@GAtom22 I find this may not be a issue. the testDelegate call is same now.
i think the difference is caused by same issue in above link. what 's more! estimate gas is binary search the gas limit. when find a fake minimal gasLimit, it doesn't means that the |
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.
tACK! Thanks for the contribution @cuiweixie!
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.
Great job @cuiweixie, and thanks a lot for contributing to our codebase and improving it!
Co-authored-by: stepit <48993133+0xstepit@users.noreply.github.com>
Co-authored-by: stepit <48993133+0xstepit@users.noreply.github.com>
Description
when execute a eth msg, the kv gas config is zeros, see comments.
but gas config is not zero in estimate gas.
these will cause estimate gas return more gas that execution really need when call precompile smart contract.
set the estimate gas to same as in execution.
Closes #XXX