fix(trie): verify empty storage tries when no storage updates exist #20645
+51
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The trie verifier previously assumed that if state root updates contained no storage branch nodes then there was nothing to validate for storage tries. In that scenario we never instantiated a storage SingleVerifier nor invoked verify_empty_storages, so stray storage nodes in the trie tables were silently ignored when hashed storage was empty for all accounts.
This change makes try_next call verify_empty_storages over the full account range when no BranchNode::Storage was ever observed. This ensures that any remaining storage nodes in the trie tables are reported as StorageExtra, keeping the trie tables consistent with the hashed state. A regression test was added to cover the case where hashed storage is empty but the storage trie still contains nodes