mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-01-12 21:34:33 +00:00
block witness: add more tests contain invalid data
This commit is contained in:
parent
4505d87849
commit
6c583c8e32
17
stateless/fixtures/bad_address.json
Normal file
17
stateless/fixtures/bad_address.json
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"version": "0x01",
|
||||||
|
"metadata": "0x00",
|
||||||
|
"rootHash": "0x5b6f632c9fe4ab50cc0f4d09b38235a3a6afbe85048af44bae35297795a932f4",
|
||||||
|
"error": true,
|
||||||
|
"tree": [
|
||||||
|
{
|
||||||
|
"nodeType": "0x02",
|
||||||
|
"accountType": "0x00",
|
||||||
|
"address": "0xAA0e7dabd304f1acd44786d3ac613a5f2ff66b77",
|
||||||
|
"balance": "0x8cf8c7f1f3ffad95bce2f996d7e1f5a6d9aa96efce9ccba59789dcd6dce3969cc99bc9c50e",
|
||||||
|
"nonce": "0xe3f483f981dee9db5e",
|
||||||
|
"debugDepth": "0x00",
|
||||||
|
"debugHash": "0x5b6f632c9fe4ab50cc0f4d09b38235a3a6afbe85048af44bae35297795a932f4"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
17
stateless/fixtures/bad_balance.json
Normal file
17
stateless/fixtures/bad_balance.json
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"version": "0x01",
|
||||||
|
"metadata": "0x00",
|
||||||
|
"rootHash": "0x5b6f632c9fe4ab50cc0f4d09b38235a3a6afbe85048af44bae35297795a932f4",
|
||||||
|
"error": true,
|
||||||
|
"tree": [
|
||||||
|
{
|
||||||
|
"nodeType": "0x02",
|
||||||
|
"accountType": "0x00",
|
||||||
|
"address": "0x080e7dabd304f1acd44786d3ac613a5f2ff66b77",
|
||||||
|
"balance": "0x8ef8c7f1f3ffad95bce2f996d7e1f5a6d9aa96efce9ccba59789dcd6dce3969cc99bc9c50e",
|
||||||
|
"nonce": "0xe3f483f981dee9db5e",
|
||||||
|
"debugDepth": "0x00",
|
||||||
|
"debugHash": "0x5b6f632c9fe4ab50cc0f4d09b38235a3a6afbe85048af44bae35297795a932f4"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
26
stateless/fixtures/bad_code.json
Normal file
26
stateless/fixtures/bad_code.json
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"version": "0x01",
|
||||||
|
"metadata": "0x00",
|
||||||
|
"rootHash": "0x3ef071a43e07a7a209d4a67f9edd05477e8e3ac30af64656cfe784961fd2433a",
|
||||||
|
"error": true,
|
||||||
|
"tree": [
|
||||||
|
{
|
||||||
|
"nodeType": "0x02",
|
||||||
|
"accountType": "0x01",
|
||||||
|
"address": "0x720ef0ee74f1b3b8252eb3270d484b223f775810",
|
||||||
|
"balance": "0xb3c2cee7e2cb9289c8cdd1d9b99ff0e7829fdce2f5afd2fca6a2ff9f9bf8e38493d09bc403",
|
||||||
|
"nonce": "0xad83abd1899ad9ee56",
|
||||||
|
"codeType": "0x00",
|
||||||
|
"codeLen": "0x3d",
|
||||||
|
"code": "0xefda93a915fe9ac8998e195a5fe0bb85a2474e676551e8978cba5b5ea3af0dc90606fd0e6d4f07b0262ada94b579676f51e4226b2dc456be061e99",
|
||||||
|
"storage": [
|
||||||
|
{
|
||||||
|
"nodeType": "0x03",
|
||||||
|
"data": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"debugDepth": "0x00",
|
||||||
|
"debugHash": "0x3ef071a43e07a7a209d4a67f9edd05477e8e3ac30af64656cfe784961fd2433a"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
26
stateless/fixtures/bad_code_len.json
Normal file
26
stateless/fixtures/bad_code_len.json
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"version": "0x01",
|
||||||
|
"metadata": "0x00",
|
||||||
|
"rootHash": "0x3ef071a43e07a7a209d4a67f9edd05477e8e3ac30af64656cfe784961fd2433a",
|
||||||
|
"error": true,
|
||||||
|
"tree": [
|
||||||
|
{
|
||||||
|
"nodeType": "0x02",
|
||||||
|
"accountType": "0x01",
|
||||||
|
"address": "0x720ef0ee74f1b3b8252eb3270d484b223f775810",
|
||||||
|
"balance": "0xb3c2cee7e2cb9289c8cdd1d9b99ff0e7829fdce2f5afd2fca6a2ff9f9bf8e38493d09bc403",
|
||||||
|
"nonce": "0xad83abd1899ad9ee56",
|
||||||
|
"codeType": "0x00",
|
||||||
|
"codeLen": "0xee56",
|
||||||
|
"code": "0x09ddefda93a915fe9ac8998e195a5fe0bb85a2474e676551e8978cba5b5ea3af0dc90606fd0e6d4f07b0262ada94b579676f51e4226b2dc456be061e99",
|
||||||
|
"storage": [
|
||||||
|
{
|
||||||
|
"nodeType": "0x03",
|
||||||
|
"data": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"debugDepth": "0x00",
|
||||||
|
"debugHash": "0x3ef071a43e07a7a209d4a67f9edd05477e8e3ac30af64656cfe784961fd2433a"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
17
stateless/fixtures/bad_nonce.json
Normal file
17
stateless/fixtures/bad_nonce.json
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"version": "0x01",
|
||||||
|
"metadata": "0x00",
|
||||||
|
"rootHash": "0x5b6f632c9fe4ab50cc0f4d09b38235a3a6afbe85048af44bae35297795a932f4",
|
||||||
|
"error": true,
|
||||||
|
"tree": [
|
||||||
|
{
|
||||||
|
"nodeType": "0x02",
|
||||||
|
"accountType": "0x00",
|
||||||
|
"address": "0x080e7dabd304f1acd44786d3ac613a5f2ff66b77",
|
||||||
|
"balance": "0x8cf8c7f1f3ffad95bce2f996d7e1f5a6d9aa96efce9ccba59789dcd6dce3969cc99bc9c50e",
|
||||||
|
"nonce": "0xEEe3f483f981dee9db5e",
|
||||||
|
"debugDepth": "0x00",
|
||||||
|
"debugHash": "0x5b6f632c9fe4ab50cc0f4d09b38235a3a6afbe85048af44bae35297795a932f4"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
26
stateless/fixtures/code_len_exceed_eip170.json
Normal file
26
stateless/fixtures/code_len_exceed_eip170.json
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"version": "0x01",
|
||||||
|
"metadata": "0x00",
|
||||||
|
"rootHash": "0x3ef071a43e07a7a209d4a67f9edd05477e8e3ac30af64656cfe784961fd2433a",
|
||||||
|
"error": true,
|
||||||
|
"tree": [
|
||||||
|
{
|
||||||
|
"nodeType": "0x02",
|
||||||
|
"accountType": "0x01",
|
||||||
|
"address": "0x720ef0ee74f1b3b8252eb3270d484b223f775810",
|
||||||
|
"balance": "0xb3c2cee7e2cb9289c8cdd1d9b99ff0e7829fdce2f5afd2fca6a2ff9f9bf8e38493d09bc403",
|
||||||
|
"nonce": "0xad83abd1899ad9ee56",
|
||||||
|
"codeType": "0x00",
|
||||||
|
"codeLen": "0xad9ee56",
|
||||||
|
"code": "0x09ddefda93a915fe9ac8998e195a5fe0bb85a2474e676551e8978cba5b5ea3af0dc90606fd0e6d4f07b0262ada94b579676f51e4226b2dc456be061e99",
|
||||||
|
"storage": [
|
||||||
|
{
|
||||||
|
"nodeType": "0x03",
|
||||||
|
"data": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"debugDepth": "0x00",
|
||||||
|
"debugHash": "0x3ef071a43e07a7a209d4a67f9edd05477e8e3ac30af64656cfe784961fd2433a"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
18
stateless/fixtures/invalid_account_type.json
Normal file
18
stateless/fixtures/invalid_account_type.json
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"version": "0x01",
|
||||||
|
"metadata": "0x00",
|
||||||
|
"rootHash": "0x5b6f632c9fe4ab50cc0f4d09b38235a3a6afbe85048af44bae35297795a932f4",
|
||||||
|
"error": true,
|
||||||
|
"tree": [
|
||||||
|
{
|
||||||
|
"nodeType": "0x02",
|
||||||
|
"accountType": "0x00",
|
||||||
|
"accountTypeSub": "0x07",
|
||||||
|
"address": "0x080e7dabd304f1acd44786d3ac613a5f2ff66b77",
|
||||||
|
"balance": "0x8cf8c7f1f3ffad95bce2f996d7e1f5a6d9aa96efce9ccba59789dcd6dce3969cc99bc9c50e",
|
||||||
|
"nonce": "0xe3f483f981dee9db5e",
|
||||||
|
"debugDepth": "0x00",
|
||||||
|
"debugHash": "0x5b6f632c9fe4ab50cc0f4d09b38235a3a6afbe85048af44bae35297795a932f4"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
29
stateless/fixtures/invalid_code_len.json
Normal file
29
stateless/fixtures/invalid_code_len.json
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"version": "0x01",
|
||||||
|
"metadata": "0x00",
|
||||||
|
"rootHash": "0x12d52947c2ec748f833d7d13d78ffac0594834a5e6d8e4e32831f4717eefc64d",
|
||||||
|
"error": true,
|
||||||
|
"tree": [
|
||||||
|
{
|
||||||
|
"nodeType": "0x02",
|
||||||
|
"accountType": "0x01",
|
||||||
|
"address": "0x205aea15c1e739b4acdae0cc3b57c34f55907a73",
|
||||||
|
"balance": "0x8ca589e2e38294c9899abddfbbe887c9bbc5d296eda1f59b8180d8d88883c88d9a86bdba06",
|
||||||
|
"nonce": "0xa3e99cc2e5e5e5d6ce01",
|
||||||
|
"codeType": "0x01",
|
||||||
|
"codeLen": "0xa3e99cc2e5e5e5d6ce01",
|
||||||
|
"codeHash": {
|
||||||
|
"nodeType": "0x03",
|
||||||
|
"data": "0x8dd74346f58c605477239378ca66f42e8a75b9cc8aea3287ad30c8a5932a92da"
|
||||||
|
},
|
||||||
|
"storage": [
|
||||||
|
{
|
||||||
|
"nodeType": "0x03",
|
||||||
|
"data": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"debugDepth": "0x00",
|
||||||
|
"debugHash": "0x12d52947c2ec748f833d7d13d78ffac0594834a5e6d8e4e32831f4717eefc64d"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
29
stateless/fixtures/invalid_code_len2.json
Normal file
29
stateless/fixtures/invalid_code_len2.json
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"version": "0x01",
|
||||||
|
"metadata": "0x00",
|
||||||
|
"rootHash": "0x12d52947c2ec748f833d7d13d78ffac0594834a5e6d8e4e32831f4717eefc64d",
|
||||||
|
"error": true,
|
||||||
|
"tree": [
|
||||||
|
{
|
||||||
|
"nodeType": "0x02",
|
||||||
|
"accountType": "0x01",
|
||||||
|
"address": "0x205aea15c1e739b4acdae0cc3b57c34f55907a73",
|
||||||
|
"balance": "0x8ca589e2e38294c9899abddfbbe887c9bbc5d296eda1f59b8180d8d88883c88d9a86bdba06",
|
||||||
|
"nonce": "0xa3e99cc2e5e5e5d6ce01",
|
||||||
|
"codeType": "0x01",
|
||||||
|
"codeLen": "0xcc2e5e5e5d6ce01",
|
||||||
|
"codeHash": {
|
||||||
|
"nodeType": "0x03",
|
||||||
|
"data": "0x8dd74346f58c605477239378ca66f42e8a75b9cc8aea3287ad30c8a5932a92da"
|
||||||
|
},
|
||||||
|
"storage": [
|
||||||
|
{
|
||||||
|
"nodeType": "0x03",
|
||||||
|
"data": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"debugDepth": "0x00",
|
||||||
|
"debugHash": "0x12d52947c2ec748f833d7d13d78ffac0594834a5e6d8e4e32831f4717eefc64d"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
29
stateless/fixtures/invalid_code_type.json
Normal file
29
stateless/fixtures/invalid_code_type.json
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"version": "0x01",
|
||||||
|
"metadata": "0x00",
|
||||||
|
"rootHash": "0x12d52947c2ec748f833d7d13d78ffac0594834a5e6d8e4e32831f4717eefc64d",
|
||||||
|
"error": true,
|
||||||
|
"tree": [
|
||||||
|
{
|
||||||
|
"nodeType": "0x02",
|
||||||
|
"accountType": "0x01",
|
||||||
|
"address": "0x205aea15c1e739b4acdae0cc3b57c34f55907a73",
|
||||||
|
"balance": "0x8ca589e2e38294c9899abddfbbe887c9bbc5d296eda1f59b8180d8d88883c88d9a86bdba06",
|
||||||
|
"nonce": "0xa3e99cc2e5e5e5d6ce01",
|
||||||
|
"codeType": "0x07",
|
||||||
|
"codeLen": "0x5e",
|
||||||
|
"codeHash": {
|
||||||
|
"nodeType": "0x03",
|
||||||
|
"data": "0x8dd74346f58c605477239378ca66f42e8a75b9cc8aea3287ad30c8a5932a92da"
|
||||||
|
},
|
||||||
|
"storage": [
|
||||||
|
{
|
||||||
|
"nodeType": "0x03",
|
||||||
|
"data": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"debugDepth": "0x00",
|
||||||
|
"debugHash": "0x12d52947c2ec748f833d7d13d78ffac0594834a5e6d8e4e32831f4717eefc64d"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
29
stateless/fixtures/invalid_hash_type.json
Normal file
29
stateless/fixtures/invalid_hash_type.json
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"version": "0x01",
|
||||||
|
"metadata": "0x00",
|
||||||
|
"rootHash": "0x12d52947c2ec748f833d7d13d78ffac0594834a5e6d8e4e32831f4717eefc64d",
|
||||||
|
"error": true,
|
||||||
|
"tree": [
|
||||||
|
{
|
||||||
|
"nodeType": "0x02",
|
||||||
|
"accountType": "0x01",
|
||||||
|
"address": "0x205aea15c1e739b4acdae0cc3b57c34f55907a73",
|
||||||
|
"balance": "0x8ca589e2e38294c9899abddfbbe887c9bbc5d296eda1f59b8180d8d88883c88d9a86bdba06",
|
||||||
|
"nonce": "0xa3e99cc2e5e5e5d6ce01",
|
||||||
|
"codeType": "0x01",
|
||||||
|
"codeLen": "0x5e",
|
||||||
|
"codeHash": {
|
||||||
|
"nodeType": "0x04",
|
||||||
|
"data": "0x8dd74346f58c605477239378ca66f42e8a75b9cc8aea3287ad30c8a5932a92da"
|
||||||
|
},
|
||||||
|
"storage": [
|
||||||
|
{
|
||||||
|
"nodeType": "0x03",
|
||||||
|
"data": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"debugDepth": "0x00",
|
||||||
|
"debugHash": "0x12d52947c2ec748f833d7d13d78ffac0594834a5e6d8e4e32831f4717eefc64d"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
17
stateless/fixtures/invalid_metadata.json
Normal file
17
stateless/fixtures/invalid_metadata.json
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"version": "0x01",
|
||||||
|
"metadata": "0x01",
|
||||||
|
"rootHash": "0x5b6f632c9fe4ab50cc0f4d09b38235a3a6afbe85048af44bae35297795a932f4",
|
||||||
|
"error": true,
|
||||||
|
"tree": [
|
||||||
|
{
|
||||||
|
"nodeType": "0x02",
|
||||||
|
"accountType": "0x00",
|
||||||
|
"address": "0x080e7dabd304f1acd44786d3ac613a5f2ff66b77",
|
||||||
|
"balance": "0x8cf8c7f1f3ffad95bce2f996d7e1f5a6d9aa96efce9ccba59789dcd6dce3969cc99bc9c50e",
|
||||||
|
"nonce": "0xe3f483f981dee9db5e",
|
||||||
|
"debugDepth": "0x00",
|
||||||
|
"debugHash": "0x5b6f632c9fe4ab50cc0f4d09b38235a3a6afbe85048af44bae35297795a932f4"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
17
stateless/fixtures/invalid_node_type.json
Normal file
17
stateless/fixtures/invalid_node_type.json
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"version": "0x01",
|
||||||
|
"metadata": "0x00",
|
||||||
|
"rootHash": "0x5b6f632c9fe4ab50cc0f4d09b38235a3a6afbe85048af44bae35297795a932f4",
|
||||||
|
"error": true,
|
||||||
|
"tree": [
|
||||||
|
{
|
||||||
|
"nodeType": "0x06",
|
||||||
|
"accountType": "0x00",
|
||||||
|
"address": "0x080e7dabd304f1acd44786d3ac613a5f2ff66b77",
|
||||||
|
"balance": "0x8cf8c7f1f3ffad95bce2f996d7e1f5a6d9aa96efce9ccba59789dcd6dce3969cc99bc9c50e",
|
||||||
|
"nonce": "0xe3f483f981dee9db5e",
|
||||||
|
"debugDepth": "0x00",
|
||||||
|
"debugHash": "0x5b6f632c9fe4ab50cc0f4d09b38235a3a6afbe85048af44bae35297795a932f4"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
29
stateless/fixtures/invalid_storage_hash_type.json
Normal file
29
stateless/fixtures/invalid_storage_hash_type.json
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"version": "0x01",
|
||||||
|
"metadata": "0x00",
|
||||||
|
"rootHash": "0x12d52947c2ec748f833d7d13d78ffac0594834a5e6d8e4e32831f4717eefc64d",
|
||||||
|
"error": true,
|
||||||
|
"tree": [
|
||||||
|
{
|
||||||
|
"nodeType": "0x02",
|
||||||
|
"accountType": "0x01",
|
||||||
|
"address": "0x205aea15c1e739b4acdae0cc3b57c34f55907a73",
|
||||||
|
"balance": "0x8ca589e2e38294c9899abddfbbe887c9bbc5d296eda1f59b8180d8d88883c88d9a86bdba06",
|
||||||
|
"nonce": "0xa3e99cc2e5e5e5d6ce01",
|
||||||
|
"codeType": "0x01",
|
||||||
|
"codeLen": "0x5e",
|
||||||
|
"codeHash": {
|
||||||
|
"nodeType": "0x03",
|
||||||
|
"data": "0x8dd74346f58c605477239378ca66f42e8a75b9cc8aea3287ad30c8a5932a92da"
|
||||||
|
},
|
||||||
|
"storage": [
|
||||||
|
{
|
||||||
|
"nodeType": "0x04",
|
||||||
|
"data": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"debugDepth": "0x00",
|
||||||
|
"debugHash": "0x12d52947c2ec748f833d7d13d78ffac0594834a5e6d8e4e32831f4717eefc64d"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
17
stateless/fixtures/invalid_version.json
Normal file
17
stateless/fixtures/invalid_version.json
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"version": "0x02",
|
||||||
|
"metadata": "0x00",
|
||||||
|
"rootHash": "0x5b6f632c9fe4ab50cc0f4d09b38235a3a6afbe85048af44bae35297795a932f4",
|
||||||
|
"error": true,
|
||||||
|
"tree": [
|
||||||
|
{
|
||||||
|
"nodeType": "0x02",
|
||||||
|
"accountType": "0x00",
|
||||||
|
"address": "0x080e7dabd304f1acd44786d3ac613a5f2ff66b77",
|
||||||
|
"balance": "0x8cf8c7f1f3ffad95bce2f996d7e1f5a6d9aa96efce9ccba59789dcd6dce3969cc99bc9c50e",
|
||||||
|
"nonce": "0xe3f483f981dee9db5e",
|
||||||
|
"debugDepth": "0x00",
|
||||||
|
"debugHash": "0x5b6f632c9fe4ab50cc0f4d09b38235a3a6afbe85048af44bae35297795a932f4"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
18
stateless/fixtures/valid_account_type_invalid_data.json
Normal file
18
stateless/fixtures/valid_account_type_invalid_data.json
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"version": "0x01",
|
||||||
|
"metadata": "0x00",
|
||||||
|
"rootHash": "0x5b6f632c9fe4ab50cc0f4d09b38235a3a6afbe85048af44bae35297795a932f4",
|
||||||
|
"error": true,
|
||||||
|
"tree": [
|
||||||
|
{
|
||||||
|
"nodeType": "0x02",
|
||||||
|
"accountType": "0x00",
|
||||||
|
"accountTypeSub": "0x01",
|
||||||
|
"address": "0x080e7dabd304f1acd44786d3ac613a5f2ff66b77",
|
||||||
|
"balance": "0x8cf8c7f1f3ffad95bce2f996d7e1f5a6d9aa96efce9ccba59789dcd6dce3969cc99bc9c50e",
|
||||||
|
"nonce": "0xe3f483f981dee9db5e",
|
||||||
|
"debugDepth": "0x00",
|
||||||
|
"debugHash": "0x5b6f632c9fe4ab50cc0f4d09b38235a3a6afbe85048af44bae35297795a932f4"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
29
stateless/fixtures/valid_code_type_invalid_data.json
Normal file
29
stateless/fixtures/valid_code_type_invalid_data.json
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"version": "0x01",
|
||||||
|
"metadata": "0x00",
|
||||||
|
"rootHash": "0x12d52947c2ec748f833d7d13d78ffac0594834a5e6d8e4e32831f4717eefc64d",
|
||||||
|
"error": true,
|
||||||
|
"tree": [
|
||||||
|
{
|
||||||
|
"nodeType": "0x02",
|
||||||
|
"accountType": "0x01",
|
||||||
|
"address": "0x205aea15c1e739b4acdae0cc3b57c34f55907a73",
|
||||||
|
"balance": "0x8ca589e2e38294c9899abddfbbe887c9bbc5d296eda1f59b8180d8d88883c88d9a86bdba06",
|
||||||
|
"nonce": "0xa3e99cc2e5e5e5d6ce01",
|
||||||
|
"codeType": "0x02",
|
||||||
|
"codeLen": "0x5e",
|
||||||
|
"codeHash": {
|
||||||
|
"nodeType": "0x03",
|
||||||
|
"data": "0x8dd74346f58c605477239378ca66f42e8a75b9cc8aea3287ad30c8a5932a92da"
|
||||||
|
},
|
||||||
|
"storage": [
|
||||||
|
{
|
||||||
|
"nodeType": "0x03",
|
||||||
|
"data": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"debugDepth": "0x00",
|
||||||
|
"debugHash": "0x12d52947c2ec748f833d7d13d78ffac0594834a5e6d8e4e32831f4717eefc64d"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
29
stateless/fixtures/valid_hash_type_bad_data.json
Normal file
29
stateless/fixtures/valid_hash_type_bad_data.json
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"version": "0x01",
|
||||||
|
"metadata": "0x00",
|
||||||
|
"rootHash": "0x12d52947c2ec748f833d7d13d78ffac0594834a5e6d8e4e32831f4717eefc64d",
|
||||||
|
"error": true,
|
||||||
|
"tree": [
|
||||||
|
{
|
||||||
|
"nodeType": "0x02",
|
||||||
|
"accountType": "0x01",
|
||||||
|
"address": "0x205aea15c1e739b4acdae0cc3b57c34f55907a73",
|
||||||
|
"balance": "0x8ca589e2e38294c9899abddfbbe887c9bbc5d296eda1f59b8180d8d88883c88d9a86bdba06",
|
||||||
|
"nonce": "0xa3e99cc2e5e5e5d6ce01",
|
||||||
|
"codeType": "0x01",
|
||||||
|
"codeLen": "0x5e",
|
||||||
|
"codeHash": {
|
||||||
|
"nodeType": "0x02",
|
||||||
|
"data": "0x8dd74346f58c605477239378ca66f42e8a75b9cc8aea3287ad30c8a5932a92da"
|
||||||
|
},
|
||||||
|
"storage": [
|
||||||
|
{
|
||||||
|
"nodeType": "0x03",
|
||||||
|
"data": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"debugDepth": "0x00",
|
||||||
|
"debugHash": "0x12d52947c2ec748f833d7d13d78ffac0594834a5e6d8e4e32831f4717eefc64d"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
18
stateless/fixtures/valid_node_type_invalid_data.json
Normal file
18
stateless/fixtures/valid_node_type_invalid_data.json
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"version": "0x01",
|
||||||
|
"metadata": "0x00",
|
||||||
|
"rootHash": "0x5b6f632c9fe4ab50cc0f4d09b38235a3a6afbe85048af44bae35297795a932f4",
|
||||||
|
"error": true,
|
||||||
|
"tree": [
|
||||||
|
{
|
||||||
|
"nodeType": "0x02",
|
||||||
|
"nodeTypeSub": "0x00",
|
||||||
|
"accountType": "0x00",
|
||||||
|
"address": "0x080e7dabd304f1acd44786d3ac613a5f2ff66b77",
|
||||||
|
"balance": "0x8cf8c7f1f3ffad95bce2f996d7e1f5a6d9aa96efce9ccba59789dcd6dce3969cc99bc9c50e",
|
||||||
|
"nonce": "0xe3f483f981dee9db5e",
|
||||||
|
"debugDepth": "0x00",
|
||||||
|
"debugHash": "0x5b6f632c9fe4ab50cc0f4d09b38235a3a6afbe85048af44bae35297795a932f4"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -28,18 +28,28 @@ proc processExtensionNode(t: var Tester, x: JsonNode) =
|
|||||||
t.write(x["nibblesLen"])
|
t.write(x["nibblesLen"])
|
||||||
t.write(x["nibbles"])
|
t.write(x["nibbles"])
|
||||||
|
|
||||||
proc processHashNode(t: var Tester, x: JsonNode) =
|
|
||||||
t.write(x["data"])
|
|
||||||
|
|
||||||
proc processNode(t: var Tester, x: JsonNode, storageMode: bool = false)
|
proc processNode(t: var Tester, x: JsonNode, storageMode: bool = false)
|
||||||
|
|
||||||
|
proc writeSub(t: var Tester, x: JsonNode, name: string): string =
|
||||||
|
let subName = name & "Sub"
|
||||||
|
let nodeType = x[name].getStr()
|
||||||
|
if subName in x:
|
||||||
|
let subType = x[subName].getStr()
|
||||||
|
t.write(subType)
|
||||||
|
else:
|
||||||
|
t.write(nodeType)
|
||||||
|
result = nodeType
|
||||||
|
|
||||||
|
proc processHashNode(t: var Tester, x: JsonNode) =
|
||||||
|
discard t.writeSub(x, "nodeType")
|
||||||
|
t.write(x["data"])
|
||||||
|
|
||||||
proc processStorage(t: var Tester, tree: JsonNode) =
|
proc processStorage(t: var Tester, tree: JsonNode) =
|
||||||
for x in tree:
|
for x in tree:
|
||||||
t.processNode(x, true)
|
t.processNode(x, true)
|
||||||
|
|
||||||
proc processByteCode(t: var Tester, x: JsonNode) =
|
proc processByteCode(t: var Tester, x: JsonNode) =
|
||||||
let codeType = x["codeType"].getStr()
|
let codeType = t.writeSub(x, "codeType")
|
||||||
t.write(codeType)
|
|
||||||
case codeType
|
case codeType
|
||||||
of "0x00":
|
of "0x00":
|
||||||
let codeLen = x["codeLen"].getStr()
|
let codeLen = x["codeLen"].getStr()
|
||||||
@ -48,14 +58,12 @@ proc processByteCode(t: var Tester, x: JsonNode) =
|
|||||||
t.write(x["code"])
|
t.write(x["code"])
|
||||||
of "0x01":
|
of "0x01":
|
||||||
t.write(x["codeLen"])
|
t.write(x["codeLen"])
|
||||||
t.write("0x03")
|
|
||||||
t.processHashNode(x["codeHash"])
|
t.processHashNode(x["codeHash"])
|
||||||
else:
|
else:
|
||||||
doAssert(false, "wrong bytecode type")
|
raise newException(ParsingError, "wrong bytecode type")
|
||||||
|
|
||||||
proc processAccountNode(t: var Tester, x: JsonNode) =
|
proc processAccountNode(t: var Tester, x: JsonNode) =
|
||||||
let accountType = x["accountType"].getStr()
|
let accountType = t.writeSub(x, "accountType")
|
||||||
t.write(accountType)
|
|
||||||
t.write(x["address"])
|
t.write(x["address"])
|
||||||
t.write(x["balance"])
|
t.write(x["balance"])
|
||||||
t.write(x["nonce"])
|
t.write(x["nonce"])
|
||||||
@ -67,15 +75,14 @@ proc processAccountNode(t: var Tester, x: JsonNode) =
|
|||||||
t.processByteCode(x)
|
t.processByteCode(x)
|
||||||
t.processStorage(x["storage"])
|
t.processStorage(x["storage"])
|
||||||
else:
|
else:
|
||||||
doAssert(false, "wrong account type")
|
raise newException(ParsingError, "wrong account type")
|
||||||
|
|
||||||
proc processStorageLeafNode(t: var Tester, x: JsonNode) =
|
proc processStorageLeafNode(t: var Tester, x: JsonNode) =
|
||||||
t.write(x["key"])
|
t.write(x["key"])
|
||||||
t.write(x["value"])
|
t.write(x["value"])
|
||||||
|
|
||||||
proc processNode(t: var Tester, x: JsonNode, storageMode: bool = false) =
|
proc processNode(t: var Tester, x: JsonNode, storageMode: bool = false) =
|
||||||
let nodeType = x["nodeType"].getStr()
|
let nodeType = t.writeSub(x, "nodeType")
|
||||||
t.write(nodeType)
|
|
||||||
case nodeType
|
case nodeType
|
||||||
of "0x00": t.processBranchNode(x)
|
of "0x00": t.processBranchNode(x)
|
||||||
of "0x01": t.processExtensionNode(x)
|
of "0x01": t.processExtensionNode(x)
|
||||||
@ -84,9 +91,10 @@ proc processNode(t: var Tester, x: JsonNode, storageMode: bool = false) =
|
|||||||
t.processStorageLeafNode(x)
|
t.processStorageLeafNode(x)
|
||||||
else:
|
else:
|
||||||
t.processAccountNode(x)
|
t.processAccountNode(x)
|
||||||
of "0x03": t.processHashNode(x)
|
of "0x03":
|
||||||
|
t.write(x["data"])
|
||||||
else:
|
else:
|
||||||
doAssert(false, "wrong node type")
|
raise newException(ParsingError, "wrong node type")
|
||||||
|
|
||||||
proc parseRootHash(x: string): KeccakHash =
|
proc parseRootHash(x: string): KeccakHash =
|
||||||
result.data = hexToByteArray[32](x)
|
result.data = hexToByteArray[32](x)
|
||||||
@ -98,8 +106,11 @@ proc parseTester(t: var Tester, n: JsonNode) =
|
|||||||
t.write(n["metadata"])
|
t.write(n["metadata"])
|
||||||
|
|
||||||
let tree = n["tree"]
|
let tree = n["tree"]
|
||||||
|
try:
|
||||||
for x in tree:
|
for x in tree:
|
||||||
t.processNode(x)
|
t.processNode(x)
|
||||||
|
except ParsingError:
|
||||||
|
check t.error == true
|
||||||
|
|
||||||
proc parseTester(filename: string): Tester =
|
proc parseTester(filename: string): Tester =
|
||||||
let n = parseFile(filename)
|
let n = parseFile(filename)
|
||||||
@ -109,9 +120,17 @@ proc runTest(filePath, fileName: string) =
|
|||||||
test fileName:
|
test fileName:
|
||||||
let t = parseTester(filePath)
|
let t = parseTester(filePath)
|
||||||
var db = newMemoryDB()
|
var db = newMemoryDB()
|
||||||
|
try:
|
||||||
var tb = initTreeBuilder(t.output, db, {wfEIP170})
|
var tb = initTreeBuilder(t.output, db, {wfEIP170})
|
||||||
let root = tb.buildTree()
|
let root = tb.buildTree()
|
||||||
|
if t.error:
|
||||||
|
check root != t.rootHash
|
||||||
|
else:
|
||||||
check root == t.rootHash
|
check root == t.rootHash
|
||||||
|
check t.error == false
|
||||||
|
except ParsingError, ContractCodeError:
|
||||||
|
debugEcho "Error detected ", getCurrentExceptionMsg()
|
||||||
|
check t.error == true
|
||||||
|
|
||||||
proc witnessJsonMain*() =
|
proc witnessJsonMain*() =
|
||||||
for x in walkDirRec("stateless" / "fixtures"):
|
for x in walkDirRec("stateless" / "fixtures"):
|
||||||
|
@ -99,13 +99,13 @@ proc safeReadByte(t: var TreeBuilder): byte =
|
|||||||
if t.readable:
|
if t.readable:
|
||||||
result = t.readByte()
|
result = t.readByte()
|
||||||
else:
|
else:
|
||||||
raise newException(IOError, "Cannot read byte from input stream")
|
raise newException(ParsingError, "Cannot read byte from input stream")
|
||||||
|
|
||||||
proc safeReadU32(t: var TreeBuilder): uint32 =
|
proc safeReadU32(t: var TreeBuilder): uint32 =
|
||||||
if t.readable(4):
|
if t.readable(4):
|
||||||
result = fromBytesBE(uint32, t.read(4))
|
result = fromBytesBE(uint32, t.read(4))
|
||||||
else:
|
else:
|
||||||
raise newException(IOError, "Cannot read U32 from input stream")
|
raise newException(ParsingError, "Cannot read U32 from input stream")
|
||||||
|
|
||||||
template safeReadEnum(t: var TreeBuilder, T: type): untyped =
|
template safeReadEnum(t: var TreeBuilder, T: type): untyped =
|
||||||
let typ = t.safeReadByte.int
|
let typ = t.safeReadByte.int
|
||||||
|
Loading…
x
Reference in New Issue
Block a user