Fix BenchmarkTransactionTrace

This commit is contained in:
Sina Mahmoodi 2024-10-24 16:00:30 +02:00 committed by Martin Holst Swende
parent 6995ebd301
commit ff277fb0a8
No known key found for this signature in database
GPG key ID: 683B438C05A5DDF0

View file

@ -99,11 +99,13 @@ func BenchmarkTransactionTrace(b *testing.B) {
for i := 0; i < b.N; i++ {
snap := state.StateDB.Snapshot()
tracer.OnTxStart(evm.GetVMContext(), tx, msg.From)
st := core.NewStateTransition(evm, msg, new(core.GasPool).AddGas(tx.Gas()))
_, err = st.TransitionDb()
res, err := st.TransitionDb()
if err != nil {
b.Fatal(err)
}
tracer.OnTxEnd(&types.Receipt{GasUsed: res.UsedGas}, nil)
state.StateDB.RevertToSnapshot(snap)
if have, want := len(tracer.StructLogs()), 244752; have != want {
b.Fatalf("trace wrong, want %d steps, have %d", want, have)