-
Notifications
You must be signed in to change notification settings - Fork 967
refactor: replace U256 with u64 in BLOCKHASH #1505
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
crates/revm/src/context.rs
Outdated
| fn block_hash(&mut self, number: u64) -> Option<B256> { | ||
| let block_number = as_usize_saturated!(self.env().block.number); | ||
| let requested_number = as_usize_saturated!(number); | ||
| let requested_number = number as usize; |
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.
This can panic. We should use usize::try_from(number).unwrap_or(usize::MAX);
rakita
left a comment
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.
cool change. One edge case pending
|
@rakita thanks for your review, I've refactored accordingly. |
cf48fd3 to
4d3faae
Compare
rakita
left a comment
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.
lgtm
Description
Change the type of the number parameter in the block_hash methods of Host and Database from U256 to u64.
Closes #1423
\cc @rakita @DaniPopes