go-ethereum/core/state
Martin HS 0e5546f032
core/state: semantic journalling (part 1) (#28880)
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>
2024-08-28 08:18:23 +02:00
..
pruner all: clean up goerli flag and config (#30289) 2024-08-20 15:59:48 +02:00
snapshot Revert "core/state/snapshot: tiny fixes" (#30039) 2024-06-21 10:42:43 +03:00
access_events_test.go core/state: fix inconsistent verkle test error messages (#29753) 2024-07-01 21:57:04 +02:00
access_events.go cmd, core, params, trie: add verkle access witness gas charging (#29338) 2024-05-10 20:13:11 +02:00
access_list.go core/state: rename all the AccessList receivers to 'al' (#29921) 2024-06-11 11:24:44 +03:00
database.go all: stateless witness builder and (self-)cross validator (#29719) 2024-06-25 14:48:08 +03:00
dump.go eth/tracers: live chain tracing with hooks (#29189) 2024-03-22 18:53:53 +01:00
iterator_test.go all: activate pbss as experimental feature (#26274) 2023-08-10 22:21:36 +03:00
iterator.go all: fix various typos (#29600) 2024-04-23 13:09:42 +03:00
journal.go core/state: semantic journalling (part 1) (#28880) 2024-08-28 08:18:23 +02:00
metrics.go core: add metrics for state access (#30353) 2024-08-26 20:02:10 +08:00
state_object_test.go build: use golangci-lint (#20295) 2019-11-18 10:49:17 +02:00
state_object.go core/state: semantic journalling (part 1) (#28880) 2024-08-28 08:18:23 +02:00
state_test.go core/state: remove account reset operation v2 (#29520) 2024-04-24 12:59:06 +03:00
statedb_fuzz_test.go core/state: semantic journalling (part 1) (#28880) 2024-08-28 08:18:23 +02:00
statedb_test.go core/state: semantic journalling (part 1) (#28880) 2024-08-28 08:18:23 +02:00
statedb.go core/state: semantic journalling (part 1) (#28880) 2024-08-28 08:18:23 +02:00
stateupdate.go core/state: introduce stateupdate structure (#29530) 2024-06-03 14:17:12 +03:00
sync_test.go eth/tracers: live chain tracing with hooks (#29189) 2024-03-22 18:53:53 +01:00
sync.go core,eth,internal: fix typo (#29024) 2024-02-20 19:42:48 +08:00
transient_storage.go core/state: better randomized testing (postcheck) on journalling (#29627) 2024-04-25 09:56:25 +02:00
trie_prefetcher_test.go core/state: fix trie prefetcher for verkle (#30354) 2024-08-26 22:18:47 +08:00
trie_prefetcher.go core/state: fix trie prefetcher for verkle (#30354) 2024-08-26 22:18:47 +08:00