go-ethereum/core
Daniel Liu e02bc0723a
refactor(core): semantic journalling #28880 (#2081)
This is a follow-up to #29520, and a preparatory PR to a more thorough
change in the journalling system.

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.

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)`.

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.

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 were, for some reason, integrated into the journal management,
despite not being a consensus-critical data structure. This PR undoes
that.

---------

Co-authored-by: Martin HS <martin@swende.se>
Co-authored-by: Gary Rong <garyrong0905@gmail.com>
2026-03-07 17:42:10 +05:30
..
asm all: pre-allocate memory for slices and maps, close XFN-148 (#1714) 2025-11-14 20:13:36 +05:30
bloombits all: use WaigGroup.Go() to simplify code (#1699) 2025-11-29 17:17:08 +05:30
rawdb refactor(crypto): vendor in golang.org/x/crypto/sha3 #33323 (#2046) 2026-02-28 17:23:57 +04:00
state refactor(core): semantic journalling #28880 (#2081) 2026-03-07 17:42:10 +05:30
tracing feat(core): extends tracing.Hooks with OnSystemCallStartV2 #30786 (#2073) 2026-02-28 16:55:51 +04:00
txpool refactor(crypto): vendor in golang.org/x/crypto/sha3 #33323 (#2046) 2026-02-28 17:23:57 +04:00
types refactor(crypto): vendor in golang.org/x/crypto/sha3 #33323 (#2046) 2026-02-28 17:23:57 +04:00
vm feat(core/vm): implement EIP-7823 - Set upper bounds for MODEXP #31818 #32363 (#2119) 2026-03-06 11:24:22 +05:30
.gitignore
bench_test.go refactor(all): move genesis initialization to blockchain #25523 (#2018) 2026-02-10 16:56:34 +05:30
block_validator.go all: set gas limit dynamically (#1945) 2026-01-21 10:49:20 +05:30
block_validator_test.go refactor(all): move genesis initialization to blockchain #25523 (#2018) 2026-02-10 16:56:34 +05:30
blockchain.go refactor(all): remove term whitelist and blacklist (#1994) 2026-02-10 17:09:21 +05:30
blockchain_insert.go
blockchain_reader.go refactor(core): make signature of ContractCode hash-independent #27209 (#1169) 2026-02-13 09:11:43 +05:30
blockchain_test.go refactor(all): remove term whitelist and blacklist (#1994) 2026-02-10 17:09:21 +05:30
blocks.go
chain_indexer.go core: refactor read and write valid sections (#1808) 2025-12-08 15:07:33 +05:30
chain_indexer_test.go
chain_makers.go refactor(core): remove unnecessary parameters #30776 (#2068) 2026-02-20 13:51:30 +05:30
chain_makers_test.go refactor(all): move genesis initialization to blockchain #25523 (#2018) 2026-02-10 16:56:34 +05:30
dao_test.go refactor(all): move genesis initialization to blockchain #25523 (#2018) 2026-02-10 16:56:34 +05:30
error.go refactor(all): remove term whitelist and blacklist (#1994) 2026-02-10 17:09:21 +05:30
events.go
evm.go perf(core): use uint256 in state #28598 (#1977) 2026-02-05 13:59:23 +05:30
gaspool.go core, miner: log gas limit error when pack transactions (#1905) 2026-01-04 17:21:34 +05:30
gen_genesis.go
genesis.go feat(core): implement EIP-2935 #29465 #30924 (#2033) 2026-02-12 09:01:26 +05:30
genesis_alloc_devnet.go
genesis_alloc_mainnet.go
genesis_alloc_testnet.go
genesis_test.go refactor(all): move genesis initialization to blockchain #25523 (#2018) 2026-02-10 16:56:34 +05:30
headerchain.go refactor(all): remove term whitelist and blacklist (#1994) 2026-02-10 17:09:21 +05:30
mkalloc.go core: use slices package for sorting #27489 #27909 (#1701) 2025-12-07 15:43:24 +05:30
sender_cacher.go
state_prefetcher.go refactor(all): rework EVM constructor #30745 (#2065) 2026-02-17 14:35:18 +05:30
state_processor.go feat(core): extends tracing.Hooks with OnSystemCallStartV2 #30786 (#2073) 2026-02-28 16:55:51 +04:00
state_processor_test.go refactor(crypto): vendor in golang.org/x/crypto/sha3 #33323 (#2046) 2026-02-28 17:23:57 +04:00
state_transition.go perf(core): reduce alloc #33576 (#2085) 2026-03-06 11:17:47 +05:30
token_validator.go refactor(all): rework EVM constructor #30745 (#2065) 2026-02-17 14:35:18 +05:30
types.go