erigontech / erigontech/erigon
execution/types/accounts: drop tolerant DeserialiseV3 path after AccountsDomain snapshots are rebuilt
- Dominant language
- Go
- Stars
- 3.6k
- Forks
- 1.5k
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 455
Description
## Background
In #21256 we removed \`accounts.Account.Incarnation\` and shortened the on-disk \`SerialiseV3\` value from 4 sections to 3 (saves 1 byte per account). The MDBX tables \`kv.TblAccountVals\` and \`kv.TblAccountHistoryVals\` are rewritten in place by the \`drop_account_incarnation\` migration.
What is **not** rewritten: the frozen AccountsDomain snapshot files (\`.kv\` segments). They are immutable, so the migration cannot touch them — every row in those segments stays in the legacy 4-section format.
To bridge the format gap, \`DeserialiseV3\` is tolerant: it reads 3 sections and silently skips any trailing bytes. That keeps legacy snapshots decodable but leaves a forever-tolerant branch sitting in the hottest account-decode path.
## What this issue tracks
Drop the tolerant branch once existing AccountsDomain snapshot files have been rebuilt in the new format.
### Concrete sequence
1. Cut a release that ships #21256 (3-section encoder + tolerant decoder + migration).
2. Snapshot rebuild — either the regular publication pipeline naturally regenerates AccountsDomain segments in the new format over time, or operators rebuild them manually.
3. Once every supported snapshot lineage is known to be in the new format (no published \`.kv\` files older than the cutover date), strip the tolerant branch:
- In \`DeserialiseV3\`: error out (or stop short) if any bytes remain after the codeHash section, instead of silently skipping.
- Optionally drop the \`DecodeForStorage\` fieldset-bit-4 walk-past too (only matters if anyone still has truly ancient databases that haven't run the migration yet).
4. Bump the DB / snapshot major schema version so older binaries refuse to read the new files.
## Related
- Parent: #12440 (Get rid of incarnations)
- Format change + migration: #21256
- Migration file: \`db/migrations/drop_account_incarnation.go\`
- Decoder: \`execution/types/accounts/account.go\` — \`DeserialiseV3\`
Contributor guide
Assessment
This issue has not been assessed yet.