go-ethereum/consensus/ethash
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
..
consensus.go core/state: move state log mechanism to a separate layer (#30569) 2024-10-23 08:03:36 +02:00
consensus_test.go all: remove deprecated uses of math.rand (#26710) 2023-02-16 14:36:58 -05:00
difficulty.go go.mod: upgrade to github.com/holiman/uint256 v1.2.0 (#22745) 2021-05-10 12:29:33 +02:00
ethash.go all: remove ethash pow, only retain shims needed for consensus and tests (#27178) 2023-05-03 12:58:39 +03:00