Local EIP2930 and EN/DE block tests (#237)

This commit is contained in:
rakita 2021-01-28 17:23:01 +01:00 committed by GitHub
parent 52d966ccaa
commit cfc6439f2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 6724 additions and 29 deletions

View File

@ -0,0 +1,69 @@
{
"name": "YoloEIP2930",
"engine": {
"Ethash": {
"params": {
"minimumDifficulty": "0x020000",
"difficultyBoundDivisor": "0x0800",
"durationLimit": "0x0d",
"blockReward": "0x1BC16D674EC80000",
"homesteadTransition": "0x0",
"eip100bTransition": "0x0",
"difficultyBombDelays": {
"0": 5000000
}
}
}
},
"params": {
"gasLimitBoundDivisor": "0x0400",
"registrar": "0xc6d9d2cd449a754c494264e1809c50e34d64562b",
"accountStartNonce": "0x00",
"maximumExtraDataSize": "0x20",
"minGasLimit": "0x1388",
"networkID": "0x1",
"maxCodeSize": 24576,
"maxCodeSizeTransition": "0x0",
"eip150Transition": "0x0",
"eip160Transition": "0x0",
"eip161abcTransition": "0x0",
"eip161dTransition": "0x0",
"eip140Transition": "0x0",
"eip211Transition": "0x0",
"eip214Transition": "0x0",
"eip155Transition": "0x0",
"eip658Transition": "0x0",
"eip145Transition": "0x0",
"eip1014Transition": "0x0",
"eip1052Transition": "0x0",
"eip1283Transition": "0x0",
"eip1283DisableTransition": "0x0",
"eip1283ReenableTransition": "0x0",
"eip1344Transition": "0x0",
"eip1706Transition": "0x0",
"eip1884Transition": "0x0",
"eip2028Transition": "0x0",
"eip2315Transition": "0x0",
"eip2929Transition": "0x0",
"eip2930Transition": "0x0"
},
"genesis": {
"seal": {
"ethereum": {
"nonce": "0x0000000000000539",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
}
},
"difficulty": "0x20000",
"gasLimit": "0x47e7c4"
},
"accounts": {
"000000000000000000000000000000000000aaaa": {
"balance": "0",
"code": "0x5854505854503231"
},
"71562b71999873db5b286df957af199ec94617f7": {
"balance": "0x3b9aca00"
}
}
}

View File

@ -1,24 +1,32 @@
{ {
"local": [
{
"path": "res/local_tests/block_en_de",
"test_type": "block_en_de"
}
],
"chain": [ "chain": [
{
"path": "res/local_tests/chain",
"skip": []
},
{ {
"path": "res/json_tests/BlockchainTests", "path": "res/json_tests/BlockchainTests",
"skip" : [] "skip": []
}, },
{ {
"path": "res/json_tests/LegacyTests/Constantinople/BlockchainTests", "path": "res/json_tests/LegacyTests/Constantinople/BlockchainTests",
"skip" : [] "skip": []
} }
], ],
"state": [ "state": [
{ {
"path": "res/json_tests/GeneralStateTests", "path": "res/json_tests/GeneralStateTests",
"skip" : [] "skip": []
}, },
{ {
"path": "res/json_tests/LegacyTests/Constantinople/GeneralStateTests", "path": "res/json_tests/LegacyTests/Constantinople/GeneralStateTests",
"skip" : [] "skip": []
} }
], ],
"difficulty": [ "difficulty": [
@ -42,10 +50,7 @@
], ],
"trie": [ "trie": [
{ {
"path": [ "path": ["res/json_tests/TrieTests/trietest.json", "res/json_tests/TrieTests/trieanyorder.json"],
"res/json_tests/TrieTests/trietest.json",
"res/json_tests/TrieTests/trieanyorder.json"
],
"triespec": "Generic" "triespec": "Generic"
}, },
{ {
@ -57,4 +62,4 @@
"triespec": "Secure" "triespec": "Secure"
} }
] ]
} }

View File

@ -0,0 +1,42 @@
{
"acl_block_0": {
"rlp": "f90263f901f5a0151b04645af991f513d5e11f8ed62e12b73f080af9c7a6a3d98fd6b1503f23faa01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940100000000000000000000000000000000000000a0968408b8a2f170bc78230cc2fac3881120a93f7392cf26b609566d8648abfd79a0e8137f2b67ac4680d8103f8b1cd7c05c49f56e4df464b0a79253679f38df9ab4a07f53535270d749f41b9d783aa1abcfceb73cc2a16ecde789cd3bc97a42fbda2ab901000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000083020000018347e7c48262740a80a00000000000000000000000000000000000000000000000000000000000000000880000000000000000f868f866800a8301e24194000000000000000000000000000000000000aaaa808086f2ded8deec88a0e7545c5664e63873d7aeb4bb5f92152c3366a9095c9140e5f8453af0998194bea04d24143ac9bc97c0aa07a7074c12ab60484d83d3b447b1e5e6ba5cbf421675bfc0",
"header": {
"parentHash": "0x151b04645af991f513d5e11f8ed62e12b73f080af9c7a6a3d98fd6b1503f23fa",
"uncleHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"coinbase": "0x0100000000000000000000000000000000000000",
"stateRoot": "0x968408b8a2f170bc78230cc2fac3881120a93f7392cf26b609566d8648abfd79",
"transactionsTrie": "0xe8137f2b67ac4680d8103f8b1cd7c05c49f56e4df464b0a79253679f38df9ab4",
"receiptTrie": "0x7f53535270d749f41b9d783aa1abcfceb73cc2a16ecde789cd3bc97a42fbda2a",
"bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"difficulty": "0x20000",
"number": "0x1",
"gasLimit": "0x47e7c4",
"gasUsed": "0x6274",
"timestamp": "0xa",
"extraData": "0x",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"nonce": "0x0000000000000000",
"hash": "0x9aa9cdb2afc4ebf893c32b67dedf1dea4291673bf4e80d3227a4e7f8d0feaf68"
},
"transactions": [
{
"type": "0x0",
"chainId": null,
"nonce": "0x0",
"gasPrice": "0xa",
"gasLimit": "0x1e241",
"to": "0x000000000000000000000000000000000000aaaa",
"value": "0x0",
"data": "0x",
"accessList": null,
"v": "0xf2ded8deec88",
"r": "0xe7545c5664e63873d7aeb4bb5f92152c3366a9095c9140e5f8453af0998194be",
"s": "0x4d24143ac9bc97c0aa07a7074c12ab60484d83d3b447b1e5e6ba5cbf421675bf",
"hash": "0x7e122173adcc02b9a3c94da426f65c7d46e724e8e3fdb16be73d5e0405e280b6"
}
],
"uncles": null,
"receipts": null
}
}

View File

@ -0,0 +1,65 @@
{
"acl_block_1": {
"rlp": "f9032df901f5a09aa9cdb2afc4ebf893c32b67dedf1dea4291673bf4e80d3227a4e7f8d0feaf68a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940100000000000000000000000000000000000000a0fb70f6c0512e7979903607bba8a4f1b18c2dd1060a8eff1b777a2182d05af524a0dfcad019a36acdf0f3fac6b3db02bf1d70012a0bd3eadabea87b856be9a6f1cca0a7a57ba954834e69b55d9115305f14f7faff9beb83443f7bb5526585848c6aefb901000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000083020000028347e7c482dd201480a00000000000000000000000000000000000000000000000000000000000000000880000000000000000f90131b8c701f8c486796f6c6f7632010a8301e24194000000000000000000000000000000000000aaaa8080f85bf859940000000000000000000000000000000000000000f842a00000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000001a0a9efa6b5fd3c2f210c4ec7232058d8dd30c93a456b4f6074429fb09bbd73eb4fa070632eff8bf0933381917c9161a98494e34fc7b836ee150445cae9ab151d267bf866020a8301e24194000000000000000000000000000000000000aaaa808086f2ded8deec88a055a39da3ce02c75e976ad84f608771080811a5ef322c6b6536c362f716c60985a018ab5df4198436eacd0e991f59bdeb8da9a75c678067db6b1a4d07881555c7a8c0",
"header": {
"parentHash": "0x9aa9cdb2afc4ebf893c32b67dedf1dea4291673bf4e80d3227a4e7f8d0feaf68",
"uncleHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"coinbase": "0x0100000000000000000000000000000000000000",
"stateRoot": "0xfb70f6c0512e7979903607bba8a4f1b18c2dd1060a8eff1b777a2182d05af524",
"transactionsTrie": "0xdfcad019a36acdf0f3fac6b3db02bf1d70012a0bd3eadabea87b856be9a6f1cc",
"receiptTrie": "0xa7a57ba954834e69b55d9115305f14f7faff9beb83443f7bb5526585848c6aef",
"bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"difficulty": "0x20000",
"number": "0x2",
"gasLimit": "0x47e7c4",
"gasUsed": "0xdd20",
"timestamp": "0x14",
"extraData": "0x",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"nonce": "0x0000000000000000",
"hash": "0xe1807e7366284bc72d34c8f02318f81c6598454dbff4c6cdd71e872cd8d5748c"
},
"transactions": [
{
"type": "0x1",
"chainId": "0x796f6c6f7632",
"nonce": "0x1",
"gasPrice": "0xa",
"gasLimit": "0x1e241",
"to": "0x000000000000000000000000000000000000aaaa",
"value": "0x0",
"data": "0x",
"accessList": [
[
"0x0000000000000000000000000000000000000000",
[
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x0000000000000000000000000000000000000000000000000000000000000000"
]
]
],
"v": "0x1",
"r": "0xa9efa6b5fd3c2f210c4ec7232058d8dd30c93a456b4f6074429fb09bbd73eb4f",
"s": "0x70632eff8bf0933381917c9161a98494e34fc7b836ee150445cae9ab151d267b",
"hash": "0x1916413ac8d1d5ee4eda786e5fe29509a109910f800894e0e18eb84abb7564cb"
},
{
"type": "0x0",
"chainId": null,
"nonce": "0x2",
"gasPrice": "0xa",
"gasLimit": "0x1e241",
"to": "0x000000000000000000000000000000000000aaaa",
"value": "0x0",
"data": "0x",
"accessList": null,
"v": "0xf2ded8deec88",
"r": "0x55a39da3ce02c75e976ad84f608771080811a5ef322c6b6536c362f716c60985",
"s": "0x18ab5df4198436eacd0e991f59bdeb8da9a75c678067db6b1a4d07881555c7a8",
"hash": "0x54c6cfb51cbbe2c562e17a0d6ee1324f1b50013a9b9d47589cedcf0ec4ac342a"
}
],
"uncles": null,
"receipts": null
}
}

View File

@ -0,0 +1,102 @@
{
"acl_block_2": {
"rlp": "f904b1f901f6a0e1807e7366284bc72d34c8f02318f81c6598454dbff4c6cdd71e872cd8d5748ca01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940100000000000000000000000000000000000000a025e5b4b7668760c0aa01d44c061d77e24b53f6d247d3e1d85a91e23646c1d679a0be53a36dd90786b4cd30fb0f3677ad3ce5f804a5615872a7b0512b6be82639a2a076946d9f034a6657c6832a6ad4df3ef0ddf3fa9f3f8be98ea64880fb23bd23e3b901000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000083020000038347e7c48301883c1e80a00000000000000000000000000000000000000000000000000000000000000000880000000000000000f902b4b9012301f9011f86796f6c6f7632030a8301e24194000000000000000000000000000000000000aaaa8080f8b6f859940000000000000000000000000000000000000000f842a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000f859940100000000000000000000000000000000000000f842a00000000000000000000000000000000000000000000000000000000000000000a0010000000000000000000000000000000000000000000000000000000000000001a0635c44b8110989ef84c77de11a377f19cbd84660559ed76b37ba0f7fdee1fb40a012e1576d168301614720c68f1a9e9d5ed20e23622dab6c3587b11177155d59f4b9012301f9011f86796f6c6f7632040a8301e24194000000000000000000000000000000000000aaaa8080f8b6f859940000000000000000000000000000000000000000f842a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000f859940100000000000000000000000000000000000000f842a00000000000000000000000000000000000000000000000000000000000000000a0010000000000000000000000000000000000000000000000000000000000000001a00380e446bf3992ee1df44b8177a11e948dc52cc3faa8eae059a52b7183126c0fa05206f0f35648d3b8f23092d4d7bdccb926967d840a269cf65b706a8a359b9029f866050a8301e24194000000000000000000000000000000000000aaaa808086f2ded8deec87a0ea5de382dbf422aa1bd156547a2bc3a9357d745a68cdc9203b14812307068567a0388f7425b873ae204d43d91f4997ca41d2af6759be49538b174a06f67d5741b5c0",
"header": {
"parentHash": "0xe1807e7366284bc72d34c8f02318f81c6598454dbff4c6cdd71e872cd8d5748c",
"uncleHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"coinbase": "0x0100000000000000000000000000000000000000",
"stateRoot": "0x25e5b4b7668760c0aa01d44c061d77e24b53f6d247d3e1d85a91e23646c1d679",
"transactionsTrie": "0xbe53a36dd90786b4cd30fb0f3677ad3ce5f804a5615872a7b0512b6be82639a2",
"receiptTrie": "0x76946d9f034a6657c6832a6ad4df3ef0ddf3fa9f3f8be98ea64880fb23bd23e3",
"bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"difficulty": "0x20000",
"number": "0x3",
"gasLimit": "0x47e7c4",
"gasUsed": "0x1883c",
"timestamp": "0x1e",
"extraData": "0x",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"nonce": "0x0000000000000000",
"hash": "0x1615129d2aa7b437cd40e3aa1a5794af9e40b07b9b017014e4123cefeef785ce"
},
"transactions": [
{
"type": "0x1",
"chainId": "0x796f6c6f7632",
"nonce": "0x3",
"gasPrice": "0xa",
"gasLimit": "0x1e241",
"to": "0x000000000000000000000000000000000000aaaa",
"value": "0x0",
"data": "0x",
"accessList": [
{
"address": "0x0000000000000000000000000000000000000000",
"storageKeys": [
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x0000000000000000000000000000000000000000000000000000000000000000"
]
},
{
"address": "0x0100000000000000000000000000000000000000",
"storageKeys": [
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x0100000000000000000000000000000000000000000000000000000000000000"
]
}
],
"v": "0x1",
"r": "0x635c44b8110989ef84c77de11a377f19cbd84660559ed76b37ba0f7fdee1fb40",
"s": "0x12e1576d168301614720c68f1a9e9d5ed20e23622dab6c3587b11177155d59f4",
"hash": "0x54471f503901f2c2fe392e43df0377a11f9a1cd9cde0ec5c68c89eac1723e02a"
},
{
"type": "0x1",
"chainId": "0x796f6c6f7632",
"nonce": "0x4",
"gasPrice": "0xa",
"gasLimit": "0x1e241",
"to": "0x000000000000000000000000000000000000aaaa",
"value": "0x0",
"data": "0x",
"accessList": [
{
"address": "0x0000000000000000000000000000000000000000",
"storageKeys": [
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x0000000000000000000000000000000000000000000000000000000000000000"
]
},
{
"address": "0x0100000000000000000000000000000000000000",
"storageKeys": [
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x0100000000000000000000000000000000000000000000000000000000000000"
]
}
],
"v": "0x1",
"r": "0x380e446bf3992ee1df44b8177a11e948dc52cc3faa8eae059a52b7183126c0f",
"s": "0x5206f0f35648d3b8f23092d4d7bdccb926967d840a269cf65b706a8a359b9029",
"hash": "0xe3a1354e84d22ebbca0c55751937b075083f0f0e3a47c65fc7249d86f872f268"
},
{
"type": "0x0",
"chainId": null,
"nonce": "0x5",
"gasPrice": "0xa",
"gasLimit": "0x1e241",
"to": "0x000000000000000000000000000000000000aaaa",
"value": "0x0",
"data": "0x",
"accessList": null,
"v": "0xf2ded8deec87",
"r": "0xea5de382dbf422aa1bd156547a2bc3a9357d745a68cdc9203b14812307068567",
"s": "0x388f7425b873ae204d43d91f4997ca41d2af6759be49538b174a06f67d5741b5",
"hash": "0x44b1e9999ac02a3b0daf1391be16bb00a262079706418697094bab5f37b522d7"
}
],
"uncles": null,
"receipts": null
}
}

View File

@ -0,0 +1,153 @@
{
"acl_block_3": {
"rlp": "f906ebf901f6a01615129d2aa7b437cd40e3aa1a5794af9e40b07b9b017014e4123cefeef785cea01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940100000000000000000000000000000000000000a0e2c895d53740e942c84623e1612189e72eea9e767b150cc0d8802b490f2574b2a060b6fa13cd50ea3732f59eb726368639dea2006ab4b67dc5730ea27b0cd75732a058ac726e0fc55cd550539c38baf3f6023615e2657ceedccc21ce7edd6516bc31b901000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000083020000048347e7c4830263c82880a00000000000000000000000000000000000000000000000000000000000000000880000000000000000f904eeb9017f01f9017b86796f6c6f7632060a8301e24194000000000000000000000000000000000000aaaa8080f90111f859940000000000000000000000000000000000000000f842a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000f859940100000000000000000000000000000000000000f842a00000000000000000000000000000000000000000000000000000000000000000a00100000000000000000000000000000000000000000000000000000000000000f859940200000000000000000000000000000000000000f842a00000000000000000000000000000000000000000000000000000000000000000a0020000000000000000000000000000000000000000000000000000000000000001a0587b3fd59a84469be7c918ae73047141027d27c47cc63f3cf13c6161bf92efaaa0453d3cd2dffd1f048a58fb1046917327f5e95cc8aedc47f82d41bffebfe31bbdb9017f01f9017b86796f6c6f7632070a8301e24194000000000000000000000000000000000000aaaa8080f90111f859940000000000000000000000000000000000000000f842a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000f859940100000000000000000000000000000000000000f842a00000000000000000000000000000000000000000000000000000000000000000a00100000000000000000000000000000000000000000000000000000000000000f859940200000000000000000000000000000000000000f842a00000000000000000000000000000000000000000000000000000000000000000a0020000000000000000000000000000000000000000000000000000000000000080a0b1944f4797bf4da4d041a66be9c41c317b40d158894103ccd50de5e4ca174b4aa079d6834c013b40d0039ca6755cecc72938461e5b8cd8d3619ddcdfb15c15b866b9017f01f9017b86796f6c6f7632080a8301e24194000000000000000000000000000000000000aaaa8080f90111f859940000000000000000000000000000000000000000f842a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000f859940100000000000000000000000000000000000000f842a00000000000000000000000000000000000000000000000000000000000000000a00100000000000000000000000000000000000000000000000000000000000000f859940200000000000000000000000000000000000000f842a00000000000000000000000000000000000000000000000000000000000000000a0020000000000000000000000000000000000000000000000000000000000000001a0793cd38309611e0117269275243fc3761fe233dc371918e450b547c70132c033a07276d4b20788938ca0ff7e4e921aec7739103dc73d3b953f47947ef194720757f866090a8301e24194000000000000000000000000000000000000aaaa808086f2ded8deec88a0a6528544064aef10d166e16d3968ae83aa29161beb57f2756dfd1151682adbe7a0507fe2d475ffab209e718345a3ad9fb20fee6e15a8c4980df3ed8ff0a714367ac0",
"header": {
"parentHash": "0x1615129d2aa7b437cd40e3aa1a5794af9e40b07b9b017014e4123cefeef785ce",
"uncleHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"coinbase": "0x0100000000000000000000000000000000000000",
"stateRoot": "0xe2c895d53740e942c84623e1612189e72eea9e767b150cc0d8802b490f2574b2",
"transactionsTrie": "0x60b6fa13cd50ea3732f59eb726368639dea2006ab4b67dc5730ea27b0cd75732",
"receiptTrie": "0x58ac726e0fc55cd550539c38baf3f6023615e2657ceedccc21ce7edd6516bc31",
"bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"difficulty": "0x20000",
"number": "0x4",
"gasLimit": "0x47e7c4",
"gasUsed": "0x263c8",
"timestamp": "0x28",
"extraData": "0x",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"nonce": "0x0000000000000000",
"hash": "0xc6340ac0a1b76cae78479a4bc6211031550719fa9b58ae42d773dce7ff7409ce"
},
"transactions": [
{
"type": "0x1",
"chainId": "0x796f6c6f7632",
"nonce": "0x6",
"gasPrice": "0xa",
"gasLimit": "0x1e241",
"to": "0x000000000000000000000000000000000000aaaa",
"value": "0x0",
"data": "0x",
"accessList": [
{
"address": "0x0000000000000000000000000000000000000000",
"storageKeys": [
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x0000000000000000000000000000000000000000000000000000000000000000"
]
},
{
"address": "0x0100000000000000000000000000000000000000",
"storageKeys": [
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x0100000000000000000000000000000000000000000000000000000000000000"
]
},
{
"address": "0x0200000000000000000000000000000000000000",
"storageKeys": [
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x0200000000000000000000000000000000000000000000000000000000000000"
]
}
],
"v": "0x1",
"r": "0x587b3fd59a84469be7c918ae73047141027d27c47cc63f3cf13c6161bf92efaa",
"s": "0x453d3cd2dffd1f048a58fb1046917327f5e95cc8aedc47f82d41bffebfe31bbd",
"hash": "0xbc9b06b5d31e6e257a3c25048e935ba433c68fdd5fa5d0ddd726d5ab7356aafd"
},
{
"type": "0x1",
"chainId": "0x796f6c6f7632",
"nonce": "0x7",
"gasPrice": "0xa",
"gasLimit": "0x1e241",
"to": "0x000000000000000000000000000000000000aaaa",
"value": "0x0",
"data": "0x",
"accessList": [
{
"address": "0x0000000000000000000000000000000000000000",
"storageKeys": [
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x0000000000000000000000000000000000000000000000000000000000000000"
]
},
{
"address": "0x0100000000000000000000000000000000000000",
"storageKeys": [
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x0100000000000000000000000000000000000000000000000000000000000000"
]
},
{
"address": "0x0200000000000000000000000000000000000000",
"storageKeys": [
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x0200000000000000000000000000000000000000000000000000000000000000"
]
}
],
"v": "0x0",
"r": "0xb1944f4797bf4da4d041a66be9c41c317b40d158894103ccd50de5e4ca174b4a",
"s": "0x79d6834c013b40d0039ca6755cecc72938461e5b8cd8d3619ddcdfb15c15b866",
"hash": "0x474ec2766068f9e9d0548aca3769ca406fdde21ba87c254d9230c18be35fe99a"
},
{
"type": "0x1",
"chainId": "0x796f6c6f7632",
"nonce": "0x8",
"gasPrice": "0xa",
"gasLimit": "0x1e241",
"to": "0x000000000000000000000000000000000000aaaa",
"value": "0x0",
"data": "0x",
"accessList": [
{
"address": "0x0000000000000000000000000000000000000000",
"storageKeys": [
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x0000000000000000000000000000000000000000000000000000000000000000"
]
},
{
"address": "0x0100000000000000000000000000000000000000",
"storageKeys": [
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x0100000000000000000000000000000000000000000000000000000000000000"
]
},
{
"address": "0x0200000000000000000000000000000000000000",
"storageKeys": [
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x0200000000000000000000000000000000000000000000000000000000000000"
]
}
],
"v": "0x1",
"r": "0x793cd38309611e0117269275243fc3761fe233dc371918e450b547c70132c033",
"s": "0x7276d4b20788938ca0ff7e4e921aec7739103dc73d3b953f47947ef194720757",
"hash": "0xe46963eb63cd75a120990ca597532020bc2dcefc4588025c0d50901681a7aae9"
},
{
"type": "0x0",
"chainId": null,
"nonce": "0x9",
"gasPrice": "0xa",
"gasLimit": "0x1e241",
"to": "0x000000000000000000000000000000000000aaaa",
"value": "0x0",
"data": "0x",
"accessList": null,
"v": "0xf2ded8deec88",
"r": "0xa6528544064aef10d166e16d3968ae83aa29161beb57f2756dfd1151682adbe7",
"s": "0x507fe2d475ffab209e718345a3ad9fb20fee6e15a8c4980df3ed8ff0a714367a",
"hash": "0x61fc16fea6b57d81f269e733cdd15d994bbc10dc6e9b0acbedbe32e6fe70a06c"
}
],
"uncles": null,
"receipts": null
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,38 @@
{
"legacy_block": {
"rlp": "f90263f901f5a0151b04645af991f513d5e11f8ed62e12b73f080af9c7a6a3d98fd6b1503f23faa01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940100000000000000000000000000000000000000a0968408b8a2f170bc78230cc2fac3881120a93f7392cf26b609566d8648abfd79a0e8137f2b67ac4680d8103f8b1cd7c05c49f56e4df464b0a79253679f38df9ab4a07f53535270d749f41b9d783aa1abcfceb73cc2a16ecde789cd3bc97a42fbda2ab901000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000083020000018347e7c48262740a80a00000000000000000000000000000000000000000000000000000000000000000880000000000000000f868f866800a8301e24194000000000000000000000000000000000000aaaa808086f2ded8deec88a0e7545c5664e63873d7aeb4bb5f92152c3366a9095c9140e5f8453af0998194bea04d24143ac9bc97c0aa07a7074c12ab60484d83d3b447b1e5e6ba5cbf421675bfc0",
"header": {
"parentHash": "0x151b04645af991f513d5e11f8ed62e12b73f080af9c7a6a3d98fd6b1503f23fa",
"uncleHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"coinbase": "0x0100000000000000000000000000000000000000",
"stateRoot": "0x968408b8a2f170bc78230cc2fac3881120a93f7392cf26b609566d8648abfd79",
"transactionsTrie": "0xe8137f2b67ac4680d8103f8b1cd7c05c49f56e4df464b0a79253679f38df9ab4",
"receiptTrie": "0x7f53535270d749f41b9d783aa1abcfceb73cc2a16ecde789cd3bc97a42fbda2a",
"bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"difficulty": "0x20000",
"number": "0x1",
"gasLimit": "0x47e7c4",
"gasUsed": "0x6274",
"timestamp": "0xa",
"extraData": "0x",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"nonce": "0x0000000000000000",
"hash": "0x9aa9cdb2afc4ebf893c32b67dedf1dea4291673bf4e80d3227a4e7f8d0feaf68"
},
"transactions": [
{
"nonce": "0x0",
"gasPrice": "0xa",
"gasLimit": "0x1e241",
"to": "0x000000000000000000000000000000000000aaaa",
"value": "0x0",
"data": "0x",
"v": "0xf2ded8deec88",
"r": "0xe7545c5664e63873d7aeb4bb5f92152c3366a9095c9140e5f8453af0998194be",
"s": "0x4d24143ac9bc97c0aa07a7074c12ab60484d83d3b447b1e5e6ba5cbf421675bf",
"hash": "0x7e122173adcc02b9a3c94da426f65c7d46e724e8e3fdb16be73d5e0405e280b6"
}
],
"uncleHeaders": null
}
}

File diff suppressed because one or more lines are too long

View File

@ -68,7 +68,7 @@ impl fmt::Display for EvmTestError {
} }
} }
use ethereum; use ethereum::{self};
use ethjson::spec::ForkSpec; use ethjson::spec::ForkSpec;
/// Simplified, single-block EVM test client. /// Simplified, single-block EVM test client.
@ -99,6 +99,7 @@ impl<'a> EvmTestClient<'a> {
ForkSpec::Homestead => Some(ethereum::new_homestead_test()), ForkSpec::Homestead => Some(ethereum::new_homestead_test()),
ForkSpec::EIP150 => Some(ethereum::new_eip150_test()), ForkSpec::EIP150 => Some(ethereum::new_eip150_test()),
ForkSpec::EIP158 => Some(ethereum::new_eip161_test()), ForkSpec::EIP158 => Some(ethereum::new_eip161_test()),
ForkSpec::EIP2930 => Some(ethereum::new_eip2930_test()),
ForkSpec::Byzantium => Some(ethereum::new_byzantium_test()), ForkSpec::Byzantium => Some(ethereum::new_byzantium_test()),
ForkSpec::Constantinople => Some(ethereum::new_constantinople_test()), ForkSpec::Constantinople => Some(ethereum::new_constantinople_test()),
ForkSpec::ConstantinopleFix => Some(ethereum::new_constantinople_fix_test()), ForkSpec::ConstantinopleFix => Some(ethereum::new_constantinople_fix_test()),

View File

@ -267,6 +267,14 @@ pub fn new_berlin_test() -> Spec {
) )
} }
/// Create a new Foundation Berlin era spec.
pub fn new_eip2930_test() -> Spec {
load(
None,
include_bytes!("../../res/chainspec/test/eip2930_test.json"),
)
}
/// Create a new YOLO spec /// Create a new YOLO spec
pub fn new_yolo3_test() -> Spec { pub fn new_yolo3_test() -> Spec {
load( load(

View File

@ -208,7 +208,7 @@ pub fn json_chain_test<H: FnMut(&str, HookType)>(
match block { match block {
Ok(block) => { Ok(block) => {
let num = block.header.number(); let num = block.header.number();
trace!(target: "json-tests", "{} Importing {} bytes. Block #{}", name, bytes_len, num); debug!(target: "json-tests", "{} Importing {} bytes. Block #{}", name, bytes_len, num);
let res = client.import_block(block); let res = client.import_block(block);
if let Err(e) = res { if let Err(e) = res {
warn!(target: "json-tests", "{} Error importing block #{}: {:?}", name, num, e); warn!(target: "json-tests", "{} Error importing block #{}: {:?}", name, num, e);

View File

@ -0,0 +1,202 @@
use super::HookType;
use ethereum_types::U256;
use ethjson::{self, blockchain::Block};
use log::warn;
use rlp::RlpStream;
use std::path::Path;
use types::transaction::{TypedTransaction, TypedTxId, UnverifiedTransaction};
use verification::queue::kind::blocks::Unverified;
pub fn json_local_block_en_de_test<H: FnMut(&str, HookType)>(
_test: &ethjson::test::LocalTests,
path: &Path,
json_data: &[u8],
start_stop_hook: &mut H,
) -> Vec<String> {
let tests = ethjson::local_tests::BlockEnDeTest::load(json_data).expect(&format!(
"Could not parse JSON chain test data from {}",
path.display()
));
let mut failed = Vec::new();
for (name, ref_block) in tests.into_iter() {
start_stop_hook(&name, HookType::OnStart);
let block = Unverified::from_rlp(ref_block.rlp());
let block = match block {
Ok(block) => block,
Err(decoder_err) => {
warn!(target: "json-tests", "Error decoding test block: {:?}", decoder_err);
failed.push(name.clone());
continue;
}
};
if !is_same_block(&ref_block, &block) {
println!("block failed {:?}", block);
failed.push(name.clone())
}
start_stop_hook(&name, HookType::OnStop);
}
failed
}
fn rlp_append_block(block: &Unverified) -> Vec<u8> {
let mut rlps = RlpStream::new();
rlps.begin_list(3);
rlps.append(&block.header);
UnverifiedTransaction::rlp_append_list(&mut rlps, &block.transactions);
rlps.append_list(&block.uncles);
rlps.out()
}
pub fn is_same_block(ref_block: &Block, block: &Unverified) -> bool {
let test_exp = |exp: bool, err: &str| -> bool {
if !exp {
println!("Test mismatch on:{}", err);
}
exp
};
let header_ok = if let Some(ref header) = ref_block.header {
test_exp(*block.header.gas_used() == header.gas_used.0, "Gas used")
&& test_exp(
*block.header.uncles_hash() == header.uncles_hash.0,
"Uncles hash",
)
&& test_exp(
*block.header.transactions_root() == header.transactions_root.0,
"Transaction Root",
)
&& test_exp(
block.header.timestamp() == header.timestamp.0.as_u64(),
"Timestamp",
)
&& test_exp(
*block.header.state_root() == header.state_root.0,
"StateRoot",
)
&& test_exp(
*block.header.receipts_root() == header.receipts_root.0,
"ReceiptsRoot",
)
&& test_exp(
*block.header.parent_hash() == header.parent_hash.0,
"ParentHash",
)
&& test_exp(
block.header.number() == header.number.0.as_u64(),
"Blocn Number",
)
&& test_exp(block.header.hash() == header.hash.0, "Header hash")
&& test_exp(*block.header.gas_limit() == header.gas_limit.0, "GasLimit")
&& test_exp(*block.header.gas_used() == header.gas_used.0, "GasUsed")
&& test_exp(
*block.header.extra_data() == header.extra_data.0,
"ExtraData",
)
&& test_exp(
*block.header.difficulty() == header.difficulty.0,
"Difficulty",
)
&& test_exp(*block.header.author() == header.author.0, "Author")
&& test_exp(*block.header.log_bloom() == header.bloom.0, "Bloom")
} else {
true
};
// check transactions
let transaction_ok = if let Some(ref txs) = ref_block.transactions {
let mut is_all_ok = true;
for (ref_tx, tx) in txs.iter().zip(block.transactions.iter()) {
// check signatures
let mut is_ok = test_exp(U256::from(tx.signature().r()) == ref_tx.r.0, "Sig R")
&& test_exp(U256::from(tx.signature().s()) == ref_tx.s.0, "Sig S");
is_ok = is_ok
&& if let Some(chain_id) = ref_tx.chain_id {
test_exp(tx.chain_id() == Some(chain_id.0.as_u64()), "Chain Id")
} else {
true
};
// check type
let ttype = if let Some(ttype) = ref_tx.transaction_type {
let ttype = ttype.0.byte(0);
if let Some(id) = TypedTxId::from_u8_id(ttype) {
id
} else {
println!("Unknown transaction {}", ttype);
continue;
}
} else {
TypedTxId::Legacy
};
is_ok = is_ok
&& test_exp(tx.tx().nonce == ref_tx.nonce.0, "Tx nonce")
&& test_exp(tx.tx().gas_price == ref_tx.gas_price.0, "Tx gas price")
&& test_exp(tx.tx().gas == ref_tx.gas_limit.0, "Tx gas")
&& test_exp(tx.tx().value == ref_tx.value.0, "Tx value")
&& test_exp(tx.tx().data == ref_tx.data.0, "Tx data")
&& test_exp(ref_tx.hash.is_some(), "tx hash is none");
if let Some(hash) = ref_tx.hash {
is_ok = is_ok && test_exp(tx.hash() == hash, "Hash mismatch");
}
// check specific tx data
is_ok = is_ok
&& match ttype {
TypedTxId::Legacy => {
test_exp(tx.original_v() == ref_tx.v.0.as_u64(), "Original Sig V")
}
TypedTxId::AccessList => {
test_exp(tx.standard_v() as u64 == ref_tx.v.0.as_u64(), "Sig V");
let al = match tx.as_unsigned() {
TypedTransaction::AccessList(tx) => &tx.access_list,
_ => {
println!("Wrong data in tx type");
continue;
}
};
if let Some(ref ref_al) = ref_tx.access_list {
if ref_al.len() != al.len() {
println!("Access list mismatch");
continue;
}
let mut is_ok = true;
for (al, ref_al) in al.iter().zip(ref_al.iter()) {
is_ok = is_ok && test_exp(al.0 == ref_al.address, "AL address");
if al.1.len() != ref_al.storage_keys.len() {
println!("Access list mismatch");
continue;
}
for (key, ref_key) in al.1.iter().zip(ref_al.storage_keys.iter()) {
is_ok = is_ok && test_exp(key == ref_key, "Key mismatch");
}
}
is_ok
} else {
false
}
}
};
if !is_ok {
println!(
"Transaction not valid got: {:?} \n expected:{:?}\n",
tx, ref_tx
);
}
is_all_ok = is_ok && is_all_ok;
}
is_all_ok
} else {
true
};
let encript_ok = {
let rlp = rlp_append_block(&block);
rlp == ref_block.rlp()
};
header_ok && transaction_ok && encript_ok
}

View File

@ -19,6 +19,7 @@
mod chain; mod chain;
mod difficulty; mod difficulty;
mod executive; mod executive;
mod local;
mod state; mod state;
mod test_common; mod test_common;
mod transaction; mod transaction;

View File

@ -1,6 +1,6 @@
use ethjson::test::{ use ethjson::test::{
ChainTests, DifficultyTests, EthereumTestSuite, ExecutiveTests, StateTests, TestChainSpec, ChainTests, DifficultyTests, EthereumTestSuite, ExecutiveTests, LocalTests, StateTests,
TestTrieSpec, TransactionTests, TrieTests, TestChainSpec, TestTrieSpec, TransactionTests, TrieTests,
}; };
use globset::Glob; use globset::Glob;
use log::info; use log::info;
@ -83,6 +83,9 @@ impl TestRunner {
/// Run the tests /// Run the tests
pub fn run(&self) -> TestResult { pub fn run(&self) -> TestResult {
let mut res = TestResult::zero(); let mut res = TestResult::zero();
for t in &self.0.local {
res += Self::run_local_tests(&t);
}
for t in &self.0.chain { for t in &self.0.chain {
res += Self::run_chain_tests(&t); res += Self::run_chain_tests(&t);
} }
@ -141,6 +144,19 @@ impl TestRunner {
false false
} }
fn run_local_tests(test: &LocalTests) -> TestResult {
match test.test_type.as_str() {
"block_en_de" => Self::run1(
test,
&test.path,
|test: &LocalTests, path: &Path, json: &[u8]| {
super::local::json_local_block_en_de_test(test, &path, &json, &mut |_, _| {})
},
),
_ => TestResult::zero(),
}
}
fn run_chain_tests(test: &ChainTests) -> TestResult { fn run_chain_tests(test: &ChainTests) -> TestResult {
Self::run1( Self::run1(
test, test,

View File

@ -707,6 +707,13 @@ impl UnverifiedTransaction {
self.unsigned.rlp_append(s, self.chain_id, &self.signature); self.unsigned.rlp_append(s, self.chain_id, &self.signature);
} }
pub fn rlp_append_list(s: &mut RlpStream, tx_list: &[UnverifiedTransaction]) {
s.begin_list(tx_list.len());
for tx in tx_list.iter() {
tx.unsigned.rlp_append(s, tx.chain_id, &tx.signature);
}
}
pub fn encode(&self) -> Vec<u8> { pub fn encode(&self) -> Vec<u8> {
self.unsigned.encode(self.chain_id, &self.signature) self.unsigned.encode(self.chain_id, &self.signature)
} }

View File

@ -23,7 +23,17 @@ use std::convert::TryFrom;
#[repr(u8)] #[repr(u8)]
pub enum TypedTxId { pub enum TypedTxId {
AccessList = 0x01, AccessList = 0x01,
Legacy = 0x80, // With 0x80 we are sure that all other types will not overlap Legacy = 0x00,
}
impl TypedTxId {
pub fn from_u8_id(n: u8) -> Option<Self> {
match n {
0 => Some(Self::Legacy),
1 => Some(Self::AccessList),
_ => None,
}
}
} }
impl Default for TypedTxId { impl Default for TypedTxId {

View File

@ -23,11 +23,11 @@ use bytes::Bytes;
#[derive(Debug, PartialEq, Deserialize)] #[derive(Debug, PartialEq, Deserialize)]
pub struct Block { pub struct Block {
#[serde(rename = "blockHeader")] #[serde(rename = "blockHeader")]
header: Option<Header>, pub header: Option<Header>,
rlp: Bytes, pub rlp: Bytes,
transactions: Option<Vec<Transaction>>, pub transactions: Option<Vec<Transaction>>,
#[serde(rename = "uncleHeaders")] #[serde(rename = "uncleHeaders")]
uncles: Option<Vec<Header>>, pub uncles: Option<Vec<Header>>,
} }
impl Block { impl Block {

View File

@ -17,18 +17,31 @@
//! Blockchain test transaction deserialization. //! Blockchain test transaction deserialization.
use bytes::Bytes; use bytes::Bytes;
use ethereum_types::{H160, H256};
use uint::Uint; use uint::Uint;
/// Blockchain test transaction deserialization. /// Blockchain test transaction deserialization.
#[derive(Debug, PartialEq, Deserialize)] #[derive(Debug, PartialEq, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Transaction { pub struct Transaction {
data: Bytes, #[serde(rename = "type")]
gas_limit: Uint, pub transaction_type: Option<Uint>,
gas_price: Uint, pub data: Bytes,
nonce: Uint, pub gas_limit: Uint,
r: Uint, pub gas_price: Uint,
s: Uint, pub nonce: Uint,
v: Uint, pub r: Uint,
value: Uint, pub s: Uint,
pub v: Uint,
pub value: Uint,
pub chain_id: Option<Uint>,
pub access_list: Option<Vec<AccessList>>,
pub hash: Option<H256>,
}
#[derive(Debug, PartialEq, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct AccessList {
pub address: H160,
pub storage_keys: Vec<H256>,
} }

View File

@ -25,7 +25,7 @@ use std::{fmt, ops::Deref, str::FromStr};
/// Lenient bytes json deserialization for test json files. /// Lenient bytes json deserialization for test json files.
#[derive(Default, Debug, PartialEq, Eq, Clone, PartialOrd, Ord)] #[derive(Default, Debug, PartialEq, Eq, Clone, PartialOrd, Ord)]
pub struct Bytes(Vec<u8>); pub struct Bytes(pub Vec<u8>);
impl Bytes { impl Bytes {
/// Creates bytes struct. /// Creates bytes struct.

View File

@ -31,6 +31,7 @@ extern crate maplit;
pub mod blockchain; pub mod blockchain;
pub mod bytes; pub mod bytes;
pub mod hash; pub mod hash;
pub mod local_tests;
pub mod maybe; pub mod maybe;
pub mod spec; pub mod spec;
pub mod state; pub mod state;

View File

@ -0,0 +1,26 @@
use blockchain::block::Block;
use serde_json::{self, Error};
use std::{collections::BTreeMap, io::Read};
/// Blockchain test deserializer.
#[derive(Debug, PartialEq, Deserialize)]
pub struct BlockEnDeTest(BTreeMap<String, Block>);
impl IntoIterator for BlockEnDeTest {
type Item = <BTreeMap<String, Block> as IntoIterator>::Item;
type IntoIter = <BTreeMap<String, Block> as IntoIterator>::IntoIter;
fn into_iter(self) -> Self::IntoIter {
self.0.into_iter()
}
}
impl BlockEnDeTest {
/// Loads test from json.
pub fn load<R>(reader: R) -> Result<Self, Error>
where
R: Read,
{
serde_json::from_reader(reader)
}
}

View File

@ -25,6 +25,7 @@ use std::io::Read;
pub enum ForkSpec { pub enum ForkSpec {
EIP150, EIP150,
EIP158, EIP158,
EIP2930,
Frontier, Frontier,
Homestead, Homestead,
Byzantium, Byzantium,

View File

@ -123,6 +123,8 @@ impl SkipStates {
/// Describes a github.com/ethereum/tests suite /// Describes a github.com/ethereum/tests suite
#[derive(Debug, PartialEq, Deserialize)] #[derive(Debug, PartialEq, Deserialize)]
pub struct EthereumTestSuite { pub struct EthereumTestSuite {
/// local tests
pub local: Vec<LocalTests>,
/// Blockchain tests /// Blockchain tests
pub chain: Vec<ChainTests>, pub chain: Vec<ChainTests>,
/// State tests /// State tests
@ -159,6 +161,15 @@ pub enum TestTrieSpec {
Secure, Secure,
} }
/// A set of local tests
#[derive(Debug, PartialEq, Deserialize)]
pub struct LocalTests {
/// Path of the json tests
pub path: PathBuf,
/// Test type
pub test_type: String,
}
/// A set of blockchain tests /// A set of blockchain tests
#[derive(Debug, PartialEq, Deserialize)] #[derive(Debug, PartialEq, Deserialize)]
pub struct ChainTests { pub struct ChainTests {