aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGav Wood <g@ethdev.com>2015-02-13 18:13:55 +0800
committerGav Wood <g@ethdev.com>2015-02-13 18:13:55 +0800
commite10cde47c4c2e4693ae3ec9ab7ce66466b7ac8f5 (patch)
treed610aee27cab96d1193bfc8ade63b902bfd45b36
parent344f262abff1149ae0b0d8e1588b119cd6b3889e (diff)
parentc09d91a2f04b862e70f30ddb32708697e77c6bea (diff)
downloaddexon-solidity-e10cde47c4c2e4693ae3ec9ab7ce66466b7ac8f5.tar.gz
dexon-solidity-e10cde47c4c2e4693ae3ec9ab7ce66466b7ac8f5.tar.zst
dexon-solidity-e10cde47c4c2e4693ae3ec9ab7ce66466b7ac8f5.zip
Merge pull request #1035 from winsvega/develop
New Tests
-rw-r--r--TestHelper.cpp2
-rw-r--r--stSolidityTestFiller.json237
-rw-r--r--stTransactionTestFiller.json152
-rw-r--r--state.cpp5
-rw-r--r--transaction.cpp11
-rw-r--r--ttTransactionTestFiller.json70
6 files changed, 449 insertions, 28 deletions
diff --git a/TestHelper.cpp b/TestHelper.cpp
index 8a00a546..5e747210 100644
--- a/TestHelper.cpp
+++ b/TestHelper.cpp
@@ -247,7 +247,7 @@ byte toByte(json_spirit::mValue const& _v)
bytes importByteArray(std::string const& _str)
{
- return fromHex(_str.substr(0, 2) == "0x" ? _str.substr(2) : _str);
+ return fromHex(_str.substr(0, 2) == "0x" ? _str.substr(2) : _str, ThrowType::Throw);
}
bytes importData(json_spirit::mObject& _o)
diff --git a/stSolidityTestFiller.json b/stSolidityTestFiller.json
new file mode 100644
index 00000000..fc0770c5
--- /dev/null
+++ b/stSolidityTestFiller.json
@@ -0,0 +1,237 @@
+{
+ "SolidityTest" : {
+ "env" : {
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
+ "currentDifficulty" : "45678256",
+ "currentGasLimit" : "1000000000000000000000",
+ "currentNumber" : "120",
+ "currentTimestamp" : 1,
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
+ },
+ "pre" :
+ {
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "10000000000000000",
+ "code" : "",
+ "nonce" : "0",
+ "storage" : {
+ }
+ },
+
+ "d94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "100000",
+ "//" : " ",
+ "//" : "contract TestContract ",
+ "//" : "{ ",
+ "//" : " function testMethod() returns (int res) ",
+ "//" : " { ",
+ "//" : " return 225; ",
+ "//" : " } ",
+ "//" : " ",
+ "//" : " function destroy(address sendFoundsTo) ",
+ "//" : " { ",
+ "//" : " suicide(sendFoundsTo); ",
+ "//" : " } ",
+ "//" : "} ",
+ "//" : " ",
+ "//" : "contract TestSolidityContracts ",
+ "//" : "{ ",
+ "//" : "struct StructTest ",
+ "//" : " { ",
+ "//" : " address addr; ",
+ "//" : " int amount; ",
+ "//" : " string32 str; ",
+ "//" : " mapping (uint => address) funders; ",
+ "//" : " } ",
+ "//" : " ",
+ "//" : " int globalValue; ",
+ "//" : " StructTest globalData; ",
+ "//" : " function runSolidityTests() returns (hash res) ",
+ "//" : " { ",
+ "//" : " //res is a mask of failing tests given the first byte is first test ",
+ "//" : " res = 0x0000000000000000000000000000000000000000000000000000000000000000; ",
+ "//" : " ",
+ "//" : " createContractFromMethod(); ",
+ "//" : " ",
+ "//" : " if (!testKeywords()) ",
+ "//" : " res = hash(int(res) + int(0xf000000000000000000000000000000000000000000000000000000000000000)); ",
+ "//" : " ",
+ "//" : " if (!testContractInteraction()) ",
+ "//" : " res = hash(int(res) + int(0x0f00000000000000000000000000000000000000000000000000000000000000)); ",
+ "//" : " ",
+ "//" : " if (!testContractSuicide()) ",
+ "//" : " res = hash(int(res) + int(0x00f0000000000000000000000000000000000000000000000000000000000000)); ",
+ "//" : " ",
+ "//" : " if (!testBlockAndTransactionProperties()) ",
+ "//" : " res = hash(int(res) + int(0x000f000000000000000000000000000000000000000000000000000000000000)); ",
+ "//" : " ",
+ "//" : " globalValue = 255; ",
+ "//" : " globalData.addr = 0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b; ",
+ "//" : " globalData.amount = 255; ",
+ "//" : " globalData.str = 'global data 32 length string'; ",
+ "//" : " globalData.funders[0] = 0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b; ",
+ "//" : " if (!testStructuresAndVariabless()) ",
+ "//" : " res = hash(int(res) + int(0x0000f00000000000000000000000000000000000000000000000000000000000)); ",
+ "//" : " ",
+ "//" : " //Tested 27.01.2015 ",
+ "//" : " //should run out of gas ",
+ "//" : " //if (!testInfiniteLoop()) ",
+ "//" : " // res = hash(int(res) + int(0x000f000000000000000000000000000000000000000000000000000000000000)); ",
+ "//" : " // ",
+ "//" : " //should run out of gas ",
+ "//" : " //if (!testRecursiveMethods()) ",
+ "//" : " // res = hash(int(res) + int(0x0000000000000000000000000000000000000000000000000000000000000000)); ",
+ "//" : " } ",
+ "//" : " ",
+ "//" : " function testStructuresAndVariabless() returns (bool res) ",
+ "//" : " { ",
+ "//" : " res = true; ",
+ "//" : " if (globalValue != 255) ",
+ "//" : " return false; ",
+ "//" : " ",
+ "//" : " if (globalValue != globalData.amount) ",
+ "//" : " return false; ",
+ "//" : " ",
+ "//" : " if (globalData.addr != 0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b) ",
+ "//" : " return false; ",
+ "//" : " ",
+ "//" : " if (globalData.str != 'global data 32 length string') ",
+ "//" : " return false; ",
+ "//" : " ",
+ "//" : " if (globalData.funders[0] != 0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b) ",
+ "//" : " return false; ",
+ "//" : " } ",
+ "//" : " ",
+ "//" : " function testBlockAndTransactionProperties() returns (bool res) ",
+ "//" : " { ",
+ "//" : " res = true; ",
+ "//" : " if (block.coinbase != 0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba) ",
+ "//" : " return false; ",
+ "//" : " ",
+ "//" : " if (block.difficulty != 45678256) ",
+ "//" : " return false; ",
+ "//" : " ",
+ "//" : " //for some reason does not work 27.01.2015 ",
+ "//" : " //if (block.gaslimit != 1000000000000000000000) ",
+ "//" : " // return false; ",
+ "//" : " ",
+ "//" : " if (block.number != 120) ",
+ "//" : " return false; ",
+ "//" : " ",
+ "//" : " //try to call this ",
+ "//" : " block.blockhash(120); ",
+ "//" : " block.timestamp; ",
+ "//" : " msg.gas; ",
+ "//" : " ",
+ "//" : " if (msg.sender != 0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b) ",
+ "//" : " return false; ",
+ "//" : " ",
+ "//" : " if (msg.value != 100) ",
+ "//" : " return false; ",
+ "//" : " ",
+ "//" : " if (tx.gasprice != 1) ",
+ "//" : " return false; ",
+ "//" : " ",
+ "//" : " if (tx.origin != 0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b) ",
+ "//" : " return false; ",
+ "//" : " ",
+ "//" : " } ",
+ "//" : " ",
+ "//" : " function testInfiniteLoop() returns (bool res) ",
+ "//" : " { ",
+ "//" : " res = false; ",
+ "//" : " while(true){} ",
+ "//" : " return true; ",
+ "//" : " } ",
+ "//" : " ",
+ "//" : " function testRecursiveMethods() returns (bool res) ",
+ "//" : " { ",
+ "//" : " res = false; ",
+ "//" : " testRecursiveMethods2(); ",
+ "//" : " return true; ",
+ "//" : " } ",
+ "//" : " function testRecursiveMethods2() ",
+ "//" : " { ",
+ "//" : " testRecursiveMethods(); ",
+ "//" : "} ",
+ "//" : " ",
+ "//" : " ",
+ "//" : " function testContractSuicide() returns (bool res) ",
+ "//" : " { ",
+ "//" : " TestContract a = new TestContract(); ",
+ "//" : " a.destroy(block.coinbase); ",
+ "//" : " if (a.testMethod() == 225) //we should be able to call a contract ",
+ "//" : " return true; ",
+ "//" : " return false; ",
+ "//" : " } ",
+ "//" : " ",
+ "//" : " function testContractInteraction() returns (bool res) ",
+ "//" : " { ",
+ "//" : " TestContract a = new TestContract(); ",
+ "//" : " if (a.testMethod() == 225) ",
+ "//" : " return true; ",
+ "//" : " return false; ",
+ "//" : " } ",
+ "//" : " ",
+ "//" : " function testKeywords() returns (bool res) ",
+ "//" : " { ",
+ "//" : " //some simple checks for the if statemnt ",
+ "//" : " //if, else, while, for, break, continue, return ",
+ "//" : " int i = 0; ",
+ "//" : " res = false; ",
+ "//" : " ",
+ "//" : " if (i == 0) ",
+ "//" : " { ",
+ "//" : " if( i <= -25) ",
+ "//" : " { ",
+ "//" : " return false; ",
+ "//" : " } ",
+ "//" : " else ",
+ "//" : " { ",
+ "//" : " while(i < 10) ",
+ "//" : " i++; ",
+ "//" : " ",
+ "//" : " if (i == 10) ",
+ "//" : " { ",
+ "//" : " for(var j=10; j>0; j--) ",
+ "//" : " { ",
+ "//" : " i--; ",
+ "//" : " } ",
+ "//" : " } ",
+ "//" : " } ",
+ "//" : " } ",
+ "//" : " ",
+ "//" : " ",
+ "//" : " if (i == 0) ",
+ "//" : " return true; ",
+ "//" : " ",
+ "//" : " return false; ",
+ "//" : " } ",
+ "//" : " ",
+ "//" : " function createContractFromMethod() returns (TestContract a) ",
+ "//" : " { ",
+ "//" : " a = new TestContract(); ",
+ "//" : " } ",
+ "//" : "} ",
+ "code" : "0x60e060020a6000350480630c4c9a8014610078578063296df0df1461008a5780632a9afb831461009c578063380e4396146100ae5780634893d88a146100c05780637ee17e12146100ce578063981a3165146100dc578063a60eedda146100ee578063e97384dc14610100578063ed973fe91461011257005b610080610431565b8060005260206000f35b6100926103f7565b8060005260206000f35b6100a46105d1565b8060005260206000f35b6100b6610220565b8060005260206000f35b6100c8610426565b60006000f35b6100d66102df565b60006000f35b6100e4610411565b8060005260206000f35b6100f6610124565b8060005260206000f35b6101086102f5565b8060005260206000f35b61011a6101be565b8060005260206000f35b60006000605f6106be600039605f60006000f0905080600160a060020a031662f55d9d8060e060020a0260005241600160a060020a0316600452600060006024600060008660155a03f150505080600160a060020a031663b9c3d0a58060e060020a02600052602060006004600060008660155a03f150505060005160e1146101ac576101b5565b600191506101ba565b600091505b5090565b60006000605f6106be600039605f60006000f0905080600160a060020a031663b9c3d0a58060e060020a02600052602060006004600060008660155a03f150505060005160e11461020e57610217565b6001915061021c565b600091505b5090565b60006000600060009150600092508160001461023b576102bf565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe78213156102b5575b600a82121561027a578180600101925050610264565b81600a14610287576102b0565b600a90505b60008160ff1611156102af5781806001900392505080806001900391505061028c565b5b6102be565b600092506102da565b5b816000146102cc576102d5565b600192506102da565b600092505b505090565b6000605f6106be600039605f60006000f0905090565b60006001905041600160a060020a0316732adc25665018aa1fe0e6bc666dac8fc2697ff9ba14156103255761032e565b600090506103f4565b446302b8feb0141561033f57610348565b600090506103f4565b43607814156103565761035f565b600090506103f4565b33600160a060020a031673a94f5374fce5edbc8e2a8697c15331677e6ebf0b141561038957610392565b600090506103f4565b34606414156103a0576103a9565b600090506103f4565b3a600114156103b7576103c0565b600090506103f4565b32600160a060020a031673a94f5374fce5edbc8e2a8697c15331677e6ebf0b14156103ea576103f3565b600090506103f4565b5b90565b6000600090505b60011561040a576103fe565b6001905090565b60006000905061041f610426565b6001905090565b61042e610411565b50565b60006000905061043f6102df565b50610448610220565b1561045257610478565b7ff000000000000000000000000000000000000000000000000000000000000000810190505b6104806101be565b1561048a576104b0565b7f0f00000000000000000000000000000000000000000000000000000000000000810190505b6104b8610124565b156104c2576104e7565b7ef0000000000000000000000000000000000000000000000000000000000000810190505b6104ef6102f5565b156104f95761051e565b7e0f000000000000000000000000000000000000000000000000000000000000810190505b60ff60008190555073a94f5374fce5edbc8e2a8697c15331677e6ebf0b60018190555060ff6002819055507f676c6f62616c2064617461203332206c656e67746820737472696e670000000060038190555073a94f5374fce5edbc8e2a8697c15331677e6ebf0b600460006000526020526040600020819055506105a06105d1565b156105aa576105ce565b7df00000000000000000000000000000000000000000000000000000000000810190505b90565b60006001905060005460ff14156105e7576105f0565b600090506106ba565b60025460005414156106015761060a565b600090506106ba565b600154600160a060020a031673a94f5374fce5edbc8e2a8697c15331677e6ebf0b14156106365761063f565b600090506106ba565b6003547f676c6f62616c2064617461203332206c656e67746820737472696e6700000000141561066e57610677565b600090506106ba565b60046000600052602052604060002054600160a060020a031673a94f5374fce5edbc8e2a8697c15331677e6ebf0b14156106b0576106b9565b600090506106ba565b5b905600605380600c6000396000f30060e060020a600035048062f55d9d14601d578063b9c3d0a514602c57005b60266004356045565b60006000f35b6032603c565b8060005260206000f35b600060e1905090565b80600160a060020a0316ff5056",
+ "nonce" : "0",
+ "storage" : {
+ }
+ }
+ },
+
+ "transaction" :
+ {
+ "//" : "createContractFromMethod()",
+ "data" : "0x7ee17e12",
+ "//" : "runSolidityTests()",
+ "data" : "0x0c4c9a80",
+ "gasLimit" : "465224",
+ "gasPrice" : "1",
+ "nonce" : "0",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "to" : "d94f5374fce5edbc8e2a8697c15331677e6ebf0b",
+ "value" : "100"
+ }
+ }
+}
diff --git a/stTransactionTestFiller.json b/stTransactionTestFiller.json
index e5369f0c..214a0ae7 100644
--- a/stTransactionTestFiller.json
+++ b/stTransactionTestFiller.json
@@ -189,6 +189,53 @@
}
},
+ "InternalCallHittingGasLimit" : {
+ "env" : {
+ "currentCoinbase" : "a94f5374fce5edbc8e2a8697c15331677e6ebf0b",
+ "currentDifficulty" : "45678256",
+ "currentGasLimit" : "1100",
+ "currentNumber" : "0",
+ "currentTimestamp" : 1,
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
+ },
+ "pre" :
+ {
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000",
+ "code" : "",
+ "nonce" : "0",
+ "storage" : {
+ }
+ },
+
+ "b94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "1000000",
+ "code" : "{ (CALL 5000 0xc94f5374fce5edbc8e2a8697c15331677e6ebf0b 1 0 0 0 0) }",
+ "nonce" : "0",
+ "storage" : {
+ }
+ },
+
+ "c94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "0",
+ "code" : "{[[1]]55}",
+ "nonce" : "0",
+ "storage" : {
+ }
+ }
+ },
+ "transaction" :
+ {
+ "data" : "",
+ "gasLimit" : "1100",
+ "gasPrice" : "1",
+ "nonce" : "",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "to" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b",
+ "value" : "10"
+ }
+ },
+
"TransactionFromCoinbaseHittingBlockGasLimit" : {
"env" : {
"currentCoinbase" : "a94f5374fce5edbc8e2a8697c15331677e6ebf0b",
@@ -623,7 +670,7 @@
"balance" : "100000",
"code" : "",
"nonce" : "115792089237316195423570985008687907853269984665640564039457584007913129639935",
- "nonce" : "10000000",
+ "nonce" : "10000",
"storage" : {
}
}
@@ -634,7 +681,7 @@
"gasLimit" : "1000",
"gasPrice" : "1",
"nonce" : "115792089237316195423570985008687907853269984665640564039457584007913129639935",
- "nonce" : "10000000",
+ "nonce" : "10000",
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
"to" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"value" : "100"
@@ -864,5 +911,106 @@
"to" : "0xffffffffffffffffffffffffffffffffffffffff",
"value" : "100"
}
+ },
+
+ "CreateTransactionReverted" : {
+ "env" : {
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
+ "currentDifficulty" : "45678256",
+ "currentGasLimit" : "1000000000000",
+ "currentNumber" : "0",
+ "currentTimestamp" : 1,
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
+ },
+ "pre" :
+ {
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "10000",
+ "code" : "",
+ "nonce" : "0",
+ "storage" : {
+ }
+ }
+ },
+ "transaction" :
+ {
+ "data" : "0x602280600c6000396000f30060e060020a600035048063f8a8fd6d14601457005b601a6020565b60006000f35b56",
+ "gasLimit" : "882",
+ "gasPrice" : "1",
+ "nonce" : "0",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "to" : "",
+ "value" : ""
+ }
+ },
+
+ "CreateTransactionWorking" : {
+ "env" : {
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
+ "currentDifficulty" : "45678256",
+ "currentGasLimit" : "1000000000000",
+ "currentNumber" : "0",
+ "currentTimestamp" : 1,
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
+ },
+ "pre" :
+ {
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "10000",
+ "code" : "",
+ "nonce" : "0",
+ "storage" : {
+ }
+ }
+ },
+ "transaction" :
+ {
+ "data" : "0x602280600c6000396000f30060e060020a600035048063f8a8fd6d14601457005b601a6020565b60006000f35b56",
+ "gasLimit" : "883",
+ "gasPrice" : "1",
+ "nonce" : "0",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "to" : "",
+ "value" : "100"
+ }
+ },
+
+ "CreateMessageReverted" : {
+ "env" : {
+ "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
+ "currentDifficulty" : "45678256",
+ "currentGasLimit" : "1000000000000",
+ "currentNumber" : "0",
+ "currentTimestamp" : 1,
+ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6"
+ },
+ "pre" :
+ {
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "10000",
+ "code" : "",
+ "nonce" : "0",
+ "storage" : {
+ }
+ },
+
+ "b94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "0",
+ "code" : "{(MSTORE 0 0x600c600055) (CREATE 0 27 5)}",
+ "nonce" : "0",
+ "storage" : {
+ }
+ }
+ },
+ "transaction" :
+ {
+ "data" : "",
+ "gasLimit" : "882",
+ "gasPrice" : "1",
+ "nonce" : "0",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "to" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b",
+ "value" : "100"
+ }
}
}
diff --git a/state.cpp b/state.cpp
index fb54a62a..03f01d0f 100644
--- a/state.cpp
+++ b/state.cpp
@@ -159,6 +159,11 @@ BOOST_AUTO_TEST_CASE(stBlockHashTest)
dev::test::executeTests("stBlockHashTest", "/StateTests", dev::test::doStateTests);
}
+BOOST_AUTO_TEST_CASE(stSolidityTest)
+{
+ dev::test::executeTests("stSolidityTest", "/StateTests", dev::test::doStateTests);
+}
+
BOOST_AUTO_TEST_CASE(stCreateTest)
{
for (int i = 1; i < boost::unit_test::framework::master_test_suite().argc; ++i)
diff --git a/transaction.cpp b/transaction.cpp
index b51494d8..9f942953 100644
--- a/transaction.cpp
+++ b/transaction.cpp
@@ -64,7 +64,7 @@ RLPStream createRLPStreamFromTransactionFields(mObject& _tObj)
rlpStream << bigint(_tObj["r"].get_str());
if (_tObj.count("s") > 0)
- rlpStream << bigint(_tObj["s"].get_str());
+ rlpStream << bigint(_tObj["s"].get_str());
if (_tObj.count("extrafield") > 0)
rlpStream << bigint(_tObj["extrafield"].get_str());
@@ -82,18 +82,18 @@ void doTransactionTests(json_spirit::mValue& _v, bool _fillin)
if (_fillin == false)
{
BOOST_REQUIRE(o.count("rlp") > 0);
- bytes rlpReaded = importByteArray(o["rlp"].get_str());
Transaction txFromRlp;
-
try
{
- txFromRlp = Transaction(rlpReaded, CheckSignature::Sender);
+ bytes stream = importByteArray(o["rlp"].get_str());
+ RLP rlp(stream);
+ txFromRlp = Transaction(rlp.data(), CheckSignature::Sender);
if (!txFromRlp.signature().isValid())
BOOST_THROW_EXCEPTION(Exception() << errinfo_comment("transaction from RLP signature is invalid") );
}
catch(...)
{
- BOOST_CHECK_MESSAGE(o.count("transaction") == 0, "A transction object should not be defined because the RLP is invalid!");
+ BOOST_CHECK_MESSAGE(o.count("transaction") == 0, "A transaction object should not be defined because the RLP is invalid!");
return;
}
@@ -115,6 +115,7 @@ void doTransactionTests(json_spirit::mValue& _v, bool _fillin)
Address addressReaded = Address(o["sender"].get_str());
BOOST_CHECK_MESSAGE(txFromFields.sender() == addressReaded || txFromRlp.sender() == addressReaded, "Signature address of sender does not match given sender address!");
+
}
else
{
diff --git a/ttTransactionTestFiller.json b/ttTransactionTestFiller.json
index 49831261..e9ae2718 100644
--- a/ttTransactionTestFiller.json
+++ b/ttTransactionTestFiller.json
@@ -44,6 +44,21 @@
}
},
+ "WrongVRSTestIncorrectSize" : {
+ "transaction" :
+ {
+ "data" : "",
+ "gasLimit" : "2000",
+ "gasPrice" : "1",
+ "nonce" : "0",
+ "to" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b",
+ "value" : "10",
+ "v" : "28",
+ "r" : "0x98ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4a02c3",
+ "s" : "0x8887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a302c3"
+ }
+ },
+
"SenderTest" : {
"//" : "sender a94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"transaction" :
@@ -196,33 +211,18 @@
}
},
- "RLPElementsWithZeros" : {
+ "AddressMoreThan20PrefixedBy0" : {
"transaction" :
{
- "data" : "0x0000011222333",
- "gasLimit" : "1000",
- "gasPrice" : "00123",
- "nonce" : "0054",
- "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
- "value" : "00000011",
- "v" : "27",
- "r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353",
- "s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804"
- }
- },
-
- "RLPWrongHexElements" : {
- "transaction" :
- {
- "data" : "0x0000000012",
+ "data" : "0x12",
"gasLimit" : "1000",
"gasPrice" : "123",
"nonce" : "54",
- "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "to" : "0x0000000000000000095e7baea6a6c7c4c2dfeb977efac326af552d87",
"value" : "11",
"v" : "27",
- "r" : "0x0048b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353",
- "s" : "0x00efffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804"
+ "r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353",
+ "s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804"
}
},
@@ -299,5 +299,35 @@
"r" : "0x98ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4a",
"s" : "0x8887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3"
}
+ },
+
+ "ValuesAsHex" : {
+ "transaction" :
+ {
+ "data" : "",
+ "gasLimit" : "0xadc053",
+ "gasPrice" : "1",
+ "nonce" : "0xffdc5",
+ "to" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b",
+ "value" : "0xfffdc12c",
+ "v" : "28",
+ "r" : "0x98ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4a",
+ "s" : "0x8887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3"
+ }
+ },
+
+ "ValuesAsDec" : {
+ "transaction" :
+ {
+ "data" : "",
+ "gasLimit" : "11386963",
+ "gasPrice" : "1",
+ "nonce" : "1048005",
+ "to" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b",
+ "value" : "4501151495864620",
+ "v" : "28",
+ "r" : "0x98ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4a",
+ "s" : "0x8887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3"
+ }
}
}