diff --git a/GeneralStateTests/stExample/balance.json b/GeneralStateTests/stExample/balance.json new file mode 100644 index 00000000000..9e2cb3b175f --- /dev/null +++ b/GeneralStateTests/stExample/balance.json @@ -0,0 +1,75 @@ +{ + "balance" : { + "_info" : { + "comment" : "A test for balance opcode result", + "filling-rpc-server" : "Geth-1.9.2-unstable", + "filling-tool-version" : "retesteth-0.0.1+commit.3eec1785.Linux.g++", + "lllcversion" : "Version: 0.5.0-develop.2019.8.22+commit.9709dfe0.Linux.g++", + "source" : "src/GeneralStateTestsFiller/stExample/balanceFiller.json", + "sourceHash" : "9141384ee241bb46f746fa6b05b159e3c6343e3e458d821f9c2d1099e8e2935a" + }, + "env" : { + "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "0x020000", + "currentGasLimit" : "0x0f4240", + "currentNumber" : "0x01", + "currentTimestamp" : "0x03e8", + "previousHash" : "0x5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "post" : { + "ConstantinopleFix" : [ + { + "indexes" : { + "data" : 0, + "gas" : 0, + "value" : 0 + }, + "hash" : "0xab994f2aec0b19c80b5ae8bd380aaea9c51f5dec81efc8fc9882dfc6f3b91ccb", + "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + } + ], + "Istanbul" : [ + { + "indexes" : { + "data" : 0, + "gas" : 0, + "value" : 0 + }, + "hash" : "0xab994f2aec0b19c80b5ae8bd380aaea9c51f5dec81efc8fc9882dfc6f3b91ccb", + "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + } + ] + }, + "pre" : { + "0x095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "0x0de0b6b3a7640000", + "code" : "0x73a94f5374fce5edbc8e2a8697c15331677e6ebf0b316000555a600155", + "nonce" : "0x00", + "storage" : { + } + }, + "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "0x0de0b6b3a7640000", + "code" : "0x", + "nonce" : "0x00", + "storage" : { + } + } + }, + "transaction" : { + "data" : [ + "0x" + ], + "gasLimit" : [ + "0x061a80" + ], + "gasPrice" : "0x01", + "nonce" : "0x00", + "secretKey" : "0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "0x095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : [ + "0x0186a0" + ] + } + } +} \ No newline at end of file diff --git a/Retesteth/default/config b/Retesteth/default/config index b9b1d3a2785..f204351f5fb 100644 --- a/Retesteth/default/config +++ b/Retesteth/default/config @@ -18,6 +18,7 @@ "EIP158", "Byzantium", "Constantinople", - "ConstantinopleFix" + "ConstantinopleFix", + "Istanbul" ] } diff --git a/Retesteth/default/genesis/Istanbul.json b/Retesteth/default/genesis/Istanbul.json new file mode 100644 index 00000000000..8b92df92562 --- /dev/null +++ b/Retesteth/default/genesis/Istanbul.json @@ -0,0 +1,77 @@ +{ + "params" : { + "homesteadForkBlock" : "0x00", + "EIP150ForkBlock" : "0x00", + "EIP158ForkBlock" : "0x00", + "byzantiumForkBlock" : "0x00", + "constantinopleForkBlock" : "0x00", + "constantinopleFixForkBlock" : "0x00", + "istanbulForkBlock" : "0x00" + }, + "accounts" : { + "0x0000000000000000000000000000000000000001" : { + "precompiled" : { + "name" : "ecrecover", + "linear" : { + "base" : 3000, + "word" : 0 + } + } + }, + "0x0000000000000000000000000000000000000002" : { + "precompiled" : { + "name" : "sha256", + "linear" : { + "base" : 60, + "word" : 12 + } + } + }, + "0x0000000000000000000000000000000000000003" : { + "precompiled" : { + "name" : "sha256", + "linear" : { + "base" : 600, + "word" : 120 + } + } + }, + "0x0000000000000000000000000000000000000004" : { + "precompiled" : { + "name" : "identity", + "linear" : { + "base" : 15, + "word" : 3 + } + } + }, + "0x0000000000000000000000000000000000000005" : { + "precompiled" : { + "name" : "modexp" + } + }, + "0x0000000000000000000000000000000000000006" : { + "precompiled" : { + "name" : "alt_bn128_G1_add", + "linear" : { + "base" : 500, + "word" : 0 + } + } + }, + "0x0000000000000000000000000000000000000007" : { + "precompiled" : { + "name" : "alt_bn128_G1_mul", + "linear" : { + "base" : 40000, + "word" : 0 + } + } + }, + "0x0000000000000000000000000000000000000008" : { + "precompiled" : { + "name" : "alt_bn128_pairing_product" + } + } + } +} diff --git a/src/GeneralStateTestsFiller/stExample/balanceFiller.json b/src/GeneralStateTestsFiller/stExample/balanceFiller.json new file mode 100644 index 00000000000..be2187d90a6 --- /dev/null +++ b/src/GeneralStateTestsFiller/stExample/balanceFiller.json @@ -0,0 +1,93 @@ +{ + "balance" : { + "_info" : { + "comment" : "A test for balance opcode result" + }, + "env" : { + "//comment" : "A blockinfo section (obsolite). Do not change. (only coinbase and gasLimit could be changed)", + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "0x20000", + "currentGasLimit" : "1000000", + "currentNumber" : "1", + "currentTimestamp" : "1000", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "//comment" : "Expect section is the post condition for the transaction result", + "expect" : [ + { + "//comment" : "indexes are used to specify post condition for a given transaction range.", + "//comment" : "transaction section describe multiple transaction which will be executed on pre state", + "indexes" : { + "//comment" : "-1 for transaction with any data from this field. or a particular index, or range [0, 1, 2]", + "data" : -1, + "gas" : 0, + "value" : -1 + }, + "//comment" : "hard fork order: Frontier, Homestead, EIP150, EIP155, Byzantium, Constantinople, ConstantinopleFix", + "network" : [">=ConstantinopleFix"], + "result" : { + "//comment" : "Account in expect section would be checked for the fields specified here (balance, code, storage)", + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "//comment" : "Better not to check the gas or mining reward affected account's balances.", + "//comment" : "A change in gasPrice will affect the test and this post condition.", + "//comment" : "So unless the test doesn't really requrie it, don't check coinbase/miner address balance or sender balance in post section", + "balance" : "1000000000000100000", + "//comment" : "Byte Code example", + "code" : "0x73a94f5374fce5edbc8e2a8697c15331677e6ebf0b316000555a600155", + "storage" : { + "0x00" : "0x0de0b6b3a75c5ee0", + "0x01" : "0x0578c0" + } + } + } + } + ], + "//comment" : "Pre condition state for the test", + "pre" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "1000000000000000000", + "//comment": "If lllc compiler is installed, LLL code will be converted into EVM bytecode when --filltests", + "//code" : "put result of add(1,1) into storage cell 0", + "//comment" : "Bytecode example: ", + "code" : "0x6001600101600055", + "//comment" : "LLL Code example. Use LLL with comments, so your tests would have transparent source logic.", + "//comment" : "If the LLL is to bit for .json use .yml test format for better sourcing of the contract", + "//code" : "{ [[0]] (BALANCE 0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b) [[1]] (GAS) }", + "code" : "0x73a94f5374fce5edbc8e2a8697c15331677e6ebf0b316000555a600155", + "nonce" : "0", + "storage" : { + } + }, + "//comment" : "A pre state account description must be complete (balance, code, nonce, storage)", + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "1000000000000000000", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + } + }, + "//comment" : "multiple transaction description that will be applied on a pre state", + "transaction" : { + "//comment" : "foreach d in `data` { foreach g in `gasLimit` { foreach v in `value` { pre.applyTransaction(d, g, v) }}}", + "//comment" : "each element of the data array is treated same as account's code field. You could use LLL here", + "data" : [ + "" + ], + "//comment" : "Be careful when adding gasLimits that are < then intrinsic gas cost. StateTests are not allowed to have invalid transactions", + "gasLimit" : [ + "400000" + ], + "gasPrice" : "1", + "//comment" : "nonce must be same as account nonce a94f5374fce5edbc8e2a8697c15331677e6ebf0b", + "nonce" : "0", + "//comment" : "secretKey is a privKey of a94f5374fce5edbc8e2a8697c15331677e6ebf0b", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "//comment" : "if `to` field is empty, the transaction becomes contract creation. code from data will be executed as a deployment code", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : [ + "100000" + ] + } + } +}