-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Description
Specification
General State Test:
{
"testname" : {
"env" : {
"currentCoinbase" : "address",
"currentDifficulty" : "0x020000", //minimum difficulty for mining on blockchain
"currentGasLimit" : "u64", //not larger then maxGasLimit = 0x7fffffffffffffff
"currentNumber" : "0x01", //Irrelevant to hardfork parameters!
"currentTimestamp" : "1000", //for blockchain version
"previousHash" : "h256"
},
"post" : {
"EIP150" : [
{
"hash" : "3e6dacc1575c6a8c76422255eca03529bbf4c0dda75dfc110b22d6dc4152396f",
"indexes" : { "data" : 0, "gas" : 0, "value" : 0 }
},
{
"hash" : "99a450d8ce5b987a71346d8a0a1203711f770745c7ef326912e46761f14cd764",
"indexes" : { "data" : 0, "gas" : 0, "value" : 1 }
},
...
],
"EIP158" : [
{
"hash" : "3e6dacc1575c6a8c76422255eca03529bbf4c0dda75dfc110b22d6dc4152396f",
"indexes" : { "data" : 0, "gas" : 0, "value" : 0 }
},
{
"hash" : "99a450d8ce5b987a71346d8a0a1203711f770745c7ef326912e46761f14cd764",
"indexes" : { "data" : 0, "gas" : 0, "value" : 1 }
},
...
],
"Frontier" : [
...
],
"Homestead" : [
...
]
},
"pre" : {
//same as for StateTests
},
"transaction" : {
"data" : [ "" ],
"gasLimit" : [ "285000", "100000", "6000" ],
"gasPrice" : "0x01",
"nonce" : "0x00",
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
"value" : [ "10", "0" ]
}
}
}
Indexes section describes which values from given array to set for transaction before it's execution on a pre state. Transaction now has data
, value
, and gasLimit
as arrays.
post section now has array of implemented forks. For each fork it has another array of execution results on that fork rules with post state root hash and transaction parameters.
all value fields are in hex and prefixed with '0x'
address, secretKey and hash fields are not prefixed with '0x'
Rationale
Due to the recent network changes it would be good to make state tests more general so we don't need to copy them each time a new hard fork occur. The new tests would have a single filler for a single test.
One test per file. So instead of previous stInitCodeTest.json
file with lost of tests it would be stInitCodeTest
folder with files describing every individual test from stInitCodeTest.json
.
The new format will have results of a transaction execution on every implemented hardfork and in addition it would also allow to describe multiple transaction parameters such as array of data
, value
and gasLimit
. Thus transaction would be executed with different parameters on a single pre state. This allows to test range of test cases where we need to check x, x+1, x-1 values results.