cmd/evm: add state transition tool for testing (#20958)

This PR implements the EVM state transition tool, which is intended
to be the replacement for our retesteth client implementation.
Documentation is present in the cmd/evm/README.md file.

Co-authored-by: Felix Lange <fjl@twurst.com>
This commit is contained in:
Martin Holst Swende
2020-06-30 10:12:51 +02:00
committed by GitHub
parent dd91c7ce6a
commit e376d2fb31
37 changed files with 1509 additions and 48 deletions

View File

@@ -22,6 +22,7 @@ import (
"math/big"
"os"
"github.com/ethereum/go-ethereum/cmd/evm/internal/t8ntool"
"github.com/ethereum/go-ethereum/cmd/utils"
"gopkg.in/urfave/cli.v1"
)
@@ -126,6 +127,27 @@ var (
}
)
var stateTransitionCommand = cli.Command{
Name: "transition",
Aliases: []string{"t8n"},
Usage: "executes a full state transition",
Action: t8ntool.Main,
Flags: []cli.Flag{
t8ntool.TraceFlag,
t8ntool.TraceDisableMemoryFlag,
t8ntool.TraceDisableStackFlag,
t8ntool.OutputAllocFlag,
t8ntool.OutputResultFlag,
t8ntool.InputAllocFlag,
t8ntool.InputEnvFlag,
t8ntool.InputTxsFlag,
t8ntool.ForknameFlag,
t8ntool.ChainIDFlag,
t8ntool.RewardFlag,
t8ntool.VerbosityFlag,
},
}
func init() {
app.Flags = []cli.Flag{
BenchFlag,
@@ -156,13 +178,18 @@ func init() {
disasmCommand,
runCommand,
stateTestCommand,
stateTransitionCommand,
}
cli.CommandHelpTemplate = utils.OriginCommandHelpTemplate
}
func main() {
if err := app.Run(os.Args); err != nil {
code := 1
if ec, ok := err.(*t8ntool.NumberedError); ok {
code = ec.Code()
}
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
os.Exit(code)
}
}