From 429716a4f9e35181fad91a3a2e9288c3a0805296 Mon Sep 17 00:00:00 2001 From: Dimitry Kh Date: Sat, 9 Nov 2019 01:42:54 +0300 Subject: [PATCH] more extCodeHash tests of empty account --- .../callToNonExistentFiller.json | 94 ++++++++++++ .../callToSuicideThenExtcodehashFiller.json | 142 ++++++++++++++++++ .../createEmptyThenExtcodehashFiller.json | 73 +++++++++ 3 files changed, 309 insertions(+) create mode 100644 src/GeneralStateTestsFiller/stExtCodeHash/callToNonExistentFiller.json create mode 100644 src/GeneralStateTestsFiller/stExtCodeHash/callToSuicideThenExtcodehashFiller.json create mode 100644 src/GeneralStateTestsFiller/stExtCodeHash/createEmptyThenExtcodehashFiller.json diff --git a/src/GeneralStateTestsFiller/stExtCodeHash/callToNonExistentFiller.json b/src/GeneralStateTestsFiller/stExtCodeHash/callToNonExistentFiller.json new file mode 100644 index 00000000000..1444aa54ec5 --- /dev/null +++ b/src/GeneralStateTestsFiller/stExtCodeHash/callToNonExistentFiller.json @@ -0,0 +1,94 @@ +{ + "callToNonExistent" : { + "_info" : { + "comment" : "https://github.com/ethereum/tests/issues/652" + }, + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "0x20000", + "currentGasLimit" : "3000000000", + "currentNumber" : "1", + "currentTimestamp" : "1000", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "expect" : [ + { + "indexes" : { "data" : [0,1,2,3], "gas" : -1, "value" : -1 }, + "network" : [ ">=Istanbul"], + "result" : { + "//comment" : "Call[0] Callcode[1] delegatecall[2] staticcall[3] to nonexistent, then extcodehash of nonexistent", + "1000000000000000000000000000000000000000" : { + "balance" : "1", + "storage" : { + "0x00" : "1", + "0x01" : "0x00" + } + } + } + } + ], + "pre" : { + "1000000000000000000000000000000000000000" : { + "balance" : "0", + "nonce" : "0", + "//comment" : "Redirect call to calldataload", + "code" : "{ (CALLCODE (GAS) (CALLDATALOAD 0) 0 0 64 0 64 ) }", + "storage": { + "0x01" : "0x1122" + } + }, + "1000000000000000000000000000000000000001" : { + "balance" : "", + "code" : "{ [[0]] (CALL 25000 0xdead000000000000000000000000000000000001 0 0 0 0 0) [[1]] (EXTCODEHASH 0xdead000000000000000000000000000000000001) }", + "nonce" : "0", + "storage" : { + } + }, + "2000000000000000000000000000000000000001" : { + "balance" : "", + "code" : "{ [[0]] (CALLCODE 25000 0xdead000000000000000000000000000000000001 0 0 0 0 0) [[1]] (EXTCODEHASH 0xdead000000000000000000000000000000000001) }", + "nonce" : "0", + "storage" : { + } + }, + "3000000000000000000000000000000000000001" : { + "balance" : "", + "code" : "{ [[0]] (DELEGATECALL 25000 0xdead000000000000000000000000000000000001 0 0 0 0) [[1]] (EXTCODEHASH 0xdead000000000000000000000000000000000001) }", + "nonce" : "0", + "storage" : { + } + }, + "4000000000000000000000000000000000000001" : { + "balance" : "", + "code" : "{ [[0]] (STATICCALL 25000 0xdead000000000000000000000000000000000001 0 0 0 0) [[1]] (EXTCODEHASH 0xdead000000000000000000000000000000000001) }", + "nonce" : "0", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "1000000000000000000", + "nonce" : "0", + "code" : "", + "storage": {} + } + }, + "transaction" : { + "data" : [ + "0x0000000000000000000000001000000000000000000000000000000000000001", + "0x0000000000000000000000002000000000000000000000000000000000000001", + "0x0000000000000000000000003000000000000000000000000000000000000001", + "0x0000000000000000000000004000000000000000000000000000000000000001" + ], + "gasLimit" : [ + "100000" + ], + "gasPrice" : "1", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "1000000000000000000000000000000000000000", + "value" : [ + "1" + ] + } + } +} diff --git a/src/GeneralStateTestsFiller/stExtCodeHash/callToSuicideThenExtcodehashFiller.json b/src/GeneralStateTestsFiller/stExtCodeHash/callToSuicideThenExtcodehashFiller.json new file mode 100644 index 00000000000..46686192f4d --- /dev/null +++ b/src/GeneralStateTestsFiller/stExtCodeHash/callToSuicideThenExtcodehashFiller.json @@ -0,0 +1,142 @@ +{ + "callToSuicideThenExtcodehash" : { + "_info" : { + "comment" : "https://github.com/ethereum/tests/issues/652" + }, + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "0x20000", + "currentGasLimit" : "3000000000", + "currentNumber" : "1", + "currentTimestamp" : "1000", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "expect" : [ + { + "//comment" : "Call[0] Callcode[1] delegatecall[2] staticcall[3] to suicider, then extcodehash of it", + "indexes" : { "data" : [0], "gas" : -1, "value" : -1 }, + "network" : [ ">=Istanbul"], + "result" : { + "1000000000000000000000000000000000000000" : { + "balance" : "1", + "storage" : { + "0x00" : "1", + "0x01" : "0x2f715723d7cde71586406b2995d4fc62acc9ce1adb8df087cc8d4502d047d3ca" + } + }, + "0000000000000000000000000000000000000025" : { + "balance" : "5555555555" + }, + "0xdead000000000000000000000000000000000001" : { + "shouldnotexist" : "1" + } + } + }, + { + "//comment" : "Call[0] Callcode[1] delegatecall[2] staticcall[3] to suicider, then extcodehash of it", + "indexes" : { "data" : [1,2], "gas" : -1, "value" : -1 }, + "network" : [ ">=Istanbul"], + "result" : { + "0000000000000000000000000000000000000025" : { + "balance" : "1" + }, + "1000000000000000000000000000000000000000" : { + "shouldnotexist" : "1" + }, + "0xdead000000000000000000000000000000000001" : { + "balance" : "5555555555" + } + } + }, + { + "//comment" : "Call[0] Callcode[1] delegatecall[2] staticcall[3] to suicider, then extcodehash of it", + "indexes" : { "data" : [3], "gas" : -1, "value" : -1 }, + "network" : [ ">=Istanbul"], + "result" : { + "0000000000000000000000000000000000000025" : { + "shouldnotexist" : "1" + }, + "1000000000000000000000000000000000000000" : { + "balance" : "1", + "storage" : { + "0x00" : "0", + "0x01" : "0x2f715723d7cde71586406b2995d4fc62acc9ce1adb8df087cc8d4502d047d3ca" + } + }, + "0xdead000000000000000000000000000000000001" : { + "balance" : "5555555555" + } + } + } + ], + "pre" : { + "1000000000000000000000000000000000000000" : { + "balance" : "0", + "nonce" : "0", + "//comment" : "Redirect call to calldataload", + "code" : "{ (CALLCODE (GAS) (CALLDATALOAD 0) 0 0 64 0 64 ) }", + "storage": { + "0x01" : "0x1122" + } + }, + "1000000000000000000000000000000000000001" : { + "balance" : "", + "code" : "{ [[0]] (CALL 165000 0xdead000000000000000000000000000000000001 0 0 0 0 0) [[1]] (EXTCODEHASH 0xdead000000000000000000000000000000000001) }", + "nonce" : "0", + "storage" : { + } + }, + "2000000000000000000000000000000000000001" : { + "balance" : "", + "code" : "{ [[0]] (CALLCODE 165000 0xdead000000000000000000000000000000000001 0 0 0 0 0) [[1]] (EXTCODEHASH 0xdead000000000000000000000000000000000001) }", + "nonce" : "0", + "storage" : { + } + }, + "3000000000000000000000000000000000000001" : { + "balance" : "", + "code" : "{ [[0]] (DELEGATECALL 165000 0xdead000000000000000000000000000000000001 0 0 0 0) [[1]] (EXTCODEHASH 0xdead000000000000000000000000000000000001) }", + "nonce" : "0", + "storage" : { + } + }, + "4000000000000000000000000000000000000001" : { + "balance" : "", + "code" : "{ [[0]] (STATICCALL 165000 0xdead000000000000000000000000000000000001 0 0 0 0) [[1]] (EXTCODEHASH 0xdead000000000000000000000000000000000001) }", + "nonce" : "0", + "storage" : { + } + }, + "0xdead000000000000000000000000000000000001" : { + "balance" : "5555555555", + "nonce" : "0", + "code" : "{(SELFDESTRUCT 0x0000000000000000000000000000000000000025)}", + "storage": {} + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "1000000000000000000", + "nonce" : "0", + "code" : "", + "storage": {} + } + }, + "transaction" : { + "data" : [ + "0x0000000000000000000000001000000000000000000000000000000000000001", + "0x0000000000000000000000002000000000000000000000000000000000000001", + "0x0000000000000000000000003000000000000000000000000000000000000001", + "0x0000000000000000000000004000000000000000000000000000000000000001" + ], + "gasLimit" : [ + "300000" + ], + "gasPrice" : "1", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "1000000000000000000000000000000000000000", + "value" : [ + "1" + ] + } + } +} diff --git a/src/GeneralStateTestsFiller/stExtCodeHash/createEmptyThenExtcodehashFiller.json b/src/GeneralStateTestsFiller/stExtCodeHash/createEmptyThenExtcodehashFiller.json new file mode 100644 index 00000000000..4b69d3a2627 --- /dev/null +++ b/src/GeneralStateTestsFiller/stExtCodeHash/createEmptyThenExtcodehashFiller.json @@ -0,0 +1,73 @@ +{ + "createEmptyThenExtcodehash" : { + "_info" : { + "comment" : "https://github.com/ethereum/tests/issues/652" + }, + "env" : { + "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "0x20000", + "currentGasLimit" : "0x0b00000000", + "currentNumber" : "0x01", + "currentTimestamp" : "0x03e8", + "previousHash" : "0x5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "expect" : [ + { "indexes" : { + "data" : -1, + "gas" : -1, + "value" : -1 + }, + "network" : [">=Istanbul"], + "result" : { + "1000000000000000000000000000000000000000" : { + "storage" : { + "0x00" : "0x0826562ac9373818f7a055166f7b0cc87485f05d", + "0x01" : "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", + "0x02" : "0x7c5a2c91b22d7a9226523d4ba717db6afb741ebd", + "0x03" : "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" + } + }, + "0x0826562ac9373818f7a055166f7b0cc87485f05d" : { + "nonce" : "1", + "code" : "" + } + } + } + ], + "pre" : { + "1000000000000000000000000000000000000000" : { + "balance" : "0x00", + "code" : "{ [[0]] (CREATE2 0 0 (lll (seq (sstore 0 0x112233) (STOP)) 0) 0) [[1]] (EXTCODEHASH 0x0826562ac9373818f7a055166f7b0cc87485f05d) [[2]] (CREATE 0 0 (lll (seq (sstore 0 0x112233) (STOP)) 0)) [[3]] (EXTCODEHASH 0x7c5a2c91b22d7a9226523d4ba717db6afb741ebd) }", + "nonce" : "0x00", + "storage" : { + "0x00" : "0x01", + "0x01" : "0x01", + "0x02" : "0x01", + "0x03" : "0x01" + } + }, + "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "0x6400000000", + "code" : "", + "nonce" : "0x00", + "storage" : { + } + } + }, + "transaction" : { + "data" : [ + "" + ], + "gasLimit" : [ + "300000" + ], + "gasPrice" : "0x01", + "nonce" : "0x00", + "secretKey" : "0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "0x1000000000000000000000000000000000000000", + "value" : [ + "0" + ] + } + } +}