go-ethereum/eth
Arran Schlosberg 12b8aa5c2e
fix: pre-state tracer logging storage after call from precompile (#64)
## Why this should be merged

Fixes tracing when a stateful precompile calls another contract that
itself accesses storage.

## How this works

The pre-state tracer from `eth/tracers/native` doesn't implement
`CaptureEnter()` (entry of a new context), instead relying on
`CaptureState()` (per-opcode tracing) to detect that a new contract has
been entered. In doing so, it [maintains an
invariant](cb7eb89341/eth/tracers/native/prestate.go (L160))
that is expected when `CaptureState(vm.SLOAD, ...)` is called—breaking
the invariant results in a panic due to a nil map.

The fix involves (a) maintaining the invariant as part of
`CaptureEnter()` (previously a no-op); and (b) calling said method
inside `vm.PrecompileEnvironment.Call()`. The latter has the added
benefit of properly handling all tracing involving an outbound call from
precompiles.

## How this was tested

New integration test demonstrates that the tracer can log the retrieved
storage value.

---------

Co-authored-by: Darioush Jalali <darioush.jalali@avalabs.org>
2024-10-29 17:26:29 +11:00
..
catalyst [AUTO] rename Go module + update internal import paths 2024-10-17 01:49:47 +00:00
downloader [AUTO] rename Go module + update internal import paths 2024-10-17 01:49:47 +00:00
ethconfig [AUTO] rename Go module + update internal import paths 2024-10-17 01:49:47 +00:00
fetcher [AUTO] rename Go module + update internal import paths 2024-10-17 01:49:47 +00:00
filters [AUTO] rename Go module + update internal import paths 2024-10-17 01:49:47 +00:00
gasestimator [AUTO] rename Go module + update internal import paths 2024-10-17 01:49:47 +00:00
gasprice [AUTO] rename Go module + update internal import paths 2024-10-17 01:49:47 +00:00
protocols [AUTO] rename Go module + update internal import paths 2024-10-17 01:49:47 +00:00
tracers fix: pre-state tracer logging storage after call from precompile (#64) 2024-10-29 17:26:29 +11:00
api.go [AUTO] rename Go module + update internal import paths 2024-10-17 01:49:47 +00:00
api_admin.go [AUTO] rename Go module + update internal import paths 2024-10-17 01:49:47 +00:00
api_backend.go [AUTO] rename Go module + update internal import paths 2024-10-17 01:49:47 +00:00
api_debug.go [AUTO] rename Go module + update internal import paths 2024-10-17 01:49:47 +00:00
api_debug_test.go [AUTO] rename Go module + update internal import paths 2024-10-17 01:49:47 +00:00
api_miner.go [AUTO] rename Go module + update internal import paths 2024-10-17 01:49:47 +00:00
backend.go [AUTO] rename Go module + update internal import paths 2024-10-17 01:49:47 +00:00
bloombits.go [AUTO] rename Go module + update internal import paths 2024-10-17 01:49:47 +00:00
handler.go [AUTO] rename Go module + update internal import paths 2024-10-17 01:49:47 +00:00
handler_eth.go [AUTO] rename Go module + update internal import paths 2024-10-17 01:49:47 +00:00
handler_eth_test.go [AUTO] rename Go module + update internal import paths 2024-10-17 01:49:47 +00:00
handler_snap.go [AUTO] rename Go module + update internal import paths 2024-10-17 01:49:47 +00:00
handler_test.go [AUTO] rename Go module + update internal import paths 2024-10-17 01:49:47 +00:00
peer.go [AUTO] rename Go module + update internal import paths 2024-10-17 01:49:47 +00:00
peerset.go [AUTO] rename Go module + update internal import paths 2024-10-17 01:49:47 +00:00
state_accessor.go [AUTO] rename Go module + update internal import paths 2024-10-17 01:49:47 +00:00
sync.go [AUTO] rename Go module + update internal import paths 2024-10-17 01:49:47 +00:00
sync_test.go [AUTO] rename Go module + update internal import paths 2024-10-17 01:49:47 +00:00