erigontech / erigontech/erigon
execution/commitment: unify unfoldStorageBase branch-read path with unfoldBranchNode
- Dominant language
- Go
- Stars
- 3.6k
- Forks
- 1.5k
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 455
Description
Follow-up to #21945 — review comment https://github.com/erigontech/erigon/pull/21945#discussion_r3456865915.
The `DecodeBranchInto` → touch/after-map → `deriveHashedKeys` sequence is now shared via `decodeBranchIntoRow` (hex_patricia_hashed.go), called by both `unfoldBranchNode` and `unfoldStorageBase`.
The **branch read** still diverges:
- `unfoldBranchNode` reads via `readBranchAndCheckForFlushing` (flush-before-read) and emits `BranchLoad` metrics + `depthsToTxNum` bookkeeping.
- `unfoldStorageBase` uses the raw `branchFromCacheOrDB` and does neither.
Harmless today — the storage-base worker has no pending deferred writes for the storage-root prefix when it unfolds — but a wire-format or flush-invariant change would have to be mirrored in both paths.
**Task:** route `unfoldStorageBase` through the same flush-checked read (or a shared read helper keyed by `(row, depth, key, deleted)`), so the on-disk read path is unified too — or, if the raw read is deliberately safe here, assert/document that invariant.
Contributor guide
Assessment
This issue has not been assessed yet.