-
Notifications
You must be signed in to change notification settings - Fork 7
Add warning when overflow happens #503
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
|
|
||
| let u128_max: U256 = U256::from(u128::MAX); | ||
| let clamped_amount = if amount > u128_max { | ||
| tracing::info!( |
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.
Here it's info and in state it's warn. Shouldn't this be consistent?
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.
The issue was that it flooded the terminal. The migration runs during each test for 15 accounts which are funded with u256::max, so I decided to decrease the log level.
When an overflow happens on the block timestamp, block number, or balance while using cheatcodes, a warning is triggered and the value is rounded to the maximum possible value. For
CALLandCREATEopcodes with an excessively high balance, a revert is triggered.