go-ethereum/trie
rjl493456442 5adf4adc8e
eth/protocols/snap: cleanup dangling account trie nodes due to incomplete storage (#30258)
This pull request fixes #30229.
 
During snap sync, large storage will be split into several pieces and
synchronized concurrently. Unfortunately, the tradeoff is that the respective
merkle trie of each storage chunk will be incomplete due to the incomplete
boundaries. The trie nodes on these boundaries will be discarded, and any
dangling nodes on disk will also be removed if they fall on these paths,
ensuring the state healer won't be blocked.

However, the dangling account trie nodes on the path from the root to the
associated account are left untouched. This means the dangling account trie
nodes could potentially stop the state healing and break the assumption that the
entire subtrie should exist if the subtrie root exists. We should consider the
account trie node as the ancestor of the corresponding storage trie node.

In the scenarios described in the above ticket, the state corruption could occur
if there is a dangling account trie node while some storage trie nodes are
removed due to synchronization redo.

The fixing idea is pretty straightforward, the trie nodes on the path from root
to account should all be explicitly removed if an incomplete storage trie
occurs. Therefore, a `delete` operation has been added into `gentrie` to
explicitly clear the account along with all nodes on this path. The special
thing is that it's a cross-trie clearing. In theory, there may be a dangling
node at any position on this account key and we have to clear all of them.
2024-08-12 10:43:54 +02:00
..
trienode trie/trienode: remove unnecessary check in Summary (#30047) 2024-06-25 15:45:33 +02:00
triestate trie: relocate state execution logic into pathdb package (#29861) 2024-06-27 20:30:39 +08:00
utils cmd, core, params, trie: add verkle access witness gas charging (#29338) 2024-05-10 20:13:11 +02:00
committer.go trie, triedb: remove unnecessary child resolver interface (#30167) 2024-07-16 18:52:19 +08:00
database_test.go all: remove the dependency from trie to triedb (#28824) 2024-02-13 14:49:53 +01:00
encoding_test.go trie: reduce allocs in recHash (#27770) 2023-08-18 22:41:19 +02:00
encoding.go trie: reduce allocs in recHash (#27770) 2023-08-18 22:41:19 +02:00
errors.go all: fix various typos (#29600) 2024-04-23 13:09:42 +03:00
hasher.go core/rawdb, trie: improve db APIs for accessing trie nodes (#29362) 2024-04-30 16:25:35 +02:00
iterator_test.go core/state, eth/protocols, trie, triedb/pathdb: remove unused error from trie Commit (#29869) 2024-06-12 12:23:16 +03:00
iterator.go trie: iterate values pre-order and fix seek behavior (#27838) 2024-06-04 11:17:26 +08:00
node_enc.go core, trie: rework trie database (#26813) 2023-04-24 10:38:52 +03:00
node_test.go trie: improve node rlp decoding performance (#25357) 2022-08-19 00:39:47 +02:00
node.go core, trie: rework trie database (#26813) 2023-04-24 10:38:52 +03:00
proof_test.go all: fix mismatched names in comments (#29348) 2024-03-26 21:01:28 +01:00
proof.go all: fix various typos (#29600) 2024-04-23 13:09:42 +03:00
secure_trie_test.go core/state, eth/protocols, trie, triedb/pathdb: remove unused error from trie Commit (#29869) 2024-06-12 12:23:16 +03:00
secure_trie.go trie: relocate state execution logic into pathdb package (#29861) 2024-06-27 20:30:39 +08:00
stacktrie_fuzzer_test.go core/state, eth/protocols, trie, triedb/pathdb: remove unused error from trie Commit (#29869) 2024-06-12 12:23:16 +03:00
stacktrie_test.go core, eth/protocols/snap, trie: fix cause for snap-sync corruption, implement gentrie (#29313) 2024-04-16 09:05:36 +02:00
stacktrie.go eth/protocols/snap: cleanup dangling account trie nodes due to incomplete storage (#30258) 2024-08-12 10:43:54 +02:00
sync_test.go core/state, eth/protocols, trie, triedb/pathdb: remove unused error from trie Commit (#29869) 2024-06-12 12:23:16 +03:00
sync.go trie: update the valid function comments (#29809) 2024-05-21 19:53:34 +08:00
tracer_test.go core/state, eth/protocols, trie, triedb/pathdb: remove unused error from trie Commit (#29869) 2024-06-12 12:23:16 +03:00
tracer.go trie, consensus/clique: use maps.Clone (#29616) 2024-04-24 14:27:58 +02:00
trie_id.go cmd, core, eth, les, light: track deleted nodes (#25757) 2022-09-27 10:01:02 +02:00
trie_reader.go trie: relocate state execution logic into pathdb package (#29861) 2024-06-27 20:30:39 +08:00
trie_test.go ethdb: remove snapshot (#30189) 2024-07-22 11:40:14 +08:00
trie.go all: stateless witness builder and (self-)cross validator (#29719) 2024-06-25 14:48:08 +03:00
verkle_test.go trie: add RollBackAccount function to verkle trees (#30135) 2024-07-15 15:05:59 +08:00
verkle.go trie: add RollBackAccount function to verkle trees (#30135) 2024-07-15 15:05:59 +08:00