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(primitives): replace HashMap re-exports with alloy_primitives::map #1805

Merged
merged 4 commits into from
Oct 2, 2024

Conversation

DaniPopes
Copy link
Collaborator

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

std = ["alloy-primitives/std", "hex/std"]
hashbrown = []
serde = ["alloy-primitives/serde", "hex/serde", "hashbrown/serde"]
default = ["std", "alloy-primitives/default"]
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 remove alloy-primitives/default to leave std map as a default. Other hashers could be enabled by alloy-primitives features

Copy link
Collaborator Author

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?

Copy link
Collaborator Author

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

Copy link
Member

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.

Copy link
Member

Choose a reason for hiding this comment

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

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.

lgtm, merging this first to not have conflict later.

Default hasher in primitives was put to std.

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.

2 participants