From f853f4a937215a571bc8b2b6a12b0565039de6a1 Mon Sep 17 00:00:00 2001 From: winsvega Date: Sat, 7 Feb 2015 14:23:17 +0300 Subject: Style Changes New exception for values larger than 2**256 Auto format .json files --- TestHelper.cpp | 13 ++- stInitCodeTestFiller.json | 154 ++++++++++++++++----------------- stTransactionTestFiller.json | 154 ++++++++++++++++----------------- transaction.cpp | 2 +- ttTransactionTestFiller.json | 198 +++++++++++++++++++++---------------------- 5 files changed, 260 insertions(+), 261 deletions(-) diff --git a/TestHelper.cpp b/TestHelper.cpp index fc05de85..fbb302f1 100644 --- a/TestHelper.cpp +++ b/TestHelper.cpp @@ -110,9 +110,9 @@ void ImportTest::importState(json_spirit::mObject& _o, State& _state) bigint biValue256 = bigint("115792089237316195423570985008687907853269984665640564039457584007913129639936"); if (bigint(o["balance"].get_str()) >= biValue256) - BOOST_THROW_EXCEPTION(Exception() << errinfo_comment("State 'balance' is equal or greater than 2**256") ); + BOOST_THROW_EXCEPTION(ValueTooLarge() << errinfo_comment("State 'balance' is equal or greater than 2**256") ); if (bigint(o["nonce"].get_str()) >= biValue256) - BOOST_THROW_EXCEPTION(Exception() << errinfo_comment("State 'nonce' is equal or greater than 2**256") ); + BOOST_THROW_EXCEPTION(ValueTooLarge() << errinfo_comment("State 'nonce' is equal or greater than 2**256") ); Address address = Address(i.first); @@ -148,14 +148,13 @@ void ImportTest::importTransaction(json_spirit::mObject& _o) bigint biValue256 = bigint("115792089237316195423570985008687907853269984665640564039457584007913129639936"); if (bigint(_o["nonce"].get_str()) >= biValue256) - BOOST_THROW_EXCEPTION(Exception() << errinfo_comment("Transaction 'nonce' is equal or greater than 2**256") ); + BOOST_THROW_EXCEPTION(ValueTooLarge() << errinfo_comment("Transaction 'nonce' is equal or greater than 2**256") ); if (bigint(_o["gasPrice"].get_str()) >= biValue256) - BOOST_THROW_EXCEPTION(Exception() << errinfo_comment("Transaction 'gasPrice' is equal or greater than 2**256") ); + BOOST_THROW_EXCEPTION(ValueTooLarge() << errinfo_comment("Transaction 'gasPrice' is equal or greater than 2**256") ); if (bigint(_o["gasLimit"].get_str()) >= biValue256) - BOOST_THROW_EXCEPTION(Exception() << errinfo_comment("Transaction 'gasLimit' is equal or greater than 2**256") ); + BOOST_THROW_EXCEPTION(ValueTooLarge() << errinfo_comment("Transaction 'gasLimit' is equal or greater than 2**256") ); if (bigint(_o["value"].get_str()) >= biValue256) - BOOST_THROW_EXCEPTION(Exception() << errinfo_comment("Transaction 'value' is equal or greater than 2**256") ); - + BOOST_THROW_EXCEPTION(ValueTooLarge() << errinfo_comment("Transaction 'value' is equal or greater than 2**256") ); m_transaction = _o["to"].get_str().empty() ? Transaction(toInt(_o["value"]), toInt(_o["gasPrice"]), toInt(_o["gasLimit"]), importData(_o), toInt(_o["nonce"]), Secret(_o["secretKey"].get_str())) : diff --git a/stInitCodeTestFiller.json b/stInitCodeTestFiller.json index 0996bd6a..134d7519 100644 --- a/stInitCodeTestFiller.json +++ b/stInitCodeTestFiller.json @@ -19,7 +19,7 @@ } }, "transaction" : - { + { "data" : "0x600a80600c6000396000f200600160008035811a8100", "gasLimit" : "599", "gasPrice" : "1", @@ -51,7 +51,7 @@ } }, "transaction" : - { + { "data" : "0x600a80600c6000396000f200600160008035811a8100", "gasLimit" : "599", "gasPrice" : "1", @@ -62,7 +62,7 @@ } }, - "OutOfGasContractCreation" : { + "OutOfGasContractCreation" : { "env" : { "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", "currentDifficulty" : "45678256", @@ -82,7 +82,7 @@ } }, "transaction" : - { + { "data" : "0x600a80600c6000396000f200600160008035811a8100", "gasLimit" : "590", "gasPrice" : "3", @@ -92,7 +92,7 @@ "value" : "1" } }, - "StackUnderFlowContractCreation" : { + "StackUnderFlowContractCreation" : { "env" : { "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", "currentDifficulty" : "45678256", @@ -112,7 +112,7 @@ } }, "transaction" : - { + { "data" : "0x6000f1", "gasLimit" : "1000", "gasPrice" : "1", @@ -123,7 +123,7 @@ } }, - "TransactionSuicideInitCode" : { + "TransactionSuicideInitCode" : { "env" : { "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", "currentDifficulty" : "45678256", @@ -143,7 +143,7 @@ } }, "transaction" : - { + { "data" : "0x600a80600c6000396000fff2ffff600160008035811a81", "gasLimit" : "1000", "gasPrice" : "1", @@ -154,7 +154,7 @@ } }, - "TransactionStopInitCode" : { + "TransactionStopInitCode" : { "env" : { "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", "currentDifficulty" : "45678256", @@ -174,7 +174,7 @@ } }, "transaction" : - { + { "data" : "0x600a80600c600039600000f20000600160008035811a81", "gasLimit" : "1000", "gasPrice" : "1", @@ -185,7 +185,7 @@ } }, - "TransactionCreateSuicideContract" : { + "TransactionCreateSuicideContract" : { "env" : { "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", "currentDifficulty" : "45678256", @@ -205,7 +205,7 @@ } }, "transaction" : - { + { "data" : "0x600a80600c6000396000f200ff600160008035811a81", "gasLimit" : "1000", "gasPrice" : "1", @@ -216,7 +216,7 @@ } }, - "CallTheContractToCreateEmptyContract" : { + "CallTheContractToCreateEmptyContract" : { "env" : { "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", "currentDifficulty" : "45678256", @@ -227,12 +227,12 @@ }, "pre" : { - "095e7baea6a6c7c4c2dfeb977efac326af552d87": { - "balance": "0", - "nonce": "0", - "code": "{(CREATE 0 0 32)}", - "storage": {} - }, + "095e7baea6a6c7c4c2dfeb977efac326af552d87": { + "balance": "0", + "nonce": "0", + "code": "{(CREATE 0 0 32)}", + "storage": {} + }, "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "100000", @@ -243,7 +243,7 @@ } }, "transaction" : - { + { "data" : "0x00", "gasLimit" : "10000", "gasPrice" : "1", @@ -254,7 +254,7 @@ } }, - "CallRecursiveContract" : { + "CallRecursiveContract" : { "env" : { "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", "currentDifficulty" : "45678256", @@ -265,12 +265,12 @@ }, "pre" : { - "095e7baea6a6c7c4c2dfeb977efac326af552d87": { - "balance": "0", - "nonce": "0", - "code": "{[[ 2 ]](ADDRESS)(CODECOPY 0 0 32)(CREATE 0 0 32)}", - "storage": {} - }, + "095e7baea6a6c7c4c2dfeb977efac326af552d87": { + "balance": "0", + "nonce": "0", + "code": "{[[ 2 ]](ADDRESS)(CODECOPY 0 0 32)(CREATE 0 0 32)}", + "storage": {} + }, "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "100000", @@ -281,7 +281,7 @@ } }, "transaction" : - { + { "data" : "0x00", "gasLimit" : "10000", "gasPrice" : "1", @@ -292,7 +292,7 @@ } }, - "CallContractToCreateContractWhichWouldCreateContractInInitCode" : { + "CallContractToCreateContractWhichWouldCreateContractInInitCode" : { "env" : { "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", "currentDifficulty" : "45678256", @@ -303,13 +303,13 @@ }, "pre" : { - "095e7baea6a6c7c4c2dfeb977efac326af552d87": { - "balance": "1", - "nonce": "0", - "//": "{[[0]] 12 (CREATE 0 64 32)}", - "code": "{(MSTORE 0 0x600c600055602060406000f0)(CREATE 0 20 12)}", - "storage": {} - }, + "095e7baea6a6c7c4c2dfeb977efac326af552d87": { + "balance": "1", + "nonce": "0", + "//": "{[[0]] 12 (CREATE 0 64 32)}", + "code": "{(MSTORE 0 0x600c600055602060406000f0)(CREATE 0 20 12)}", + "storage": {} + }, "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "100000000", @@ -320,7 +320,7 @@ } }, "transaction" : - { + { "data" : "0x00", "gasLimit" : "20000000", "gasPrice" : "1", @@ -331,7 +331,7 @@ } }, - "CallContractToCreateContractWhichWouldCreateContractIfCalled" : { + "CallContractToCreateContractWhichWouldCreateContractIfCalled" : { "env" : { "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", "currentDifficulty" : "45678256", @@ -342,14 +342,14 @@ }, "pre" : { - "095e7baea6a6c7c4c2dfeb977efac326af552d87": { - "balance": "1000", - "nonce": "0", - "//": "(CREATE 0 64 32)", - "//": "{[[0]] 12 (MSTORE 32 0x602060406000f0)(RETURN 57 7)}", - "code": "{(MSTORE 0 0x600c60005566602060406000f060205260076039f3)[[0]](CREATE 1 11 21)(CALL 500 (SLOAD 0) 1 0 0 0 0)}", - "storage": {} - }, + "095e7baea6a6c7c4c2dfeb977efac326af552d87": { + "balance": "1000", + "nonce": "0", + "//": "(CREATE 0 64 32)", + "//": "{[[0]] 12 (MSTORE 32 0x602060406000f0)(RETURN 57 7)}", + "code": "{(MSTORE 0 0x600c60005566602060406000f060205260076039f3)[[0]](CREATE 1 11 21)(CALL 500 (SLOAD 0) 1 0 0 0 0)}", + "storage": {} + }, "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "100000000", @@ -360,7 +360,7 @@ } }, "transaction" : - { + { "data" : "0x00", "gasLimit" : "20000000", "gasPrice" : "1", @@ -371,7 +371,7 @@ } }, - "CallContractToCreateContractOOG" : { + "CallContractToCreateContractOOG" : { "env" : { "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", "currentDifficulty" : "45678256", @@ -382,14 +382,14 @@ }, "pre" : { - "095e7baea6a6c7c4c2dfeb977efac326af552d87": { - "balance": "0", - "nonce": "0", - "//": "(CREATE 0 64 32)", - "//": "{[[0]] 12 (MSTORE 32 0x602060406000f0)(RETURN 57 7)}", - "code": "{(MSTORE 0 0x600c60005566602060406000f060205260076039f3)[[0]](CREATE 1 11 21)(CALL 0 (SLOAD 0) 0 0 0 0 0)}", - "storage": {} - }, + "095e7baea6a6c7c4c2dfeb977efac326af552d87": { + "balance": "0", + "nonce": "0", + "//": "(CREATE 0 64 32)", + "//": "{[[0]] 12 (MSTORE 32 0x602060406000f0)(RETURN 57 7)}", + "code": "{(MSTORE 0 0x600c60005566602060406000f060205260076039f3)[[0]](CREATE 1 11 21)(CALL 0 (SLOAD 0) 0 0 0 0 0)}", + "storage": {} + }, "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "100000000", @@ -400,7 +400,7 @@ } }, "transaction" : - { + { "data" : "0x00", "gasLimit" : "20000000", "gasPrice" : "1", @@ -411,7 +411,7 @@ } }, - "CallContractToCreateContractAndCallItOOG" : { + "CallContractToCreateContractAndCallItOOG" : { "env" : { "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", "currentDifficulty" : "45678256", @@ -422,14 +422,14 @@ }, "pre" : { - "095e7baea6a6c7c4c2dfeb977efac326af552d87": { - "balance": "1000", - "nonce": "0", - "//": "(CREATE 0 64 32)", - "//": "{[[0]] 12 (MSTORE 32 0x602060406000f0)(RETURN 57 7)}", - "code": "{(MSTORE 0 0x600c60005566602060406000f060205260076039f3)[[0]](CREATE 1 11 21)(CALL 0 (SLOAD 0) 1 0 0 0 0)}", - "storage": {} - }, + "095e7baea6a6c7c4c2dfeb977efac326af552d87": { + "balance": "1000", + "nonce": "0", + "//": "(CREATE 0 64 32)", + "//": "{[[0]] 12 (MSTORE 32 0x602060406000f0)(RETURN 57 7)}", + "code": "{(MSTORE 0 0x600c60005566602060406000f060205260076039f3)[[0]](CREATE 1 11 21)(CALL 0 (SLOAD 0) 1 0 0 0 0)}", + "storage": {} + }, "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "100000000", @@ -440,7 +440,7 @@ } }, "transaction" : - { + { "data" : "0x00", "gasLimit" : "20000000", "gasPrice" : "1", @@ -451,7 +451,7 @@ } }, - "CallContractToCreateContractNoCash" : { + "CallContractToCreateContractNoCash" : { "env" : { "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", "currentDifficulty" : "45678256", @@ -462,14 +462,14 @@ }, "pre" : { - "095e7baea6a6c7c4c2dfeb977efac326af552d87": { - "balance": "1000", - "nonce": "0", - "//": "(CREATE 0 64 32)", - "//": "{[[0]] 12 (MSTORE 32 0x602060406000f0)(RETURN 57 7)}", - "code": "{(MSTORE 0 0x600c60005566602060406000f060205260076039f3)[[0]](CREATE 1001 11 21)}", - "storage": {} - }, + "095e7baea6a6c7c4c2dfeb977efac326af552d87": { + "balance": "1000", + "nonce": "0", + "//": "(CREATE 0 64 32)", + "//": "{[[0]] 12 (MSTORE 32 0x602060406000f0)(RETURN 57 7)}", + "code": "{(MSTORE 0 0x600c60005566602060406000f060205260076039f3)[[0]](CREATE 1001 11 21)}", + "storage": {} + }, "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "100000000", @@ -480,7 +480,7 @@ } }, "transaction" : - { + { "data" : "0x00", "gasLimit" : "20000000", "gasPrice" : "1", diff --git a/stTransactionTestFiller.json b/stTransactionTestFiller.json index 878aed0d..cf132b0d 100644 --- a/stTransactionTestFiller.json +++ b/stTransactionTestFiller.json @@ -19,7 +19,7 @@ } }, "transaction" : - { + { "data" : "", "gasLimit" : "", "gasPrice" : "", @@ -50,7 +50,7 @@ } }, "transaction" : - { + { "data" : "", "gasLimit" : "500", "gasPrice" : "1", @@ -82,7 +82,7 @@ } }, "transaction" : - { + { "data" : "", "gasLimit" : "5000", "gasPrice" : "1", @@ -114,7 +114,7 @@ } }, "transaction" : - { + { "data" : "", "gasLimit" : "5000", "gasPrice" : "1", @@ -146,7 +146,7 @@ } }, "transaction" : - { + { "data" : "", "gasLimit" : "600", "gasPrice" : "1", @@ -178,7 +178,7 @@ } }, "transaction" : - { + { "data" : "", "gasLimit" : "600", "gasPrice" : "1", @@ -213,22 +213,22 @@ "code" : "{(SSTORE 0 0)(SSTORE 1 0)(SSTORE 2 0)(SSTORE 3 0)(SSTORE 4 0)(SSTORE 5 0)(SSTORE 6 0)(SSTORE 7 0)(SSTORE 8 0)(SSTORE 9 0)}", "nonce" : "0", "storage" : { - "0x" : "0x0c", + "0x" : "0x0c", "0x01" : "0x0c", - "0x02" : "0x0c", - "0x03" : "0x0c", - "0x04" : "0x0c", - "0x05" : "0x0c", - "0x06" : "0x0c", - "0x07" : "0x0c", - "0x08" : "0x0c", - "0x09" : "0x0c" - } + "0x02" : "0x0c", + "0x03" : "0x0c", + "0x04" : "0x0c", + "0x05" : "0x0c", + "0x06" : "0x0c", + "0x07" : "0x0c", + "0x08" : "0x0c", + "0x09" : "0x0c" + } } }, "transaction" : - { + { "data" : "", "gasLimit" : "600", "gasPrice" : "1", @@ -263,22 +263,22 @@ "code" : "{(SSTORE 0 0)(SSTORE 1 0)(SSTORE 2 0)(SSTORE 3 0)(SSTORE 4 0)(SSTORE 5 0)(SSTORE 6 0)(SSTORE 7 0)(SSTORE 8 0)(SSTORE 9 12)}", "nonce" : "0", "storage" : { - "0x" : "0x0c", + "0x" : "0x0c", "0x01" : "0x0c", - "0x02" : "0x0c", - "0x03" : "0x0c", - "0x04" : "0x0c", - "0x05" : "0x0c", - "0x06" : "0x0c", - "0x07" : "0x0c", - "0x08" : "0x0c", - "0x09" : "0x0c" - } + "0x02" : "0x0c", + "0x03" : "0x0c", + "0x04" : "0x0c", + "0x05" : "0x0c", + "0x06" : "0x0c", + "0x07" : "0x0c", + "0x08" : "0x0c", + "0x09" : "0x0c" + } } }, "transaction" : - { + { "data" : "", "gasLimit" : "600", "gasPrice" : "1", @@ -308,9 +308,9 @@ } }, - "c94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "c94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "10", - "//" : "gas = 19 going OOG, gas = 20 fine", + "//" : "gas = 19 going OOG, gas = 20 fine", "code" : "{ (CALL 19 0 1 0 0 0 0) }", "nonce" : "0", "storage" : { @@ -322,23 +322,23 @@ "code" : "{(SSTORE 0 0)(SSTORE 1 0)(SSTORE 2 0)(SSTORE 3 0)(SSTORE 4 0)(SSTORE 5 0)(SSTORE 6 0)(SSTORE 7 0)(SSTORE 8 0)(SSTORE 9 0)}", "nonce" : "0", "storage" : { - "0x" : "0x0c", + "0x" : "0x0c", "0x01" : "0x0c", - "0x02" : "0x0c", - "0x03" : "0x0c", - "0x04" : "0x0c", - "0x05" : "0x0c", - "0x06" : "0x0c", - "0x07" : "0x0c", - "0x08" : "0x0c", - "0x09" : "0x0c" - } + "0x02" : "0x0c", + "0x03" : "0x0c", + "0x04" : "0x0c", + "0x05" : "0x0c", + "0x06" : "0x0c", + "0x07" : "0x0c", + "0x08" : "0x0c", + "0x09" : "0x0c" + } } }, "transaction" : - { + { "data" : "", "gasLimit" : "700", "gasPrice" : "1", @@ -368,7 +368,7 @@ } }, - "c94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "c94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "10", "//" : "gas = 19 going OOG, gas = 20 fine", "code" : "{(SSTORE 0 0)(SSTORE 1 0)(SSTORE 2 0)(SSTORE 3 0) (CALL 19 0 1 0 0 0 0) }", @@ -379,7 +379,7 @@ "0x02" : "0x0c", "0x03" : "0x0c", "0x04" : "0x0c" - } + } }, "0000000000000000000000000000000000000000" : { @@ -387,23 +387,23 @@ "code" : "{(SSTORE 0 0)(SSTORE 1 0)(SSTORE 2 0)(SSTORE 3 0)(SSTORE 4 0)(SSTORE 5 0)(SSTORE 6 0)(SSTORE 7 0)(SSTORE 8 0)(SSTORE 9 0)}", "nonce" : "0", "storage" : { - "0x" : "0x0c", + "0x" : "0x0c", "0x01" : "0x0c", - "0x02" : "0x0c", - "0x03" : "0x0c", - "0x04" : "0x0c", - "0x05" : "0x0c", - "0x06" : "0x0c", - "0x07" : "0x0c", - "0x08" : "0x0c", - "0x09" : "0x0c" - } + "0x02" : "0x0c", + "0x03" : "0x0c", + "0x04" : "0x0c", + "0x05" : "0x0c", + "0x06" : "0x0c", + "0x07" : "0x0c", + "0x08" : "0x0c", + "0x09" : "0x0c" + } } }, "transaction" : - { + { "data" : "", "gasLimit" : "700", "gasPrice" : "1", @@ -414,7 +414,7 @@ } }, - "TransactionNonceCheck" : { + "TransactionNonceCheck" : { "env" : { "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", "currentDifficulty" : "45678256", @@ -434,7 +434,7 @@ } }, "transaction" : - { + { "data" : "", "gasLimit" : "1000", "gasPrice" : "1", @@ -465,7 +465,7 @@ } }, "transaction" : - { + { "data" : "", "gasLimit" : "1000", "gasPrice" : "1", @@ -496,7 +496,7 @@ } }, "transaction" : - { + { "data" : "0x00000000000000000000112233445566778f32", "gasLimit" : "1000", "gasPrice" : "1", @@ -526,7 +526,7 @@ } }, - "b94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "b94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "115792089237316195423570985008687907853269984665640564039457584007913129639935", "code" : "", "nonce" : "0", @@ -535,7 +535,7 @@ } }, "transaction" : - { + { "data" : "", "gasLimit" : "1000", "gasPrice" : "1", @@ -561,13 +561,13 @@ "balance" : "100000", "code" : "", "nonce" : "115792089237316195423570985008687907853269984665640564039457584007913129639935", - "nonce" : "10000000", + "nonce" : "10000000", "storage" : { } } }, "transaction" : - { + { "data" : "", "gasLimit" : "1000", "gasPrice" : "1", @@ -579,7 +579,7 @@ } }, - "UserTransactionZeroCost" : { + "UserTransactionZeroCost" : { "env" : { "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", "currentDifficulty" : "45678256", @@ -599,7 +599,7 @@ } }, "transaction" : - { + { "data" : "", "gasLimit" : "5100", "gasPrice" : "0", @@ -630,7 +630,7 @@ } }, "transaction" : - { + { "data" : "", "gasLimit" : "12", "gasPrice" : "0", @@ -661,7 +661,7 @@ } }, "transaction" : - { + { "data" : "0x3240349548983454", "gasLimit" : "500", "gasPrice" : "0", @@ -676,7 +676,7 @@ "env" : { "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", "currentDifficulty" : "45678256", - "currentGasLimit" : "(2**256)-1", + "currentGasLimit" : "(2**256)-1", "currentGasLimit" : "115792089237316195423570985008687907853269984665640564039457584007913129639935", "currentNumber" : "0", "currentTimestamp" : 1, @@ -693,9 +693,9 @@ } }, "transaction" : - { + { "data" : "0x3240349548983454", - "gasLimit" : "2**200", + "gasLimit" : "2**200", "gasLimit" : "1606938044258990275541962092341162602522202993782792835301376", "gasPrice" : "2**56-1", "gasPrice" : "72057594037927935", @@ -710,7 +710,7 @@ "env" : { "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", "currentDifficulty" : "45678256", - "currentGasLimit" : "(2**256)-1", + "currentGasLimit" : "(2**256)-1", "currentGasLimit" : "115792089237316195423570985008687907853269984665640564039457584007913129639935", "currentNumber" : "0", "currentTimestamp" : 1, @@ -727,9 +727,9 @@ } }, "transaction" : - { + { "data" : "0x3240349548983454", - "gasLimit" : "2**200", + "gasLimit" : "2**200", "gasLimit" : "1606938044258990275541962092341162602522202993782792835301376", "gasPrice" : "(2**56)*10", "gasPrice" : "720575940379279360", @@ -744,7 +744,7 @@ "env" : { "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", "currentDifficulty" : "45678256", - "currentGasLimit" : "(2**256)-1", + "currentGasLimit" : "(2**256)-1", "currentGasLimit" : "115792089237316195423570985008687907853269984665640564039457584007913129639935", "currentNumber" : "0", "currentTimestamp" : 1, @@ -761,9 +761,9 @@ } }, "transaction" : - { + { "data" : "", - "gasLimit" : "(2**256+400)/20", + "gasLimit" : "(2**256+400)/20", "gasLimit" : "5789604461865809771178549250434395392663499233282028201972879200395656482016", "gasPrice" : "20", "nonce" : "0", @@ -793,13 +793,13 @@ } }, "transaction" : - { + { "data" : "", "gasLimit" : "1000", "gasPrice" : "1", "nonce" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "to" : "0xffffffffffffffffffffffffffffffffffffffff", + "to" : "0xffffffffffffffffffffffffffffffffffffffff", "value" : "100" } } diff --git a/transaction.cpp b/transaction.cpp index ddd7c3dc..b51494d8 100644 --- a/transaction.cpp +++ b/transaction.cpp @@ -100,7 +100,7 @@ void doTransactionTests(json_spirit::mValue& _v, bool _fillin) BOOST_REQUIRE(o.count("transaction") > 0); mObject tObj = o["transaction"].get_obj(); - Transaction txFromFields(createRLPStreamFromTransactionFields(tObj).out(),CheckSignature::Sender); + Transaction txFromFields(createRLPStreamFromTransactionFields(tObj).out(), CheckSignature::Sender); //Check the fields restored from RLP to original fields BOOST_CHECK_MESSAGE(txFromFields.data() == txFromRlp.data(), "Data in given RLP not matching the Transaction data!"); diff --git a/ttTransactionTestFiller.json b/ttTransactionTestFiller.json index 26f32271..49831261 100644 --- a/ttTransactionTestFiller.json +++ b/ttTransactionTestFiller.json @@ -1,303 +1,303 @@ { "RightVRSTest" : { "transaction" : - { + { "data" : "0x5544", "gasLimit" : "2000", "gasPrice" : "1", "nonce" : "3", "to" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b", "value" : "10", - "v" : "28", - "r" : "0x98ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4a", - "s" : "0x8887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3" + "v" : "28", + "r" : "0x98ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4a", + "s" : "0x8887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3" } }, "WrongVRSTestVl27" : { "transaction" : - { + { "data" : "", "gasLimit" : "2000", "gasPrice" : "1", "nonce" : "0", "to" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b", "value" : "10", - "v" : "26", - "r" : "0x98ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4a", - "s" : "0x8887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3" + "v" : "26", + "r" : "0x98ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4a", + "s" : "0x8887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3" } }, "WrongVRSTestVge31" : { "transaction" : - { + { "data" : "", "gasLimit" : "2000", "gasPrice" : "1", "nonce" : "0", "to" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b", "value" : "10", - "v" : "31", - "r" : "0x98ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4a", - "s" : "0x8887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3" + "v" : "31", + "r" : "0x98ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4a", + "s" : "0x8887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3" } }, - "SenderTest" : { - "//" : "sender a94f5374fce5edbc8e2a8697c15331677e6ebf0b", + "SenderTest" : { + "//" : "sender a94f5374fce5edbc8e2a8697c15331677e6ebf0b", "transaction" : - { + { "data" : "", "gasLimit" : "850", "gasPrice" : "1", "nonce" : "0", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "10", - "v" : "27", - "r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353", - "s" : "secretkey 45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", - "s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804" + "v" : "27", + "r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353", + "s" : "secretkey 45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804" } }, - "TransactionWithTooManyRLPElements" : { + "TransactionWithTooManyRLPElements" : { "transaction" : - { + { "data" : "", "gasLimit" : "850", "gasPrice" : "1", "nonce" : "0", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "10", - "v" : "27", - "r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353", - "s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804", - "extrafield" : "128472387293" + "v" : "27", + "r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353", + "s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804", + "extrafield" : "128472387293" } }, - "TransactionWithTooFewRLPElements" : { + "TransactionWithTooFewRLPElements" : { "transaction" : - { + { "data" : "", "gasPrice" : "1", "nonce" : "0", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", - "v" : "27", - "r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353", - "s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804" + "v" : "27", + "r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353", + "s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804" } }, - "TransactionWithHihghValue" : { + "TransactionWithHihghValue" : { "transaction" : - { + { "data" : "", "gasLimit" : "850", "gasPrice" : "1", "nonce" : "0", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "115792089237316195423570985008687907853269984665640564039457584007913129639935", - "v" : "27", - "r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353", - "s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804" + "v" : "27", + "r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353", + "s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804" } }, - "TransactionWithHihghValueOverflow" : { + "TransactionWithHihghValueOverflow" : { "transaction" : - { + { "data" : "", "gasLimit" : "850", "gasPrice" : "1", "nonce" : "0", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "115792089237316195423570985008687907853269984665640564039457584007913129639936", - "v" : "27", - "r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353", - "s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804" + "v" : "27", + "r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353", + "s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804" } }, "TransactionWithSvalueOverflow" : { "transaction" : - { + { "data" : "", "gasLimit" : "850", "gasPrice" : "1", "nonce" : "0", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "11", - "v" : "27", - "r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353", - "s" : "0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f" + "v" : "27", + "r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353", + "s" : "0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f" } }, - "TransactionWithRvalueOverflow" : { + "TransactionWithRvalueOverflow" : { "transaction" : - { + { "data" : "", "gasLimit" : "850", "gasPrice" : "1", "nonce" : "0", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "11", - "v" : "27", - "r" : "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141", - "s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804" + "v" : "27", + "r" : "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141", + "s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804" } }, - "TransactionWithNonceOverflow" : { + "TransactionWithNonceOverflow" : { "transaction" : - { + { "data" : "", "gasLimit" : "850", "gasPrice" : "1", "nonce" : "115792089237316195423570985008687907853269984665640564039457584007913129639936", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "11", - "v" : "27", - "r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353", - "s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804" + "v" : "27", + "r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353", + "s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804" } }, -"TransactionWithGasPriceOverflow" : { + "TransactionWithGasPriceOverflow" : { "transaction" : - { + { "data" : "", "gasLimit" : "850", "gasPrice" : "115792089237316195423570985008687907853269984665640564039457584007913129639936", "nonce" : "0", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "11", - "v" : "27", - "r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353", - "s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804" + "v" : "27", + "r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353", + "s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804" } }, - "TransactionWithGasLimitOverflow" : { + "TransactionWithGasLimitOverflow" : { "transaction" : - { + { "data" : "", "gasLimit" : "115792089237316195423570985008687907853269984665640564039457584007913129639936", "gasPrice" : "123", "nonce" : "0", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "11", - "v" : "27", - "r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353", - "s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804" + "v" : "27", + "r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353", + "s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804" } }, "RLPElementsWithZeros" : { "transaction" : - { + { "data" : "0x0000011222333", "gasLimit" : "1000", "gasPrice" : "00123", "nonce" : "0054", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "00000011", - "v" : "27", - "r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353", - "s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804" + "v" : "27", + "r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353", + "s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804" } }, - "RLPWrongHexElements" : { + "RLPWrongHexElements" : { "transaction" : - { + { "data" : "0x0000000012", "gasLimit" : "1000", "gasPrice" : "123", "nonce" : "54", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "11", - "v" : "27", - "r" : "0x0048b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353", - "s" : "0x00efffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804" + "v" : "27", + "r" : "0x0048b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353", + "s" : "0x00efffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804" } }, - "EmptyTransaction" : { + "EmptyTransaction" : { "transaction" : - { - "data" : "", + { + "data" : "", "gasLimit" : "", "gasPrice" : "", "nonce" : "", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "", - "v" : "27", - "r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353", - "s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804" + "v" : "27", + "r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353", + "s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804" } }, "WrongAddress" : { "transaction" : - { - "data" : "", + { + "data" : "", "gasLimit" : "", "gasPrice" : "", "nonce" : "", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d8v", "value" : "", - "v" : "27", - "r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353", - "s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804" + "v" : "27", + "r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353", + "s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804" } }, - "AddressMoreThan20" : { + "AddressMoreThan20" : { "transaction" : - { + { "data" : "", "gasLimit" : "2000", "gasPrice" : "1", "nonce" : "0", "to" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b1c", "value" : "10", - "v" : "28", - "r" : "0x98ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4a", - "s" : "0x8887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3" + "v" : "28", + "r" : "0x98ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4a", + "s" : "0x8887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3" } }, - "AddressLessThan20" : { + "AddressLessThan20" : { "transaction" : - { + { "data" : "", "gasLimit" : "2000", "gasPrice" : "1", "nonce" : "0", "to" : "b9331677e6ebf", "value" : "10", - "v" : "28", - "r" : "0x98ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4a", - "s" : "0x8887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3" + "v" : "28", + "r" : "0x98ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4a", + "s" : "0x8887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3" } }, - "AddressLessThan20Prefixed0" : { + "AddressLessThan20Prefixed0" : { "transaction" : - { + { "data" : "", "gasLimit" : "2000", "gasPrice" : "1", "nonce" : "0", "to" : "0x000000000000000000000000000b9331677e6ebf", "value" : "10", - "v" : "28", - "r" : "0x98ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4a", - "s" : "0x8887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3" + "v" : "28", + "r" : "0x98ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4a", + "s" : "0x8887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3" } } } -- cgit