0e5546f032
This is a follow-up to #29520, and a preparatory PR to a more thorough change in the journalling system. ### API methods instead of `append` operations This PR hides the journal-implementation details away, so that the statedb invokes methods like `JournalCreate`, instead of explicitly appending journal-events in a list. This means that it's up to the journal whether to implement it as a sequence of events or aggregate/merge events. ### Snapshot-management inside the journal This PR also makes it so that management of valid snapshots is moved inside the journal, exposed via the methods `Snapshot() int` and `RevertToSnapshot(revid int, s *StateDB)`. ### SetCode JournalSetCode journals the setting of code: it is implicit that the previous values were "no code" and emptyCodeHash. Therefore, we can simplify the setCode journal. ### Selfdestruct The self-destruct journalling is a bit strange: we allow the selfdestruct operation to be journalled several times. This makes it so that we also are forced to store whether the account was already destructed. What we can do instead, is to only journal the first destruction, and after that only journal balance-changes, but not journal the selfdestruct itself. This simplifies the journalling, so that internals about state management does not leak into the journal-API. ### Preimages Preimages were, for some reason, integrated into the journal management, despite not being a consensus-critical data structure. This PR undoes that. --------- Co-authored-by: Gary Rong <garyrong0905@gmail.com> |
||
---|---|---|
.. | ||
pruner | ||
snapshot | ||
access_events_test.go | ||
access_events.go | ||
access_list.go | ||
database.go | ||
dump.go | ||
iterator_test.go | ||
iterator.go | ||
journal.go | ||
metrics.go | ||
state_object_test.go | ||
state_object.go | ||
state_test.go | ||
statedb_fuzz_test.go | ||
statedb_test.go | ||
statedb.go | ||
stateupdate.go | ||
sync_test.go | ||
sync.go | ||
transient_storage.go | ||
trie_prefetcher_test.go | ||
trie_prefetcher.go |