Add tests module, add two more transaction tests.

This commit is contained in:
Gav Wood 2016-01-12 12:22:18 +01:00
parent df3db60ec0
commit 7634d60a97
10 changed files with 73 additions and 580 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "res/ethereum/tests"]
path = res/ethereum/tests
url = git@github.com:ethereum/tests

1
res/ethereum/tests Submodule

@ -0,0 +1 @@
Subproject commit dc86e6359675440aea59ddb48648a01c799925d8

View File

@ -1,531 +0,0 @@
{
"AddressLessThan20" : {
"blocknumber" : "0",
"rlp" : "0xf8528001825208870b9331677e6ebf0a801ca098ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4aa08887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3"
},
"AddressLessThan20Prefixed0" : {
"blocknumber" : "0",
"rlp" : "0xf85f800182520894000000000000000000000000000b9331677e6ebf0a801ca098ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4aa08887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3",
"sender" : "31bb58672e8bf7684108feeacf424ab62b873824",
"transaction" : {
"data" : "",
"gasLimit" : "0x5208",
"gasPrice" : "0x01",
"nonce" : "0x00",
"r" : "0x98ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4a",
"s" : "0x8887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3",
"to" : "0x000000000000000000000000000b9331677e6ebf",
"v" : "0x1c",
"value" : "0x0a"
}
},
"AddressMoreThan20" : {
"blocknumber" : "0",
"rlp" : "0xf860800182520895b94f5374fce5edbc8e2a8697c15331677e6ebf0b1c0a801ca098ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4aa08887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3"
},
"AddressMoreThan20PrefixedBy0" : {
"blocknumber" : "0",
"rlp" : "0xf867367b8252089c0000000000000000095e7baea6a6c7c4c2dfeb977efac326af552d870b121ba048b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353a0efffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804"
},
"DataTestEnoughGAS" : {
"blocknumber" : "0",
"rlp" : "0xf86d80018259d894095e7baea6a6c7c4c2dfeb977efac326af552d870a8e0358ac39584bc98a7c979f984b031ba048b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353a0efffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804",
"sender" : "ce26839c9bd0e87e38897bb97fca8b340fd12a53",
"transaction" : {
"data" : "0x0358ac39584bc98a7c979f984b03",
"gasLimit" : "0x59d8",
"gasPrice" : "0x01",
"nonce" : "0x00",
"r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353",
"s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804",
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
"v" : "0x1b",
"value" : "0x0a"
}
},
"DataTestFirstZeroBytes" : {
"blocknumber" : "0",
"rlp" : "0xf87c80018261a894095e7baea6a6c7c4c2dfeb977efac326af552d870a9d00000000000000000000000000010000000000000000000000000000001ba048b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353a0efffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804",
"sender" : "8131688854fe0dca411aa19572a01fe3e3e4fa74",
"transaction" : {
"data" : "0x000000000000000000000000001000000000000000000000000000000",
"gasLimit" : "0x61a8",
"gasPrice" : "0x01",
"nonce" : "0x00",
"r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353",
"s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804",
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
"v" : "0x1b",
"value" : "0x0a"
}
},
"DataTestLastZeroBytes" : {
"blocknumber" : "0",
"rlp" : "0xf87c80018261a894095e7baea6a6c7c4c2dfeb977efac326af552d870a9d00100000000000000000000000000000000000000000000000000000001ba048b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353a0efffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804",
"sender" : "ead53a9560ea38feb0bc2cad8ef65e5d8f990fc1",
"transaction" : {
"data" : "0x010000000000000000000000000000000000000000000000000000000",
"gasLimit" : "0x61a8",
"gasPrice" : "0x01",
"nonce" : "0x00",
"r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353",
"s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804",
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
"v" : "0x1b",
"value" : "0x0a"
}
},
"DataTestNotEnoughGAS" : {
"blocknumber" : "0",
"rlp" : "0xf86d800182521c94095e7baea6a6c7c4c2dfeb977efac326af552d870a8e0358ac39584bc98a7c979f984b031ba048b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353a0efffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804"
},
"DataTestZeroBytes" : {
"blocknumber" : "0",
"rlp" : "0xf87c80018261a894095e7baea6a6c7c4c2dfeb977efac326af552d870a9d00000000000000000000000000000000000000000000000000000000001ba048b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353a0efffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804",
"sender" : "b7ab01c0f092d30aeed17e23adb7aa5a9b2ee077",
"transaction" : {
"data" : "0x000000000000000000000000000000000000000000000000000000000",
"gasLimit" : "0x61a8",
"gasPrice" : "0x01",
"nonce" : "0x00",
"r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353",
"s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804",
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
"v" : "0x1b",
"value" : "0x0a"
}
},
"EmptyTransaction" : {
"blocknumber" : "0",
"rlp" : "0xf85d80808094095e7baea6a6c7c4c2dfeb977efac326af552d8780801ba048b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353a0efffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804"
},
"NotEnoughGasLimit" : {
"blocknumber" : "0",
"rlp" : "0xf85f0301824e2094b94f5374fce5edbc8e2a8697c15331677e6ebf0b0a801ca098ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4aa08887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3"
},
"RSsecp256k1" : {
"blocknumber" : "0",
"rlp" : "0xf85f030182520894b94f5374fce5edbc8e2a8697c15331677e6ebf0b0a801ca0fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141a0fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"
},
"RightVRSTest" : {
"blocknumber" : "0",
"rlp" : "0xf85f030182520894b94f5374fce5edbc8e2a8697c15331677e6ebf0b0a801ca098ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4aa08887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3",
"sender" : "fa7f04899691becd07dd3081d0a2f3ee7640af52",
"transaction" : {
"data" : "0x",
"gasLimit" : "0x5208",
"gasPrice" : "0x01",
"nonce" : "0x03",
"r" : "0x98ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4a",
"s" : "0x8887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3",
"to" : "b94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"v" : "0x1c",
"value" : "0x0a"
}
},
"SenderTest" : {
"blocknumber" : "0",
"rlp" : "0xf85f800182520894095e7baea6a6c7c4c2dfeb977efac326af552d870a801ba048b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353a0efffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804",
"sender" : "0f65fe9276bc9a24ae7083ae28e2660ef72df99e",
"senderExpect" : "sender 0f65fe9276bc9a24ae7083ae28e2660ef72df99e",
"transaction" : {
"data" : "",
"gasLimit" : "0x5208",
"gasPrice" : "0x01",
"nonce" : "0x00",
"r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353",
"s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804",
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
"v" : "0x1b",
"value" : "0x0a"
}
},
"TransactionWithGasLimitOverflow" : {
"blocknumber" : "0",
"rlp" : "0xf87e807ba101000000000000000000000000000000000000000000000000000000000000000094095e7baea6a6c7c4c2dfeb977efac326af552d870b801ba048b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353a0efffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804"
},
"TransactionWithGasLimitxPriceOverflow" : {
"blocknumber" : "0",
"rlp" : "0xf8858088016345785d8a0000a0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff94095e7baea6a6c7c4c2dfeb977efac326af552d8780801ba048b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353a0efffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804",
"sender" : "700764607c82cf3e9cf4ecbd49185f8914f1a361",
"transaction" : {
"data" : "",
"gasLimit" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"gasPrice" : "0x016345785d8a0000",
"nonce" : "0x00",
"r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353",
"s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804",
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
"v" : "0x1b",
"value" : "0x00"
}
},
"TransactionWithGasPriceOverflow" : {
"blocknumber" : "0",
"rlp" : "0xf88080a101000000000000000000000000000000000000000000000000000000000000000082520894095e7baea6a6c7c4c2dfeb977efac326af552d870b801ba048b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353a0efffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804"
},
"TransactionWithHighValueOverflow" : {
"blocknumber" : "0",
"rlp" : "0xf880800182520894095e7baea6a6c7c4c2dfeb977efac326af552d87a1010000000000000000000000000000000000000000000000000000000000000000801ba048b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353a0efffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804"
},
"TransactionWithHihghGas" : {
"blocknumber" : "0",
"rlp" : "0xf87d8001a0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff94095e7baea6a6c7c4c2dfeb977efac326af552d8780801ba048b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353a0efffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804",
"sender" : "9e92c26895f279d68ad7b57b803dc522717d5572",
"transaction" : {
"data" : "",
"gasLimit" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"gasPrice" : "0x01",
"nonce" : "0x00",
"r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353",
"s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804",
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
"v" : "0x1b",
"value" : "0x00"
}
},
"TransactionWithHihghGasPrice" : {
"blocknumber" : "0",
"rlp" : "0xf87f80a0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82520894095e7baea6a6c7c4c2dfeb977efac326af552d8780801ba048b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353a0efffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804",
"sender" : "b10eac078276dc8dbf1753715396d480156236f8",
"transaction" : {
"data" : "",
"gasLimit" : "0x5208",
"gasPrice" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"nonce" : "0x00",
"r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353",
"s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804",
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
"v" : "0x1b",
"value" : "0x00"
}
},
"TransactionWithHihghNonce256" : {
"blocknumber" : "0",
"rlp" : "0xf87fa0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0182520894095e7baea6a6c7c4c2dfeb977efac326af552d8780801ba048b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353a0efffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804",
"sender" : "9b96002788562fefd5ac08d5af877fa738272dc7",
"transaction" : {
"data" : "",
"gasLimit" : "0x5208",
"gasPrice" : "0x01",
"nonce" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353",
"s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804",
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
"v" : "0x1b",
"value" : "0x00"
}
},
"TransactionWithHihghNonce32" : {
"blocknumber" : "0",
"rlp" : "0xf8648501000000000182520894095e7baea6a6c7c4c2dfeb977efac326af552d8780801ba048b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353a0efffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804",
"sender" : "e86dc346fd8debf719486ff2f9c4c629fe58fc46",
"transaction" : {
"data" : "",
"gasLimit" : "0x5208",
"gasPrice" : "0x01",
"nonce" : "0x0100000000",
"r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353",
"s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804",
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
"v" : "0x1b",
"value" : "0x00"
}
},
"TransactionWithHihghValue" : {
"blocknumber" : "0",
"rlp" : "0xf87f800182520894095e7baea6a6c7c4c2dfeb977efac326af552d87a0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff801ba048b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353a0efffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804",
"sender" : "396bd0363e26195eeacfedbe54c44f16fbe470b6",
"transaction" : {
"data" : "",
"gasLimit" : "0x5208",
"gasPrice" : "0x01",
"nonce" : "0x00",
"r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353",
"s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804",
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
"v" : "0x1b",
"value" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
}
},
"TransactionWithNonceOverflow" : {
"blocknumber" : "0",
"rlp" : "0xf880a10100000000000000000000000000000000000000000000000000000000000000000182520894095e7baea6a6c7c4c2dfeb977efac326af552d870b801ba048b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353a0efffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804"
},
"TransactionWithRSvalue0" : {
"blocknumber" : "0",
"rlp" : "0xdf800182520894095e7baea6a6c7c4c2dfeb977efac326af552d870b801b8080"
},
"TransactionWithRSvalue1" : {
"blocknumber" : "0",
"rlp" : "0xdf800182520894095e7baea6a6c7c4c2dfeb977efac326af552d870b801b0101",
"sender" : "98c188f183d4e93ff2bffadd145f39b4a792ed85",
"transaction" : {
"data" : "",
"gasLimit" : "0x5208",
"gasPrice" : "0x01",
"nonce" : "0x00",
"r" : "0x01",
"s" : "0x01",
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
"v" : "0x1b",
"value" : "0x0b"
}
},
"TransactionWithRvalue0" : {
"blocknumber" : "0",
"rlp" : "0xf83f800182520894095e7baea6a6c7c4c2dfeb977efac326af552d870b801b80a0efffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804"
},
"TransactionWithRvalue1" : {
"blocknumber" : "0",
"rlp" : "0xf83f800182520894095e7baea6a6c7c4c2dfeb977efac326af552d870b801b01a0efffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804",
"sender" : "421ba7ba39c1c2ddb98308deca3af1dd9e461740",
"transaction" : {
"data" : "",
"gasLimit" : "0x5208",
"gasPrice" : "0x01",
"nonce" : "0x00",
"r" : "0x01",
"s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804",
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
"v" : "0x1b",
"value" : "0x0b"
}
},
"TransactionWithRvalueHigh" : {
"blocknumber" : "0",
"rlp" : "0xf85f800182520894095e7baea6a6c7c4c2dfeb977efac326af552d870b801ba0fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140a08887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3"
},
"TransactionWithRvalueOverflow" : {
"blocknumber" : "0",
"rlp" : "0xf861800182520894095e7baea6a6c7c4c2dfeb977efac326af552d870b801ba2fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd03641410000a0efffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804"
},
"TransactionWithRvaluePrefixed00" : {
"blocknumber" : "0",
"rlp" : "0xf850800182520894095e7baea6a6c7c4c2dfeb977efac326af552d870b801b910ebaaedce6af48a03bbfd25e8cd0364141a0efffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804",
"sender" : "0dd0dcb6502a463fa90ecaa59ca29a5e6571deef",
"transaction" : {
"data" : "",
"gasLimit" : "0x5208",
"gasPrice" : "0x01",
"nonce" : "0x00",
"r" : "0xebaaedce6af48a03bbfd25e8cd0364141",
"s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804",
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
"v" : "0x1b",
"value" : "0x0b"
}
},
"TransactionWithRvalueTooHigh" : {
"blocknumber" : "0",
"rlp" : "0xf85f800182520894095e7baea6a6c7c4c2dfeb977efac326af552d870b801ba0fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141a0efffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804"
},
"TransactionWithSvalue0" : {
"blocknumber" : "0",
"rlp" : "0xf83f800182520894095e7baea6a6c7c4c2dfeb977efac326af552d870b801ba048b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a3664935380"
},
"TransactionWithSvalue1" : {
"blocknumber" : "0",
"rlp" : "0xf83f800182520894095e7baea6a6c7c4c2dfeb977efac326af552d870b801ba048b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a3664935301",
"sender" : "e115cf6bb5656786569dd273705242ca72d84bc0",
"transaction" : {
"data" : "",
"gasLimit" : "0x5208",
"gasPrice" : "0x01",
"nonce" : "0x00",
"r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353",
"s" : "0x01",
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
"v" : "0x1b",
"value" : "0x0b"
}
},
"TransactionWithSvalueEqual_c_secp256k1n_x05" : {
"blocknumber" : "0",
"rlp" : "0xf85f800182520894095e7baea6a6c7c4c2dfeb977efac326af552d870b801ba048b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353a07fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",
"sender" : "b284109d8e781949638d995c19f8feba0268191c",
"transaction" : {
"data" : "",
"gasLimit" : "0x5208",
"gasPrice" : "0x01",
"nonce" : "0x00",
"r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353",
"s" : "0x7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
"v" : "0x1b",
"value" : "0x0b"
}
},
"TransactionWithSvalueHigh" : {
"blocknumber" : "0",
"rlp" : "0xf85f800182520894095e7baea6a6c7c4c2dfeb977efac326af552d870b801ba048b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353a0fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140",
"sender" : "474869ba435affa1f45aaada48520880921c0887",
"transaction" : {
"data" : "",
"gasLimit" : "0x5208",
"gasPrice" : "0x01",
"nonce" : "0x00",
"r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353",
"s" : "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140",
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
"v" : "0x1b",
"value" : "0x0b"
}
},
"TransactionWithSvalueLargerThan_c_secp256k1n_x05" : {
"blocknumber" : "0",
"rlp" : "0xf85f800182520894095e7baea6a6c7c4c2dfeb977efac326af552d870b801ba048b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353a07fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a1",
"sender" : "5ced92a94a7bfd7853b12d33ee59dd10ae94eb86",
"transaction" : {
"data" : "",
"gasLimit" : "0x5208",
"gasPrice" : "0x01",
"nonce" : "0x00",
"r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353",
"s" : "0x7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a1",
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
"v" : "0x1b",
"value" : "0x0b"
}
},
"TransactionWithSvalueLessThan_c_secp256k1n_x05" : {
"blocknumber" : "0",
"rlp" : "0xf85f800182520894095e7baea6a6c7c4c2dfeb977efac326af552d870b801ba048b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353a07fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b2090",
"sender" : "33e931e187e9cb5b6f8560755519d54560dd63e8",
"transaction" : {
"data" : "",
"gasLimit" : "0x5208",
"gasPrice" : "0x01",
"nonce" : "0x00",
"r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353",
"s" : "0x7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b2090",
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
"v" : "0x1b",
"value" : "0x0b"
}
},
"TransactionWithSvalueOverflow" : {
"blocknumber" : "0",
"rlp" : "0xf861800182520894095e7baea6a6c7c4c2dfeb977efac326af552d870b801ba048b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353a2fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f0000"
},
"TransactionWithSvaluePrefixed00" : {
"blocknumber" : "0",
"rlp" : "0xf851800182520894095e7baea6a6c7c4c2dfeb977efac326af552d870b801ba098ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4a920ef0b28ad43601b4ab949f53faa07bd2c804",
"sender" : "a825d77f343f31619c991cd7db5aaa6adbe9452e",
"transaction" : {
"data" : "",
"gasLimit" : "0x5208",
"gasPrice" : "0x01",
"nonce" : "0x00",
"r" : "0x98ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4a",
"s" : "0xef0b28ad43601b4ab949f53faa07bd2c804",
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
"v" : "0x1b",
"value" : "0x0b"
}
},
"TransactionWithSvalueTooHigh" : {
"blocknumber" : "0",
"rlp" : "0xf85f800182520894095e7baea6a6c7c4c2dfeb977efac326af552d870b801ba048b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353a0fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"
},
"TransactionWithTooFewRLPElements" : {
"blocknumber" : "0",
"rlp" : "0xf85b800194095e7baea6a6c7c4c2dfeb977efac326af552d87801ba048b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353a0efffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804"
},
"TransactionWithTooManyRLPElements" : {
"blocknumber" : "0",
"rlp" : "0xf865800182520894095e7baea6a6c7c4c2dfeb977efac326af552d870a801ba048b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353a0efffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804851de98d0edd"
},
"V_overflow32bit" : {
"blocknumber" : "0",
"rlp" : "0xf866030182520894b94f5374fce5edbc8e2a8697c15331677e6ebf0b0a82554485010000001ba098ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4aa08887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3"
},
"V_overflow32bitSigned" : {
"blocknumber" : "0",
"rlp" : "0xf865030182520894b94f5374fce5edbc8e2a8697c15331677e6ebf0b0a825544847fffffffa098ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4aa08887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3"
},
"V_overflow64bitPlus27" : {
"blocknumber" : "0",
"rlp" : "0xf86a03018255f094b94f5374fce5edbc8e2a8697c15331677e6ebf0b0a8255448901000000000000001ba098ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4aa08887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3"
},
"V_overflow64bitPlus28" : {
"blocknumber" : "0",
"rlp" : "0xf86a03018255f094b94f5374fce5edbc8e2a8697c15331677e6ebf0b0a8255448901000000000000001ca098ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4aa08887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3"
},
"V_overflow64bitSigned" : {
"blocknumber" : "0",
"rlp" : "0xf869030182520894b94f5374fce5edbc8e2a8697c15331677e6ebf0b0a82554488ffffffffffffff1ca098ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4aa08887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3"
},
"WrongVRSTestIncorrectSize" : {
"blocknumber" : "0",
"rlp" : "0xf863800182520894b94f5374fce5edbc8e2a8697c15331677e6ebf0b0a801ca298ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4a02c3a28887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a302c3"
},
"WrongVRSTestVEqual26" : {
"blocknumber" : "0",
"rlp" : "0xf85f800182520894b94f5374fce5edbc8e2a8697c15331677e6ebf0b0a801aa098ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4aa08887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3"
},
"WrongVRSTestVEqual29" : {
"blocknumber" : "0",
"rlp" : "0xf85f800182520894b94f5374fce5edbc8e2a8697c15331677e6ebf0b0a801da098ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4aa08887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3"
},
"WrongVRSTestVEqual31" : {
"blocknumber" : "0",
"rlp" : "0xf85f800182520894b94f5374fce5edbc8e2a8697c15331677e6ebf0b0a801fa098ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4aa08887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3"
},
"WrongVRSTestVOverflow" : {
"blocknumber" : "0",
"rlp" : "0xf861800182520894b94f5374fce5edbc8e2a8697c15331677e6ebf0b0a80820136a098ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4aa08887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3"
},
"dataTx_bcValidBlockTest" : {
"blocknumber" : "0",
"rlp" : "0xf901fb803282c3508080b901ae60056013565b6101918061001d6000396000f35b3360008190555056006001600060e060020a6000350480630a874df61461003a57806341c0e1b514610058578063a02b161e14610066578063dbbdf0831461007757005b610045600435610149565b80600160a060020a031660005260206000f35b610060610161565b60006000f35b6100716004356100d4565b60006000f35b61008560043560243561008b565b60006000f35b600054600160a060020a031632600160a060020a031614156100ac576100b1565b6100d0565b8060018360005260205260406000208190555081600060005260206000a15b5050565b600054600160a060020a031633600160a060020a031614158015610118575033600160a060020a0316600182600052602052604060002054600160a060020a031614155b61012157610126565b610146565b600060018260005260205260406000208190555080600060005260206000a15b50565b60006001826000526020526040600020549050919050565b600054600160a060020a031633600160a060020a0316146101815761018f565b600054600160a060020a0316ff5b561ca0c5689ed1ad124753d54576dfb4b571465a41900a1dff4058d8adf16f752013d0a0e221cbd70ec28c94a3b55ec771bcbc70778d6ee0b51ca7ea9514594c861b1884",
"sender" : "a94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"transaction" : {
"data" : "0x60056013565b6101918061001d6000396000f35b3360008190555056006001600060e060020a6000350480630a874df61461003a57806341c0e1b514610058578063a02b161e14610066578063dbbdf0831461007757005b610045600435610149565b80600160a060020a031660005260206000f35b610060610161565b60006000f35b6100716004356100d4565b60006000f35b61008560043560243561008b565b60006000f35b600054600160a060020a031632600160a060020a031614156100ac576100b1565b6100d0565b8060018360005260205260406000208190555081600060005260206000a15b5050565b600054600160a060020a031633600160a060020a031614158015610118575033600160a060020a0316600182600052602052604060002054600160a060020a031614155b61012157610126565b610146565b600060018260005260205260406000208190555080600060005260206000a15b50565b60006001826000526020526040600020549050919050565b600054600160a060020a031633600160a060020a0316146101815761018f565b600054600160a060020a0316ff5b56",
"gasLimit" : "0xc350",
"gasPrice" : "0x32",
"nonce" : "0x00",
"r" : "0xc5689ed1ad124753d54576dfb4b571465a41900a1dff4058d8adf16f752013d0",
"s" : "0xe221cbd70ec28c94a3b55ec771bcbc70778d6ee0b51ca7ea9514594c861b1884",
"to" : "",
"v" : "0x1c",
"value" : "0x00"
}
},
"invalidSignature" : {
"blocknumber" : "0",
"rlp" : "0xf8638080830f424094095e7baea6a6c7c4c2dfeb977efac326af552d87830186a0801ba0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa0badf00d70ec28c94a3b55ec771bcbc70778d6ee0b51ca7ea9514594c861b1884"
},
"libsecp256k1test" : {
"blocknumber" : "0",
"rlp" : "0xd1808609184e72a00082f3888080801b2c04",
"sender" : "170ad78f26da62f591fa3fe3d54c30016167cbbf",
"transaction" : {
"data" : "0x",
"gasLimit" : "0xf388",
"gasPrice" : "0x09184e72a000",
"nonce" : "0x00",
"r" : "0x2c",
"s" : "0x04",
"to" : "",
"v" : "0x1b",
"value" : "0x00"
}
},
"unpadedRValue" : {
"blocknumber" : "0",
"rlp" : "0xf8880d8609184e72a00082f710947c47ef93268a311f4cad0c750724299e9b72c26880a4379607f500000000000000000000000000000000000000000000000000000000000000051c9f6ab6dda9f4df56ea45583af36660329147f1753f3724ea5eb9ed83e812ca77a0495701e230667832c8999e884e366a61028633ecf951e8cd66d119f381ae5718",
"sender" : "c1584838993ee7a9581cba0bced81785e8bb581d",
"transaction" : {
"data" : "0x379607f50000000000000000000000000000000000000000000000000000000000000005",
"gasLimit" : "0xf710",
"gasPrice" : "0x09184e72a000",
"nonce" : "0x0d",
"r" : "0x006ab6dda9f4df56ea45583af36660329147f1753f3724ea5eb9ed83e812ca77",
"s" : "0x495701e230667832c8999e884e366a61028633ecf951e8cd66d119f381ae5718",
"to" : "7c47ef93268a311f4cad0c750724299e9b72c268",
"v" : "0x1c",
"value" : "0x00"
}
}
}

View File

@ -12,19 +12,19 @@ pub use self::denominations::*;
use super::spec::*;
/// Create a new Olympic chain spec.
pub fn new_olympic() -> Spec { Spec::from_json_utf8(include_bytes!("res/olympic.json")) }
pub fn new_olympic() -> Spec { Spec::from_json_utf8(include_bytes!("../../res/ethereum/olympic.json")) }
/// Create a new Frontier mainnet chain spec.
pub fn new_frontier() -> Spec { Spec::from_json_utf8(include_bytes!("res/frontier.json")) }
pub fn new_frontier() -> Spec { Spec::from_json_utf8(include_bytes!("../../res/ethereum/frontier.json")) }
/// Create a new Frontier chain spec as though it never changes to Homestead.
pub fn new_frontier_test() -> Spec { Spec::from_json_utf8(include_bytes!("res/frontier_test.json")) }
pub fn new_frontier_test() -> Spec { Spec::from_json_utf8(include_bytes!("../../res/ethereum/frontier_test.json")) }
/// Create a new Homestead chain spec as though it never changed from Frontier.
pub fn new_homestead_test() -> Spec { Spec::from_json_utf8(include_bytes!("res/homestead_test.json")) }
pub fn new_homestead_test() -> Spec { Spec::from_json_utf8(include_bytes!("../../res/ethereum/homestead_test.json")) }
/// Create a new Morden chain spec.
pub fn new_morden() -> Spec { Spec::from_json_utf8(include_bytes!("res/morden.json")) }
pub fn new_morden() -> Spec { Spec::from_json_utf8(include_bytes!("../../res/ethereum/morden.json")) }
#[cfg(test)]
mod tests {

View File

@ -147,20 +147,6 @@ impl Decodable for Transaction {
}
}
#[test]
fn sender_test() {
let t: Transaction = decode(&FromHex::from_hex("f85f800182520894095e7baea6a6c7c4c2dfeb977efac326af552d870a801ba048b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353a0efffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804").unwrap());
assert_eq!(t.data, b"");
assert_eq!(t.gas, U256::from(0x5208u64));
assert_eq!(t.gas_price, U256::from(0x01u64));
assert_eq!(t.nonce, U256::from(0x00u64));
if let Action::Call(ref to) = t.action {
assert_eq!(*to, address_from_hex("095e7baea6a6c7c4c2dfeb977efac326af552d87"));
} else { panic!(); }
assert_eq!(t.value, U256::from(0x0au64));
assert_eq!(t.sender().unwrap(), address_from_hex("0f65fe9276bc9a24ae7083ae28e2660ef72df99e"));
}
pub fn clean(s: &str) -> &str {
if s.len() >= 2 && &s[0..2] == "0x" {
&s[2..]
@ -172,9 +158,9 @@ pub fn clean(s: &str) -> &str {
pub fn bytes_from_json(json: &Json) -> Bytes {
let s = json.as_string().unwrap();
if s.len() % 2 == 1 {
FromHex::from_hex(&("0".to_string() + &(clean(s).to_string()))[..]).unwrap()
FromHex::from_hex(&("0".to_string() + &(clean(s).to_string()))[..]).unwrap_or(vec![])
} else {
FromHex::from_hex(clean(s)).unwrap()
FromHex::from_hex(clean(s)).unwrap_or(vec![])
}
}
@ -199,36 +185,70 @@ pub fn u256_from_json(json: &Json) -> U256 {
}
}
#[test]
fn json_tests() {
#[cfg(test)]
mod tests {
use util::*;
use evm::Schedule;
use header::BlockNumber;
let json = Json::from_str(::std::str::from_utf8(include_bytes!("../res/ttTransactionTest.json")).unwrap()).expect("Json is invalid");
let mut failed = Vec::new();
let schedule = Schedule::new_frontier();
for (name, test) in json.as_object().unwrap() {
let mut fail = false;
let mut fail_unless = |cond: bool| if !cond && fail { failed.push(name.to_string()); fail = true };
let _ = BlockNumber::from_str(test["blocknumber"].as_string().unwrap()).unwrap();
let rlp = bytes_from_json(&test["rlp"]);
let res = UntrustedRlp::new(&rlp).as_val().map_err(|e| From::from(e)).and_then(|t: Transaction| t.validate(&schedule));
fail_unless(test.find("transaction").is_none() == res.is_err());
if let (Some(&Json::Object(ref tx)), Some(&Json::String(ref expect_sender))) = (test.find("transaction"), test.find("sender")) {
let t = res.unwrap();
fail_unless(t.sender().unwrap() == address_from_hex(clean(expect_sender)));
fail_unless(t.data == bytes_from_json(&tx["data"]));
fail_unless(t.gas == u256_from_json(&tx["gasLimit"]));
fail_unless(t.gas_price == u256_from_json(&tx["gasPrice"]));
fail_unless(t.nonce == u256_from_json(&tx["nonce"]));
fail_unless(t.value == u256_from_json(&tx["value"]));
if let Action::Call(ref to) = t.action {
fail_unless(to == &address_from_json(&tx["to"]));
} else {
fail_unless(bytes_from_json(&tx["to"]).len() == 0);
use super::*;
#[test]
fn sender_test() {
let t: Transaction = decode(&FromHex::from_hex("f85f800182520894095e7baea6a6c7c4c2dfeb977efac326af552d870a801ba048b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353a0efffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804").unwrap());
assert_eq!(t.data, b"");
assert_eq!(t.gas, U256::from(0x5208u64));
assert_eq!(t.gas_price, U256::from(0x01u64));
assert_eq!(t.nonce, U256::from(0x00u64));
if let Action::Call(ref to) = t.action {
assert_eq!(*to, address_from_hex("095e7baea6a6c7c4c2dfeb977efac326af552d87"));
} else { panic!(); }
assert_eq!(t.value, U256::from(0x0au64));
assert_eq!(t.sender().unwrap(), address_from_hex("0f65fe9276bc9a24ae7083ae28e2660ef72df99e"));
}
fn do_json_test(json_data: &[u8]) -> Vec<String> {
let json = Json::from_str(::std::str::from_utf8(json_data).unwrap()).expect("Json is invalid");
let mut failed = Vec::new();
let schedule = Schedule::new_frontier();
for (name, test) in json.as_object().unwrap() {
let mut fail = false;
let mut fail_unless = |cond: bool| if !cond && fail { failed.push(name.to_string()); fail = true };
let _ = BlockNumber::from_str(test["blocknumber"].as_string().unwrap()).unwrap();
let rlp = bytes_from_json(&test["rlp"]);
let res = UntrustedRlp::new(&rlp).as_val().map_err(|e| From::from(e)).and_then(|t: Transaction| t.validate(&schedule));
fail_unless(test.find("transaction").is_none() == res.is_err());
if let (Some(&Json::Object(ref tx)), Some(&Json::String(ref expect_sender))) = (test.find("transaction"), test.find("sender")) {
let t = res.unwrap();
fail_unless(t.sender().unwrap() == address_from_hex(clean(expect_sender)));
fail_unless(t.data == bytes_from_json(&tx["data"]));
fail_unless(t.gas == u256_from_json(&tx["gasLimit"]));
fail_unless(t.gas_price == u256_from_json(&tx["gasPrice"]));
fail_unless(t.nonce == u256_from_json(&tx["nonce"]));
fail_unless(t.value == u256_from_json(&tx["value"]));
if let Action::Call(ref to) = t.action {
fail_unless(to == &address_from_json(&tx["to"]));
} else {
fail_unless(bytes_from_json(&tx["to"]).len() == 0);
}
}
}
for f in failed.iter() {
println!("FAILED: {:?}", f);
}
failed
}
macro_rules! declare_test {
($test_set_name: ident/$name: ident) => {
#[test]
#[allow(non_snake_case)]
fn $name() {
assert!(do_json_test(include_bytes!(concat!("../res/ethereum/tests/", stringify!($test_set_name), "/", stringify!($name), ".json"))).len() == 0);
}
}
}
for f in failed.iter() {
println!("FAILED: {:?}", f);
}
assert!(failed.len() == 0);
declare_test!{TransactionTests/ttTransactionTest}
declare_test!{TransactionTests/tt10mbDataField}
declare_test!{TransactionTests/ttWrongRLPTransaction}
}