fix: propagate trie update diff result to trigger debug recorder writes (#22331)

Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Brian Picciano
2026-02-19 03:52:43 +01:00
committed by GitHub
parent c2e846093e
commit 506ab806e4
3 changed files with 20 additions and 9 deletions

View 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.

View File

@@ -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) => {

View File

@@ -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>(