|
24 | 24 | pytestmark = pytest.mark.valid_from(EOF_FORK_NAME)
|
25 | 25 |
|
26 | 26 | VALID: List[Container] = [
|
| 27 | + Container( |
| 28 | + name="retf_stack_validation_0", |
| 29 | + sections=[ |
| 30 | + Section.Code(code=Op.CALLF[1] + Op.STOP, max_stack_height=2), |
| 31 | + Section.Code( |
| 32 | + code=Op.PUSH0 * 2 + Op.RETF, |
| 33 | + code_outputs=2, |
| 34 | + max_stack_height=2, |
| 35 | + ), |
| 36 | + ], |
| 37 | + ), |
| 38 | + Container( |
| 39 | + name="retf_stack_validation_3", |
| 40 | + sections=[ |
| 41 | + Section.Code( |
| 42 | + code=Op.PUSH0 + Op.CALLF[1] + Op.STOP, |
| 43 | + max_stack_height=2, |
| 44 | + ), |
| 45 | + Section.Code( |
| 46 | + code=Op.RJUMPI[7] + Op.PUSH1[1] * 2 + Op.RJUMP[2] + Op.PUSH0 * 2 + Op.RETF, |
| 47 | + code_inputs=1, |
| 48 | + code_outputs=2, |
| 49 | + max_stack_height=2, |
| 50 | + ), |
| 51 | + ], |
| 52 | + ), |
27 | 53 | Container(
|
28 | 54 | name="retf_code_input_output",
|
29 | 55 | sections=[
|
|
90 | 116 | ]
|
91 | 117 |
|
92 | 118 | INVALID: List[Container] = [
|
| 119 | + Container( |
| 120 | + name="retf_stack_validation_1", |
| 121 | + sections=[ |
| 122 | + Section.Code(code=Op.CALLF[1] + Op.STOP, max_stack_height=2), |
| 123 | + Section.Code( |
| 124 | + code=Op.PUSH0 + Op.RETF, |
| 125 | + code_outputs=2, |
| 126 | + max_stack_height=1, |
| 127 | + ), |
| 128 | + ], |
| 129 | + validity_error=EOFException.STACK_UNDERFLOW, |
| 130 | + ), |
| 131 | + Container( |
| 132 | + name="retf_variable_stack_0", |
| 133 | + sections=[ |
| 134 | + Section.Code(code=Op.CALLF[1] + Op.STOP, max_stack_height=5), |
| 135 | + Section.Code( |
| 136 | + code=Op.PUSH0 + Op.PUSH1[0] + Op.RJUMPI[2] + Op.PUSH0 * 2 + Op.RETF, |
| 137 | + code_outputs=5, |
| 138 | + max_stack_height=3, |
| 139 | + ), |
| 140 | + ], |
| 141 | + validity_error=EOFException.STACK_UNDERFLOW, |
| 142 | + ), |
| 143 | + Container( |
| 144 | + name="retf_variable_stack_1", |
| 145 | + sections=[ |
| 146 | + Section.Code(code=Op.CALLF[1] + Op.STOP, max_stack_height=3), |
| 147 | + Section.Code( |
| 148 | + code=Op.PUSH0 + Op.PUSH1[0] + Op.RJUMPI[2] + Op.PUSH0 * 2 + Op.RETF, |
| 149 | + code_outputs=3, |
| 150 | + max_stack_height=3, |
| 151 | + ), |
| 152 | + ], |
| 153 | + validity_error=EOFException.STACK_UNDERFLOW, |
| 154 | + ), |
| 155 | + Container( |
| 156 | + name="retf_variable_stack_4", |
| 157 | + sections=[ |
| 158 | + Section.Code(code=Op.CALLF[1] + Op.STOP, max_stack_height=3), |
| 159 | + Section.Code( |
| 160 | + code=Op.PUSH0 * 3 + Op.PUSH1[0] + Op.RJUMPI[2] + Op.POP * 2 + Op.RETF, |
| 161 | + code_outputs=3, |
| 162 | + max_stack_height=4, |
| 163 | + ), |
| 164 | + ], |
| 165 | + validity_error=EOFException.STACK_UNDERFLOW, |
| 166 | + ), |
| 167 | + Container( |
| 168 | + name="callf_inputs_underflow_0", |
| 169 | + sections=[ |
| 170 | + Section.Code(code=Op.CALLF[1] + Op.STOP, max_stack_height=1), |
| 171 | + Section.Code( |
| 172 | + code=Op.PUSH0 + Op.CALLF[2] + Op.RETF, |
| 173 | + code_outputs=1, |
| 174 | + max_stack_height=1, |
| 175 | + ), |
| 176 | + Section.Code( |
| 177 | + code=Op.POP + Op.RETF, |
| 178 | + code_inputs=2, |
| 179 | + code_outputs=1, |
| 180 | + max_stack_height=2, |
| 181 | + ), |
| 182 | + ], |
| 183 | + validity_error=EOFException.STACK_UNDERFLOW, |
| 184 | + ), |
93 | 185 | Container(
|
94 | 186 | # CALLF to function with incorrectly specified number of inputs
|
95 | 187 | name="code_inputs_underflow_1", # EOF1I4750_0020
|
|
128 | 220 | ],
|
129 | 221 | validity_error=EOFException.STACK_UNDERFLOW,
|
130 | 222 | ),
|
| 223 | + Container( |
| 224 | + name="retf_stack_validation_2", |
| 225 | + sections=[ |
| 226 | + Section.Code(code=Op.CALLF[1] + Op.STOP, max_stack_height=2), |
| 227 | + Section.Code( |
| 228 | + code=Op.PUSH0 * 3 + Op.RETF, |
| 229 | + code_outputs=2, |
| 230 | + max_stack_height=3, |
| 231 | + ), |
| 232 | + ], |
| 233 | + validity_error=EOFException.STACK_HIGHER_THAN_OUTPUTS, |
| 234 | + ), |
| 235 | + Container( |
| 236 | + name="retf_variable_stack_2", |
| 237 | + sections=[ |
| 238 | + Section.Code(code=Op.CALLF[1] + Op.STOP, max_stack_height=1), |
| 239 | + Section.Code( |
| 240 | + code=Op.PUSH0 + Op.PUSH1[0] + Op.RJUMPI[2] + Op.PUSH0 * 2 + Op.RETF, |
| 241 | + code_outputs=1, |
| 242 | + max_stack_height=3, |
| 243 | + ), |
| 244 | + ], |
| 245 | + validity_error=EOFException.STACK_HIGHER_THAN_OUTPUTS, |
| 246 | + ), |
| 247 | + Container( |
| 248 | + name="retf_variable_stack_5", |
| 249 | + sections=[ |
| 250 | + Section.Code(code=Op.CALLF[1] + Op.STOP, max_stack_height=1), |
| 251 | + Section.Code( |
| 252 | + code=Op.PUSH0 + Op.PUSH1[0] + Op.RJUMPI[1] + Op.PUSH0 + Op.RETF, |
| 253 | + code_outputs=1, |
| 254 | + max_stack_height=3, |
| 255 | + ), |
| 256 | + ], |
| 257 | + validity_error=EOFException.STACK_HIGHER_THAN_OUTPUTS, |
| 258 | + ), |
| 259 | + Container( |
| 260 | + name="retf_variable_stack_6", |
| 261 | + sections=[ |
| 262 | + Section.Code(code=Op.CALLF[1] + Op.STOP, max_stack_height=1), |
| 263 | + Section.Code( |
| 264 | + code=Op.PUSH0 * 2 + Op.PUSH1[0] + Op.RJUMPI[1] + Op.POP + Op.RETF, |
| 265 | + code_outputs=1, |
| 266 | + max_stack_height=3, |
| 267 | + ), |
| 268 | + ], |
| 269 | + validity_error=EOFException.STACK_HIGHER_THAN_OUTPUTS, |
| 270 | + ), |
| 271 | + Container( |
| 272 | + name="retf_variable_stack_3", |
| 273 | + sections=[ |
| 274 | + Section.Code(code=Op.CALLF[1] + Op.STOP), |
| 275 | + Section.Code( |
| 276 | + code=Op.PUSH0 + Op.PUSH1[0] + Op.RJUMPI[2] + Op.PUSH0 * 2 + Op.RETF, |
| 277 | + code_outputs=0, |
| 278 | + max_stack_height=3, |
| 279 | + ), |
| 280 | + ], |
| 281 | + validity_error=EOFException.STACK_HIGHER_THAN_OUTPUTS, |
| 282 | + ), |
131 | 283 | Container(
|
132 | 284 | name="stack_higher_than_code_outputs",
|
133 | 285 | sections=[
|
|
0 commit comments