-
Notifications
You must be signed in to change notification settings - Fork 323
Fix to expmod precompile gas calculation #1176
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
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1176 +/- ##
=======================================
Coverage 94.89% 94.89%
=======================================
Files 171 171
Lines 19676 19687 +11
=======================================
+ Hits 18671 18682 +11
Misses 1005 1005
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
96674ed
to
e5a4ddb
Compare
e165b28
to
7b03fc1
Compare
9bf56bc
to
4dd801d
Compare
992144c
to
45b766f
Compare
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.
Ok overall, One comment added.
test/state/precompiles.cpp
Outdated
const auto base_len = be::unsafe::load<uint256>(&input_header[0]); | ||
const auto exp_len = be::unsafe::load<uint256>(&input_header[32]); | ||
const auto mod_len = be::unsafe::load<uint256>(&input_header[64]); | ||
const auto adjusted_len = [input](size_t offset, uint32_t len) { |
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.
It's valid only for calculation of adjusted exp
len. Should we call it adjusted_exp_len
?
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.
Added prefix calc_
for helper function to distinguish it from values. And renamed this to calc_adjusted_exp_len()
.
Fix and refactor gas cost calculation for the expmod precompile. The issue was that some computations could overflow and the result was incorrect. This was found by a fuzzer so some test vectors are included.
45b766f
to
f322609
Compare
Fix and refactor gas cost calculation for the expmod precompile.
The issue was that some computations could overflow and the result
was incorrect.
This was found by a fuzzer so some test vectors are included.