go-ethereum/consensus/clique
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
..
api.go consensus/clique: fix typo in comment (#27503) 2023-06-19 08:47:00 +02:00
clique.go core/state: move state log mechanism to a separate layer (#30569) 2024-10-23 08:03:36 +02:00
clique_test.go all: remove forkchoicer and reorgNeeded (#29179) 2024-09-04 15:03:06 +02:00
snapshot.go trie, consensus/clique: use maps.Clone (#29616) 2024-04-24 14:27:58 +02:00
snapshot_test.go all: remove forkchoicer and reorgNeeded (#29179) 2024-09-04 15:03:06 +02:00