You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
triedb/pathdb: add regression test for zero-base-root lookup fallback
TestLookupZeroBaseRootFallback constructs a layer tree whose disk-layer
root is common.Hash{} (mirroring the bintrie/verkle configuration where
an empty trie hashes to EmptyVerkleHash), stacks diff layers on top,
and exercises four cases:
1. lookupAccount on a never-written key must fall through to the disk
layer and return (diskLayer, nil). Before the previous commit this
returned errSnapshotStale because the disk-layer fallback hash
collided with the stale sentinel.
2. Symmetric case for lookupStorage.
3. lookupAccount on a written account must still return the diff
layer that holds it — pins the normal resolution path.
4. lookupAccount/lookupStorage for an unknown state root must still
return errSnapshotStale. This pins the other half of the contract
so a future refactor that always returned ok=true would be caught
here rather than in production.
Verified by reverse-applying the previous commit: the test fails with
the exact pre-fix error ("layer stale") on cases 1 and 2, and passes
once the fix is restored.
The existing TestAccountLookup/TestStorageLookup tests use
newTestLayerTree which hard-codes common.Hash{0x1} as the disk-layer
root, so none of them could cover the zero-root case without a tailored
helper; this test inlines newDiskLayer(common.Hash{}, …) directly
rather than parameterize the shared helper.
0 commit comments