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

chore: implement Default for other databases #691

Merged
merged 2 commits into from
Sep 7, 2023

Conversation

DaniPopes
Copy link
Collaborator

@DaniPopes DaniPopes commented Sep 6, 2023

And some code cleanup and docs

use crate::AccountInfo;
use crate::U256;
use crate::{Account, Bytecode};
use crate::{B160, B256};
use auto_impl::auto_impl;
use hashbrown::HashMap as Map;

pub mod components;
Copy link
Member

Choose a reason for hiding this comment

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

Why this style and not moving pub used componnets behind pub mod?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't think there's a style guide for this, but I like when it's mod x; use x::*; groups, like: https://github.com/alloy-rs/core/blob/d9d0ded3ca4e2dde992dad1afe6410015158d6b1/crates/syn-solidity/src/lib.rs

Copy link
Member

Choose a reason for hiding this comment

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

I would prefer a little bit of a different order.

// use if needed. or maybe even put reexports.
use std::..

// list all modules in one place
mod components;
mod tests;

// reexport module items here.
pub use components::*

Something like this is easier to my eyes: https://github.com/bluealloy/revm/blob/main/crates/revm/src/db/states.rs
having mod * grouped together.

Just bikesheding, this change in general is nice

Copy link
Member

@rakita rakita left a comment

Choose a reason for hiding this comment

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

Check that ExtDB: DatabaseRef + Default if it can be replaced with Database as it is main trait

Other things lgtm!

@rakita rakita merged commit 7eacc3a into bluealloy:main Sep 7, 2023
7 checks passed
@DaniPopes DaniPopes deleted the db-default-2 branch September 7, 2023 23:29
mikelodder7 pushed a commit to LIT-Protocol/revm that referenced this pull request Sep 12, 2023
* chore: implement `Default` for other databases

* chore: impl EmptyDB traits manually
Evalir pushed a commit to Evalir/revm that referenced this pull request Sep 14, 2023
* chore: implement `Default` for other databases

* chore: impl EmptyDB traits manually
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.

None yet

2 participants