cmd/evm: make evm blocktest output logs if so instructed (#27396)

* cmd/evm: make evm blocktest output logs if so instructed

* Apply suggestions from code review

Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>

---------

Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
This commit is contained in:
Martin Holst Swende
2023-06-06 04:27:40 -04:00
committed by GitHub
co-authored by Marius van der Wijden
parent 0e5d2c7c53
commit 8eb0c2de76
3 changed files with 19 additions and 6 deletions
+2 -2
View File
@@ -48,10 +48,10 @@ func TestBlockchain(t *testing.T) {
bt.skipLoad(`.*randomStatetest94.json.*`)
bt.walk(t, blockTestDir, func(t *testing.T, name string, test *BlockTest) {
if err := bt.checkFailure(t, test.Run(false)); err != nil {
if err := bt.checkFailure(t, test.Run(false, nil)); err != nil {
t.Errorf("test without snapshotter failed: %v", err)
}
if err := bt.checkFailure(t, test.Run(true)); err != nil {
if err := bt.checkFailure(t, test.Run(true, nil)); err != nil {
t.Errorf("test with snapshotter failed: %v", err)
}
})
+4 -2
View File
@@ -100,7 +100,7 @@ type btHeaderMarshaling struct {
BaseFeePerGas *math.HexOrDecimal256
}
func (t *BlockTest) Run(snapshotter bool) error {
func (t *BlockTest) Run(snapshotter bool, tracer vm.EVMLogger) error {
config, ok := Forks[t.json.Network]
if !ok {
return UnsupportedForkError{t.json.Network}
@@ -124,7 +124,9 @@ func (t *BlockTest) Run(snapshotter bool) error {
cache.SnapshotLimit = 1
cache.SnapshotWait = true
}
chain, err := core.NewBlockChain(db, cache, gspec, nil, engine, vm.Config{}, nil, nil)
chain, err := core.NewBlockChain(db, cache, gspec, nil, engine, vm.Config{
Tracer: tracer,
}, nil, nil)
if err != nil {
return err
}