Skip to content
This repository has been archived by the owner on Nov 18, 2024. It is now read-only.

Commit

Permalink
call parallel rh in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dvush committed Oct 6, 2024
1 parent ef55a27 commit 5b08c8f
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/sparse_mpt/diff_trie/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ fn compare_impls_with_hashing(data: Vec<(Bytes, Bytes)>, insert_hashing: bool) {
"comparing hashing, insert_hashing: {}",
insert_hashing
);

let got_parallel = trie.root_hash_parallel().expect("hashing failed");
assert_eq!(
got_parallel, expected,
"comparing parallel hashing, insert_hashing: {}",
insert_hashing
);
}

fn compare_sparse_impl(mut data: Vec<(Bytes, Bytes)>, insert_hashing: bool) {
Expand Down Expand Up @@ -64,6 +71,9 @@ fn compare_sparse_impl(mut data: Vec<(Bytes, Bytes)>, insert_hashing: bool) {
}
let got = gathered_trie.root_hash().expect("can't hash gathered trie");
assert_eq!(got, expected);

let got_parallel = gathered_trie.root_hash_parallel().expect("can't hash gathered trie");
assert_eq!(got_parallel, expected);
}

fn compare_impls(data: &[(Vec<u8>, Vec<u8>)]) {
Expand Down Expand Up @@ -208,6 +218,13 @@ fn compare_with_removals_with_hashing(
insert_hashing
);

let parallel_hash = trie.root_hash_parallel().expect("must hash");
assert_eq!(
parallel_hash, reference_hash,
"comparing parallel hashing, insert_hashing: {}",
insert_hashing
);

Ok(())
}

Expand Down Expand Up @@ -246,6 +263,13 @@ fn compare_with_removals_sparse(
insert_hashing
);

let parallel_hash = gathered_trie.root_hash_parallel().expect("must hash");
assert_eq!(
parallel_hash, reference_hash,
"comparing sparse removals parallel hashing, insert_hashing: {}",
insert_hashing
);

Ok(())
}

Expand Down

0 comments on commit 5b08c8f

Please sign in to comment.