diff --git a/cmd/evm/runner.go b/cmd/evm/runner.go index b2cf28353b..b454b14f94 100644 --- a/cmd/evm/runner.go +++ b/cmd/evm/runner.go @@ -311,12 +311,16 @@ func runCmd(ctx *cli.Context) error { } input := common.FromHex(string(hexInput)) + bench := ctx.Bool(BenchFlag.Name) + var execFunc func() ([]byte, uint64, error) if ctx.Bool(CreateFlag.Name) { input = append(code, input...) execFunc = func() ([]byte, uint64, error) { - // don't mutate the state! - runtimeConfig.State = prestate.Copy() + if bench { + // don't mutate the state! + runtimeConfig.State = prestate.Copy() + } output, _, gasLeft, err := runtime.Create(input, &runtimeConfig) return output, gasLeft, err } @@ -325,14 +329,15 @@ func runCmd(ctx *cli.Context) error { prestate.SetCode(receiver, code) } execFunc = func() ([]byte, uint64, error) { - // don't mutate the state! - runtimeConfig.State = prestate.Copy() + if bench { + // don't mutate the state! + runtimeConfig.State = prestate.Copy() + } output, gasLeft, err := runtime.Call(receiver, input, &runtimeConfig) return output, initialGas - gasLeft, err } } - bench := ctx.Bool(BenchFlag.Name) output, stats, err := timedExec(bench, execFunc) if ctx.Bool(DumpFlag.Name) { diff --git a/cmd/evm/testdata/evmrun/3.out.1.txt b/cmd/evm/testdata/evmrun/3.out.1.txt index 44956f54f6..25dd8da5a1 100644 --- a/cmd/evm/testdata/evmrun/3.out.1.txt +++ b/cmd/evm/testdata/evmrun/3.out.1.txt @@ -1,12 +1,13 @@ { "root": "b444481d1367188172f8c6091e948aaa68bae763fd26d6b9e994306a66bf69f9", "accounts": { - "pre(0x30d7a0694cb29af31b982480e11d7ebb003a3fca4026939149071f014689b142)": { + "0x0000000000000000000000007265636569766572": { "balance": "0", "nonce": 0, "root": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "codeHash": "0x3e48ef54b89079a075f3b8fc253c657a86b110a7aed3568c1517b10edf2c3eb6", "code": "0x6040", + "address": "0x0000000000000000000000007265636569766572", "key": "0x30d7a0694cb29af31b982480e11d7ebb003a3fca4026939149071f014689b142" } } diff --git a/cmd/evm/testdata/evmrun/4.out.1.txt b/cmd/evm/testdata/evmrun/4.out.1.txt index 44956f54f6..25dd8da5a1 100644 --- a/cmd/evm/testdata/evmrun/4.out.1.txt +++ b/cmd/evm/testdata/evmrun/4.out.1.txt @@ -1,12 +1,13 @@ { "root": "b444481d1367188172f8c6091e948aaa68bae763fd26d6b9e994306a66bf69f9", "accounts": { - "pre(0x30d7a0694cb29af31b982480e11d7ebb003a3fca4026939149071f014689b142)": { + "0x0000000000000000000000007265636569766572": { "balance": "0", "nonce": 0, "root": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "codeHash": "0x3e48ef54b89079a075f3b8fc253c657a86b110a7aed3568c1517b10edf2c3eb6", "code": "0x6040", + "address": "0x0000000000000000000000007265636569766572", "key": "0x30d7a0694cb29af31b982480e11d7ebb003a3fca4026939149071f014689b142" } }