Skip to content

Commit

Permalink
Fix EOFTests/efExample - comment out old constructor examples
Browse files Browse the repository at this point in the history
  • Loading branch information
pdobacz committed Mar 18, 2024
1 parent e63aa98 commit 07f8496
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 126 deletions.
35 changes: 9 additions & 26 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.62d18d90",
"filling-tool-version" : "retesteth-0.3.2-cancun+commit.377a97b2.Linux.g++",
"generatedTestHash" : "c6c99062f366425349656a9736f883425b4eb231756f1c687ee3855f7ae48fd7",
"lllcversion" : "Version: 0.5.14-develop.2021.4.29+commit.14c9d5de.Linux.clang",
"solidity" : "Version: 0.8.17-develop.2022.9.30+commit.8df45f5f.Linux.clang",
"filling-rpc-server" : "evmone-t8n 0.12.0-dev+commit.808cc18c.dirty",
"filling-tool-version" : "retesteth-0.3.2-cancun+commit.0abe77bb.Linux.g++",
"generatedTestHash" : "f8e6bfd137b22d00be89550031afc4dbde688894f3106354df95c6d5189db5d4",
"lllcversion" : "Error getting LLLC Version",
"solidity" : "Version: 0.8.24+commit.e11b9ed9.Linux.g++",
"source" : "src/EOFTestsFiller/efExample/validInvalidFiller.yml",
"sourceHash" : "a3f712c8affc7e09ff65dc289806c7e249976d2dfe2ac7aac257db20f3562990"
"sourceHash" : "cf5c56c806bc1d720bae433362bd131d5b31861d59010575d2c4141e76a19ea9"
},
"vectors" : {
"validInvalid_0" : {
Expand Down Expand Up @@ -354,7 +354,7 @@
"code" : "0xef020101000402000100030400010000800001305000ef",
"results" : {
"Prague" : {
"exception" : "EOF_InvalidMagic",
"exception" : "EOF_InvalidPrefix",
"result" : false
}
}
Expand All @@ -363,7 +363,7 @@
"code" : "0xef000001000402000100030400010000800001305000ef",
"results" : {
"Prague" : {
"exception" : "EOF_InvalidVersion",
"exception" : "EOF_UnknownVersion",
"result" : false
}
}
Expand All @@ -372,7 +372,7 @@
"code" : "0xef000201000402000100030400010000800001305000ef",
"results" : {
"Prague" : {
"exception" : "EOF_InvalidVersion",
"exception" : "EOF_UnknownVersion",
"result" : false
}
}
Expand Down Expand Up @@ -430,23 +430,6 @@
}
}
},
"validInvalid_52" : {
"code" : "0xef0001010004020001000a040016000080000338600060003938601df3ef0001010004020001000304001d0000000001385000",
"results" : {
"Prague" : {
"result" : true
}
}
},
"validInvalid_53" : {
"code" : "0x610badfe",
"results" : {
"Prague" : {
"exception" : "EOF_InvalidMagic",
"result" : false
}
}
},
"validInvalid_6" : {
"code" : "0xef00010100040200010003040001ff00800001305000ef",
"results" : {
Expand Down
22 changes: 7 additions & 15 deletions EOFTests/efExample/ymlExample.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
"ymlExample" : {
"_info" : {
"comment" : "EOF example test",
"filling-rpc-server" : "evmone-t8n 0.12.0-dev+commit.14ba7529",
"filling-tool-version" : "retesteth-0.3.2-cancun+commit.9d793abd.Linux.g++",
"generatedTestHash" : "acafd37d166881fa1a015acb1d6ff88f0f698e14a7db9098952065aaa90e78e5",
"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.808cc18c.dirty",
"filling-tool-version" : "retesteth-0.3.2-cancun+commit.0abe77bb.Linux.g++",
"generatedTestHash" : "04e7659cd33c11d48c8421f7a3342d4840b288d21694f37e0b01c841857c60ef",
"lllcversion" : "Error getting LLLC Version",
"solidity" : "Version: 0.8.24+commit.e11b9ed9.Linux.g++",
"source" : "src/EOFTestsFiller/efExample/ymlExampleFiller.yml",
"sourceHash" : "3eb098795ee0f651ae94dab0674f1a6f2e9dd5d6210cf6719508d9f301b4b71d"
"sourceHash" : "324654e1783340f8279f7e7b7c8dbe2b71497c28e2a25eef16e4429266f62c02"
},
"vectors" : {
"ymlExample_0" : {
Expand All @@ -21,14 +21,6 @@
}
},
"ymlExample_1" : {
"code" : "0xef0001010004020001000a040016000080000338600060003938601df3ef0001010004020001000304001d0000800001385000",
"results" : {
"Prague" : {
"result" : true
}
}
},
"ymlExample_2" : {
"code" : "0xefffff",
"results" : {
"Prague" : {
Expand All @@ -37,7 +29,7 @@
}
}
},
"ymlExample_3" : {
"ymlExample_2" : {
"code" : "0x610badfe",
"results" : {
"Prague" : {
Expand Down
97 changes: 49 additions & 48 deletions src/EOFTestsFiller/efExample/validInvalidFiller.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1490,7 +1490,7 @@ validInvalid:
# Data segment
ef
expectException:
">=Prague" : "EOF_InvalidMagic"
">=Prague" : "EOF_InvalidPrefix"
# Data 45
# EOF1I0002 check that EOF1 with a bad version number fails (ver 0)
Expand All @@ -1514,7 +1514,7 @@ validInvalid:
# Data segment
ef
expectException:
">=Prague" : "EOF_InvalidVersion"
">=Prague" : "EOF_UnknownVersion"
# EOF1I0002 check that EOF1 with a bad version number fails (ver 2)
- data: |
Expand All @@ -1537,7 +1537,7 @@ validInvalid:
# Data segment
ef
expectException:
">=Prague" : "EOF_InvalidVersion"
">=Prague" : "EOF_UnknownVersion"
# EOF1I0003 check that EOF1 with a bad section order fails
- data: |
Expand Down Expand Up @@ -1653,49 +1653,50 @@ validInvalid:
# EOF1 constructor returning an EOF1 contract
- data: |
:label eofreof1 :raw
0xEF0001 # Magic and version
010004 # One code segment
020001 # One code segment
000a # Code segment zero length: 10 bytes
040016 # Data segment length (the code being deployed): 0x16=22 bytes
00 # End of header
# Code segment zero (header)
00 # No inputs
80 # Non-Returning Function
0003 # Max stack height 3
# Code segment zero (actual code)
38 # 0 CODESIZE <codesize>
6000 # 1 PUSH1 0 0,<codesize>
6000 # 3 PUSH1 0 0,0,<codesize>
39 # 5 CODECOPY (from the code to memory, copy everything)
38 # 6 CODESIZE <codesize>
601D # 7 PUSH1 0x1d (= 22) <codesize>,0x1d
F3 # 9 RETURN (the deployed code is code size long, starting at byte 22)
# 10
# Data segment (which happens to also be EOF1 code)
EF0001 # Magic and version
010004 # One code segment
020001 # One code segment
0003 # Code segment zero's length: 3 bytes
04001d # Data segment length: 22 bytes
# (not specified here, but part of the buffer returned by the init code)
00 # End of header
# Code segment 0 header
00 # No inputs
00 # No outputs
0001 # Max stack height 1
# Code segment 0 code
38 # CODESIZE
50 # POP
00 # STOP
# Init code which doesn't create a contract
- data: :label bad :raw 0x610BADFE
expectException:
">=Prague" : "EOF_InvalidMagic"
# TODO: rewrite to EOFCREATE, when it's ready
# - data: |
# :label eofreof1 :raw
# 0xEF0001 # Magic and version
# 010004 # One code segment
# 020001 # One code segment
# 000a # Code segment zero length: 10 bytes
# 040016 # Data segment length (the code being deployed): 0x16=22 bytes
# 00 # End of header

# # Code segment zero (header)
# 00 # No inputs
# 80 # Non-Returning Function
# 0003 # Max stack height 3


# # Code segment zero (actual code)
# 38 # 0 CODESIZE <codesize>
# 6000 # 1 PUSH1 0 0,<codesize>
# 6000 # 3 PUSH1 0 0,0,<codesize>
# 39 # 5 CODECOPY (from the code to memory, copy everything)
# 38 # 6 CODESIZE <codesize>
# 601D # 7 PUSH1 0x1d (= 22) <codesize>,0x1d
# F3 # 9 RETURN (the deployed code is code size long, starting at byte 22)
# # 10

# # Data segment (which happens to also be EOF1 code)
# EF0001 # Magic and version
# 010004 # One code segment
# 020001 # One code segment
# 0003 # Code segment zero's length: 3 bytes
# 04001d # Data segment length: 22 bytes
# # (not specified here, but part of the buffer returned by the init code)
# 00 # End of header
# # Code segment 0 header
# 00 # No inputs
# 00 # No outputs
# 0001 # Max stack height 1
# # Code segment 0 code
# 38 # CODESIZE
# 50 # POP
# 00 # STOP
# # Init code which doesn't create a contract
# - data: :label bad :raw 0x610BADFE
# expectException:
# ">=Prague" : "EOF_InvalidMagic"

75 changes: 38 additions & 37 deletions src/EOFTestsFiller/efExample/ymlExampleFiller.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,47 +14,48 @@ ymlExample:
">=Prague" : "EOF_InvalidPrefix"
# EOF1 constructor returning an EOF1 contract
- data: |
:raw
0xEF0001 # Magic and version
010004 # One code segment
020001 # One code segment
000a # Code segment zero length: 10 bytes
040016 # Data segment length (the code being deployed): 0x16=22 bytes
00 # End of header
# TODO: rewrite to EOFCREATE, when it's ready
# - data: |
# :raw
# 0xEF0001 # Magic and version
# 010004 # One code segment
# 020001 # One code segment
# 000a # Code segment zero length: 10 bytes
# 040016 # Data segment length (the code being deployed): 0x16=22 bytes
# 00 # End of header

# Code segment zero (header)
00 # No inputs
80 # Non-Returning Function
0003 # Max stack height 3
# # Code segment zero (header)
# 00 # No inputs
# 80 # Non-Returning Function
# 0003 # Max stack height 3


# Code segment zero (actual code)
38 # 0 CODESIZE <codesize>
6000 # 1 PUSH1 0 0,<codesize>
6000 # 3 PUSH1 0 0,0,<codesize>
39 # 5 CODECOPY (from the code to memory, copy everything)
38 # 6 CODESIZE <codesize>
601D # 7 PUSH1 0x1d (= 22) <codesize>,0x1d
F3 # 9 RETURN (the deployed code is code size long, starting at byte 22)
# 10
# # Code segment zero (actual code)
# 38 # 0 CODESIZE <codesize>
# 6000 # 1 PUSH1 0 0,<codesize>
# 6000 # 3 PUSH1 0 0,0,<codesize>
# 39 # 5 CODECOPY (from the code to memory, copy everything)
# 38 # 6 CODESIZE <codesize>
# 601D # 7 PUSH1 0x1d (= 22) <codesize>,0x1d
# F3 # 9 RETURN (the deployed code is code size long, starting at byte 22)
# # 10

# Data segment (which happens to also be EOF1 code)
EF0001 # Magic and version
010004 # One code segment
020001 # One code segment
0003 # Code segment zero's length: 3 bytes
04001d # Data segment length: 22 bytes
# (not specified here, but part of the buffer returned by the init code)
00 # End of header
# Code segment 0 header
00 # No inputs
80 # Non-Returning Function
0001 # Max stack height 1
# Code segment 0 code
38 # CODESIZE
50 # POP
00 # STOP
# # Data segment (which happens to also be EOF1 code)
# EF0001 # Magic and version
# 010004 # One code segment
# 020001 # One code segment
# 0003 # Code segment zero's length: 3 bytes
# 04001d # Data segment length: 22 bytes
# # (not specified here, but part of the buffer returned by the init code)
# 00 # End of header
# # Code segment 0 header
# 00 # No inputs
# 80 # Non-Returning Function
# 0001 # Max stack height 1
# # Code segment 0 code
# 38 # CODESIZE
# 50 # POP
# 00 # STOP

# Invalid init code
# Not EOF1
Expand Down

0 comments on commit 07f8496

Please sign in to comment.