From d53f9aeec1cc05350d5305d0c8125bf8b8f96299 Mon Sep 17 00:00:00 2001 From: Alexandru Gheorghe Date: Fri, 11 Jul 2025 11:58:33 +0300 Subject: [PATCH] fixup! memory-db: allow changing the default hasher (#224) Signed-off-by: Alexandru Gheorghe --- memory-db/Cargo.toml | 2 +- memory-db/src/lib.rs | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/memory-db/Cargo.toml b/memory-db/Cargo.toml index a25d06db..b8913a26 100644 --- a/memory-db/Cargo.toml +++ b/memory-db/Cargo.toml @@ -10,7 +10,7 @@ edition = "2018" [dependencies] hash-db = { version = "0.16.0", path = "../hash-db", default-features = false } hashbrown = "0.15.3" -foldhash = "0.1.5" +foldhash = { version = "0.1.5", default-features = false } [dev-dependencies] keccak-hasher = { path = "../test-support/keccak-hasher" } diff --git a/memory-db/src/lib.rs b/memory-db/src/lib.rs index 4c45b793..6dda2f0c 100644 --- a/memory-db/src/lib.rs +++ b/memory-db/src/lib.rs @@ -421,7 +421,7 @@ where T: Default + PartialEq + for<'a> From<&'a [u8]> + Clone + Send + Sync, KF: Send + Sync + KeyFunction, KF::Key: Borrow<[u8]> + for<'a> From<&'a [u8]>, - S: BuildHasher + Default, + S: BuildHasher + Default + Send + Sync, { fn get(&self, key: &H::Out) -> Option { match self.data.get(key.as_ref()) { @@ -472,7 +472,7 @@ where T: Default + PartialEq + for<'a> From<&'a [u8]> + Clone + Send + Sync, KF: Send + Sync + KeyFunction, KF::Key: Borrow<[u8]> + for<'a> From<&'a [u8]>, - S: BuildHasher + Default, + S: BuildHasher + Default + Send + Sync, { fn get(&self, key: &H::Out) -> Option { PlainDB::get(self, key) @@ -487,7 +487,7 @@ where H: KeyHasher, T: Default + PartialEq + AsRef<[u8]> + for<'a> From<&'a [u8]> + Clone + Send + Sync, KF: KeyFunction + Send + Sync, - S: BuildHasher + Default, + S: BuildHasher + Default + Send + Sync, { fn get(&self, key: &H::Out, prefix: Prefix) -> Option { if key == &self.hashed_null_node { @@ -567,7 +567,7 @@ where H: KeyHasher, T: Default + PartialEq + AsRef<[u8]> + for<'a> From<&'a [u8]> + Clone + Send + Sync, KF: KeyFunction + Send + Sync, - S: BuildHasher + Default, + S: BuildHasher + Default + Send + Sync, { fn get(&self, key: &H::Out, prefix: Prefix) -> Option { HashDB::get(self, key, prefix) @@ -583,7 +583,7 @@ where T: Default + PartialEq + for<'a> From<&'a [u8]> + Clone + Send + Sync, KF: KeyFunction + Send + Sync, KF::Key: Borrow<[u8]> + for<'a> From<&'a [u8]>, - S: BuildHasher + Default, + S: BuildHasher + Default + Send + Sync, { fn as_plain_db(&self) -> &dyn PlainDB { self @@ -598,7 +598,7 @@ where H: KeyHasher, T: Default + PartialEq + AsRef<[u8]> + for<'a> From<&'a [u8]> + Clone + Send + Sync, KF: KeyFunction + Send + Sync, - S: BuildHasher + Default, + S: BuildHasher + Default + Send + Sync, { fn as_hash_db(&self) -> &dyn HashDB { self