core/vm: Refactor tracing to make Tracer the main interface
This CL makes several refactors: - Define a Tracer interface, implementing the `CaptureState` method - Add the VM environment as the first argument of `Tracer.CaptureState` - Rename existing functionality `StructLogger` an make it an implementation of `Tracer` - Delete `StructLogCollector` and make `StructLogger` collect the logs directly - Change all callers to use the new `StructLogger` where necessary and extract logs from that. - Deletes the apparently obsolete and likely nonfunctional 'TraceCall' from the eth API. Callers that only wish accumulated logs can use the `StructLogger` implementation straightforwardly. Callers that wish to efficiently capture VM traces and operate on them without excessive copying can now implement the `Tracer` interface to receive VM state at each step and do with it as they wish. This CL also removes the accumulation of logs from the vm.Environment; this was necessary as part of the refactor, but also simplifies it by removing a responsibility that doesn't directly belong to the Environment.
Showing
- cmd/evm/main.go 4 additions, 8 deletionscmd/evm/main.go
- core/vm/environment.go 0 additions, 2 deletionscore/vm/environment.go
- core/vm/gas.go 1 addition, 1 deletioncore/vm/gas.go
- core/vm/instructions.go 73 additions, 73 deletionscore/vm/instructions.go
- core/vm/jit.go 3 additions, 3 deletionscore/vm/jit.go
- core/vm/jit_test.go 0 additions, 5 deletionscore/vm/jit_test.go
- core/vm/logger.go 34 additions, 30 deletionscore/vm/logger.go
- core/vm/logger_test.go 6 additions, 7 deletionscore/vm/logger_test.go
- core/vm/runtime/env.go 0 additions, 14 deletionscore/vm/runtime/env.go
- core/vm/segments.go 2 additions, 2 deletionscore/vm/segments.go
- core/vm/stack.go 13 additions, 13 deletionscore/vm/stack.go
- core/vm/vm.go 4 additions, 12 deletionscore/vm/vm.go
- core/vm_env.go 0 additions, 14 deletionscore/vm_env.go
- eth/api.go 22 additions, 34 deletionseth/api.go
- internal/ethapi/api.go 0 additions, 54 deletionsinternal/ethapi/api.go
- tests/util.go 0 additions, 10 deletionstests/util.go
Loading
Please register or sign in to comment