mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 09:53:48 +00:00
cmd/evm: fix state dump output
Signed-off-by: xermicus <cyrill@parity.io>
This commit is contained in:
parent
4cda8f06ea
commit
74ab14e383
3 changed files with 14 additions and 7 deletions
|
|
@ -311,12 +311,16 @@ func runCmd(ctx *cli.Context) error {
|
||||||
}
|
}
|
||||||
input := common.FromHex(string(hexInput))
|
input := common.FromHex(string(hexInput))
|
||||||
|
|
||||||
|
bench := ctx.Bool(BenchFlag.Name)
|
||||||
|
|
||||||
var execFunc func() ([]byte, uint64, error)
|
var execFunc func() ([]byte, uint64, error)
|
||||||
if ctx.Bool(CreateFlag.Name) {
|
if ctx.Bool(CreateFlag.Name) {
|
||||||
input = append(code, input...)
|
input = append(code, input...)
|
||||||
execFunc = func() ([]byte, uint64, error) {
|
execFunc = func() ([]byte, uint64, error) {
|
||||||
|
if bench {
|
||||||
// don't mutate the state!
|
// don't mutate the state!
|
||||||
runtimeConfig.State = prestate.Copy()
|
runtimeConfig.State = prestate.Copy()
|
||||||
|
}
|
||||||
output, _, gasLeft, err := runtime.Create(input, &runtimeConfig)
|
output, _, gasLeft, err := runtime.Create(input, &runtimeConfig)
|
||||||
return output, gasLeft, err
|
return output, gasLeft, err
|
||||||
}
|
}
|
||||||
|
|
@ -325,14 +329,15 @@ func runCmd(ctx *cli.Context) error {
|
||||||
prestate.SetCode(receiver, code)
|
prestate.SetCode(receiver, code)
|
||||||
}
|
}
|
||||||
execFunc = func() ([]byte, uint64, error) {
|
execFunc = func() ([]byte, uint64, error) {
|
||||||
|
if bench {
|
||||||
// don't mutate the state!
|
// don't mutate the state!
|
||||||
runtimeConfig.State = prestate.Copy()
|
runtimeConfig.State = prestate.Copy()
|
||||||
|
}
|
||||||
output, gasLeft, err := runtime.Call(receiver, input, &runtimeConfig)
|
output, gasLeft, err := runtime.Call(receiver, input, &runtimeConfig)
|
||||||
return output, initialGas - gasLeft, err
|
return output, initialGas - gasLeft, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bench := ctx.Bool(BenchFlag.Name)
|
|
||||||
output, stats, err := timedExec(bench, execFunc)
|
output, stats, err := timedExec(bench, execFunc)
|
||||||
|
|
||||||
if ctx.Bool(DumpFlag.Name) {
|
if ctx.Bool(DumpFlag.Name) {
|
||||||
|
|
|
||||||
3
cmd/evm/testdata/evmrun/3.out.1.txt
vendored
3
cmd/evm/testdata/evmrun/3.out.1.txt
vendored
|
|
@ -1,12 +1,13 @@
|
||||||
{
|
{
|
||||||
"root": "b444481d1367188172f8c6091e948aaa68bae763fd26d6b9e994306a66bf69f9",
|
"root": "b444481d1367188172f8c6091e948aaa68bae763fd26d6b9e994306a66bf69f9",
|
||||||
"accounts": {
|
"accounts": {
|
||||||
"pre(0x30d7a0694cb29af31b982480e11d7ebb003a3fca4026939149071f014689b142)": {
|
"0x0000000000000000000000007265636569766572": {
|
||||||
"balance": "0",
|
"balance": "0",
|
||||||
"nonce": 0,
|
"nonce": 0,
|
||||||
"root": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
"root": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||||
"codeHash": "0x3e48ef54b89079a075f3b8fc253c657a86b110a7aed3568c1517b10edf2c3eb6",
|
"codeHash": "0x3e48ef54b89079a075f3b8fc253c657a86b110a7aed3568c1517b10edf2c3eb6",
|
||||||
"code": "0x6040",
|
"code": "0x6040",
|
||||||
|
"address": "0x0000000000000000000000007265636569766572",
|
||||||
"key": "0x30d7a0694cb29af31b982480e11d7ebb003a3fca4026939149071f014689b142"
|
"key": "0x30d7a0694cb29af31b982480e11d7ebb003a3fca4026939149071f014689b142"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
3
cmd/evm/testdata/evmrun/4.out.1.txt
vendored
3
cmd/evm/testdata/evmrun/4.out.1.txt
vendored
|
|
@ -1,12 +1,13 @@
|
||||||
{
|
{
|
||||||
"root": "b444481d1367188172f8c6091e948aaa68bae763fd26d6b9e994306a66bf69f9",
|
"root": "b444481d1367188172f8c6091e948aaa68bae763fd26d6b9e994306a66bf69f9",
|
||||||
"accounts": {
|
"accounts": {
|
||||||
"pre(0x30d7a0694cb29af31b982480e11d7ebb003a3fca4026939149071f014689b142)": {
|
"0x0000000000000000000000007265636569766572": {
|
||||||
"balance": "0",
|
"balance": "0",
|
||||||
"nonce": 0,
|
"nonce": 0,
|
||||||
"root": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
"root": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
|
||||||
"codeHash": "0x3e48ef54b89079a075f3b8fc253c657a86b110a7aed3568c1517b10edf2c3eb6",
|
"codeHash": "0x3e48ef54b89079a075f3b8fc253c657a86b110a7aed3568c1517b10edf2c3eb6",
|
||||||
"code": "0x6040",
|
"code": "0x6040",
|
||||||
|
"address": "0x0000000000000000000000007265636569766572",
|
||||||
"key": "0x30d7a0694cb29af31b982480e11d7ebb003a3fca4026939149071f014689b142"
|
"key": "0x30d7a0694cb29af31b982480e11d7ebb003a3fca4026939149071f014689b142"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue