Skip to content
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

Implement panics #476

Merged
merged 4 commits into from
Jul 9, 2021
Merged

Conversation

cburgdorf
Copy link
Collaborator

@cburgdorf cburgdorf commented Jul 5, 2021

What was wrong?

Internal errors are currently reverted without any data. They should be encoded using certain panic codes as defined here: https://docs.soliditylang.org/en/v0.8.4/control-structures.html?highlight=Panic#panic-via-assert-and-error-via-require

How was it fixed?

  1. Added a few more solidity tests to make sure we follow their lead here
  2. Some cleanups
  3. Added a new revert_with_panic runtime function that is used to properly encode reverts from:
  • failed assertions
  • div or mod by zero
  • over / underflow

TODO

Note that #339 specifies a few more panics and I suspect some of that can be introduced in #440

@codecov-commenter
Copy link

codecov-commenter commented Jul 7, 2021

Codecov Report

Merging #476 (d2b96c8) into master (77c7b72) will increase coverage by 0.10%.
The diff coverage is n/a.

❗ Current head d2b96c8 differs from pull request most recent head 15cb46c. Consider uploading reports for the commit 15cb46c to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master     #476      +/-   ##
==========================================
+ Coverage   87.32%   87.43%   +0.10%     
==========================================
  Files          77       77              
  Lines        5081     5116      +35     
==========================================
+ Hits         4437     4473      +36     
+ Misses        644      643       -1     
Impacted Files Coverage Δ
crates/test-utils/src/lib.rs 83.00% <ø> (+0.56%) ⬆️
crates/yulgen/src/constants.rs 100.00% <ø> (ø)
crates/yulgen/src/mappers/functions.rs 97.50% <ø> (ø)
crates/yulgen/src/runtime/functions/math.rs 95.91% <ø> (+0.48%) ⬆️
crates/yulgen/src/runtime/functions/mod.rs 100.00% <ø> (ø)
crates/yulgen/src/runtime/functions/revert.rs 100.00% <ø> (ø)
... and 1 more

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 77c7b72...15cb46c. Read the comment docs.

@cburgdorf cburgdorf marked this pull request as ready for review July 8, 2021 09:37
@g-r-a-n-t g-r-a-n-t merged commit 95b833c into ethereum:master Jul 9, 2021
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