From 4bd1088c642d35b012dd3cfd82f719c068b26809 Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Tue, 10 Mar 2015 17:49:54 +0100 Subject: [PATCH 1/9] add 32 bit overflow tests --- test/stMemoryStressTestFiller.json | 102 +++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) diff --git a/test/stMemoryStressTestFiller.json b/test/stMemoryStressTestFiller.json index 420f7c3db..d697db44e 100644 --- a/test/stMemoryStressTestFiller.json +++ b/test/stMemoryStressTestFiller.json @@ -33,6 +33,108 @@ } }, + "mload32bitBound_return": { + "env" : { + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", + "currentNumber" : "0", + "currentGasLimit" : "175923205248920000", + "currentDifficulty" : "256", + "currentTimestamp" : "1", + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "nonce" : "0", + "code" : "{ (RETURN 0 4294967297) } ", + "storage": {} + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "1759232052489200000", + "nonce" : "0", + "code" : "", + "storage": {} + } + }, + "transaction" : { + "nonce" : "0", + "gasPrice" : "1", + "gasLimit" : "175923205248920000", + "to" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "value" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "data" : "" + } + }, + + "mload32bitBound_return2": { + "env" : { + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", + "currentNumber" : "0", + "currentGasLimit" : "175923205248920000", + "currentDifficulty" : "256", + "currentTimestamp" : "1", + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "nonce" : "0", + "code" : "{[ 0 ] 1 (RETURN 0 4294967296) } ", + "storage": {} + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "1759232052489200000", + "nonce" : "0", + "code" : "", + "storage": {} + } + }, + "transaction" : { + "nonce" : "0", + "gasPrice" : "1", + "gasLimit" : "175923205248920000", + "to" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "value" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "data" : "" + } + }, + + "mload32bitBound_Msize": { + "env" : { + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", + "currentNumber" : "0", + "currentGasLimit" : "175923205248920000", + "currentDifficulty" : "256", + "currentTimestamp" : "1", + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "nonce" : "0", + "code" : "{ [4294967295] 1 [[ 0 ]] (MSIZE)} ", + "storage": {} + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "1759232052489200000", + "nonce" : "0", + "code" : "", + "storage": {} + } + }, + "transaction" : { + "nonce" : "0", + "gasPrice" : "1", + "gasLimit" : "175923205248920000", + "to" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "value" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "data" : "" + } + }, + "mload32bitBound2": { "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", From 78027960ee47f3fee2a292108aaf03613d19effd Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Wed, 11 Mar 2015 12:28:01 +0100 Subject: [PATCH 2/9] suicide and storage refund tests --- test/stRefundTestFiller.json | 159 ++++++++++++++++++++++++++++++----- 1 file changed, 140 insertions(+), 19 deletions(-) diff --git a/test/stRefundTestFiller.json b/test/stRefundTestFiller.json index b0d0e1747..c4ea2f3c9 100644 --- a/test/stRefundTestFiller.json +++ b/test/stRefundTestFiller.json @@ -3,7 +3,7 @@ "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", - "currentGasLimit" : "1000000", + "currentGasLimit" : "228500", "currentDifficulty" : "256", "currentTimestamp" : 1, "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" @@ -18,7 +18,7 @@ } }, "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "100000", + "balance" : "2285000", "nonce" : "0", "code" : "", "storage": {} @@ -27,7 +27,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "22850", + "gasLimit" : "228500", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "10", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -54,7 +54,7 @@ } }, "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "100000", + "balance" : "1000000", "nonce" : "0", "code" : "", "storage": {} @@ -63,7 +63,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "22850", + "gasLimit" : "228500", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "10", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -90,7 +90,7 @@ } }, "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "50000", + "balance" : "500000", "nonce" : "0", "code" : "", "storage": {} @@ -99,7 +99,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "21000", + "gasLimit" : "26005", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -135,7 +135,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "21002", + "gasLimit" : "26006", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -223,7 +223,7 @@ } }, - "refund500" : { + "refund50percentCap" : { "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", @@ -305,6 +305,55 @@ } }, + "refundSuicide50procentCap" : { + "env" : { + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", + "currentNumber" : "0", + "currentGasLimit" : "10000000", + "currentDifficulty" : "256", + "currentTimestamp" : 1, + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" + }, + "pre" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "1000000000000000000", + "nonce" : "0", + "code" : "{ [[ 22 ]] (GAS) [[ 10 ]] 1 [[ 11 ]] (CALL 500 0xaaae7baea6a6c7c4c2dfeb977efac326af552aaa 0 0 0 0 0 ) [[ 1 ]] 0 [[ 2 ]] 0 [[ 3 ]] 0 [[ 4 ]] 0 [[ 5 ]] 0 [[ 6 ]] 0 [[ 7 ]] 0 [[ 8 ]] 0 [[ 23 ]] (GAS) }", + "storage" : { + "0x01" : "0x01", + "0x02" : "0x01", + "0x03" : "0x01", + "0x04" : "0x01", + "0x05" : "0x01", + "0x06" : "0x01", + "0x07" : "0x01", + "0x08" : "0x01" + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "10000000", + "nonce" : "0", + "code" : "", + "storage": {} + }, + "aaae7baea6a6c7c4c2dfeb977efac326af552aaa" : { + "balance" : "1000000000000000000", + "nonce" : "0", + "code" : "{ (SUICIDE 0x095e7baea6a6c7c4c2dfeb977efac326af552d87) }", + "storage" : {} + } + }, + "transaction" : { + "nonce" : "0", + "gasPrice" : "1", + "gasLimit" : "10000000", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "data" : "" + } + }, + "refund_CallToSuicide" : { "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", @@ -349,6 +398,78 @@ } }, + "refund_TxToSuicide" : { + "env" : { + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", + "currentNumber" : "0", + "currentGasLimit" : "10000000", + "currentDifficulty" : "256", + "currentTimestamp" : 1, + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" + }, + "pre" : { + "aaae7baea6a6c7c4c2dfeb977efac326af552aaa" : { + "balance" : "1000000000000000000", + "nonce" : "0", + "code" : "{ (SUICIDE 0x095e7baea6a6c7c4c2dfeb977efac326af552d87) }", + "storage" : { + "0x01" : "0x01" + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "100000000", + "nonce" : "0", + "code" : "", + "storage": {} + } + }, + "transaction" : { + "nonce" : "0", + "gasPrice" : "1", + "gasLimit" : "21003", + "to" : "aaae7baea6a6c7c4c2dfeb977efac326af552aaa", + "value" : "10", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "data" : "" + } + }, + + "refund_TxToSuicideOOG" : { + "env" : { + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", + "currentNumber" : "0", + "currentGasLimit" : "10000000", + "currentDifficulty" : "256", + "currentTimestamp" : 1, + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" + }, + "pre" : { + "aaae7baea6a6c7c4c2dfeb977efac326af552aaa" : { + "balance" : "1000000000000000000", + "nonce" : "0", + "code" : "{ (SUICIDE 0x095e7baea6a6c7c4c2dfeb977efac326af552d87) }", + "storage" : { + "0x01" : "0x01" + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "100000000", + "nonce" : "0", + "code" : "", + "storage": {} + } + }, + "transaction" : { + "nonce" : "0", + "gasPrice" : "1", + "gasLimit" : "21002", + "to" : "aaae7baea6a6c7c4c2dfeb977efac326af552aaa", + "value" : "10", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "data" : "" + } + }, + "refund_CallToSuicideTwice" : { "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", @@ -406,7 +527,7 @@ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { "balance" : "1000000000000000000", "nonce" : "0", - "code" : "{ [[ 0 ]] (CALL 500 0xaaae7baea6a6c7c4c2dfeb977efac326af552aaa 0 0 0 0 0 )}", + "code" : "{ [[ 0 ]] (CALL 5500 0xaaae7baea6a6c7c4c2dfeb977efac326af552aaa 0 0 0 0 0 )}", "storage" : { "0x01" : "0x01" } @@ -420,7 +541,7 @@ } }, "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "2000", + "balance" : "2000000", "nonce" : "0", "code" : "", "storage": {} @@ -429,7 +550,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "1500", + "gasLimit" : "200000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "10", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -437,7 +558,7 @@ } }, - "refund_CallA2" : { + "refund_CallA_notEnoughGasInCall" : { "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", @@ -450,7 +571,7 @@ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { "balance" : "1000000000000000000", "nonce" : "0", - "code" : "{ [[ 0 ]] (CALL 50 0xaaae7baea6a6c7c4c2dfeb977efac326af552aaa 0 0 0 0 0 )}", + "code" : "{ [[ 0 ]] (CALL 5005 0xaaae7baea6a6c7c4c2dfeb977efac326af552aaa 0 0 0 0 0 )}", "storage" : { "0x01" : "0x01" } @@ -464,7 +585,7 @@ } }, "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "1000", + "balance" : "100000", "nonce" : "0", "code" : "", "storage": {} @@ -473,7 +594,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "850", + "gasLimit" : "85000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "10", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -494,7 +615,7 @@ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { "balance" : "1000000000000000000", "nonce" : "0", - "code" : "{ [[ 0 ]] (CALL 1 0xaaae7baea6a6c7c4c2dfeb977efac326af552aaa 0 0 0 0 0 )}", + "code" : "{ [[ 0 ]] (CALL 6000 0xaaae7baea6a6c7c4c2dfeb977efac326af552aaa 0 0 0 0 0 )}", "storage" : { "0x01" : "0x01" } @@ -508,7 +629,7 @@ } }, "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "1000", + "balance" : "300000", "nonce" : "0", "code" : "", "storage": {} @@ -517,7 +638,7 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "850", + "gasLimit" : "31069", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "10", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", From 015741d8e763356cb4aaf74dfa9137efe0862683 Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Wed, 11 Mar 2015 12:42:37 +0100 Subject: [PATCH 3/9] suicide refund with and without storage --- test/stRefundTestFiller.json | 44 +++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/test/stRefundTestFiller.json b/test/stRefundTestFiller.json index c4ea2f3c9..5fb040f50 100644 --- a/test/stRefundTestFiller.json +++ b/test/stRefundTestFiller.json @@ -354,7 +354,7 @@ } }, - "refund_CallToSuicide" : { + "refund_CallToSuicideStorage" : { "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", @@ -398,6 +398,48 @@ } }, + "refund_CallToSuicideNoStorage" : { + "env" : { + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", + "currentNumber" : "0", + "currentGasLimit" : "10000000", + "currentDifficulty" : "256", + "currentTimestamp" : 1, + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" + }, + "pre" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "1000000000000000000", + "nonce" : "0", + "code" : "{ [[ 0 ]] (CALL 500 0xaaae7baea6a6c7c4c2dfeb977efac326af552aaa 0 0 0 0 0 )}", + "storage" : { + "0x01" : "0x01" + } + }, + "aaae7baea6a6c7c4c2dfeb977efac326af552aaa" : { + "balance" : "1000000000000000000", + "nonce" : "0", + "code" : "{ (SUICIDE 0x095e7baea6a6c7c4c2dfeb977efac326af552d87) }", + "storage" : {} + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "100000000", + "nonce" : "0", + "code" : "", + "storage": {} + } + }, + "transaction" : { + "nonce" : "0", + "gasPrice" : "1", + "gasLimit" : "10000000", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "10", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "data" : "" + } + }, + "refund_TxToSuicide" : { "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", From 3f2e246e7149fac694b8d3ee2bb4315c7b7822c4 Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Wed, 11 Mar 2015 13:18:39 +0100 Subject: [PATCH 4/9] check value when doing callcode --- test/stSystemOperationsTestFiller.json | 48 ++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/test/stSystemOperationsTestFiller.json b/test/stSystemOperationsTestFiller.json index 7460ca94e..c2d90b518 100644 --- a/test/stSystemOperationsTestFiller.json +++ b/test/stSystemOperationsTestFiller.json @@ -797,7 +797,7 @@ "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", "currentNumber" : "0", - "currentGasLimit" : "10000000", + "currentGasLimit" : "30000000", "currentDifficulty" : "256", "currentTimestamp" : 1, "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" @@ -806,7 +806,7 @@ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { "balance" : "1000000000000000000", "nonce" : "0", - "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (MSTORE 32 0xaaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa ) [[ 0 ]] (CALLCODE 500 0x945304eb96065b2a98b57a48a06ae28d285a71b5 23 0 64 0 2 ) }", + "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (MSTORE 32 0xaaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa ) [[ 0 ]] (CALLCODE 50000 0x945304eb96065b2a98b57a48a06ae28d285a71b5 23 0 64 0 2 ) }", "storage": {} }, "945304eb96065b2a98b57a48a06ae28d285a71b5" : { @@ -827,7 +827,49 @@ "transaction" : { "nonce" : "0", "gasPrice" : "1", - "gasLimit" : "30000", + "gasLimit" : "3000000", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "100000", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "data" : "" + } + }, + + "callcodeWithHighValue": { + "env" : { + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", + "currentNumber" : "0", + "currentGasLimit" : "30000000", + "currentDifficulty" : "256", + "currentTimestamp" : 1, + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" + }, + "pre" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "1000000000000000000", + "nonce" : "0", + "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (MSTORE 32 0xaaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa ) [[ 0 ]] (CALLCODE 50000 0x945304eb96065b2a98b57a48a06ae28d285a71b5 100000000000000000000 0 64 0 2 ) }", + "storage": {} + }, + "945304eb96065b2a98b57a48a06ae28d285a71b5" : { + "balance" : "23", + "code" : "0x6001600155603760005360026000f3", + "nonce" : "0", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "1000000000000000000", + "nonce" : "0", + "code" : "", + "storage": {} + } + + }, + "transaction" : { + "nonce" : "0", + "gasPrice" : "1", + "gasLimit" : "3000000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", From d65fcc86876dd2ecc666b0233e07603058d2e03c Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Wed, 11 Mar 2015 13:44:02 +0100 Subject: [PATCH 5/9] add callCreateCallCode test file --- test/stCallCreateCallCodeTestFiller.json | 161 +++++++++++++++++++++++ test/stSystemOperationsTestFiller.json | 42 ------ test/state.cpp | 5 + 3 files changed, 166 insertions(+), 42 deletions(-) create mode 100644 test/stCallCreateCallCodeTestFiller.json diff --git a/test/stCallCreateCallCodeTestFiller.json b/test/stCallCreateCallCodeTestFiller.json new file mode 100644 index 000000000..742874c8e --- /dev/null +++ b/test/stCallCreateCallCodeTestFiller.json @@ -0,0 +1,161 @@ +{ + "callcodeWithHighValue": { + "env" : { + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", + "currentNumber" : "0", + "currentGasLimit" : "30000000", + "currentDifficulty" : "256", + "currentTimestamp" : 1, + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" + }, + "pre" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "1000000000000000000", + "nonce" : "0", + "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (MSTORE 32 0xaaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa ) [[ 0 ]] (CALLCODE 50000 0x945304eb96065b2a98b57a48a06ae28d285a71b5 100000000000000000000 0 64 0 2 ) }", + "storage": {} + }, + "945304eb96065b2a98b57a48a06ae28d285a71b5" : { + "balance" : "23", + "code" : "0x6001600155603760005360026000f3", + "nonce" : "0", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "1000000000000000000", + "nonce" : "0", + "code" : "", + "storage": {} + } + + }, + "transaction" : { + "nonce" : "0", + "gasPrice" : "1", + "gasLimit" : "3000000", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "100000", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "data" : "" + } + }, + + "callcodeWithHighValueAndGasOOG": { + "env" : { + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", + "currentNumber" : "0", + "currentGasLimit" : "30000000", + "currentDifficulty" : "256", + "currentTimestamp" : 1, + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" + }, + "pre" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "1000000000000000000", + "nonce" : "0", + "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (MSTORE 32 0xaaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa ) [[ 0 ]] (CALLCODE 1 0x945304eb96065b2a98b57a48a06ae28d285a71b5 100000000000000000000 0 64 0 2 ) }", + "storage": {} + }, + "945304eb96065b2a98b57a48a06ae28d285a71b5" : { + "balance" : "23", + "code" : "0x6001600155603760005360026000f3", + "nonce" : "0", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "1000000000000000000", + "nonce" : "0", + "code" : "", + "storage": {} + } + + }, + "transaction" : { + "nonce" : "0", + "gasPrice" : "1", + "gasLimit" : "3000000", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "100000", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "data" : "" + } + }, + + "callWithHighValueAndGasOOG": { + "env" : { + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", + "currentNumber" : "0", + "currentGasLimit" : "30000000", + "currentDifficulty" : "256", + "currentTimestamp" : 1, + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" + }, + "pre" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "1000000000000000000", + "nonce" : "0", + "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (MSTORE 32 0xaaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa ) [[ 0 ]] (CALL 1 0x945304eb96065b2a98b57a48a06ae28d285a71b5 100000000000000000000 0 64 0 2 ) }", + "storage": {} + }, + "945304eb96065b2a98b57a48a06ae28d285a71b5" : { + "balance" : "23", + "code" : "0x6001600155603760005360026000f3", + "nonce" : "0", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "1000000000000000000", + "nonce" : "0", + "code" : "", + "storage": {} + } + + }, + "transaction" : { + "nonce" : "0", + "gasPrice" : "1", + "gasLimit" : "3000000", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "100000", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "data" : "" + } + }, + + "createNameRegistratorendowmentTooHigh": { + "env" : { + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", + "currentNumber" : "0", + "currentGasLimit" : "1000000", + "currentDifficulty" : "256", + "currentTimestamp" : 1, + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" + }, + "pre" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "1000000000000000000", + "nonce" : "0", + "code" : "{ (MSTORE 0 0x601080600c6000396000f3006000355415600957005b60203560003555) [[ 0 ]] (CREATE 1000000000000000001 3 29) }", + "storage": {} + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "1000000000000000000", + "nonce" : "0", + "code" : "", + "storage": {} + } + }, + "transaction" : { + "nonce" : "0", + "gasPrice" : "1", + "gasLimit" : "300000", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "data" : "" + } + } +} diff --git a/test/stSystemOperationsTestFiller.json b/test/stSystemOperationsTestFiller.json index c2d90b518..d1d59faba 100644 --- a/test/stSystemOperationsTestFiller.json +++ b/test/stSystemOperationsTestFiller.json @@ -835,48 +835,6 @@ } }, - "callcodeWithHighValue": { - "env" : { - "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", - "currentNumber" : "0", - "currentGasLimit" : "30000000", - "currentDifficulty" : "256", - "currentTimestamp" : 1, - "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" - }, - "pre" : { - "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { - "balance" : "1000000000000000000", - "nonce" : "0", - "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (MSTORE 32 0xaaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa ) [[ 0 ]] (CALLCODE 50000 0x945304eb96065b2a98b57a48a06ae28d285a71b5 100000000000000000000 0 64 0 2 ) }", - "storage": {} - }, - "945304eb96065b2a98b57a48a06ae28d285a71b5" : { - "balance" : "23", - "code" : "0x6001600155603760005360026000f3", - "nonce" : "0", - "storage" : { - } - }, - "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "1000000000000000000", - "nonce" : "0", - "code" : "", - "storage": {} - } - - }, - "transaction" : { - "nonce" : "0", - "gasPrice" : "1", - "gasLimit" : "3000000", - "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", - "value" : "100000", - "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "data" : "" - } - }, - "CallToNameRegistratorOutOfGas": { "env" : { diff --git a/test/state.cpp b/test/state.cpp index 5202aff22..46ebb1a71 100644 --- a/test/state.cpp +++ b/test/state.cpp @@ -130,6 +130,11 @@ BOOST_AUTO_TEST_CASE(stSystemOperationsTest) dev::test::executeTests("stSystemOperationsTest", "/StateTests", dev::test::doStateTests); } +BOOST_AUTO_TEST_CASE(stCallCreateCallCodeTest) +{ + dev::test::executeTests("stCallCreateCallCodeTest", "/StateTests", dev::test::doStateTests); +} + BOOST_AUTO_TEST_CASE(stPreCompiledContracts) { dev::test::executeTests("stPreCompiledContracts", "/StateTests", dev::test::doStateTests); From e01ebe78f3b734b5b5165bfe6cc54c1d7d51a6d6 Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Wed, 11 Mar 2015 16:35:55 +0100 Subject: [PATCH 6/9] OOG or 1024 depth level fail --- test/stCallCreateCallCodeTestFiller.json | 237 ++++++++++++++++++++++- 1 file changed, 233 insertions(+), 4 deletions(-) diff --git a/test/stCallCreateCallCodeTestFiller.json b/test/stCallCreateCallCodeTestFiller.json index 742874c8e..1e6797401 100644 --- a/test/stCallCreateCallCodeTestFiller.json +++ b/test/stCallCreateCallCodeTestFiller.json @@ -12,7 +12,7 @@ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { "balance" : "1000000000000000000", "nonce" : "0", - "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (MSTORE 32 0xaaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa ) [[ 0 ]] (CALLCODE 50000 0x945304eb96065b2a98b57a48a06ae28d285a71b5 100000000000000000000 0 64 0 2 ) }", + "code" : "{ [[ 0 ]] (CALLCODE 50000 0x945304eb96065b2a98b57a48a06ae28d285a71b5 1000000000000000001 0 64 0 2 ) }", "storage": {} }, "945304eb96065b2a98b57a48a06ae28d285a71b5" : { @@ -35,12 +35,241 @@ "gasPrice" : "1", "gasLimit" : "3000000", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", - "value" : "100000", + "value" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", "data" : "" } }, + "callWithHighValue": { + "env" : { + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", + "currentNumber" : "0", + "currentGasLimit" : "30000000", + "currentDifficulty" : "256", + "currentTimestamp" : 1, + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" + }, + "pre" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "1000000000000000000", + "nonce" : "0", + "code" : "{ [[ 0 ]] (CALL 50000 0x945304eb96065b2a98b57a48a06ae28d285a71b5 1000000000000000001 0 64 0 2 ) }", + "storage": {} + }, + "945304eb96065b2a98b57a48a06ae28d285a71b5" : { + "balance" : "23", + "code" : "0x6001600155603760005360026000f3", + "nonce" : "0", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "1000000000000000000", + "nonce" : "0", + "code" : "", + "storage": {} + } + + }, + "transaction" : { + "nonce" : "0", + "gasPrice" : "1", + "gasLimit" : "3000000", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "data" : "" + } + }, + + "callWithHighValueAndOOGatTxLevel": { + "env" : { + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", + "currentNumber" : "0", + "currentGasLimit" : "30000000", + "currentDifficulty" : "256", + "currentTimestamp" : 1, + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" + }, + "pre" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "100000", + "nonce" : "0", + "code" : "{ [[ 0 ]] (CALL 3000001 0x945304eb96065b2a98b57a48a06ae28d285a71b5 100001 0 0 0 0 ) }", + "storage": {} + }, + "945304eb96065b2a98b57a48a06ae28d285a71b5" : { + "balance" : "23", + "code" : "0x6001600155603760005360026000f3", + "nonce" : "0", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "1000000000000000000", + "nonce" : "0", + "code" : "", + "storage": {} + } + + }, + "transaction" : { + "nonce" : "0", + "gasPrice" : "1", + "gasLimit" : "3000000", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "data" : "" + } + }, + + "Call1024BalanceTooLow" : { + "env" : { + "currentCoinbase" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b", + "currentDifficulty" : "45678256", + "currentGasLimit" : "0xffffffffffffffffffffffffffffffff", + "currentNumber" : "0", + "currentTimestamp" : 1, + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "pre" : + { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "0xffffffffffffffffffffffffffffffff", + "code" : "", + "nonce" : "0", + "storage" : { + } + }, + + "aaaf5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "7000", + "code" : "", + "nonce" : "0", + "storage" : { + } + }, + + "bbbf5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "1024", + "code" : "{ [[ 0 ]] (ADD @@0 1) [[ 1 ]] (CALL 0xfffffffffff 0xbbbf5374fce5edbc8e2a8697c15331677e6ebf0b @@0 0 0 0 0) }", + "nonce" : "0", + "storage" : { + } + } + }, + + "transaction" : + { + "data" : "", + "gasLimit" : "0xffffffffffffffffffffffffffffff", + "gasPrice" : "1", + "nonce" : "", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "bbbf5374fce5edbc8e2a8697c15331677e6ebf0b", + "value" : "10" + } + }, + + "Call1024OOG" : { + "env" : { + "currentCoinbase" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b", + "currentDifficulty" : "45678256", + "currentGasLimit" : "0xffffffffffffffffffffffffffffffff", + "currentNumber" : "0", + "currentTimestamp" : 1, + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "pre" : + { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "0xffffffffffffffffffffffffffffffff", + "code" : "", + "nonce" : "0", + "storage" : { + } + }, + + "aaaf5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "7000", + "code" : "", + "nonce" : "0", + "storage" : { + } + }, + + "bbbf5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "1024", + "code" : "{ [[ 0 ]] (ADD @@0 1) [[ 1 ]] (CALL (MUL (SUB (GAS) 10000) (SUB 1 (DIV @@0 1025))) 0xbbbf5374fce5edbc8e2a8697c15331677e6ebf0b 0 0 0 0 0) [[ 2 ]] (ADD 1(MUL @@0 1000)) }", + "nonce" : "0", + "storage" : { + } + } + }, + "transaction" : + { + "data" : "", + "gasLimit" : "0xffffffffffffffffffffffffffffff", + "gasPrice" : "1", + "nonce" : "", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "bbbf5374fce5edbc8e2a8697c15331677e6ebf0b", + "value" : "10" + } + }, + + "CallLoseGasOOG" : { + "env" : { + "currentCoinbase" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b", + "currentDifficulty" : "45678256", + "currentGasLimit" : "0xffffffffffffffffffffffffffffffff", + "currentNumber" : "0", + "currentTimestamp" : 1, + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "pre" : + { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "0xffffffffffffffffffffffffffffffff", + "code" : "", + "nonce" : "0", + "storage" : { + } + }, + + "aaaf5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "7000", + "code" : "", + "nonce" : "0", + "storage" : { + } + }, + + "bbbf5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "1024", + "code" : "{ [[ 0 ]] (ADD @@0 1) [[ 1 ]] (CALL (ADD 1(MUL @@0 100000)) 0xbbbf5374fce5edbc8e2a8697c15331677e6ebf0b 0 0 0 0 0) [[ 2 ]] (ADD 1(MUL @@0 1000)) }", + "nonce" : "0", + "storage" : { + } + } + }, + + + "transaction" : + { + "data" : "", + "gasLimit" : "0xffffffffffffffffffffffffffffff", + "gasPrice" : "1", + "nonce" : "", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "bbbf5374fce5edbc8e2a8697c15331677e6ebf0b", + "value" : "10" + } + }, + + "callcodeWithHighValueAndGasOOG": { "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", @@ -54,7 +283,7 @@ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { "balance" : "1000000000000000000", "nonce" : "0", - "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (MSTORE 32 0xaaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa ) [[ 0 ]] (CALLCODE 1 0x945304eb96065b2a98b57a48a06ae28d285a71b5 100000000000000000000 0 64 0 2 ) }", + "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (MSTORE 32 0xaaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa ) [[ 0 ]] (CALLCODE 0xffffffffffffffffffffffff 0x945304eb96065b2a98b57a48a06ae28d285a71b5 100000000000000000000 0 64 0 2 ) }", "storage": {} }, "945304eb96065b2a98b57a48a06ae28d285a71b5" : { @@ -96,7 +325,7 @@ "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { "balance" : "1000000000000000000", "nonce" : "0", - "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (MSTORE 32 0xaaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa ) [[ 0 ]] (CALL 1 0x945304eb96065b2a98b57a48a06ae28d285a71b5 100000000000000000000 0 64 0 2 ) }", + "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (MSTORE 32 0xaaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffaa ) [[ 0 ]] (CALL 0xffffffffffffffffffffffff 0x945304eb96065b2a98b57a48a06ae28d285a71b5 100000000000000000000 0 64 0 2 ) }", "storage": {} }, "945304eb96065b2a98b57a48a06ae28d285a71b5" : { From a07eb1a519daffc312a2be1786f10f199c52eff7 Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Wed, 11 Mar 2015 16:58:38 +0100 Subject: [PATCH 7/9] OOG or 1024 depth level fail for CALLCODE --- test/stCallCreateCallCodeTestFiller.json | 208 +++++++++++++++++++---- 1 file changed, 176 insertions(+), 32 deletions(-) diff --git a/test/stCallCreateCallCodeTestFiller.json b/test/stCallCreateCallCodeTestFiller.json index 1e6797401..b0245ee72 100644 --- a/test/stCallCreateCallCodeTestFiller.json +++ b/test/stCallCreateCallCodeTestFiller.json @@ -125,6 +125,150 @@ } }, + "Callcode1024BalanceTooLow" : { + "env" : { + "currentCoinbase" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b", + "currentDifficulty" : "45678256", + "currentGasLimit" : "0xffffffffffffffffffffffffffffffff", + "currentNumber" : "0", + "currentTimestamp" : 1, + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "pre" : + { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "0xffffffffffffffffffffffffffffffff", + "code" : "", + "nonce" : "0", + "storage" : { + } + }, + + "aaaf5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "7000", + "code" : "", + "nonce" : "0", + "storage" : { + } + }, + + "bbbf5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "1024", + "code" : "{ [[ 0 ]] (ADD @@0 1) [[ 1 ]] (CALLCODE 0xfffffffffff 0xbbbf5374fce5edbc8e2a8697c15331677e6ebf0b @@0 0 0 0 0) }", + "nonce" : "0", + "storage" : { + } + } + }, + + "transaction" : + { + "data" : "", + "gasLimit" : "0xffffffffffffffffffffffffffffff", + "gasPrice" : "1", + "nonce" : "", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "bbbf5374fce5edbc8e2a8697c15331677e6ebf0b", + "value" : "10" + } + }, + + "Callcode1024OOG" : { + "env" : { + "currentCoinbase" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b", + "currentDifficulty" : "45678256", + "currentGasLimit" : "0xffffffffffffffffffffffffffffffff", + "currentNumber" : "0", + "currentTimestamp" : 1, + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "pre" : + { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "0xffffffffffffffffffffffffffffffff", + "code" : "", + "nonce" : "0", + "storage" : { + } + }, + + "aaaf5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "7000", + "code" : "", + "nonce" : "0", + "storage" : { + } + }, + + "bbbf5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "1024", + "code" : "{ [[ 0 ]] (ADD @@0 1) [[ 1 ]] (CALLCODE (MUL (SUB (GAS) 10000) (SUB 1 (DIV @@0 1025))) 0xbbbf5374fce5edbc8e2a8697c15331677e6ebf0b 0 0 0 0 0) [[ 2 ]] (ADD 1(MUL @@0 1000)) }", + "nonce" : "0", + "storage" : { + } + } + }, + "transaction" : + { + "data" : "", + "gasLimit" : "0xffffffffffffffffffffffffffffff", + "gasPrice" : "1", + "nonce" : "", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "bbbf5374fce5edbc8e2a8697c15331677e6ebf0b", + "value" : "10" + } + }, + + "CallcodeLoseGasOOG" : { + "env" : { + "currentCoinbase" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b", + "currentDifficulty" : "45678256", + "currentGasLimit" : "0xffffffffffffffffffffffffffffffff", + "currentNumber" : "0", + "currentTimestamp" : 1, + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "pre" : + { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "0xffffffffffffffffffffffffffffffff", + "code" : "", + "nonce" : "0", + "storage" : { + } + }, + + "aaaf5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "7000", + "code" : "", + "nonce" : "0", + "storage" : { + } + }, + + "bbbf5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "1024", + "code" : "{ [[ 0 ]] (ADD @@0 1) [[ 1 ]] (CALLCODE (ADD 1(MUL @@0 100000)) 0xbbbf5374fce5edbc8e2a8697c15331677e6ebf0b 0 0 0 0 0) [[ 2 ]] (ADD 1(MUL @@0 1000)) }", + "nonce" : "0", + "storage" : { + } + } + }, + + + "transaction" : + { + "data" : "", + "gasLimit" : "0xffffffffffffffffffffffffffffff", + "gasPrice" : "1", + "nonce" : "", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "bbbf5374fce5edbc8e2a8697c15331677e6ebf0b", + "value" : "10" + } + }, + "Call1024BalanceTooLow" : { "env" : { "currentCoinbase" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b", @@ -220,42 +364,42 @@ } }, - "CallLoseGasOOG" : { - "env" : { - "currentCoinbase" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b", - "currentDifficulty" : "45678256", - "currentGasLimit" : "0xffffffffffffffffffffffffffffffff", - "currentNumber" : "0", - "currentTimestamp" : 1, - "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + "CallLoseGasOOG" : { + "env" : { + "currentCoinbase" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b", + "currentDifficulty" : "45678256", + "currentGasLimit" : "0xffffffffffffffffffffffffffffffff", + "currentNumber" : "0", + "currentTimestamp" : 1, + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "pre" : + { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "0xffffffffffffffffffffffffffffffff", + "code" : "", + "nonce" : "0", + "storage" : { + } }, - "pre" : - { - "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "0xffffffffffffffffffffffffffffffff", - "code" : "", - "nonce" : "0", - "storage" : { - } - }, - - "aaaf5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "7000", - "code" : "", - "nonce" : "0", - "storage" : { - } - }, - - "bbbf5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "1024", - "code" : "{ [[ 0 ]] (ADD @@0 1) [[ 1 ]] (CALL (ADD 1(MUL @@0 100000)) 0xbbbf5374fce5edbc8e2a8697c15331677e6ebf0b 0 0 0 0 0) [[ 2 ]] (ADD 1(MUL @@0 1000)) }", - "nonce" : "0", - "storage" : { - } + + "aaaf5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "7000", + "code" : "", + "nonce" : "0", + "storage" : { } }, + "bbbf5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "1024", + "code" : "{ [[ 0 ]] (ADD @@0 1) [[ 1 ]] (CALL (ADD 1(MUL @@0 100000)) 0xbbbf5374fce5edbc8e2a8697c15331677e6ebf0b 0 0 0 0 0) [[ 2 ]] (ADD 1(MUL @@0 1000)) }", + "nonce" : "0", + "storage" : { + } + } + }, + "transaction" : { From 5238ad58f5844eb440eaa28650d8a8dc89650915 Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Thu, 12 Mar 2015 16:53:00 +0100 Subject: [PATCH 8/9] readd --filltest option and add dejavu issue 42 test --- test/TestHelper.cpp | 2 ++ test/vmArithmeticTestFiller.json | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/test/TestHelper.cpp b/test/TestHelper.cpp index fcca46308..a2e1eaf1b 100644 --- a/test/TestHelper.cpp +++ b/test/TestHelper.cpp @@ -549,6 +549,8 @@ Options::Options() } else if (arg == "--vmtrace") vmtrace = true; + else if (arg == "--filltests") + fillTests = true; else if (arg == "--performance") performance = true; else if (arg == "--quadratic") diff --git a/test/vmArithmeticTestFiller.json b/test/vmArithmeticTestFiller.json index 81dbf052b..19224cc2e 100644 --- a/test/vmArithmeticTestFiller.json +++ b/test/vmArithmeticTestFiller.json @@ -4847,6 +4847,35 @@ } }, + "signextend_Overflow_dj42": { + "env" : { + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", + "currentNumber" : "0", + "currentGasLimit" : "10000000", + "currentDifficulty" : "256", + "currentTimestamp" : "1", + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "nonce" : "0", + "//" : "{ asm PUSH1 0x05 JUMP JUMPDEST STOP JUMPDEST PUSH2 0x8000 DUP1 PUSH9 0x01000000000000001 SIGNEXTEND PUSH2 0x8001 GT PUSH1 0x03 JUMPI PUSH4 0xbadf000d PUSH1 0x11 SSTORE}", + "code" : "0x6005565b005b61800080680100000000000000010b6180011160035763badf000d601155", + "storage": {} + } + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000", + "data" : "", + "gasPrice" : "100000000000000", + "gas" : "1000000" + } + }, + "not1": { "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", From 21b90342ab72f38d95950c3e47266e0f8bb77ab9 Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Thu, 12 Mar 2015 17:11:58 +0100 Subject: [PATCH 9/9] dejavu issue 19 - stack underflows --- test/vmArithmeticTestFiller.json | 31 +++++++++++- test/vmBlockInfoTestFiller.json | 28 +++++++++++ test/vmEnvironmentalInfoTestFiller.json | 63 +++++++++++++++++++++++++ 3 files changed, 120 insertions(+), 2 deletions(-) diff --git a/test/vmArithmeticTestFiller.json b/test/vmArithmeticTestFiller.json index 19224cc2e..16e085a12 100644 --- a/test/vmArithmeticTestFiller.json +++ b/test/vmArithmeticTestFiller.json @@ -393,6 +393,34 @@ } }, + "mulUnderFlow": { + "env" : { + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", + "currentNumber" : "0", + "currentGasLimit" : "1000000", + "currentDifficulty" : "256", + "currentTimestamp" : "1", + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "1000000000000000000", + "nonce" : "0", + "code" : "(asm 1 MUL 01 SSTORE)", + "storage": {} + } + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "origin" : "cd1722f2947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f2947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000", + "data" : "", + "gasPrice" : "100000000000000", + "gas" : "100000" + } + }, + "sub0": { "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", @@ -4860,8 +4888,7 @@ "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { "balance" : "1000000000000000000", "nonce" : "0", - "//" : "{ asm PUSH1 0x05 JUMP JUMPDEST STOP JUMPDEST PUSH2 0x8000 DUP1 PUSH9 0x01000000000000001 SIGNEXTEND PUSH2 0x8001 GT PUSH1 0x03 JUMPI PUSH4 0xbadf000d PUSH1 0x11 SSTORE}", - "code" : "0x6005565b005b61800080680100000000000000010b6180011160035763badf000d601155", + "code" : "(asm 0x05 JUMP JUMPDEST STOP JUMPDEST 0x8000 DUP1 0x010000000000000001 SIGNEXTEND 0x8001 GT 0x03 JUMPI 0xbadf000d 0x11 SSTORE)", "storage": {} } }, diff --git a/test/vmBlockInfoTestFiller.json b/test/vmBlockInfoTestFiller.json index c86a9f2cb..2455b2387 100644 --- a/test/vmBlockInfoTestFiller.json +++ b/test/vmBlockInfoTestFiller.json @@ -27,6 +27,34 @@ } }, + "blockhashUnderFlow": { + "env" : { + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", + "currentNumber" : "1", + "currentGasLimit" : "1000000", + "currentDifficulty" : "256", + "currentTimestamp" : "1", + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "100000000000000000000000", + "nonce" : "0", + "code" : "(asm BLOCKHASH)", + "storage": {} + } + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000", + "data" : "", + "gasPrice" : "100000000000000", + "gas" : "100000" + } + }, + "blockhashMyBlock": { "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", diff --git a/test/vmEnvironmentalInfoTestFiller.json b/test/vmEnvironmentalInfoTestFiller.json index 4de871d9e..d9e1ef654 100644 --- a/test/vmEnvironmentalInfoTestFiller.json +++ b/test/vmEnvironmentalInfoTestFiller.json @@ -563,6 +563,34 @@ } }, + "calldatacopyUnderFlow": { + "env" : { + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", + "currentNumber" : "0", + "currentGasLimit" : "1000000", + "currentDifficulty" : "256", + "currentTimestamp" : "1", + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "100000000000000000000000", + "nonce" : "0", + "code" : "(asm 1 2 CALLDATACOPY)", + "storage": {} + } + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000", + "data" : "0x1234567890abcdef01234567890abcdef", + "gasPrice" : "1000000000", + "gas" : "100000000000" + } + }, + "calldatacopyZeroMemExpansion": { "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", @@ -1129,6 +1157,41 @@ "gas" : "100000000000" } }, + + "extcodesizeUnderFlow": { + "env" : { + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", + "currentNumber" : "0", + "currentGasLimit" : "1000000", + "currentDifficulty" : "256", + "currentTimestamp" : "1", + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "100000000000000000000000", + "nonce" : "0", + "code" : "(asm EXTCODESIZE)", + "storage": {} + }, + "cd1722f3947def4cf144679da39c4c32bdc35681" : { + "balance" : "100000000000000000000000", + "nonce" : "0", + "code" : "{ [[ 0 ]] (EQ (EXTCODESIZE (CALLER)) (CODESIZE) ) }", + "storage": {} + } + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "1000000000000000000", + "data" : "0x1234567890abcdef01234567890abcdef", + "gasPrice" : "123456789", + "gas" : "100000000000" + } + }, + "extcodesize1": { "env" : { "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6",