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

Remove risks of panic #1231

Merged
merged 4 commits into from
Sep 18, 2023
Merged

Conversation

Nashtare
Copy link
Collaborator

@Nashtare Nashtare commented Sep 12, 2023

The as_u32 / as_u64 methods of U256 will panic if the integer is actually greater, which is not ideal.
This PR handles soft conversions which error instead of panicking.

Also prevents panicking from the interpreter methods and tests.

@Nashtare Nashtare self-assigned this Sep 12, 2023
@Nashtare
Copy link
Collaborator Author

@npwardberkeley Would you mind having a look when you have time? That's not a super rich PR but the test runner / cluster would break unexpectedly with those conditions not respected (and a bunch of tests from the EVM test suite do not abide).

@npwardberkeley npwardberkeley self-requested a review September 18, 2023 17:06
evm/src/util.rs Outdated Show resolved Hide resolved
evm/src/fixed_recursive_verifier.rs Show resolved Hide resolved
Copy link
Contributor

@npwardberkeley npwardberkeley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm!

@Nashtare Nashtare merged commit 696377b into 0xPolygonZero:main Sep 18, 2023
2 checks passed
@Nashtare Nashtare deleted the error_vs_panic branch September 18, 2023 18:55
@Nashtare Nashtare mentioned this pull request Sep 21, 2023
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.

2 participants