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

refactor: small refactoring of revm database and documentation #5864

Merged
merged 1 commit into from
Dec 27, 2023

Conversation

tcoratger
Copy link
Contributor

Description

This pull request introduces a minor refactoring in the REVM database to improve readability and make slight enhancements to the documentation.

Changes Made

  • Refactoring: Streamlined method implementations in the REVM database for improved readability.
  • Documentation: Enhanced function header comments for better clarity and understanding.

@tcoratger tcoratger requested a review from mattsse as a code owner December 27, 2023 10:40
Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

thanks, this is great!

the existing U256 -> u64 unwraps are not great, I think we should do something about this and map them to a new error variant perhaps

Comment on lines +75 to 78
/// Note: It safely casts the `number` to `u64`.
fn block_hash(&mut self, number: U256) -> Result<B256, Self::Error> {
// The `number` represents the block number, so it is safe to cast it to u64.
Ok(self.0.block_hash(number.try_into().unwrap())?.unwrap_or_default())
Copy link
Collaborator

Choose a reason for hiding this comment

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

actually, I don't like the try_into unwrap here, perhaps we can do something about this in a followup.

@mattsse mattsse added this pull request to the merge queue Dec 27, 2023
@mattsse mattsse added the C-docs An addition or correction to our documentation label Dec 27, 2023
Merged via the queue into paradigmxyz:main with commit fa2fd0d Dec 27, 2023
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-docs An addition or correction to our documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants