go-ethereum/eth/tracers
Daniel Liu 51f4757eed
eth/traces: add state limit #25812 (#1300)
This PR introduces a new mechanism in chain tracer for preventing creating too many trace states.

The workflow of chain tracer can be divided into several parts:

- state creator generates trace state in a thread
- state tracer retrieves the trace state and applies the tracing on top in another thread
- state collector gathers all result from state tracer and stream to users

It's basically a producer-consumer model here, while if we imagine that the state producer generates states too fast, then it will lead to accumulate lots of unused states in memory. Even worse, in path-based state scheme it will only keep the latest 128 states in memory, and the newly generated state will invalidate the oldest one by marking it as stale.

The solution for fixing it is to limit the speed of state generation. If there are over 128 states un-consumed in memory, then the creation will be paused until the states are be consumed properly.

Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
2025-09-09 07:03:24 +08:00
..
internal/tracetest eth/tracers: add diffMode to prestateTracer #25422 (#1299) 2025-09-09 06:56:34 +08:00
js eth/tracers: remove revertReasonTracer, add revert reason to callTracer #25508 (#1298) 2025-09-09 06:43:32 +08:00
logger eth/tracers: refactor traceTx to separate out struct logging #24326 (#1278) 2025-09-08 20:55:06 +08:00
native eth/tracers: add diffMode to prestateTracer #25422 (#1299) 2025-09-09 06:56:34 +08:00
api.go eth/traces: add state limit #25812 (#1300) 2025-09-09 07:03:24 +08:00
api_test.go eth: rework chain tracer #25143 #25715 #29162 (#1294) 2025-09-09 00:06:07 +08:00
tracers.go eth/tracers: package restructuring #23857 (#1266) 2025-08-29 05:26:36 +08:00
tracers_test.go eth/tracers: fix typo and linter #25020 #24783 #25551 (#1286) 2025-09-08 21:15:42 +08:00
tracker.go eth/traces: add state limit #25812 (#1300) 2025-09-09 07:03:24 +08:00
tracker_test.go eth/traces: add state limit #25812 (#1300) 2025-09-09 07:03:24 +08:00