diff --git a/test/TestHelper.cpp b/test/TestHelper.cpp index e86b84aad..45fe55b07 100644 --- a/test/TestHelper.cpp +++ b/test/TestHelper.cpp @@ -671,7 +671,6 @@ Options::Options() memory = true; inputLimits = true; bigData = true; - checkState = true; } } } diff --git a/test/bcInvalidHeaderTestFiller.json b/test/bcInvalidHeaderTestFiller.json index 2d23ca039..9c9bdacd5 100644 --- a/test/bcInvalidHeaderTestFiller.json +++ b/test/bcInvalidHeaderTestFiller.json @@ -17,9 +17,14 @@ "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "100" + } + }, "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "10000000000", + "balance" : "100000000000", "nonce" : "0", "code" : "", "storage": {} @@ -44,7 +49,7 @@ "nonce" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", - "value" : "5000000000" + "value" : "5000" } ], "uncleHeaders" : [ @@ -54,7 +59,6 @@ }, "log1_wrongBloom" : { - "genesisBlockHeader" : { "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", @@ -72,10 +76,14 @@ "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, - + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "100" + } + }, "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "10000000000", + "balance" : "100000000000", "nonce" : "0", "code" : "", "storage": {} @@ -100,7 +108,7 @@ "nonce" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", - "value" : "5000000000" + "value" : "5000" } ], "uncleHeaders" : [ @@ -127,9 +135,14 @@ "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "100" + } + }, "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "10000000000", + "balance" : "100000000000", "nonce" : "0", "code" : "", "storage": {} @@ -144,7 +157,7 @@ "blocks" : [ { "blockHeader" : { - "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1" + "coinbase" : "0x9888f1f195afa192cfee860698584c030f4c9db1" }, "transactions" : [ { @@ -154,7 +167,7 @@ "nonce" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", - "value" : "5000000000" + "value" : "5000" } ], "uncleHeaders" : [ @@ -181,9 +194,14 @@ "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "100" + } + }, "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "10000000000", + "balance" : "100000000000", "nonce" : "0", "code" : "", "storage": {} @@ -208,7 +226,7 @@ "nonce" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", - "value" : "5000000000" + "value" : "5000" } ], "uncleHeaders" : [ @@ -217,7 +235,7 @@ ] }, - "DifferentExtraData" : { + "DifferentExtraData1025" : { "genesisBlockHeader" : { "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", @@ -235,9 +253,14 @@ "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "100" + } + }, "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "10000000000", + "balance" : "100000000000", "nonce" : "0", "code" : "", "storage": {} @@ -252,7 +275,7 @@ "blocks" : [ { "blockHeader" : { - "extraData" : "0x42" + "extraData" : "0x0101020304050607080910111213141516171819202122232410000000000000000000200000000000000000003000000000000000000040000000000000000000500000000000000000006000000000000000000070000000000000000000800000000000000000009000000000000000000010000000000000000000100000000000000000002000000000000000000030000000000000000000400000000000000000005000000000000000000060000000000000000000700000000000000000008000000000000000000090000000000000000000100000000000000000001000000000000000000020000000000000000000300000000000000000004000000000000000000050000000000000000000600000000000000000007000000000000000000080000000000000000000900000000000000000001000000000000000000010000000000000000000200000000000000000003000000000000000000040000000000000000000500000000000000000006000000000000000000070000000000000000000800000000000000000009000000000000000000010000000000000000000100000000000000000002000000000000000000030000000000000000000400000000000000000005000000000000000000060000000000000000000700000000000000000008000000000000000000090000000000000000000100000000000000000001000000000000000000020000000000000000000300000000000000000004000000000000000000050000000000000000000600000000000000000007000000000000000000080000000000000000000900000000000000000001000000000000000000010000000000000000000200000000000000000003000000000000000000040000000000000000000500000000000000000006000000000000000000070000000000000000000800000000000000000009000000000000000000010000000000000000000100000000000000000002000000000000000000030000000000000000000400000000000000000005000000000000000000060000000000000000000700000000000000000008000000000000000000090000000000000000000100000000000000000001000000000000000000020000000000000000000300000000000000000004000000000000000000050000000000000000000600000000000000000007000000000000000000080000000000000000000900000000000000000001000000000000000000010000000000000000000200000000000000000003000000000000000000040000000000000000000500000000000000000006000000000000000000070000000000000000000800000000000000000009000000000000000000010000000000000000000" }, "transactions" : [ { @@ -262,7 +285,7 @@ "nonce" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", - "value" : "5000000000" + "value" : "5000" } ], "uncleHeaders" : [ @@ -289,9 +312,14 @@ "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "100" + } + }, "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "10000000000", + "balance" : "100000000000", "nonce" : "0", "code" : "", "storage": {} @@ -316,7 +344,7 @@ "nonce" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", - "value" : "5000000000" + "value" : "5000" } ], "uncleHeaders" : [ @@ -344,9 +372,14 @@ "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "100" + } + }, "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "10000000000", + "balance" : "100000000000", "nonce" : "0", "code" : "", "storage": {} @@ -371,7 +404,7 @@ "nonce" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", - "value" : "5000000000" + "value" : "5000" } ], "uncleHeaders" : [ @@ -398,9 +431,14 @@ "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "100" + } + }, "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "10000000000", + "balance" : "100000000000", "nonce" : "0", "code" : "", "storage": {} @@ -425,7 +463,7 @@ "nonce" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", - "value" : "5000000000" + "value" : "5000" } ], "uncleHeaders" : [ @@ -452,9 +490,14 @@ "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "100" + } + }, "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "10000000000", + "balance" : "100000000000", "nonce" : "0", "code" : "", "storage": {} @@ -479,7 +522,66 @@ "nonce" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", - "value" : "5000000000" + "value" : "5000" + } + ], + "uncleHeaders" : [ + ] + } + ] + }, + + "wrongParentHash2" : { + "genesisBlockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "131072", + "extraData" : "0x42", + "gasLimit" : "3141592", + "gasUsed" : "0", + "mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", + "number" : "0", + "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", + "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", + "timestamp" : "0x54c98c81", + "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "100" + } + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "100000000000", + "nonce" : "0", + "code" : "", + "storage": {} + }, + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "100", + "nonce" : "0", + "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }", + "storage": {} + } + }, + "blocks" : [ + { + "blockHeader" : { + "parentHash" : "0x6151889c8f14ab46e32ee0b1894bc276416385d068a1ade000d0dadef9b08b18" + }, + "transactions" : [ + { + "data" : "", + "gasLimit" : "50000", + "gasPrice" : "10", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "5000" } ], "uncleHeaders" : [ @@ -506,9 +608,14 @@ "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "100" + } + }, "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "10000000000", + "balance" : "100000000000", "nonce" : "0", "code" : "", "storage": {} @@ -533,7 +640,7 @@ "nonce" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", - "value" : "5000000000" + "value" : "5000" } ], "uncleHeaders" : [ @@ -560,9 +667,14 @@ "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "100" + } + }, "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "10000000000", + "balance" : "100000000000", "nonce" : "0", "code" : "", "storage": {} @@ -587,7 +699,7 @@ "nonce" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", - "value" : "5000000000" + "value" : "5000" } ], "uncleHeaders" : [ @@ -614,9 +726,14 @@ "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "100" + } + }, "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "10000000000", + "balance" : "100000000000", "nonce" : "0", "code" : "", "storage": {} @@ -641,7 +758,7 @@ "nonce" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", - "value" : "5000000000" + "value" : "5000" } ], "uncleHeaders" : [ @@ -668,9 +785,14 @@ "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "100" + } + }, "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "10000000000", + "balance" : "100000000000", "nonce" : "0", "code" : "", "storage": {} @@ -695,7 +817,7 @@ "nonce" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", - "value" : "5000000000" + "value" : "5000" } ], "uncleHeaders" : [ @@ -722,9 +844,14 @@ "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "100" + } + }, "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { - "balance" : "10000000000", + "balance" : "100000000000", "nonce" : "0", "code" : "", "storage": {} @@ -749,7 +876,7 @@ "nonce" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", - "value" : "5000000000" + "value" : "5000" } ], "uncleHeaders" : [ diff --git a/test/bcJS_API_TestFiller.json b/test/bcJS_API_TestFiller.json index 468b3b2e8..fe7396e59 100644 --- a/test/bcJS_API_TestFiller.json +++ b/test/bcJS_API_TestFiller.json @@ -17,6 +17,21 @@ "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "70" + }, + "6295ee1b4f6dd65047762f924ecd367c17eabf8f" : { + "storage" : { + "0x" : "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b", + "0x01" : "0x42", + "0x02" : "0x23", + "0x03" : "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b", + "0x04" : "0x01", + "0x05" : "0x55114a49" + } + } + }, "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "10000000000000", diff --git a/test/bcUncleHeaderValiditiyFiller.json b/test/bcUncleHeaderValiditiyFiller.json index 9725a3241..ee36e230d 100644 --- a/test/bcUncleHeaderValiditiyFiller.json +++ b/test/bcUncleHeaderValiditiyFiller.json @@ -17,6 +17,17 @@ "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "30" + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "nonce" : "3" + }, + "acde5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "1312500000000000000" + } + }, "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "10000000000000", @@ -110,6 +121,17 @@ "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "30" + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "nonce" : "3" + }, + "acde5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "1312500000000000000" + } + }, "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "10000000000000", @@ -204,6 +226,17 @@ "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "30" + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "nonce" : "3" + }, + "acde5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "1312500000000000000" + } + }, "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "10000000000000", @@ -298,6 +331,17 @@ "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "30" + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "nonce" : "3" + }, + "acde5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "1312500000000000000" + } + }, "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "10000000000000", @@ -392,6 +436,17 @@ "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "30" + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "nonce" : "3" + }, + "acde5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "1312500000000000000" + } + }, "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "10000000000000", @@ -486,6 +541,17 @@ "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "30" + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "nonce" : "3" + }, + "acde5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "1312500000000000000" + } + }, "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "10000000000000", @@ -580,6 +646,14 @@ "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "30" + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "nonce" : "3" + } + }, "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "10000000000000", @@ -674,6 +748,14 @@ "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "20" + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "nonce" : "2" + } + }, "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "10000000000000", @@ -768,6 +850,14 @@ "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "20" + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "nonce" : "2" + } + }, "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "10000000000000", @@ -862,6 +952,14 @@ "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "20" + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "nonce" : "2" + } + }, "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "10000000000000", diff --git a/test/bcUncleTestFiller.json b/test/bcUncleTestFiller.json index 9c0cedc3b..e67cfeecd 100644 --- a/test/bcUncleTestFiller.json +++ b/test/bcUncleTestFiller.json @@ -17,6 +17,14 @@ "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "20" + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "nonce" : "2" + } + }, "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "10000000000000", @@ -95,6 +103,14 @@ "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "30" + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "nonce" : "3" + } + }, "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "10000000000000", @@ -188,6 +204,14 @@ "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "30" + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "nonce" : "3" + } + }, "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "10000000000000", @@ -281,6 +305,14 @@ "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "20" + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "nonce" : "2" + } + }, "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "10000000000000", @@ -374,6 +406,14 @@ "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "20" + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "nonce" : "2" + } + }, "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "10000000000000", @@ -470,6 +510,14 @@ "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "20" + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "nonce" : "2" + } + }, "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "10000000000000", @@ -566,6 +614,20 @@ "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "30" + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "nonce" : "3" + }, + "bcde5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "1312500000000000000" + }, + "ccde5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "1312500000000000000" + } + }, "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "10000000000000", @@ -677,6 +739,14 @@ "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "20" + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "nonce" : "2" + } + }, "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "10000000000000", @@ -806,6 +876,17 @@ "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "40" + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "nonce" : "4" + }, + "bcde5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "1125000000000000000" + } + }, "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "10000000000000", @@ -914,6 +995,17 @@ "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "50" + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "nonce" : "5" + }, + "bcde5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "937500000000000000" + } + }, "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "10000000000000", @@ -1037,6 +1129,17 @@ "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "60" + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "nonce" : "6" + }, + "bcde5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "750000000000000000" + } + }, "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "10000000000000", @@ -1175,6 +1278,17 @@ "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "70" + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "nonce" : "7" + }, + "bcde5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "562500000000000000" + } + }, "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "10000000000000", @@ -1328,6 +1442,17 @@ "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "80" + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "nonce" : "8" + }, + "bcde5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "375000000000000000" + } + }, "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "10000000000000", @@ -1496,6 +1621,14 @@ "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "80" + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "nonce" : "8" + } + }, "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "10000000000000", diff --git a/test/bcValidBlockTestFiller.json b/test/bcValidBlockTestFiller.json index c0ed86437..3529c61ee 100644 --- a/test/bcValidBlockTestFiller.json +++ b/test/bcValidBlockTestFiller.json @@ -1,5 +1,4 @@ { - "diff1024" : { "genesisBlockHeader" : { "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", @@ -18,6 +17,11 @@ "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "10" + } + }, "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "10000000000", @@ -64,6 +68,14 @@ "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "10" + }, + "8888f1f195afa192cfee860698584c030f4c9db1" : { + "balance" : "1500000000000000000" + } + }, "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "10000000000", @@ -109,6 +121,11 @@ "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "100" + } + }, "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "10000000000", @@ -127,7 +144,7 @@ "nonce" : "0", "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", - "value" : "0" + "value" : "100" } ], "uncleHeaders" : [ @@ -154,6 +171,11 @@ "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "10" + } + }, "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "10000000000", @@ -199,6 +221,11 @@ "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "8000000000" + } + }, "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "10000000000", @@ -253,6 +280,14 @@ "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "5000000000" + }, + "8888f1f195afa192cfee860698584c030f4c9db1" : { + "balance" : "1500000000000210000" + } + }, "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "10000000000", @@ -307,6 +342,11 @@ "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "5000000100" + } + }, "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "10000000000", @@ -358,6 +398,11 @@ "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, + "expect" : { + "8888f1f195afa192cfee860698584c030f4c9db1" : { + "balance" : "1500000000002500000" + } + }, "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "10000000000", @@ -403,6 +448,11 @@ "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "5000000100" + } + }, "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { "balance" : "10000000000", diff --git a/test/blockchain.cpp b/test/blockchain.cpp index 15cda8037..97171e3f2 100644 --- a/test/blockchain.cpp +++ b/test/blockchain.cpp @@ -53,6 +53,7 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) BOOST_REQUIRE(o.count("pre")); ImportTest importer(o["pre"].get_obj()); State state(OverlayDB(), BaseState::Empty, biGenesisBlock.coinbaseAddress); + State stateTemp(OverlayDB(), BaseState::Empty, biGenesisBlock.coinbaseAddress); importer.importState(o["pre"].get_obj(), state); o["pre"] = fillJsonWithState(state); state.commit(); @@ -89,7 +90,7 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) for (auto const& bl: o["blocks"].get_array()) { mObject blObj = bl.get_obj(); - + stateTemp = state; // get txs TransactionQueue txs; ZeroGasPricer gp; @@ -180,7 +181,7 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) } uncleHeaderObj_pre = uncleHeaderObj; - } + } //for blObj["uncleHeaders"].get_array() blObj["uncleHeaders"] = aUncleList; bc.sync(uncleBlockQueue, state.db(), 4); @@ -288,12 +289,23 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) blObj.erase(blObj.find("blockHeader")); blObj.erase(blObj.find("uncleHeaders")); blObj.erase(blObj.find("transactions")); + state = stateTemp; //revert state as if it was before executing this block } blArray.push_back(blObj); + } //for blocks + + if (o.count("expect") > 0) + { + stateOptionsMap expectStateMap; + State stateExpect(OverlayDB(), BaseState::Empty, biGenesisBlock.coinbaseAddress); + importer.importState(o["expect"].get_obj(), stateExpect, expectStateMap); + ImportTest::checkExpectedState(stateExpect, state, expectStateMap, Options::get().checkState ? WhenError::Throw : WhenError::DontThrow); + o.erase(o.find("expect")); } + o["blocks"] = blArray; o["postState"] = fillJsonWithState(state); - } + }//_fillin else { @@ -605,7 +617,6 @@ BlockInfo constructBlock(mObject& _o) catch (Exception const& _e) { cnote << "block population did throw an exception: " << diagnostic_information(_e); - BOOST_ERROR("Failed block population with Exception: " << _e.what()); } catch (std::exception const& _e) { @@ -667,6 +678,11 @@ RLPStream createFullBlockFromHeader(BlockInfo const& _bi, bytes const& _txs, byt BOOST_AUTO_TEST_SUITE(BlockChainTests) +BOOST_AUTO_TEST_CASE(bcForkBlockTest) +{ + dev::test::executeTests("bcForkBlockTest", "/BlockTests", dev::test::doBlockchainTests); +} + BOOST_AUTO_TEST_CASE(bcInvalidRLPTest) { dev::test::executeTests("bcInvalidRLPTest", "/BlockTests", dev::test::doBlockchainTests); diff --git a/test/stTransactionTestFiller.json b/test/stTransactionTestFiller.json index 28e7318fd..70d329d6c 100644 --- a/test/stTransactionTestFiller.json +++ b/test/stTransactionTestFiller.json @@ -79,6 +79,49 @@ } }, + "EmptyTransaction3" : { + "env" : { + "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", + "currentDifficulty" : "45678256", + "currentGasLimit" : "1000000", + "currentNumber" : "0", + "currentTimestamp" : 1, + "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" + }, + "expect" : { + "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba" : { + "balance" : "21000" + }, + "6295ee1b4f6dd65047762f924ecd367c17eabf8f" : { + "code" : "0x" + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "79000", + "nonce" : "1" + } + }, + "pre" : + { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "100000", + "code" : "", + "nonce" : "0", + "storage" : { + } + } + }, + "transaction" : + { + "data" : "", + "gasLimit" : "22000", + "gasPrice" : "1", + "nonce" : "", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "", + "value" : "" + } + }, + "TransactionSendingToEmpty" : { "env" : { "currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", @@ -640,6 +683,7 @@ }, "expect" : { "0000000000000000000000000000000000000000" : { + "balance" : "0", "storage" : { "0x" : "0x0c", "0x01" : "0x0c", @@ -794,6 +838,7 @@ "previousHash" : "5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" }, "expect" : { + "balance" : "0", "0000000000000000000000000000000000000000" : { "storage" : { "0x" : "0x0c", diff --git a/test/transaction.cpp b/test/transaction.cpp index 7aa073f29..b87cc37e9 100644 --- a/test/transaction.cpp +++ b/test/transaction.cpp @@ -36,8 +36,54 @@ void doTransactionTests(json_spirit::mValue& _v, bool _fillin) cerr << i.first << endl; mObject& o = i.second.get_obj(); - if (_fillin == false) + if (_fillin) { + BOOST_REQUIRE(o.count("transaction") > 0); + mObject tObj = o["transaction"].get_obj(); + + //Construct Rlp of the given transaction + RLPStream rlpStream = createRLPStreamFromTransactionFields(tObj); + o["rlp"] = "0x" + toHex(rlpStream.out()); + + try + { + Transaction txFromFields(rlpStream.out(), CheckTransaction::Everything); + if (!txFromFields.signature().isValid()) + BOOST_THROW_EXCEPTION(Exception() << errinfo_comment("transaction from RLP signature is invalid") ); + + o["sender"] = toString(txFromFields.sender()); + } + catch(Exception const& _e) + { + //Transaction is InValid + cnote << "Transaction Exception: " << diagnostic_information(_e); + o.erase(o.find("transaction")); + if (o.count("expect") > 0) + { + bool expectInValid = (o["expect"].get_str() == "invalid"); + if (Options::get().checkState) + BOOST_CHECK_MESSAGE(expectInValid, "Check state: Transaction '" << i.first << "' is expected to be valid!"); + else + BOOST_WARN_MESSAGE(expectInValid, "Check state: Transaction '" << i.first << "' is expected to be valid!"); + + o.erase(o.find("expect")); + } + } + + //Transaction is Valid + if (o.count("expect") > 0) + { + bool expectValid = (o["expect"].get_str() == "valid"); + if (Options::get().checkState) + BOOST_CHECK_MESSAGE(expectValid, "Check state: Transaction '" << i.first << "' is expected to be invalid!"); + else + BOOST_WARN_MESSAGE(expectValid, "Check state: Transaction '" << i.first << "' is expected to be invalid!"); + + o.erase(o.find("expect")); + } + } + else + { BOOST_REQUIRE(o.count("rlp") > 0); Transaction txFromRlp; try @@ -80,29 +126,6 @@ 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 - { - BOOST_REQUIRE(o.count("transaction") > 0); - mObject tObj = o["transaction"].get_obj(); - - //Construct Rlp of the given transaction - RLPStream rlpStream = createRLPStreamFromTransactionFields(tObj); - o["rlp"] = "0x" + toHex(rlpStream.out()); - - try - { - Transaction txFromFields(rlpStream.out(), CheckTransaction::Everything); - if (!txFromFields.signature().isValid()) - BOOST_THROW_EXCEPTION(Exception() << errinfo_comment("transaction from RLP signature is invalid") ); - - o["sender"] = toString(txFromFields.sender()); - } - catch(Exception const& _e) - { - cnote << "Transaction Exception: " << diagnostic_information(_e); - o.erase(o.find("transaction")); - } - } }//for }//doTransactionTests diff --git a/test/ttTransactionTestFiller.json b/test/ttTransactionTestFiller.json index 1d4f5bcdd..1dcc0f94e 100644 --- a/test/ttTransactionTestFiller.json +++ b/test/ttTransactionTestFiller.json @@ -1,9 +1,26 @@ { "RightVRSTest" : { + "expect" : "valid", "transaction" : { - "data" : "0x5544", - "gasLimit" : "2000", + "data" : "0x", + "gasLimit" : "21000", + "gasPrice" : "1", + "nonce" : "3", + "to" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b", + "value" : "10", + "v" : "28", + "r" : "0x98ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4a", + "s" : "0x8887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3" + } + }, + + "NotEnoughGasLimit" : { + "expect" : "invalid", + "transaction" : + { + "data" : "0x", + "gasLimit" : "20000", "gasPrice" : "1", "nonce" : "3", "to" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b", @@ -15,10 +32,11 @@ }, "V_overflow32bit" : { + "expect" : "invalid", "transaction" : { "data" : "0x5544", - "gasLimit" : "2000", + "gasLimit" : "21000", "gasPrice" : "1", "nonce" : "3", "to" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b", @@ -30,10 +48,11 @@ }, "V_overflow32bitSigned" : { + "expect" : "invalid", "transaction" : { "data" : "0x5544", - "gasLimit" : "2000", + "gasLimit" : "21000", "gasPrice" : "1", "nonce" : "3", "to" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b", @@ -45,10 +64,11 @@ }, "V_overflow64bit" : { + "expect" : "invalid", "transaction" : { "data" : "0x5544", - "gasLimit" : "2000", + "gasLimit" : "21000", "gasPrice" : "1", "nonce" : "3", "to" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b", @@ -60,10 +80,11 @@ }, "V_overflow64bitSigned" : { + "expect" : "invalid", "transaction" : { "data" : "0x5544", - "gasLimit" : "2000", + "gasLimit" : "21000", "gasPrice" : "1", "nonce" : "3", "to" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b", @@ -75,10 +96,11 @@ }, "WrongVRSTestVEqual26" : { + "expect" : "invalid", "transaction" : { "data" : "", - "gasLimit" : "2000", + "gasLimit" : "21000", "gasPrice" : "1", "nonce" : "0", "to" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b", @@ -90,10 +112,11 @@ }, "WrongVRSTestVEqual29" : { + "expect" : "invalid", "transaction" : { "data" : "", - "gasLimit" : "2000", + "gasLimit" : "21000", "gasPrice" : "1", "nonce" : "0", "to" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b", @@ -105,10 +128,11 @@ }, "WrongVRSTestVEqual31" : { + "expect" : "invalid", "transaction" : { "data" : "", - "gasLimit" : "2000", + "gasLimit" : "21000", "gasPrice" : "1", "nonce" : "0", "to" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b", @@ -120,10 +144,11 @@ }, "WrongVRSTestVOverflow" : { + "expect" : "invalid", "transaction" : { "data" : "", - "gasLimit" : "2000", + "gasLimit" : "21000", "gasPrice" : "1", "nonce" : "0", "to" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b", @@ -135,10 +160,11 @@ }, "WrongVRSTestIncorrectSize" : { + "expect" : "invalid", "transaction" : { "data" : "", - "gasLimit" : "2000", + "gasLimit" : "21000", "gasPrice" : "1", "nonce" : "0", "to" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b", @@ -150,11 +176,29 @@ }, "SenderTest" : { - "//" : "sender a94f5374fce5edbc8e2a8697c15331677e6ebf0b", + "//" : "sender 0f65fe9276bc9a24ae7083ae28e2660ef72df99e", + "expect" : "valid", "transaction" : { "data" : "", - "gasLimit" : "850", + "gasLimit" : "21000", + "gasPrice" : "1", + "nonce" : "0", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "10", + "v" : "27", + "r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353", + "s" : "secretkey 45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804" + } + }, + + "DataTestNotEnoughGAS" : { + "expect" : "invalid", + "transaction" : + { + "data" : "0x0358ac39584bc98a7c979f984b03", + "gasLimit" : "21020", "gasPrice" : "1", "nonce" : "0", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", @@ -166,11 +210,12 @@ } }, - "DataTest" : { + "DataTestEnoughGAS" : { + "expect" : "valid", "transaction" : { "data" : "0x0358ac39584bc98a7c979f984b03", - "gasLimit" : "850", + "gasLimit" : "23000", "gasPrice" : "1", "nonce" : "0", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", @@ -183,10 +228,11 @@ }, "TransactionWithTooManyRLPElements" : { + "expect" : "invalid", "transaction" : { "data" : "", - "gasLimit" : "850", + "gasLimit" : "21000", "gasPrice" : "1", "nonce" : "0", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", @@ -199,6 +245,7 @@ }, "TransactionWithTooFewRLPElements" : { + "expect" : "invalid", "transaction" : { "data" : "", @@ -212,10 +259,11 @@ }, "TransactionWithHihghValue" : { + "expect" : "valid", "transaction" : { "data" : "", - "gasLimit" : "850", + "gasLimit" : "21000", "gasPrice" : "1", "nonce" : "0", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", @@ -227,11 +275,12 @@ }, - "TransactionWithHihghValueOverflow" : { + "TransactionWithHighValueOverflow" : { + "expect" : "invalid", "transaction" : { "data" : "", - "gasLimit" : "850", + "gasLimit" : "21000", "gasPrice" : "1", "nonce" : "0", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", @@ -243,10 +292,11 @@ }, "TransactionWithSvalueHigh" : { + "expect" : "valid", "transaction" : { "data" : "", - "gasLimit" : "850", + "gasLimit" : "21000", "gasPrice" : "1", "nonce" : "0", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", @@ -258,10 +308,11 @@ }, "TransactionWithSvalueTooHigh" : { + "expect" : "invalid", "transaction" : { "data" : "", - "gasLimit" : "850", + "gasLimit" : "21000", "gasPrice" : "1", "nonce" : "0", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", @@ -273,10 +324,11 @@ }, "TransactionWithSvalueOverflow" : { + "expect" : "invalid", "transaction" : { "data" : "", - "gasLimit" : "850", + "gasLimit" : "21000", "gasPrice" : "1", "nonce" : "0", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", @@ -288,10 +340,11 @@ }, "TransactionWithRvalueOverflow" : { + "expect" : "invalid", "transaction" : { "data" : "", - "gasLimit" : "850", + "gasLimit" : "21000", "gasPrice" : "1", "nonce" : "0", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", @@ -303,10 +356,11 @@ }, "TransactionWithRvalueHigh" : { + "expect" : "invalid", "transaction" : { "data" : "", - "gasLimit" : "850", + "gasLimit" : "21000", "gasPrice" : "1", "nonce" : "0", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", @@ -318,10 +372,11 @@ }, "TransactionWithRvalueTooHigh" : { + "expect" : "invalid", "transaction" : { "data" : "", - "gasLimit" : "850", + "gasLimit" : "21000", "gasPrice" : "1", "nonce" : "0", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", @@ -332,11 +387,12 @@ } }, - "TransactionWithRvalueWrongSize" : { + "TransactionWithRvaluePrefixed00" : { + "expect" : "valid", "transaction" : { "data" : "", - "gasLimit" : "850", + "gasLimit" : "21000", "gasPrice" : "1", "nonce" : "0", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", @@ -347,11 +403,12 @@ } }, - "TransactionWithSvalueWrongSize" : { + "TransactionWithSvaluePrefixed00" : { + "expect" : "valid", "transaction" : { "data" : "", - "gasLimit" : "850", + "gasLimit" : "21000", "gasPrice" : "1", "nonce" : "0", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", @@ -363,10 +420,11 @@ }, "TransactionWithHihghNonce" : { + "expect" : "valid", "transaction" : { "data" : "", - "gasLimit" : "850", + "gasLimit" : "21000", "gasPrice" : "1", "nonce" : "115792089237316195423570985008687907853269984665640564039457584007913129639935", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", @@ -378,10 +436,11 @@ }, "TransactionWithNonceOverflow" : { + "expect" : "invalid", "transaction" : { "data" : "", - "gasLimit" : "850", + "gasLimit" : "21000", "gasPrice" : "1", "nonce" : "115792089237316195423570985008687907853269984665640564039457584007913129639936", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", @@ -393,6 +452,7 @@ }, "TransactionWithHihghGas" : { + "expect" : "valid", "transaction" : { "data" : "", @@ -407,11 +467,12 @@ } }, - "TransactionWithHihghGasPrice" : { + "TransactionWithHihghGasPrice" : { + "expect" : "valid", "transaction" : { "data" : "", - "gasLimit" : "1000", + "gasLimit" : "21000", "gasPrice" : "115792089237316195423570985008687907853269984665640564039457584007913129639935", "nonce" : "0", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", @@ -422,7 +483,8 @@ } }, - "TransactionWithGasLimitxPriceOverflow" : { + "TransactionWithGasLimitxPriceOverflow" : { + "expect" : "valid", "transaction" : { "data" : "", @@ -438,10 +500,11 @@ }, "TransactionWithGasPriceOverflow" : { + "expect" : "invalid", "transaction" : { "data" : "", - "gasLimit" : "850", + "gasLimit" : "21000", "gasPrice" : "115792089237316195423570985008687907853269984665640564039457584007913129639936", "nonce" : "0", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", @@ -453,6 +516,7 @@ }, "TransactionWithGasLimitOverflow" : { + "expect" : "invalid", "transaction" : { "data" : "", @@ -468,10 +532,11 @@ }, "AddressMoreThan20PrefixedBy0" : { + "expect" : "invalid", "transaction" : { "data" : "0x12", - "gasLimit" : "1000", + "gasLimit" : "21000", "gasPrice" : "123", "nonce" : "54", "to" : "0x0000000000000000095e7baea6a6c7c4c2dfeb977efac326af552d87", @@ -483,14 +548,15 @@ }, "EmptyTransaction" : { + "expect" : "invalid", "transaction" : { "data" : "", - "gasLimit" : "", - "gasPrice" : "", - "nonce" : "", + "gasLimit" : "0", + "gasPrice" : "0", + "nonce" : "0", "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", - "value" : "", + "value" : "0", "v" : "27", "r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353", "s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804" @@ -498,10 +564,11 @@ }, "AddressMoreThan20" : { + "expect" : "invalid", "transaction" : { "data" : "", - "gasLimit" : "2000", + "gasLimit" : "21000", "gasPrice" : "1", "nonce" : "0", "to" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b1c", @@ -513,10 +580,11 @@ }, "AddressLessThan20" : { + "expect" : "invalid", "transaction" : { "data" : "", - "gasLimit" : "2000", + "gasLimit" : "21000", "gasPrice" : "1", "nonce" : "0", "to" : "b9331677e6ebf", @@ -528,10 +596,11 @@ }, "AddressLessThan20Prefixed0" : { + "expect" : "valid", "transaction" : { "data" : "", - "gasLimit" : "2000", + "gasLimit" : "21000", "gasPrice" : "1", "nonce" : "0", "to" : "0x000000000000000000000000000b9331677e6ebf", @@ -542,41 +611,12 @@ } }, - "ValuesAsHex" : { - "transaction" : - { - "data" : "", - "gasLimit" : "0xadc053", - "gasPrice" : "1", - "nonce" : "0xffdc5", - "to" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b", - "value" : "4294820140", - "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" - } - }, - "unpadedRValue": { + "expect" : "valid", "transaction": { "nonce": "13", "gasPrice": "0x09184e72a000", - "gasLimit": "0x2710", + "gasLimit": "0xf710", "to": "7c47ef93268a311f4cad0c750724299e9b72c268", "data": "0x379607f50000000000000000000000000000000000000000000000000000000000000005", "r": "0x006ab6dda9f4df56ea45583af36660329147f1753f3724ea5eb9ed83e812ca77", @@ -587,20 +627,22 @@ }, "libsecp256k1test": { + "expect" : "valid", "transaction": { - "nonce": "", + "nonce": "0", "gasPrice": "0x09184e72a000", - "gasLimit": "0x1388", + "gasLimit": "0xf388", "to": "", - "data": "", + "data": "0x", "r": "44", "s": "4", "v": "27", - "value": "" + "value": "0" } }, "dataTx_bcValidBlockTest": { + "expect" : "valid", "transaction": { "nonce": "0", "gasPrice": "50", @@ -612,5 +654,20 @@ "v": "28", "value": "0" } + }, + + "RSsecp256k1" : { + "expect" : "invalid", + "transaction" : { + "data" : "0x", + "gasLimit" : "21000", + "gasPrice" : "1", + "nonce" : "3", + "to" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b", + "value" : "10", + "v" : "28", + "r" : "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141", + "s" : "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141" + } } }