Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
f0dad8a
test: add fuzz testing for checker
rkuris Jul 23, 2025
6bb4f1d
fix: use full path, not partial path
rkuris Jul 23, 2025
18b7ef5
fix: add the branch partial path
rkuris Jul 23, 2025
f6b5518
Increase the iteration count
rkuris Jul 23, 2025
af7a50c
fix: Generate valid hash
rkuris Jul 23, 2025
90bfa85
test: add ethereum compatible data generation
rkuris Jul 23, 2025
b9c58ba
fix: Use the full path
rkuris Jul 23, 2025
480c9cc
fix: Use the full path
rkuris Jul 23, 2025
672b299
Merge branch 'main' into rkuris/diff-fuzz-checker
rkuris Jul 23, 2025
14cd865
Merge branch 'main' into rkuris/diff-fuzz-checker
rkuris Jul 23, 2025
7457850
make checker test more robust
qusuyan Jul 23, 2025
f35149d
Merge branch 'rkuris/diff-fuzz-checker' of https://github.com/ava-lab…
qusuyan Jul 23, 2025
d9fdb28
Merge branch 'rkuris/diff-fuzz-checker' into rkuris/diff-fuzz-checker…
qusuyan Jul 23, 2025
ac6edc0
Merge branch 'main' into rkuris/diff-fuzz-checker-eth
qusuyan Jul 23, 2025
996e2e1
restructure hash_helper
qusuyan Jul 23, 2025
26c7eb4
ethhash compute node function
qusuyan Jul 23, 2025
f320070
Merge branch 'main' into qusuyan/diff-fuzz-checker-eth
qusuyan Jul 23, 2025
72dac35
start refactoring hash_helper for ethhash
qusuyan Jul 23, 2025
f0090a4
Merge branch 'main' into qusuyan/diff-fuzz-checker-eth
qusuyan Jul 24, 2025
777b253
Merge branch 'main' into qusuyan/diff-fuzz-checker-eth
qusuyan Jul 24, 2025
75644eb
undo change hash_helper
qusuyan Jul 24, 2025
167f96e
reenable checker for ethhash
qusuyan Jul 24, 2025
653af24
Merge branch 'main' into qusuyan/diff-fuzz-checker-eth
qusuyan Jul 24, 2025
d1f7cda
reorganize hash_helper
qusuyan Jul 24, 2025
e97a804
rename variable
qusuyan Jul 24, 2025
c674be0
reorg ethhash
qusuyan Jul 24, 2025
44b8a99
Merge branch 'main' into qusuyan/hash-helper-reorg
qusuyan Jul 24, 2025
a95f632
nit
qusuyan Jul 25, 2025
e4bcb93
bugfix
qusuyan Jul 25, 2025
69f1a5f
address previous comments
qusuyan Jul 25, 2025
78c6881
Merge branch 'main' into qusuyan/hash-helper-reorg
qusuyan Jul 25, 2025
0ef4b42
fix clippy
qusuyan Jul 25, 2025
4ed0558
Merge branch 'main' into qusuyan/hash-helper-reorg
qusuyan Jul 28, 2025
61c91c4
add path guard
qusuyan Jul 28, 2025
23212c6
Merge branch 'main' into qusuyan/hash-helper-reorg
qusuyan Jul 30, 2025
f94eb4f
fix non ethhash
qusuyan Jul 30, 2025
8d1981d
recursive path guard for hash_helper
qusuyan Jul 30, 2025
d0650e8
fix clippy
qusuyan Jul 30, 2025
f50fbfd
Merge branch 'main' into qusuyan/hash-helper-reorg
qusuyan Jul 30, 2025
6fe7294
update comments
qusuyan Jul 31, 2025
28c6ad2
update comments
qusuyan Jul 31, 2025
ee67e83
Merge branch 'main' into qusuyan/hash-helper-reorg
qusuyan Aug 1, 2025
b7ca8ea
bugfix with eth rehash
qusuyan Aug 1, 2025
66de86f
Merge branch 'main' into qusuyan/hash-helper-reorg
qusuyan Aug 1, 2025
f8d2d1a
Merge branch 'main' into qusuyan/hash-helper-reorg
qusuyan Aug 1, 2025
0577682
rename variable
qusuyan Aug 1, 2025
0f0b578
Merge branch 'main' into qusuyan/hash-helper-reorg
qusuyan Aug 4, 2025
d9bc5cf
rename variables
qusuyan Aug 4, 2025
e1d1224
undo cursor auto change
qusuyan Aug 4, 2025
6ef8ab8
add NodeRef
qusuyan Aug 5, 2025
d8323e0
Merge branch 'main' into qusuyan/hash-helper-reorg
qusuyan Aug 6, 2025
085c887
Merge branch 'main' into qusuyan/hash-helper-reorg
qusuyan Aug 7, 2025
1706d90
Merge branch 'main' into qusuyan/hash-helper-reorg
qusuyan Aug 11, 2025
1895b65
remove unnecessary box
qusuyan Aug 11, 2025
b5a5dde
cleanup
qusuyan Aug 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 19 additions & 8 deletions storage/src/checker/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ struct SubTrieMetadata {
depth: usize,
path_prefix: Path,
#[cfg(feature = "ethhash")]
has_peers: bool,
num_siblings: usize, // include this node
}

/// [`NodeStore`] checker
Expand Down Expand Up @@ -224,7 +224,7 @@ impl<S: WritableStorage> NodeStore<Committed, S> {
depth: 0,
path_prefix: Path::new(),
#[cfg(feature = "ethhash")]
has_peers: false,
num_siblings: 1,
};
let mut trie_stats = TrieStats::default();
let errors = self
Expand All @@ -244,14 +244,23 @@ impl<S: WritableStorage> NodeStore<Committed, S> {
progress_bar: Option<&ProgressBar>,
hash_check: bool,
) -> Result<(), Vec<CheckerError>> {
#[cfg(feature = "ethhash")]
let SubTrieMetadata {
root_address: subtrie_root_address,
root_hash: subtrie_root_hash,
parent,
depth,
mut path_prefix,
num_siblings,
} = subtrie;

#[cfg(not(feature = "ethhash"))]
let SubTrieMetadata {
root_address: subtrie_root_address,
root_hash: subtrie_root_hash,
parent,
depth,
path_prefix,
#[cfg(feature = "ethhash")]
has_peers,
} = subtrie;

// check that address is aligned
Expand Down Expand Up @@ -299,10 +308,12 @@ impl<S: WritableStorage> NodeStore<Committed, S> {
// compute the hash of the node and check it against the stored hash
if hash_check {
#[cfg(feature = "ethhash")]
let hash = Self::compute_node_ethhash(&node, &path_prefix, has_peers);
let hash = Self::compute_node_ethhash(&node, &mut path_prefix, num_siblings);
#[cfg(not(feature = "ethhash"))]
let hash = hash_node(&node, &path_prefix);
if hash != subtrie_root_hash {
let mut path = path_prefix.clone();
path.0.extend_from_slice(node.partial_path());
return Err(vec![CheckerError::HashMismatch {
path: current_path_prefix,
address: subtrie_root_address,
Expand Down Expand Up @@ -373,7 +384,7 @@ impl<S: WritableStorage> NodeStore<Committed, S> {
depth: depth.saturating_add(1),
path_prefix: child_path_prefix,
#[cfg(feature = "ethhash")]
has_peers: num_children != 1,
num_siblings: num_children,
};
if let Err(e) = self.visit_trie_helper(
child_subtrie,
Expand Down Expand Up @@ -773,8 +784,8 @@ mod test {
#[cfg(feature = "ethhash")]
let computed_hash = NodeStore::<Committed, MemStore>::compute_node_ethhash(
branch_node,
&Path::from([2, 0]),
false,
&mut Path::from([2, 0]),
1, // 1 being the node itself
);
#[cfg(not(feature = "ethhash"))]
let computed_hash = hash_node(branch_node, &Path::from([2, 0]));
Expand Down
Loading
Loading