go-ethereum/core/state/snapshot
rjl493456442 8c1a36dad3
core/state/snapshot: handle legacy journal (#30802)
This workaround is meant to minimize the possibility for snapshot generation
once the geth node upgrades to new version (specifically #30752 )

In #30752, the journal format in state snapshot is modified by removing
the destruct set. Therefore, the existing old format (version = 0) will be
discarded and all in-memory layers will be lost. Unfortunately, the lost 
in-memory layers can't be recovered by some other approaches, and the 
entire state snapshot will be regenerated (it will last about 2.5 hours).

This pull request introduces a workaround to adopt the legacy journal if
the destruct set contained is empty. Since self-destruction has been
deprecated following the cancun fork, the destruct set is expected to be nil for
layers above the fork block. However, an exception occurs during contract 
deployment: pre-funded accounts may self-destruct, causing accounts with 
non-zero balances to be removed from the state. For example,
https://etherscan.io/tx/0xa087333d83f0cd63b96bdafb686462e1622ce25f40bd499e03efb1051f31fe49).


For nodes with a fully synced state, the legacy journal is likely compatible with
the updated definition, eliminating the need for regeneration. Unfortunately,
nodes performing a full sync of historical chain segments or encountering 
pre-funded account deletions may face incompatibilities, leading to automatic 
snapshot regeneration.
2024-11-28 11:21:31 +08:00
..
context.go all: get rid of custom MaxUint64 and MaxUint64 (#30636) 2024-10-20 14:41:51 +03:00
conversion.go core, triedb: remove destruct flag in state snapshot (#30752) 2024-11-22 16:55:43 +08:00
difflayer.go core, triedb: remove destruct flag in state snapshot (#30752) 2024-11-22 16:55:43 +08:00
difflayer_test.go core, triedb: remove destruct flag in state snapshot (#30752) 2024-11-22 16:55:43 +08:00
disklayer.go core, triedb: remove destruct flag in state snapshot (#30752) 2024-11-22 16:55:43 +08:00
disklayer_test.go core, triedb: remove destruct flag in state snapshot (#30752) 2024-11-22 16:55:43 +08:00
generate.go core, trie, triedb: minor changes from snapshot integration (#30599) 2024-10-18 17:06:31 +02:00
generate_test.go core, triedb: remove destruct flag in state snapshot (#30752) 2024-11-22 16:55:43 +08:00
holdable_iterator.go all: update license headers and AUTHORS from git history (#24947) 2022-05-24 20:39:40 +02:00
holdable_iterator_test.go all: update license headers and AUTHORS from git history (#24947) 2022-05-24 20:39:40 +02:00
iterator.go core, triedb: remove destruct flag in state snapshot (#30752) 2024-11-22 16:55:43 +08:00
iterator_binary.go core, triedb: remove destruct flag in state snapshot (#30752) 2024-11-22 16:55:43 +08:00
iterator_fast.go core, triedb: remove destruct flag in state snapshot (#30752) 2024-11-22 16:55:43 +08:00
iterator_test.go core, triedb: remove destruct flag in state snapshot (#30752) 2024-11-22 16:55:43 +08:00
journal.go core/state/snapshot: handle legacy journal (#30802) 2024-11-28 11:21:31 +08:00
metrics.go all: fix spelling mistakes (#25961) 2022-10-11 09:37:00 +02:00
snapshot.go core/state/snapshot: handle legacy journal (#30802) 2024-11-28 11:21:31 +08:00
snapshot_test.go core, triedb: remove destruct flag in state snapshot (#30752) 2024-11-22 16:55:43 +08:00
utils.go core, triedb: remove destruct flag in state snapshot (#30752) 2024-11-22 16:55:43 +08:00