go-ethereum/core
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
..
asm all: fix mismatched names in comments (#29348) 2024-03-26 21:01:28 +01:00
bloombits all: fix typos in comments (#29873) 2024-05-29 12:24:10 +02:00
forkid all: clean up goerli flag and config (#30289) 2024-08-20 15:59:48 +02:00
rawdb core/rawdb: drop MigrateTable (#30331) 2024-08-20 14:06:00 +02:00
state core/state: semantic journalling (part 1) (#28880) 2024-08-28 08:18:23 +02:00
stateless all: stateless witness builder and (self-)cross validator (#29719) 2024-06-25 14:48:08 +03:00
tracing core/tracing: update latest release version (#30211) 2024-07-23 14:05:46 +02:00
txpool core/txpool/blobpool: fix error message (#30247) 2024-08-13 19:49:31 +08:00
types eth/downloader, core/types: take withdrawals-size into account in downloader queue (#30276) 2024-08-08 15:14:00 +02:00
vm core/vm: reuse Memory instances (#30137) 2024-08-20 14:31:06 +02:00
.gitignore Renamed `chain` => `core` 2014-12-04 10:28:02 +01:00
bench_test.go core: move genesis alloc types to core/types (#29003) 2024-02-16 19:05:33 +01:00
block_validator.go all: stateless witness builder and (self-)cross validator (#29719) 2024-06-25 14:48:08 +03:00
block_validator_test.go core: use in-memory freezer for tests (#29720) 2024-05-08 09:43:33 +03:00
blockchain.go core: add metrics for state access (#30353) 2024-08-26 20:02:10 +08:00
blockchain_insert.go all: fix various typos (#29600) 2024-04-23 13:09:42 +03:00
blockchain_reader.go core: add txlookup lock (#29343) 2024-04-09 08:37:18 +02:00
blockchain_repair_test.go cmd: use package filepath over path for file system operations (#29227) 2024-03-12 10:00:34 +01:00
blockchain_sethead_test.go all: replace path.Join with filepath.Join (#29479) 2024-04-08 12:29:49 +03:00
blockchain_snapshot_test.go cmd: use package filepath over path for file system operations (#29227) 2024-03-12 10:00:34 +01:00
blockchain_test.go all: stateless witness builder and (self-)cross validator (#29719) 2024-06-25 14:48:08 +03:00
bloom_indexer.go core: preallocate batch size in bloomIndexer (#25289) 2022-08-03 17:02:09 +02:00
chain_indexer.go core,console: replace noarg fmt.Errorf with errors.New (#27332) 2023-05-25 08:24:09 -04:00
chain_indexer_test.go all: improve some error strings (#29842) 2024-05-28 13:44:40 +02:00
chain_makers.go cmd, core, params, trie: add verkle access witness gas charging (#29338) 2024-05-10 20:13:11 +02:00
chain_makers_test.go core: deploy EIP-4788 contract in dev mode genesis (#29655) 2024-05-14 15:04:32 +02:00
dao_test.go all: activate pbss as experimental feature (#26274) 2023-08-10 22:21:36 +03:00
error.go cmd, core, params, trie: add verkle access witness gas charging (#29338) 2024-05-10 20:13:11 +02:00
events.go eth/filters: remove use of event.TypeMux for pending logs (#20312) 2019-12-10 12:39:14 +01:00
evm.go all: use big.Sign to compare with zero (#29490) 2024-04-09 12:14:30 +02:00
forkchoice.go core: clarify code in forkchoice (#26257) 2022-11-28 11:07:25 +01:00
gaspool.go core, miner: revert block gas counter in case of invalid transaction (#26799) 2023-03-07 05:23:52 -05:00
gen_genesis.go core: go fmt (#29544) 2024-04-16 15:42:16 +03:00
genesis.go core: implement EIP-2935 (#29465) 2024-08-26 10:39:35 +02:00
genesis_alloc.go all: clean up goerli flag and config (#30289) 2024-08-20 15:59:48 +02:00
genesis_test.go all: clean up goerli flag and config (#30289) 2024-08-20 15:59:48 +02:00
headerchain.go core: remove bad block checks (#29609) 2024-04-22 20:00:42 +03:00
headerchain_test.go all: remove the dependency from trie to triedb (#28824) 2024-02-13 14:49:53 +01:00
mkalloc.go accounts, cmd/geth, core: close opened files (#29598) 2024-04-30 15:47:21 +02:00
rlp_test.go core: move genesis alloc types to core/types (#29003) 2024-02-16 19:05:33 +01:00
sender_cacher.go all: refactor txpool into it's own package in prep for 4844 2022-10-24 16:35:53 +03:00
state_prefetcher.go all: stateless witness builder and (self-)cross validator (#29719) 2024-06-25 14:48:08 +03:00
state_processor.go core: implement EIP-2935 (#29465) 2024-08-26 10:39:35 +02:00
state_processor_test.go core: implement EIP-2935 (#29465) 2024-08-26 10:39:35 +02:00
state_transition.go core: move balanceCheck addition in buyGas (#29762) 2024-05-15 14:23:24 +02:00
stateless.go all: stateless witness builder and (self-)cross validator (#29719) 2024-06-25 14:48:08 +03:00
txindexer.go core: cache transaction indexing tail in memory (#28908) 2024-02-06 10:44:42 +08:00
txindexer_test.go core: use in-memory freezer for tests (#29720) 2024-05-08 09:43:33 +03:00
types.go all: stateless witness builder and (self-)cross validator (#29719) 2024-06-25 14:48:08 +03:00