Skip to content

Commit

Permalink
Update EOF validation test for top-level containers
Browse files Browse the repository at this point in the history
- Update tests because of the validation rule change: top-level
  containers must not have truncated data.
- Fix some expected error messages.
- Change ">=Prague" to "Prague" because not supported in retesteth.
  • Loading branch information
chfast committed Jun 6, 2024
1 parent 6785644 commit 8e505c2
Show file tree
Hide file tree
Showing 10 changed files with 230 additions and 215 deletions.
22 changes: 12 additions & 10 deletions EOFTests/EIP3540/validInvalid.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
"validInvalid" : {
"_info" : {
"comment" : "Test various examples to see if they are valid or invalid.\nImplements\n EOF1V3540_0001 (Valid) Deployed code without data section - Data index: 0\n EOF1V3540_0002 (Valid) Deployed code with data section - Data index: 1\n EOF1V3540_0003 (Valid) No data section contents (valid according to relaxed stack validation) - Data index: 2\n EOF1V3540_0004 (Valid) Data section contents incomplete (valid according to relaxed stack validation) - Data index: 3\n EOF1I3540_0001 (Invalid) No magic - Data index: 4\n EOF1I3540_0002 (Invalid) Invalid magic - Data index: 5\n EOF1I3540_0003 - Data index: 6\n EOF1I3540_0004 - Data index: 7\n EOF1I3540_0005 (Invalid) No version - Data index: 8\n EOF1I3540_0006 (Invalid) Invalid version - Data index: 9\n EOF1I3540_0007 - Data index: 10\n EOF1I3540_0008 - Data index: 11\n EOF1I3540_0009 (Invalid) No header - Data index: 12\n EOF1I3540_0010 (Invalid) No type section size - Data index: 13\n EOF1I3540_0011 (Invalid) Type section size incomplete - Data index: 14\n EOF1I3540_0012 (Invalid) Empty code section with non-empty data section - Data index: 15\n EOF1I3540_0013 (Invalid) No total of code sections - Data index: 16\n EOF1I3540_0014 (Invalid) Total of code sections incomplete - Data index: 17\n EOF1I3540_0015 (Invalid) No code section size - Data index: 18\n EOF1I3540_0016 (Invalid) Code section size incomplete - Data index: 19\n EOF1I3540_0017 (Invalid) No data section after code section size - Data index: 20\n EOF1I3540_0018 (Invalid) No data size - Data index: 21\n EOF1I3540_0019 (Invalid) Data size incomplete - Data index: 22\n EOF1I3540_0020 (Invalid) No section terminator after data section size - Data index: 23\n EOF1I3540_0021 (Invalid) No type section contents - Data index: 24\n EOF1I3540_0022 (Invalid) Type section contents (no outputs and max stack) - Data index: 25\n EOF1I3540_0023 (Invalid) Type section contents (no max stack) - Data index: 26\n EOF1I3540_0024 (Invalid) Type section contents (max stack incomplete) - Data index: 27\n EOF1I3540_0025 (Invalid) No code section contents - Data index: 28\n EOF1I3540_0026 (Invalid) Code section contents incomplete - Data index: 29\n EOF1I3540_0027 (Invalid) Trailing bytes after code section - Data index: 30\n EOF1I3540_0028 (Invalid) Empty code section - Data index: 31\n EOF1I3540_0029 (Invalid) Empty code section with non-empty data section - Data index: 32\n EOF1I3540_0030 (Invalid) Code section preceding type section - Data index: 33\n EOF1I3540_0031 (Invalid) Data section preceding type section - Data index: 34\n EOF1I3540_0032 (Invalid) Data section preceding code section - Data index: 35\n EOF1I3540_0033 (Invalid) Data section without code section - Data index: 36\n EOF1I3540_0034 (Invalid) No data section - Data index: 37\n EOF1I3540_0035 (Invalid) Trailing bytes after data section - Data index: 38\n EOF1I3540_0036 (Invalid) Multiple data sections - Data index: 39\n EOF1I3540_0037 (Invalid) Multiple code and data sections - Data index: 40\n EOF1I3540_0038 (Invalid) Unknown section IDs (at the beginning) - Data index: 41\n EOF1I3540_0039 - Data index: 42\n EOF1I3540_0040 - Data index: 43\n EOF1I3540_0041 (Invalid) Unknown section IDs (after types section) - Data index: 44\n EOF1I3540_0042 - Data index: 45\n EOF1I3540_0043 - Data index: 46\n EOF1I3540_0044 (Invalid) Unknown section IDs (after code section) - Data index: 47\n EOF1I3540_0045 - Data index: 48\n EOF1I3540_0046 - Data index: 49\n EOF1I3540_0047 (Invalid) Unknown section IDs (after data section) - Data index: 50\n EOF1I3540_0048 - Data index: 51\n EOF1I3540_0049 - Data index: 52\n",
"filling-rpc-server" : "evmone-t8n 0.12.0-dev+commit.14ba7529",
"filling-tool-version" : "retesteth-0.3.2-cancun+commit.9d793abd.Linux.g++",
"generatedTestHash" : "70f1c847a164c49063ecd1387e723bcecfdad88b8f833bc5be85c24c98c35b44",
"lllcversion" : "Version: 0.5.14-develop.2022.4.6+commit.401d5358.Linux.g++",
"solidity" : "Version: 0.8.18-develop.2023.1.16+commit.469d6d4d.Linux.g++",
"filling-rpc-server" : "evmone-t8n 0.12.0-dev+commit.81c7b531",
"filling-tool-version" : "retesteth-0.3.2-cancun+commit.2ab0208e.Linux.g++",
"generatedTestHash" : "d4e845e90749f3583f4b2b7b230cd0e7e93719699e46ed15ccab8de911680a2d",
"lllcversion" : "Version: 0.5.14-develop.2022.6.30+commit.401d5358.mod.Linux.g++",
"solidity" : "Version: 0.8.21-develop.2023.7.19+commit.d9974bed.Linux.g++",
"source" : "src/EOFTestsFiller/EIP3540/validInvalidFiller.yml",
"sourceHash" : "4625c63a66a8d034619df01985568a2e17850ed4100d04ab877c769ca9105f60"
"sourceHash" : "0437666ea010b826ca6eb26777056390ba96588c75ee89d83f9c59c78cb74da7"
},
"vectors" : {
"validInvalid_0" : {
Expand Down Expand Up @@ -121,7 +121,8 @@
"code" : "0xef000101000402000100010400020000800000fe",
"results" : {
"Prague" : {
"result" : true
"exception" : "err: toplevel_container_truncated",
"result" : false
}
}
},
Expand Down Expand Up @@ -219,15 +220,16 @@
"code" : "0xef000101000402000100010400020000800000feaa",
"results" : {
"Prague" : {
"result" : true
"exception" : "err: toplevel_container_truncated",
"result" : false
}
}
},
"validInvalid_30" : {
"code" : "0xef000101000402000100010400000000000000feaabbcc",
"results" : {
"Prague" : {
"exception" : "EOF_InvalidSectionBodiesSize",
"exception" : "EOF_InvalidFirstSectionType",
"result" : false
}
}
Expand Down Expand Up @@ -299,7 +301,7 @@
"code" : "0xef000101000402000100010400020000000000feaabbccdd",
"results" : {
"Prague" : {
"exception" : "EOF_InvalidSectionBodiesSize",
"exception" : "EOF_InvalidFirstSectionType",
"result" : false
}
}
Expand Down
15 changes: 8 additions & 7 deletions EOFTests/efExample/validInvalid.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
"validInvalid" : {
"_info" : {
"comment" : "Test various examples to see if they are valid or invalid.\nImplements\n EOF1I0001 check that EOF1 with a bad magic number fails\n EOF1I0002 check that EOF1 with a bad version number fails\n EOF1I0003 check that EOF1 with a bad section order fails\n EOF1I0004 check that EOF1 missing a section fails\n EOF1I0005 check that EOF1 with a bad end of sections number fails\n EOF1I0006 check that EOF1 with too many or too few bytes fails\n EOF1I0007 check that EOF1 with a malformed code section fails\n EOF1I0008 check that EOF1 with an illegal opcode fails\n EOF1I0009 check that EOF1 with the wrong maxStackDepth fails\n EOF1I0010 check that return values are not allowed on section 0\n EOF1I0011 check that function calls to code sections that don't exist fail\n EOF1I0012 check that code sections that cause stack underflow fail\n EOF1I0013 check that we can't return more values than we declare\n EOF1I0014 check that code that looks deeper in the stack than the parameters fails\n EOF1I0015 check that code that uses removed opcodes fails\n EOF1I0016 check that code that uses new relative jumps to outside the section fails\n EOF1I0017 check that parameters are not allowed on section 0\n EOF1I0018 inconsistent number of code sections (between types and code)\n EOF1I0019 check that jumps into the middle on an opcode are not allowed\n EOF1I0020 check that you can't get to the same opcode with two different stack heights\n EOF1I0022 stack underflow caused by a function call\n EOF1I0023 sections with unreachable code fail\n EOF1I0024 sections that end with a non-terminator opcode fail\n EOF1I0025 data stack height of 1024 is invalid\n EOF1V0001 check that simple valid EOF1 deploys\n EOF1V0002 check that valid EOF1 with two code sections deploys\n EOF1V0003 check that valid EOF1 with four code sections deploys\n EOF1V0004 check that valid EOF1 can include 0xFE, the designated invalid opcode\n EOF1V0005 check that EOF1 with the right maxStackDepth deploys\n EOF1V0006 check that return values are allowed on code sections that aren't zero\n EOF1V0007 check that function calls to code sections that exist are allowed\n EOF1V0008 check that code that uses a new style relative jump (5C) succeeds\n EOF1V0009 check that parameters are allowed on code sections that aren't zero\n EOF1V0010 parameters are part of the max stack height\n EOF1V0011 check that code that uses a new style conditional jump (5D) succeeds\n EOF1V0012 return values on code sections affect maxStackHeight of the caller\n EOF1V0013 jump tables work\n EOF1V0014 sections that end with a legit terminating opcode are OK\n EOF1V0015 data stack height of 1023 is valid\n EOF1V0016 check that data section size can be less than the declared size\n",
"filling-rpc-server" : "evmone-t8n 0.12.0-dev+commit.8202c81e",
"filling-tool-version" : "retesteth-0.3.2-cancun+commit.a7cdb586.Linux.g++",
"generatedTestHash" : "c62a0385dff27dfa283e037ddc2299ce1ecaa2932061306af3a7191c4dfa5f86",
"lllcversion" : "Error getting LLLC Version",
"solidity" : "Version: 0.8.25+commit.b61c2a91.Linux.g++",
"filling-rpc-server" : "evmone-t8n 0.12.0-dev+commit.81c7b531",
"filling-tool-version" : "retesteth-0.3.2-cancun+commit.2ab0208e.Linux.g++",
"generatedTestHash" : "142cc3c8b76d8a933c5645d2d616660bf730fe989f7b4637b43f3b38bf31f6f1",
"lllcversion" : "Version: 0.5.14-develop.2022.6.30+commit.401d5358.mod.Linux.g++",
"solidity" : "Version: 0.8.21-develop.2023.7.19+commit.d9974bed.Linux.g++",
"source" : "src/EOFTestsFiller/efExample/validInvalidFiller.yml",
"sourceHash" : "0eb24a7a7ffb551c5816d2986e04ef73171870f7facaafb8bb91da89bb3a20a3"
"sourceHash" : "cc1994435109e7b90d166b32e6c67304c459108e7357de0599672c48f9b24d8c"
},
"vectors" : {
"validInvalid_0" : {
Expand All @@ -23,7 +23,8 @@
"code" : "0xef0001010004020001000304000400008000013050000bad",
"results" : {
"Prague" : {
"result" : true
"exception" : "err: toplevel_container_truncated",
"result" : false
}
}
},
Expand Down
15 changes: 8 additions & 7 deletions EOFTests/efValidation/EOF1_embedded_container_.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
"EOF1_embedded_container" : {
"_info" : {
"comment" : "",
"filling-rpc-server" : "evmone-t8n 0.12.0-dev+commit.d935077c",
"filling-tool-version" : "retesteth-0.3.2-cancun+commit.cf90baf3.Linux.g++",
"generatedTestHash" : "5743ae583913c61eb7fdfa60eba3682c7867a2575212fa32ec16a0f0a9dac1fc",
"lllcversion" : "Version: 0.5.14-develop.2023.7.11+commit.c58ab2c6.mod.Linux.g++",
"solidity" : "Version: 0.8.21+commit.d9974bed.Linux.g++",
"filling-rpc-server" : "evmone-t8n 0.12.0-dev+commit.81c7b531",
"filling-tool-version" : "retesteth-0.3.2-cancun+commit.2ab0208e.Linux.g++",
"generatedTestHash" : "bfba10a0c6e91753cd7263483bc2e057eb14789d31a52bb02b6f1ff8022d72bc",
"lllcversion" : "Version: 0.5.14-develop.2022.6.30+commit.401d5358.mod.Linux.g++",
"solidity" : "Version: 0.8.21-develop.2023.7.19+commit.d9974bed.Linux.g++",
"source" : "src/EOFTestsFiller/efValidation/EOF1_embedded_container_Copier.json",
"sourceHash" : "d30f7961069e10c8d3c81afb4216ad9796e8a29fa695200b05da97da5a4eea45"
"sourceHash" : "83df9720ea2e43fe20e391360195abbf152e4f048f35d7ecde5cc1d5d31d28b2"
},
"vectors" : {
"EOF1_embedded_container_0" : {
Expand All @@ -23,7 +23,8 @@
"code" : "0xef00010100040200010006030001001404000200008000016000e0000000ef000101000402000100010400000000800000fe",
"results" : {
"Prague" : {
"result" : true
"exception" : "err: toplevel_container_truncated",
"result" : false
}
}
},
Expand Down
18 changes: 10 additions & 8 deletions EOFTests/efValidation/EOF1_truncated_section_.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
"EOF1_truncated_section" : {
"_info" : {
"comment" : "",
"filling-rpc-server" : "evmone-t8n 0.12.0-dev+commit.d935077c",
"filling-tool-version" : "retesteth-0.3.2-cancun+commit.cf90baf3.Linux.g++",
"generatedTestHash" : "9f276f072546e55332accf4b7f5a88f083d734331b5ac80d079993e1aa17854d",
"lllcversion" : "Version: 0.5.14-develop.2023.7.11+commit.c58ab2c6.mod.Linux.g++",
"solidity" : "Version: 0.8.21+commit.d9974bed.Linux.g++",
"filling-rpc-server" : "evmone-t8n 0.12.0-dev+commit.81c7b531",
"filling-tool-version" : "retesteth-0.3.2-cancun+commit.2ab0208e.Linux.g++",
"generatedTestHash" : "ed715ad428d2cf8fa2090add6be36121531f3581c3c60147b51ba8749761189e",
"lllcversion" : "Version: 0.5.14-develop.2022.6.30+commit.401d5358.mod.Linux.g++",
"solidity" : "Version: 0.8.21-develop.2023.7.19+commit.d9974bed.Linux.g++",
"source" : "src/EOFTestsFiller/efValidation/EOF1_truncated_section_Copier.json",
"sourceHash" : "f0b591cf0c08ec7d8ca286db6ed83efa25e601392da30a9403257d994e36ab63"
"sourceHash" : "7633121d80f8bbf323ca1036f969636a99e1c2d915d22e95cc66608cb09093a3"
},
"vectors" : {
"EOF1_truncated_section_0" : {
Expand Down Expand Up @@ -42,15 +42,17 @@
"code" : "0xef000101000402000100010400020000800000fe",
"results" : {
"Prague" : {
"result" : true
"exception" : "err: toplevel_container_truncated",
"result" : false
}
}
},
"EOF1_truncated_section_4" : {
"code" : "0xef000101000402000100010400020000800000feaa",
"results" : {
"Prague" : {
"result" : true
"exception" : "err: toplevel_container_truncated",
"result" : false
}
}
}
Expand Down
17 changes: 9 additions & 8 deletions EOFTests/ori/validInvalid.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
"validInvalid" : {
"_info" : {
"comment" : "Ori Pomerantz [email protected]\nImplements EOF1I0001, EOF1I0002, EOF1I0003, EOF1I0004, EOF1I0005,\nEOF1I0006, EOF1I0007, EOF1I0008, EOF1I0009, EOF1I0010,\nEOF1I0011, EOF1I0012, EOF1I0013, EOF1I0014, EOF1I0015,\nEOF1I0016, EOF1I0017, EOF1I0018, EOF1I0019, EOF1I0020,\nEOF1I0021, EOF1I0022, EOF1I0023, EOF1I0024, EOF1I0025,\nEOF1V0001, EOF1V0002, EOF1V0003, EOF1V0004, EOF1V0005,\nEOF1V0006, EOF1V0007, EOF1V0008, EOF1V0009, EOF1V0010,\nEOF1V0011, EOF1V0012, EOF1V0013, EOF1V0014, EOF1V0015\n",
"filling-rpc-server" : "evmone-t8n 0.12.0-dev+commit.14ba7529",
"filling-tool-version" : "retesteth-0.3.2-cancun+commit.9d793abd.Linux.g++",
"generatedTestHash" : "42a674b5b1d41a51050ca56d5e2924a22edcd0e4f8b251913bfc7bb34c5d1457",
"lllcversion" : "Version: 0.5.14-develop.2022.4.6+commit.401d5358.Linux.g++",
"solidity" : "Version: 0.8.18-develop.2023.1.16+commit.469d6d4d.Linux.g++",
"filling-rpc-server" : "evmone-t8n 0.12.0-dev+commit.81c7b531",
"filling-tool-version" : "retesteth-0.3.2-cancun+commit.2ab0208e.Linux.g++",
"generatedTestHash" : "3bdf7b4e07835b5d5414caf875e8c0b9afa3f520a81cad6897ad744568a65615",
"lllcversion" : "Version: 0.5.14-develop.2022.6.30+commit.401d5358.mod.Linux.g++",
"solidity" : "Version: 0.8.21-develop.2023.7.19+commit.d9974bed.Linux.g++",
"source" : "src/EOFTestsFiller/ori/validInvalidFiller.yml",
"sourceHash" : "f4594e906050a1a0e30a17822dbb83cd4382fc613a1a7dac7f6b97360ba2e903"
"sourceHash" : "76f0170e2ea08e6c977203e5d9ea2175b3518811dbc8e188da410edfcd70f3c6"
},
"vectors" : {
"validInvalid_0" : {
Expand Down Expand Up @@ -399,7 +399,8 @@
"code" : "0xef000101000402000100030400060000800001305000ef",
"results" : {
"Prague" : {
"result" : true
"exception" : "err: toplevel_container_truncated",
"result" : false
}
}
},
Expand Down Expand Up @@ -667,7 +668,7 @@
"code" : "0xef000101000302000100030400010000800001305000ef",
"results" : {
"Prague" : {
"exception" : "EOF_InvalidSectionBodiesSize",
"exception" : "EOF_InvalidTypeSectionSize",
"result" : false
}
}
Expand Down
Loading

0 comments on commit 8e505c2

Please sign in to comment.