native/callflat: register parity tracer

Signed-off-by: jsvisa <delweng@gmail.com>
This commit is contained in:
jsvisa 2024-08-19 15:56:30 +00:00
parent b759f84cf9
commit efa411ffb7

View file

@ -38,6 +38,7 @@ import (
func init() {
tracers.DefaultDirectory.Register("flatCallTracer", newFlatCallTracer, false)
tracers.DefaultDirectory.Register("parityTracer", newParityTracer, false)
}
var parityErrorMapping = map[string]string{
@ -153,6 +154,11 @@ func newFlatCallTracer(ctx *tracers.Context, cfg json.RawMessage) (*tracers.Trac
}, nil
}
// newParityTracer returns a new flatCallTracer with parity style.
func newParityTracer(ctx *tracers.Context, _ json.RawMessage) (*tracers.Tracer, error) {
return newFlatCallTracer(ctx, []byte(`{"includePrecompiles": true, "convertParityErrors": true}`))
}
// OnEnter is called when EVM enters a new scope (via call, create or selfdestruct).
func (t *flatCallTracer) OnEnter(depth int, typ byte, from common.Address, to common.Address, input []byte, gas uint64, value *big.Int) {
if t.interrupt.Load() {