mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-02-19 03:04:27 -05:00
fix: propagate trie update diff result to trigger debug recorder writes (#22331)
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
5
.changelog/odd-donkeys-chirp.md
Normal file
5
.changelog/odd-donkeys-chirp.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
reth-engine-tree: patch
|
||||
---
|
||||
|
||||
Fixed `compare_trie_updates` to return `bool` indicating whether differences were found, and updated the caller to properly use the return value instead of treating all successful comparisons as having no differences.
|
||||
@@ -1104,17 +1104,20 @@ where
|
||||
// Get a database provider to use as trie cursor factory
|
||||
match overlay_factory.database_provider_ro() {
|
||||
Ok(provider) => {
|
||||
if let Err(err) = super::trie_updates::compare_trie_updates(
|
||||
match super::trie_updates::compare_trie_updates(
|
||||
&provider,
|
||||
task_trie_updates,
|
||||
serial_trie_updates,
|
||||
) {
|
||||
warn!(
|
||||
target: "engine::tree::payload_validator",
|
||||
%err,
|
||||
"Error comparing trie updates"
|
||||
);
|
||||
return true;
|
||||
Ok(has_diff) => return has_diff,
|
||||
Err(err) => {
|
||||
warn!(
|
||||
target: "engine::tree::payload_validator",
|
||||
%err,
|
||||
"Error comparing trie updates"
|
||||
);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(err) => {
|
||||
|
||||
@@ -101,11 +101,13 @@ impl StorageTrieUpdatesDiff {
|
||||
|
||||
/// Compares the trie updates from state root task, regular state root calculation and database,
|
||||
/// and logs the differences if there's any.
|
||||
///
|
||||
/// Returns `true` if there are differences.
|
||||
pub(crate) fn compare_trie_updates(
|
||||
trie_cursor_factory: impl TrieCursorFactory,
|
||||
task: TrieUpdates,
|
||||
regular: TrieUpdates,
|
||||
) -> Result<(), DatabaseError> {
|
||||
) -> Result<bool, DatabaseError> {
|
||||
let mut task = adjust_trie_updates(task);
|
||||
let mut regular = adjust_trie_updates(regular);
|
||||
|
||||
@@ -179,9 +181,10 @@ pub(crate) fn compare_trie_updates(
|
||||
}
|
||||
|
||||
// log differences
|
||||
let has_differences = diff.has_differences();
|
||||
diff.log_differences();
|
||||
|
||||
Ok(())
|
||||
Ok(has_differences)
|
||||
}
|
||||
|
||||
fn compare_storage_trie_updates<C: TrieCursor>(
|
||||
|
||||
Reference in New Issue
Block a user