Skip to content

Commit

Permalink
cmd/evm: simplify blockrunner
Browse files Browse the repository at this point in the history
  • Loading branch information
holiman committed Jan 27, 2023
1 parent 1e2b109 commit dee1b1b
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions cmd/evm/blockrunner.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@ package main
import (
"encoding/json"
"errors"
"fmt"
"os"

"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/tests"

"github.com/urfave/cli/v2"
)

Expand All @@ -35,16 +34,6 @@ var blockTestCommand = &cli.Command{
ArgsUsage: "<file>",
}

// BlocktestResult contains the execution status after running a blockchain test, any
// error that might have occurred and a dump of the final blockchain if requested.
type BlocktestResult struct {
Name string `json:"name"`
Pass bool `json:"pass"`
Fork string `json:"fork"`
Error string `json:"error,omitempty"`
State *state.Dump `json:"state,omitempty"`
}

func blockTestCmd(ctx *cli.Context) error {
if len(ctx.Args().First()) == 0 {
return errors.New("path-to-test argument required")
Expand All @@ -63,9 +52,9 @@ func blockTestCmd(ctx *cli.Context) error {
if err = json.Unmarshal(src, &tests); err != nil {
return err
}
for _, test := range tests {
for i, test := range tests {
if err := test.Run(false); err != nil {
return err
return fmt.Errorf("test %v: %w", i, err)
}
}
return nil
Expand Down

0 comments on commit dee1b1b

Please sign in to comment.