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:
committed by
GitHub
parent
dd91c7ce6a
commit
e376d2fb31
12
cmd/evm/testdata/1/alloc.json
vendored
Normal file
12
cmd/evm/testdata/1/alloc.json
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b": {
|
||||
"balance": "0x5ffd4878be161d74",
|
||||
"code": "0x",
|
||||
"nonce": "0xac",
|
||||
"storage": {}
|
||||
},
|
||||
"0x8a8eafb1cf62bfbeb1741769dae1a9dd47996192":{
|
||||
"balance": "0xfeedbead",
|
||||
"nonce" : "0x00"
|
||||
}
|
||||
}
|
7
cmd/evm/testdata/1/env.json
vendored
Normal file
7
cmd/evm/testdata/1/env.json
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"currentCoinbase": "0xc94f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"currentDifficulty": "0x20000",
|
||||
"currentGasLimit": "0x750a163df65e8a",
|
||||
"currentNumber": "1",
|
||||
"currentTimestamp": "1000"
|
||||
}
|
26
cmd/evm/testdata/1/txs.json
vendored
Normal file
26
cmd/evm/testdata/1/txs.json
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
[
|
||||
{
|
||||
"gas": "0x5208",
|
||||
"gasPrice": "0x2",
|
||||
"hash": "0x0557bacce3375c98d806609b8d5043072f0b6a8bae45ae5a67a00d3a1a18d673",
|
||||
"input": "0x",
|
||||
"nonce": "0x0",
|
||||
"r": "0x9500e8ba27d3c33ca7764e107410f44cbd8c19794bde214d694683a7aa998cdb",
|
||||
"s": "0x7235ae07e4bd6e0206d102b1f8979d6adab280466b6a82d2208ee08951f1f600",
|
||||
"to": "0x8a8eafb1cf62bfbeb1741769dae1a9dd47996192",
|
||||
"v": "0x1b",
|
||||
"value": "0x1"
|
||||
},
|
||||
{
|
||||
"gas": "0x5208",
|
||||
"gasPrice": "0x2",
|
||||
"hash": "0x0557bacce3375c98d806609b8d5043072f0b6a8bae45ae5a67a00d3a1a18d673",
|
||||
"input": "0x",
|
||||
"nonce": "0x0",
|
||||
"r": "0x9500e8ba27d3c33ca7764e107410f44cbd8c19794bde214d694683a7aa998cdb",
|
||||
"s": "0x7235ae07e4bd6e0206d102b1f8979d6adab280466b6a82d2208ee08951f1f600",
|
||||
"to": "0x8a8eafb1cf62bfbeb1741769dae1a9dd47996192",
|
||||
"v": "0x1b",
|
||||
"value": "0x1"
|
||||
}
|
||||
]
|
16
cmd/evm/testdata/2/alloc.json
vendored
Normal file
16
cmd/evm/testdata/2/alloc.json
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"0x095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "0x0de0b6b3a7640000",
|
||||
"code" : "0x6001600053600160006001f0ff00",
|
||||
"nonce" : "0x00",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0x0de0b6b3a7640000",
|
||||
"code" : "0x",
|
||||
"nonce" : "0x00",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
}
|
7
cmd/evm/testdata/2/env.json
vendored
Normal file
7
cmd/evm/testdata/2/env.json
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
|
||||
"currentDifficulty" : "0x020000",
|
||||
"currentGasLimit" : "0x3b9aca00",
|
||||
"currentNumber" : "0x01",
|
||||
"currentTimestamp" : "0x03e8"
|
||||
}
|
1
cmd/evm/testdata/2/readme.md
vendored
Normal file
1
cmd/evm/testdata/2/readme.md
vendored
Normal file
@ -0,0 +1 @@
|
||||
These files examplify a selfdestruct to the `0`-address.
|
14
cmd/evm/testdata/2/txs.json
vendored
Normal file
14
cmd/evm/testdata/2/txs.json
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
[
|
||||
{
|
||||
"input" : "0x",
|
||||
"gas" : "0x5f5e100",
|
||||
"gasPrice" : "0x1",
|
||||
"nonce" : "0x0",
|
||||
"to" : "0x095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "0x186a0",
|
||||
"v" : "0x1b",
|
||||
"r" : "0x88544c93a564b4c28d2ffac2074a0c55fdd4658fe0d215596ed2e32e3ef7f56b",
|
||||
"s" : "0x7fb4075d54190f825d7c47bb820284757b34fd6293904a93cddb1d3aa961ac28",
|
||||
"hash" : "0x72fadbef39cd251a437eea619cfeda752271a5faaaa2147df012e112159ffb81"
|
||||
}
|
||||
]
|
16
cmd/evm/testdata/3/alloc.json
vendored
Normal file
16
cmd/evm/testdata/3/alloc.json
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"0x095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "0x0de0b6b3a7640000",
|
||||
"code" : "0x600140",
|
||||
"nonce" : "0x00",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0x0de0b6b3a7640000",
|
||||
"code" : "0x",
|
||||
"nonce" : "0x00",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
}
|
8
cmd/evm/testdata/3/env.json
vendored
Normal file
8
cmd/evm/testdata/3/env.json
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
|
||||
"currentDifficulty" : "0x020000",
|
||||
"currentGasLimit" : "0x3b9aca00",
|
||||
"currentNumber" : "0x05",
|
||||
"currentTimestamp" : "0x03e8",
|
||||
"blockHashes" : { "1" : "0xdac58aa524e50956d0c0bae7f3f8bb9d35381365d07804dd5b48a5a297c06af4"}
|
||||
}
|
2
cmd/evm/testdata/3/readme.md
vendored
Normal file
2
cmd/evm/testdata/3/readme.md
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
These files examplify a transition where a transaction (excuted on block 5) requests
|
||||
the blockhash for block `1`.
|
14
cmd/evm/testdata/3/txs.json
vendored
Normal file
14
cmd/evm/testdata/3/txs.json
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
[
|
||||
{
|
||||
"input" : "0x",
|
||||
"gas" : "0x5f5e100",
|
||||
"gasPrice" : "0x1",
|
||||
"nonce" : "0x0",
|
||||
"to" : "0x095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "0x186a0",
|
||||
"v" : "0x1b",
|
||||
"r" : "0x88544c93a564b4c28d2ffac2074a0c55fdd4658fe0d215596ed2e32e3ef7f56b",
|
||||
"s" : "0x7fb4075d54190f825d7c47bb820284757b34fd6293904a93cddb1d3aa961ac28",
|
||||
"hash" : "0x72fadbef39cd251a437eea619cfeda752271a5faaaa2147df012e112159ffb81"
|
||||
}
|
||||
]
|
16
cmd/evm/testdata/4/alloc.json
vendored
Normal file
16
cmd/evm/testdata/4/alloc.json
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"0x095e7baea6a6c7c4c2dfeb977efac326af552d87" : {
|
||||
"balance" : "0x0de0b6b3a7640000",
|
||||
"code" : "0x600340",
|
||||
"nonce" : "0x00",
|
||||
"storage" : {
|
||||
}
|
||||
},
|
||||
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
|
||||
"balance" : "0x0de0b6b3a7640000",
|
||||
"code" : "0x",
|
||||
"nonce" : "0x00",
|
||||
"storage" : {
|
||||
}
|
||||
}
|
||||
}
|
8
cmd/evm/testdata/4/env.json
vendored
Normal file
8
cmd/evm/testdata/4/env.json
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
|
||||
"currentDifficulty" : "0x020000",
|
||||
"currentGasLimit" : "0x3b9aca00",
|
||||
"currentNumber" : "0x05",
|
||||
"currentTimestamp" : "0x03e8",
|
||||
"blockHashes" : { "1" : "0xdac58aa524e50956d0c0bae7f3f8bb9d35381365d07804dd5b48a5a297c06af4"}
|
||||
}
|
3
cmd/evm/testdata/4/readme.md
vendored
Normal file
3
cmd/evm/testdata/4/readme.md
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
These files examplify a transition where a transaction (excuted on block 5) requests
|
||||
the blockhash for block `4`, but where the hash for that block is missing.
|
||||
It's expected that executing these should cause `exit` with errorcode `4`.
|
14
cmd/evm/testdata/4/txs.json
vendored
Normal file
14
cmd/evm/testdata/4/txs.json
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
[
|
||||
{
|
||||
"input" : "0x",
|
||||
"gas" : "0x5f5e100",
|
||||
"gasPrice" : "0x1",
|
||||
"nonce" : "0x0",
|
||||
"to" : "0x095e7baea6a6c7c4c2dfeb977efac326af552d87",
|
||||
"value" : "0x186a0",
|
||||
"v" : "0x1b",
|
||||
"r" : "0x88544c93a564b4c28d2ffac2074a0c55fdd4658fe0d215596ed2e32e3ef7f56b",
|
||||
"s" : "0x7fb4075d54190f825d7c47bb820284757b34fd6293904a93cddb1d3aa961ac28",
|
||||
"hash" : "0x72fadbef39cd251a437eea619cfeda752271a5faaaa2147df012e112159ffb81"
|
||||
}
|
||||
]
|
1
cmd/evm/testdata/5/alloc.json
vendored
Normal file
1
cmd/evm/testdata/5/alloc.json
vendored
Normal file
@ -0,0 +1 @@
|
||||
{}
|
11
cmd/evm/testdata/5/env.json
vendored
Normal file
11
cmd/evm/testdata/5/env.json
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"currentCoinbase": "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
||||
"currentDifficulty": "0x20000",
|
||||
"currentGasLimit": "0x750a163df65e8a",
|
||||
"currentNumber": "1",
|
||||
"currentTimestamp": "1000",
|
||||
"ommers": [
|
||||
{"delta": 1, "address": "0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" },
|
||||
{"delta": 2, "address": "0xcccccccccccccccccccccccccccccccccccccccc" }
|
||||
]
|
||||
}
|
1
cmd/evm/testdata/5/readme.md
vendored
Normal file
1
cmd/evm/testdata/5/readme.md
vendored
Normal file
@ -0,0 +1 @@
|
||||
These files examplify a transition where there are no transcations, two ommers, at block `N-1` (delta 1) and `N-2` (delta 2).
|
1
cmd/evm/testdata/5/txs.json
vendored
Normal file
1
cmd/evm/testdata/5/txs.json
vendored
Normal file
@ -0,0 +1 @@
|
||||
[]
|
12
cmd/evm/testdata/7/alloc.json
vendored
Normal file
12
cmd/evm/testdata/7/alloc.json
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b": {
|
||||
"balance": "0x5ffd4878be161d74",
|
||||
"code": "0x",
|
||||
"nonce": "0xac",
|
||||
"storage": {}
|
||||
},
|
||||
"0x8a8eafb1cf62bfbeb1741769dae1a9dd47996192":{
|
||||
"balance": "0xfeedbead",
|
||||
"nonce" : "0x00"
|
||||
}
|
||||
}
|
7
cmd/evm/testdata/7/env.json
vendored
Normal file
7
cmd/evm/testdata/7/env.json
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"currentCoinbase": "0xc94f5374fce5edbc8e2a8697c15331677e6ebf0b",
|
||||
"currentDifficulty": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffff020000",
|
||||
"currentGasLimit": "0x750a163df65e8a",
|
||||
"currentNumber": "5",
|
||||
"currentTimestamp": "1000"
|
||||
}
|
7
cmd/evm/testdata/7/readme.md
vendored
Normal file
7
cmd/evm/testdata/7/readme.md
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
This is a test for HomesteadToDao, checking if the
|
||||
DAO-transition works
|
||||
|
||||
Example:
|
||||
```
|
||||
./statet8n --input.alloc=./testdata/7/alloc.json --input.txs=./testdata/7/txs.json --input.env=./testdata/7/env.json --output.alloc=stdout --state.fork=HomesteadToDaoAt5
|
||||
```
|
1
cmd/evm/testdata/7/txs.json
vendored
Normal file
1
cmd/evm/testdata/7/txs.json
vendored
Normal file
@ -0,0 +1 @@
|
||||
[]
|
Reference in New Issue
Block a user