From b392afac3cd6145b909ad9dfe3c6370d341ca062 Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Fri, 20 Feb 2015 15:05:11 +0100 Subject: [PATCH] memGasCost checks --- StateTests/stPreCompiledContracts.json | 8 +- StateTests/stTransactionTest.json | 144 +++++++++- VMTests/vmSha3Test.json | 362 ++++++++++++++++++++++++- 3 files changed, 498 insertions(+), 16 deletions(-) diff --git a/StateTests/stPreCompiledContracts.json b/StateTests/stPreCompiledContracts.json index 0f1db1275..8cca6f7a4 100644 --- a/StateTests/stPreCompiledContracts.json +++ b/StateTests/stPreCompiledContracts.json @@ -1074,14 +1074,14 @@ } }, "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : { - "balance" : "32684", + "balance" : "986358", "code" : "0x", "nonce" : "0", "storage" : { } }, "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "999999999999867316", + "balance" : "999999999998913642", "code" : "0x", "nonce" : "1", "storage" : { @@ -1631,14 +1631,14 @@ } }, "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : { - "balance" : "32684", + "balance" : "986358", "code" : "0x", "nonce" : "0", "storage" : { } }, "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "999999999999867316", + "balance" : "999999999998913642", "code" : "0x", "nonce" : "1", "storage" : { diff --git a/StateTests/stTransactionTest.json b/StateTests/stTransactionTest.json index b75f66df9..40c0244fe 100644 --- a/StateTests/stTransactionTest.json +++ b/StateTests/stTransactionTest.json @@ -778,22 +778,22 @@ ], "out" : "0x", "post" : { - "0000000000000000000000000000000000000000" : { - "balance" : "20", - "code" : "0x6001ff", + "0000000000000000000000000000000000000001" : { + "balance" : "1", + "code" : "0x", "nonce" : "0", "storage" : { } }, "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "6489", + "balance" : "6460", "code" : "0x", "nonce" : "1", "storage" : { } }, "b94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "501", + "balance" : "530", "code" : "0x", "nonce" : "0", "storage" : { @@ -817,7 +817,7 @@ }, "c94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "10", - "code" : "0x6000ff60006000600060006001600060c8f1", + "code" : "0x6000600060006000600160006014f1506000ff", "nonce" : "0", "storage" : { } @@ -825,7 +825,7 @@ }, "transaction" : { "data" : "", - "gasLimit" : "1700", + "gasLimit" : "700", "gasPrice" : "1", "nonce" : "", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", @@ -854,14 +854,14 @@ } }, "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "6489", + "balance" : "6461", "code" : "0x", "nonce" : "1", "storage" : { } }, "b94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "501", + "balance" : "529", "code" : "0x", "nonce" : "0", "storage" : { @@ -885,7 +885,7 @@ }, "c94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "10", - "code" : "0x6000ff6000600060006000600060006014f1", + "code" : "0x6000600060006000600160006000f1506000ff", "nonce" : "0", "storage" : { } @@ -901,7 +901,7 @@ "value" : "10" } }, - "SuicidesAndSendMoneyToItself" : { + "SuicidesAndSendMoneyToItselfEtherDestroyed" : { "env" : { "currentCoinbase" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b", "currentDifficulty" : "45678256", @@ -955,6 +955,128 @@ "value" : "10" } }, + "SuicidesMixingCoinbase" : { + "env" : { + "currentCoinbase" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b", + "currentDifficulty" : "45678256", + "currentGasLimit" : "10000", + "currentNumber" : "0", + "currentTimestamp" : 1, + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "logs" : [ + ], + "out" : "0x", + "post" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "6489", + "code" : "0x", + "nonce" : "1", + "storage" : { + } + }, + "c94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "1010", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "7000", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + }, + "b94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "1000", + "code" : "0x73c94f5374fce5edbc8e2a8697c15331677e6ebf0bff", + "nonce" : "0", + "storage" : { + } + } + }, + "transaction" : { + "data" : "", + "gasLimit" : "1700", + "gasPrice" : "1", + "nonce" : "", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b", + "value" : "10" + } + }, + "SuicidesStopAfterSuicide" : { + "env" : { + "currentCoinbase" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b", + "currentDifficulty" : "45678256", + "currentGasLimit" : "100000", + "currentNumber" : "0", + "currentTimestamp" : 1, + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "logs" : [ + ], + "out" : "0x", + "post" : { + "0000000000000000000000000000000000000000" : { + "balance" : "11120", + "code" : "0x6001ff", + "nonce" : "0", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "6489", + "code" : "0x", + "nonce" : "1", + "storage" : { + } + }, + "b94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "501", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + } + }, + "pre" : { + "0000000000000000000000000000000000000000" : { + "balance" : "1110", + "code" : "0x6001ff", + "nonce" : "0", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "7000", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + }, + "c94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "10000", + "code" : "0x6000ff600060006000600060006107d06000f1", + "nonce" : "0", + "storage" : { + } + } + }, + "transaction" : { + "data" : "", + "gasLimit" : "3700", + "gasPrice" : "1", + "nonce" : "", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "c94f5374fce5edbc8e2a8697c15331677e6ebf0b", + "value" : "10" + } + }, "TransactionCosts555" : { "env" : { "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", diff --git a/VMTests/vmSha3Test.json b/VMTests/vmSha3Test.json index 2004536a1..7a054cf89 100644 --- a/VMTests/vmSha3Test.json +++ b/VMTests/vmSha3Test.json @@ -300,7 +300,7 @@ "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", "value" : "115792089237316195423570985008687907853269984665640564039457584007913129639935" }, - "gas" : "4294442684", + "gas" : "4026006204", "logs" : [ ], "out" : "0x", @@ -352,5 +352,365 @@ } } } + }, + "sha3_memSizeNoQuadraticCost31" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x60016103c020600055", + "data" : "0x", + "gas" : "4294967296", + "gasPrice" : "1", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "115792089237316195423570985008687907853269984665640564039457584007913129639935" + }, + "gas" : "4294966942", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "code" : "0x60016103c020600055", + "nonce" : "0", + "storage" : { + "0x" : "0xbc36789e7a1e281436464229828f817d6612f7b477d66591ff96a9e064bcc98a" + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "code" : "0x60016103c020600055", + "nonce" : "0", + "storage" : { + } + } + } + }, + "sha3_memSizeQuadraticCost32" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x60016103e020600055", + "data" : "0x", + "gas" : "4294967296", + "gasPrice" : "1", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "115792089237316195423570985008687907853269984665640564039457584007913129639935" + }, + "gas" : "4294966940", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "code" : "0x60016103e020600055", + "nonce" : "0", + "storage" : { + "0x" : "0xbc36789e7a1e281436464229828f817d6612f7b477d66591ff96a9e064bcc98a" + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "code" : "0x60016103e020600055", + "nonce" : "0", + "storage" : { + } + } + } + }, + "sha3_memSizeQuadraticCost32_zeroSize" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x600061040020600055", + "data" : "0x", + "gas" : "4294967296", + "gasPrice" : "1", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "115792089237316195423570985008687907853269984665640564039457584007913129639935" + }, + "gas" : "4294966983", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "code" : "0x600061040020600055", + "nonce" : "0", + "storage" : { + "0x" : "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "code" : "0x600061040020600055", + "nonce" : "0", + "storage" : { + } + } + } + }, + "sha3_memSizeQuadraticCost33" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x600161040020600055", + "data" : "0x", + "gas" : "4294967296", + "gasPrice" : "1", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "115792089237316195423570985008687907853269984665640564039457584007913129639935" + }, + "gas" : "4294966939", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "code" : "0x600161040020600055", + "nonce" : "0", + "storage" : { + "0x" : "0xbc36789e7a1e281436464229828f817d6612f7b477d66591ff96a9e064bcc98a" + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "code" : "0x600161040020600055", + "nonce" : "0", + "storage" : { + } + } + } + }, + "sha3_memSizeQuadraticCost63" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x60016107c020600055", + "data" : "0x", + "gas" : "4294967296", + "gasPrice" : "1", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "115792089237316195423570985008687907853269984665640564039457584007913129639935" + }, + "gas" : "4294966907", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "code" : "0x60016107c020600055", + "nonce" : "0", + "storage" : { + "0x" : "0xbc36789e7a1e281436464229828f817d6612f7b477d66591ff96a9e064bcc98a" + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "code" : "0x60016107c020600055", + "nonce" : "0", + "storage" : { + } + } + } + }, + "sha3_memSizeQuadraticCost64" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x60016107e020600055", + "data" : "0x", + "gas" : "4294967296", + "gasPrice" : "1", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "115792089237316195423570985008687907853269984665640564039457584007913129639935" + }, + "gas" : "4294966905", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "code" : "0x60016107e020600055", + "nonce" : "0", + "storage" : { + "0x" : "0xbc36789e7a1e281436464229828f817d6612f7b477d66591ff96a9e064bcc98a" + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "code" : "0x60016107e020600055", + "nonce" : "0", + "storage" : { + } + } + } + }, + "sha3_memSizeQuadraticCost64_2" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x60206107e020600055", + "data" : "0x", + "gas" : "4294967296", + "gasPrice" : "1", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "115792089237316195423570985008687907853269984665640564039457584007913129639935" + }, + "gas" : "4294966905", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "code" : "0x60206107e020600055", + "nonce" : "0", + "storage" : { + "0x" : "0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563" + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "code" : "0x60206107e020600055", + "nonce" : "0", + "storage" : { + } + } + } + }, + "sha3_memSizeQuadraticCost65" : { + "callcreates" : [ + ], + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : "1", + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "caller" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "code" : "0x600161080020600055", + "data" : "0x", + "gas" : "4294967296", + "gasPrice" : "1", + "origin" : "cd1722f3947def4cf144679da39c4c32bdc35681", + "value" : "115792089237316195423570985008687907853269984665640564039457584007913129639935" + }, + "gas" : "4294966904", + "logs" : [ + ], + "out" : "0x", + "post" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "code" : "0x600161080020600055", + "nonce" : "0", + "storage" : { + "0x" : "0xbc36789e7a1e281436464229828f817d6612f7b477d66591ff96a9e064bcc98a" + } + } + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "115792089237316195423570985008687907853269984665640564039457584007913129639935", + "code" : "0x600161080020600055", + "nonce" : "0", + "storage" : { + } + } + } } } \ No newline at end of file