go-ethereum/core
Martin HS 459bb4a647
core/state: move state log mechanism to a separate layer (#30569)
This PR moves the logging/tracing-facilities out of `*state.StateDB`,
in to a wrapping struct which implements `vm.StateDB` instead.

In most places, it is a pretty straight-forward change: 
- First, hoisting the invocations from state objects up to the statedb. 
- Then making the mutation-methods simply return the previous value, so
that the external logging layer could log everything.

Some internal code uses the direct object-accessors to mutate the state,
particularly in testing and in setting up state overrides, which means
that these changes are unobservable for the hooked layer. Thus, configuring
the overrides are not necessarily part of the API we want to publish.

The trickiest part about the layering is that when the selfdestructs are
finally deleted during `Finalise`, there's the possibility that someone
sent some ether to it, which is burnt at that point, and thus needs to
be logged. The hooked layer reaches into the inner layer to figure out
these events.

In package `vm`, the conversion from `state.StateDB + hooks` into a
hooked `vm.StateDB` is performed where needed.

---------

Co-authored-by: Gary Rong <garyrong0905@gmail.com>
2024-10-23 08:03:36 +02:00
..
asm core/vm, cmd/evm: implement eof validation (#30418) 2024-10-02 15:05:50 +02: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 all: get rid of custom MaxUint64 and MaxUint64 (#30636) 2024-10-20 14:41:51 +03:00
state core/state: move state log mechanism to a separate layer (#30569) 2024-10-23 08:03:36 +02:00
stateless beacon, core, eth, miner: integrate witnesses into production Geth (#30069) 2024-09-20 16:43:42 +03:00
tracing eth/tracers: various fixes (#30540) 2024-10-17 06:51:47 +02:00
txpool beacon/engine, core/txpool, eth/catalyst: add engine_getBlobsV1 API (#30537) 2024-10-17 19:27:35 +03:00
types common: drop BigMin and BigMax, they pollute our dep graph (#30645) 2024-10-21 12:45:33 +03:00
vm core/state: move state log mechanism to a separate layer (#30569) 2024-10-23 08:03:36 +02:00
.gitignore Renamed `chain` => `core` 2014-12-04 10:28:02 +01:00
bench_test.go all: remove forkchoicer and reorgNeeded (#29179) 2024-09-04 15:03:06 +02:00
block_validator.go build: update to golangci-lint 1.61.0 (#30587) 2024-10-14 19:25:22 +02:00
block_validator_test.go beacon, core, eth, miner: integrate witnesses into production Geth (#30069) 2024-09-20 16:43:42 +03:00
blockchain.go core/state: move state log mechanism to a separate layer (#30569) 2024-10-23 08:03:36 +02:00
blockchain_insert.go all: remove forkchoicer and reorgNeeded (#29179) 2024-09-04 15:03:06 +02:00
blockchain_reader.go core, eth, ethstats: simplify chain head events (#30601) 2024-10-16 10:32:58 +03:00
blockchain_repair_test.go core, ethdb/pebble: run pebble in non-sync mode (#30573) 2024-10-15 18:10:03 +03:00
blockchain_sethead_test.go core, ethdb/pebble: run pebble in non-sync mode (#30573) 2024-10-15 18:10:03 +03:00
blockchain_snapshot_test.go core, ethdb/pebble: run pebble in non-sync mode (#30573) 2024-10-15 18:10:03 +03:00
blockchain_test.go all: get rid of custom MaxUint64 and MaxUint64 (#30636) 2024-10-20 14:41:51 +03:00
bloom_indexer.go core: preallocate batch size in bloomIndexer (#25289) 2022-08-03 17:02:09 +02:00
chain_indexer.go core, eth, ethstats: simplify chain head events (#30601) 2024-10-16 10:32:58 +03:00
chain_indexer_test.go all: improve some error strings (#29842) 2024-05-28 13:44:40 +02:00
chain_makers.go core: enable EIP-2935 in chain maker (#30575) 2024-10-13 18:51:51 +02:00
chain_makers_test.go all: remove forkchoicer and reorgNeeded (#29179) 2024-09-04 15:03:06 +02:00
dao_test.go all: remove forkchoicer and reorgNeeded (#29179) 2024-09-04 15:03:06 +02:00
error.go cmd, core, params, trie: add verkle access witness gas charging (#29338) 2024-05-10 20:13:11 +02:00
events.go core, eth, ethstats: simplify chain head events (#30601) 2024-10-16 10:32:58 +03:00
evm.go all: use big.Sign to compare with zero (#29490) 2024-04-09 12:14:30 +02: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 all: implement EIP-7002 & EIP-7251 (#30571) 2024-10-11 21:36:13 +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: remove forkchoicer and reorgNeeded (#29179) 2024-09-04 15:03:06 +02:00
headerchain.go all: remove forkchoicer and reorgNeeded (#29179) 2024-09-04 15:03:06 +02:00
headerchain_test.go all: remove forkchoicer and reorgNeeded (#29179) 2024-09-04 15:03:06 +02: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/state: move state log mechanism to a separate layer (#30569) 2024-10-23 08:03:36 +02:00
state_processor_test.go all: get rid of custom MaxUint64 and MaxUint64 (#30636) 2024-10-20 14:41:51 +03:00
state_transition.go common: drop BigMin and BigMax, they pollute our dep graph (#30645) 2024-10-21 12:45:33 +03:00
stateless.go beacon, core, eth, miner: integrate witnesses into production Geth (#30069) 2024-09-20 16:43:42 +03:00
txindexer.go core, eth, ethstats: simplify chain head events (#30601) 2024-10-16 10:32:58 +03:00
txindexer_test.go core: use in-memory freezer for tests (#29720) 2024-05-08 09:43:33 +03:00
types.go all: implement flat deposit requests encoding (#30425) 2024-10-09 12:24:58 +02:00