core/state/snapshot: handle legacy journal #30802
Open
+42
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The frequency for pre-funded account deletion is: