Skip to content

Commit

Permalink
fix: re-enable foldhash by default, but exclude it from zkvm (#777)
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniPopes authored Oct 21, 2024
1 parent 9c53778 commit 0ba6265
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions crates/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ tiny-keccak = ["alloy-primitives/tiny-keccak"]
map = ["alloy-primitives/map"]
map-hashbrown = ["alloy-primitives/map-hashbrown"]
map-indexmap = ["alloy-primitives/map-indexmap"]
map-foldhash = ["alloy-primitives/map-foldhash"]
map-fxhash = ["alloy-primitives/map-fxhash"]

getrandom = ["alloy-primitives/getrandom"]
Expand Down
2 changes: 1 addition & 1 deletion crates/primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ criterion.workspace = true
serde_json.workspace = true

[features]
default = ["std", "map"]
default = ["std", "map", "map-foldhash"]
std = [
"bytes/std",
"hex/std",
Expand Down
3 changes: 2 additions & 1 deletion crates/primitives/src/map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ cfg_if! {

// Default hasher.
cfg_if! {
if #[cfg(feature = "map-foldhash")] {
// TODO: Use `foldhash` in zkVM when it's supported.
if #[cfg(all(feature = "map-foldhash", not(target_os = "zkvm")))] {
type DefaultHashBuilderInner = foldhash::fast::RandomState;
} else if #[cfg(feature = "map-fxhash")] {
type DefaultHashBuilderInner = FxBuildHasher;
Expand Down

0 comments on commit 0ba6265

Please sign in to comment.