-
Notifications
You must be signed in to change notification settings - Fork 589
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(primitives): replace HashMap re-exports with alloy_primitives::map #1805
Conversation
af676c2
to
f60ac88
Compare
crates/primitives/Cargo.toml
Outdated
std = ["alloy-primitives/std", "hex/std"] | ||
hashbrown = [] | ||
serde = ["alloy-primitives/serde", "hex/serde", "hashbrown/serde"] | ||
default = ["std", "alloy-primitives/default"] |
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.
I would remove alloy-primitives/default
to leave std map as a default. Other hashers could be enabled by alloy-primitives features
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.
Sure, do you want to expose these features in revm too?
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.
A small problem with this is that some methods only work with the std hasher (new
, with_capacity
, From::from
...), which is fine if it's the default, but if you change hasher revm will fail to compile and it might not be caught in CI
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.
Was surprised by new
, From::from
when I looked at the changes. We should have CI that switches to non standard hasher.
I want to experiment with this a little, features get unified if same version of dependency is included, as in include both revm
and revm-primitives
, so we could by enabling revm-primitives features enable them inside revm.
Need to check what happens if versions are not same, and how brittle is this pattern.
You don't need to do it now in this PR, but I will maybe add it later when I come to this.
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.
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, merging this first to not have conflict later.
Default hasher in primitives was put to std
.
The semantics of the "hashbrown" feature are the same, meaning that enabling it overrides std with hashbrown, as well as it being the default if std is not enabled.
See: alloy-rs/core#743