fix(trie): encode FlaggedStorage in StorageProof::verify#343
fix(trie): encode FlaggedStorage in StorageProof::verify#343ameya-deshmukh wants to merge 4 commits intoseismicfrom
Conversation
|
Fixes storage proof verification to encode FlaggedStorage with privacy flags, matching actual trie storage format. LGTM The change correctly addresses a semantic mismatch where The updated zero-value handling is also correct - private zero values ( The test coverage is comprehensive and validates the fix across various scenarios. |
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
StorageProof::verify was encoding just the U256 value when comparing against trie nodes, but the trie stores FlaggedStorage (value + privacy flag byte). This caused proof verification to fail with ValueMismatch for any non-zero storage value. Also adds test_flagged_storage_proof covering mixed public/private storage slots, all-private accounts, and all-public accounts.
878bd50 to
b745af1
Compare
Summary
StorageProof::verifyto encode values asFlaggedStorage(value + privacy flag byte) instead of rawU256, matching what the trie actually stores. This is a client-side utility function currently only used in tests —verify_proofin seismic-trie is already well-tested with privacy flags.test_flagged_storage_proofintegration test covering proof generation viaProof::from_txwith mixed public/private storage slots, all-private accounts, all-public accounts, and accounts with no storage.Test plan
cargo nextest run -p reth-trie-db --test proof— all 5 tests pass (including newtest_flagged_storage_proof)reth-trie-common(where the fix lives)🤖 Generated with Claude Code