Skip to content

Commit

Permalink
show account node and storage trie update one diff per line
Browse files Browse the repository at this point in the history
  • Loading branch information
fgimenez committed Dec 6, 2024
1 parent 48dec85 commit 0551393
Showing 1 changed file with 29 additions and 7 deletions.
36 changes: 29 additions & 7 deletions crates/engine/tree/src/tree/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2294,14 +2294,36 @@ where
match state_root_handle.wait_for_result() {
Ok(state_root_task_result) => {
info!(target: "engine::tree", block=?sealed_block.num_hash(), state_root_task_result=?state_root_task_result.0, regular_state_root_result = ?result.0);
let diff = compare_trie_updates(&state_root_task_result.1, &result.1);
let task_trie_updates = &state_root_task_result.1;
let regular_trie_updates = &result.1;
let diff = compare_trie_updates(task_trie_updates, regular_trie_updates);
if diff.has_differences() {
info!(target: "engine::tree",
block=?sealed_block.num_hash(),
storage_tries_only_in_first= ?diff.storage_tries_only_in_first,
storage_tries_only_in_second= ?diff.storage_tries_only_in_second,
storage_tries_with_differences= ?diff.storage_tries_with_differences,
"Found differences in TrieUpdates");
for path in diff.account_nodes_with_different_values {
let task_entry = task_trie_updates.account_nodes.get(&path);
let regular_entry = regular_trie_updates.account_nodes.get(&path);
if task_entry != regular_entry {
debug!(target: "engine::tree", ?path, ?task_entry, ?regular_entry, "Difference in account node updates");
}
}
for address in diff.storage_tries_with_differences.keys() {
let task = task_trie_updates.storage_tries.get(address);
let regular = regular_trie_updates.storage_tries.get(address);
for path in task
.map_or_else(HashSet::new, |tries| {
tries.storage_nodes.keys().collect()
})
.union(&regular.map_or_else(HashSet::new, |tries| {
tries.storage_nodes.keys().collect()
}))
{
let task_entry = task.map(|tries| tries.storage_nodes.get(*path));
let regular_entry =
regular.map(|tries| tries.storage_nodes.get(*path));
if task_entry != regular_entry {
debug!(target: "engine::tree", ?address, ?path, ?task_entry, ?regular_entry, "Difference in storage trie updates");
}
}
}
} else {
debug!(target: "engine::tree", block=?sealed_block.num_hash(), "TrieUpdates match exactly");
}
Expand Down

0 comments on commit 0551393

Please sign in to comment.