Skip to content

fixed log tests that were failing because gas calculations were resulting in U256 to overflow#342

Merged
SamWilsn merged 1 commit intoethereum:masterfrom
voith:fix/u256-overflow-tests
Sep 15, 2021
Merged

fixed log tests that were failing because gas calculations were resulting in U256 to overflow#342
SamWilsn merged 1 commit intoethereum:masterfrom
voith:fix/u256-overflow-tests

Conversation

@voith
Copy link
Contributor

@voith voith commented Sep 15, 2021

What was wrong?

Some gas calculations were causing U256 to overflow.

How was it fixed?

  • Implemented u256_safe_add and u256_safe_multiply that add and multiuply respectively and raise OutOfGasError if the result exceeds U256.MAX_VALUE.
  • Uncommented tests that were failing because of the above-mentioned error.

Note

I haven't applied the new safe arithmetic methods in other places where gas calculation could possibly overflow. I can do this in a separate PR.

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

Pic credits: www.homeoanimal.com

@codecov-commenter
Copy link

Codecov Report

Merging #342 (8d823dc) into master (232c42b) will decrease coverage by 0.15%.
The diff coverage is 84.84%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #342      +/-   ##
==========================================
- Coverage   95.19%   95.04%   -0.16%     
==========================================
  Files          45       46       +1     
  Lines        2291     2319      +28     
==========================================
+ Hits         2181     2204      +23     
- Misses        110      115       +5     
Flag Coverage Δ
unittests 95.04% <84.84%> (-0.16%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/ethereum/utils/safe_arithmetic.py 73.68% <73.68%> (ø)
src/ethereum/frontier/vm/gas.py 100.00% <100.00%> (ø)
src/ethereum/frontier/vm/instructions/log.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 232c42b...8d823dc. Read the comment docs.

@voith voith changed the title fixed log tests that were failing because gas calculations would result in U256 to overflow fixed log tests that were failing because gas calculations were resulting in U256 to overflow Sep 15, 2021
@SamWilsn SamWilsn merged commit 79cae05 into ethereum:master Sep 15, 2021
@voith voith deleted the fix/u256-overflow-tests branch September 15, 2021 15:07
Carsons-Eels pushed a commit to Carsons-Eels/execution-specs that referenced this pull request Oct 16, 2025
…m#342)

Co-authored-by: spencer <spencer.taylor-brown@ethereum.org>
danceratopz added a commit to danceratopz/execution-specs that referenced this pull request Oct 22, 2025
…m#342)

Co-authored-by: spencer <spencer.taylor-brown@ethereum.org>
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

Successfully merging this pull request may close these issues.

3 participants