mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-14 02:41:34 +00:00
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.
|
||
|---|---|---|
| .. | ||
| database | ||
| hashdb | ||
| internal | ||
| pathdb | ||
| database.go | ||
| generate.go | ||
| generate_test.go | ||
| history.go | ||
| preimages.go | ||
| preimages_test.go | ||
| states.go | ||