diff --git a/eth/tracers/blocknative/tracer.go b/eth/tracers/blocknative/tracer.go index c407548b309d..7fa4841a7b35 100644 --- a/eth/tracers/blocknative/tracer.go +++ b/eth/tracers/blocknative/tracer.go @@ -242,6 +242,12 @@ func finalizeCallFrame(call *CallFrame, output []byte, gasUsed uint64, err error call.Output = bytesToHex(output) } +// EmptyCache is for testing purposes. It clears the global cache so tests don't +// interfere with each other. +func EmptyCache() { + decoderCache = decoder.NewCaches() +} + // // Unused interface methods. // diff --git a/eth/tracers/internal/tracetest/blocknative_test.go b/eth/tracers/internal/tracetest/blocknative_test.go index c09d29ebdb6b..cb5f9c07d1e7 100644 --- a/eth/tracers/internal/tracetest/blocknative_test.go +++ b/eth/tracers/internal/tracetest/blocknative_test.go @@ -264,6 +264,8 @@ func loadTestTxs(dirPath string) ([]*blocknativeTracerTest, error) { } func executeTestCase(test *blocknativeTracerTest, t testing.TB, checkResult bool) { + blocknative.EmptyCache() + st := core.NewStateTransition(test.evm, test.msg, new(core.GasPool).AddGas(test.tx.Gas())) if _, err := st.TransitionDb(); err != nil { t.Fatalf("failed to execute transaction: %v", err)