File tree Expand file tree Collapse file tree 16 files changed +39
-42
lines changed
tests/osaka/eip7692_eof_v1
eip663_dupn_swapn_exchange Expand file tree Collapse file tree 16 files changed +39
-42
lines changed Original file line number Diff line number Diff line change @@ -266,12 +266,12 @@ class BesuExceptionMapper(ExceptionMapper):
266
266
EOFException .INVALID_RJUMP_DESTINATION : "err: invalid_rjump_destination" ,
267
267
EOFException .UNREACHABLE_CODE_SECTIONS : "err: unreachable_code_sections" ,
268
268
EOFException .STACK_UNDERFLOW : "err: stack_underflow" ,
269
- EOFException .MAX_STACK_HEIGHT_ABOVE_LIMIT : "err: max_stack_height_above_limit " ,
269
+ EOFException .MAX_STACK_INCREASE_ABOVE_LIMIT : "err: max_stack_increase_above_limit " ,
270
270
EOFException .STACK_HIGHER_THAN_OUTPUTS : "err: stack_higher_than_outputs_required" ,
271
271
EOFException .JUMPF_DESTINATION_INCOMPATIBLE_OUTPUTS : (
272
272
"err: jumpf_destination_incompatible_outputs"
273
273
),
274
- EOFException .INVALID_MAX_STACK_HEIGHT : "err: invalid_max_stack_height " ,
274
+ EOFException .INVALID_MAX_STACK_INCREASE : "err: invalid_max_stack_increase " ,
275
275
EOFException .INVALID_DATALOADN_INDEX : "err: invalid_dataloadn_index" ,
276
276
EOFException .TRUNCATED_INSTRUCTION : "err: truncated_instruction" ,
277
277
EOFException .TOPLEVEL_CONTAINER_TRUNCATED : "err: toplevel_container_truncated" ,
Original file line number Diff line number Diff line change @@ -96,12 +96,12 @@ class EthereumJSExceptionMapper(ExceptionMapper):
96
96
EOFException .INVALID_RJUMP_DESTINATION : "err: invalid_rjump_destination" ,
97
97
EOFException .UNREACHABLE_CODE_SECTIONS : "err: unreachable_code_sections" ,
98
98
EOFException .STACK_UNDERFLOW : "err: stack_underflow" ,
99
- EOFException .MAX_STACK_HEIGHT_ABOVE_LIMIT : "err: max_stack_height_above_limit " ,
99
+ EOFException .MAX_STACK_INCREASE_ABOVE_LIMIT : "err: max_stack_increase_above_limit " ,
100
100
EOFException .STACK_HIGHER_THAN_OUTPUTS : "err: stack_higher_than_outputs_required" ,
101
101
EOFException .JUMPF_DESTINATION_INCOMPATIBLE_OUTPUTS : (
102
102
"err: jumpf_destination_incompatible_outputs"
103
103
),
104
- EOFException .INVALID_MAX_STACK_HEIGHT : "err: invalid_max_stack_height " ,
104
+ EOFException .INVALID_MAX_STACK_INCREASE : "err: invalid_max_stack_increase " ,
105
105
EOFException .INVALID_DATALOADN_INDEX : "err: invalid_dataloadn_index" ,
106
106
EOFException .TRUNCATED_INSTRUCTION : "err: truncated_instruction" ,
107
107
EOFException .TOPLEVEL_CONTAINER_TRUNCATED : "err: toplevel_container_truncated" ,
Original file line number Diff line number Diff line change @@ -105,12 +105,12 @@ class EvmoneExceptionMapper(ExceptionMapper):
105
105
EOFException .UNREACHABLE_CODE_SECTIONS : "err: unreachable_code_sections" ,
106
106
EOFException .STACK_UNDERFLOW : "err: stack_underflow" ,
107
107
EOFException .STACK_OVERFLOW : "err: stack_overflow" ,
108
- EOFException .MAX_STACK_HEIGHT_ABOVE_LIMIT : "err: max_stack_height_above_limit " ,
108
+ EOFException .MAX_STACK_INCREASE_ABOVE_LIMIT : "err: max_stack_increase_above_limit " ,
109
109
EOFException .STACK_HIGHER_THAN_OUTPUTS : "err: stack_higher_than_outputs_required" ,
110
110
EOFException .JUMPF_DESTINATION_INCOMPATIBLE_OUTPUTS : (
111
111
"err: jumpf_destination_incompatible_outputs"
112
112
),
113
- EOFException .INVALID_MAX_STACK_HEIGHT : "err: invalid_max_stack_height " ,
113
+ EOFException .INVALID_MAX_STACK_INCREASE : "err: invalid_max_stack_increase " ,
114
114
EOFException .INVALID_DATALOADN_INDEX : "err: invalid_dataloadn_index" ,
115
115
EOFException .TRUNCATED_INSTRUCTION : "err: truncated_instruction" ,
116
116
EOFException .TOPLEVEL_CONTAINER_TRUNCATED : "err: toplevel_container_truncated" ,
Original file line number Diff line number Diff line change @@ -182,12 +182,12 @@ class ExecutionSpecsExceptionMapper(ExceptionMapper):
182
182
EOFException .INVALID_RJUMP_DESTINATION : "err: invalid_rjump_destination" ,
183
183
EOFException .UNREACHABLE_CODE_SECTIONS : "err: unreachable_code_sections" ,
184
184
EOFException .STACK_UNDERFLOW : "err: stack_underflow" ,
185
- EOFException .MAX_STACK_HEIGHT_ABOVE_LIMIT : "err: max_stack_height_above_limit " ,
185
+ EOFException .MAX_STACK_INCREASE_ABOVE_LIMIT : "err: max_stack_increase_above_limit " ,
186
186
EOFException .STACK_HIGHER_THAN_OUTPUTS : "err: stack_higher_than_outputs_required" ,
187
187
EOFException .JUMPF_DESTINATION_INCOMPATIBLE_OUTPUTS : (
188
188
"err: jumpf_destination_incompatible_outputs"
189
189
),
190
- EOFException .INVALID_MAX_STACK_HEIGHT : "err: invalid_max_stack_height " ,
190
+ EOFException .INVALID_MAX_STACK_INCREASE : "err: invalid_max_stack_increase " ,
191
191
EOFException .INVALID_DATALOADN_INDEX : "err: invalid_dataloadn_index" ,
192
192
EOFException .TRUNCATED_INSTRUCTION : "err: truncated_instruction" ,
193
193
EOFException .TOPLEVEL_CONTAINER_TRUNCATED : "err: toplevel_container_truncated" ,
Original file line number Diff line number Diff line change @@ -75,12 +75,12 @@ class GethExceptionMapper(ExceptionMapper):
75
75
EOFException .INVALID_RJUMP_DESTINATION : "err: invalid_rjump_destination" ,
76
76
EOFException .UNREACHABLE_CODE_SECTIONS : "err: unreachable_code_sections" ,
77
77
EOFException .STACK_UNDERFLOW : "err: stack_underflow" ,
78
- EOFException .MAX_STACK_HEIGHT_ABOVE_LIMIT : "err: max_stack_height_above_limit " ,
78
+ EOFException .MAX_STACK_INCREASE_ABOVE_LIMIT : "err: max_stack_increase_above_limit " ,
79
79
EOFException .STACK_HIGHER_THAN_OUTPUTS : "err: stack_higher_than_outputs_required" ,
80
80
EOFException .JUMPF_DESTINATION_INCOMPATIBLE_OUTPUTS : (
81
81
"err: jumpf_destination_incompatible_outputs"
82
82
),
83
- EOFException .INVALID_MAX_STACK_HEIGHT : "err: invalid_max_stack_height " ,
83
+ EOFException .INVALID_MAX_STACK_INCREASE : "err: invalid_max_stack_increase " ,
84
84
EOFException .INVALID_DATALOADN_INDEX : "err: invalid_dataloadn_index" ,
85
85
EOFException .TRUNCATED_INSTRUCTION : "err: truncated_instruction" ,
86
86
EOFException .TOPLEVEL_CONTAINER_TRUNCATED : "err: toplevel_container_truncated" ,
Original file line number Diff line number Diff line change @@ -114,12 +114,12 @@ class NimbusExceptionMapper(ExceptionMapper):
114
114
EOFException .INVALID_RJUMP_DESTINATION : "err: invalid_rjump_destination" ,
115
115
EOFException .UNREACHABLE_CODE_SECTIONS : "err: unreachable_code_sections" ,
116
116
EOFException .STACK_UNDERFLOW : "err: stack_underflow" ,
117
- EOFException .MAX_STACK_HEIGHT_ABOVE_LIMIT : "err: max_stack_height_above_limit " ,
117
+ EOFException .MAX_STACK_INCREASE_ABOVE_LIMIT : "err: max_stack_increase_above_limit " ,
118
118
EOFException .STACK_HIGHER_THAN_OUTPUTS : "err: stack_higher_than_outputs_required" ,
119
119
EOFException .JUMPF_DESTINATION_INCOMPATIBLE_OUTPUTS : (
120
120
"err: jumpf_destination_incompatible_outputs"
121
121
),
122
- EOFException .INVALID_MAX_STACK_HEIGHT : "err: invalid_max_stack_height " ,
122
+ EOFException .INVALID_MAX_STACK_INCREASE : "err: invalid_max_stack_increase " ,
123
123
EOFException .INVALID_DATALOADN_INDEX : "err: invalid_dataloadn_index" ,
124
124
EOFException .TRUNCATED_INSTRUCTION : "err: truncated_instruction" ,
125
125
EOFException .TOPLEVEL_CONTAINER_TRUNCATED : "err: toplevel_container_truncated" ,
Original file line number Diff line number Diff line change @@ -710,9 +710,9 @@ class EOFException(ExceptionBase):
710
710
"""
711
711
EOF container section stack height mismatch.
712
712
"""
713
- MAX_STACK_HEIGHT_ABOVE_LIMIT = auto ()
713
+ MAX_STACK_INCREASE_ABOVE_LIMIT = auto ()
714
714
"""
715
- EOF container's specified max stack height is above the limit.
715
+ EOF container's specified max stack increase is above the limit.
716
716
"""
717
717
STACK_HIGHER_THAN_OUTPUTS = auto ()
718
718
"""
@@ -723,9 +723,9 @@ class EOFException(ExceptionBase):
723
723
"""
724
724
EOF container section JUMPF's to a destination section with incompatible outputs.
725
725
"""
726
- INVALID_MAX_STACK_HEIGHT = auto ()
726
+ INVALID_MAX_STACK_INCREASE = auto ()
727
727
"""
728
- EOF container section's specified max stack height does not match the actual stack height.
728
+ EOF container section's specified max stack increase does not match the actual stack height.
729
729
"""
730
730
INVALID_DATALOADN_INDEX = auto ()
731
731
"""
Original file line number Diff line number Diff line change @@ -199,12 +199,12 @@ def type_definition(self) -> bytes:
199
199
auto_code_outputs ,
200
200
)
201
201
202
- assert max_stack_height >= code_inputs , "incorrect max_stack_height value"
203
-
202
+ max_stack_increase = max_stack_height - code_inputs
203
+ assert max_stack_increase >= 0 , "incorrect max stack height value"
204
204
return (
205
205
code_inputs .to_bytes (length = TYPES_INPUTS_BYTE_LENGTH , byteorder = "big" )
206
206
+ code_outputs .to_bytes (length = TYPES_OUTPUTS_BYTE_LENGTH , byteorder = "big" )
207
- + max_stack_height .to_bytes (length = TYPES_STACK_BYTE_LENGTH , byteorder = "big" )
207
+ + max_stack_increase .to_bytes (length = TYPES_STACK_BYTE_LENGTH , byteorder = "big" )
208
208
)
209
209
210
210
def with_max_stack_height (self , max_stack_height ) -> "Section" :
Original file line number Diff line number Diff line change 293
293
),
294
294
"""
295
295
ef0001 01 0004 02 0001 0001 ff 0000 00
296
- 01800001
296
+ 01800000
297
297
00
298
298
""" ,
299
299
),
310
310
),
311
311
"""
312
312
ef0001 01 0004 02 0001 0001 ff 0000 00
313
- ff8000ff
313
+ ff800000
314
314
00
315
315
""" ,
316
316
),
Original file line number Diff line number Diff line change @@ -326,7 +326,7 @@ def test_all_unreachable_terminating_opcodes_before_stop(
326
326
# for stack overflow.
327
327
# 2. Max stack height above limit, where we don't modify the `max_stack_height` field of the
328
328
# code section, so the actual code doesn't have to be verified for the stack overflow.
329
- [EOFException .INVALID_MAX_STACK_HEIGHT , EOFException .MAX_STACK_HEIGHT_ABOVE_LIMIT ],
329
+ [EOFException .INVALID_MAX_STACK_INCREASE , EOFException .MAX_STACK_INCREASE_ABOVE_LIMIT ],
330
330
)
331
331
def test_all_opcodes_stack_overflow (
332
332
eof_test : EOFTestFiller ,
@@ -345,7 +345,7 @@ def test_all_opcodes_stack_overflow(
345
345
346
346
kwargs : Dict [str , Any ] = {"code" : bytecode }
347
347
348
- if exception == EOFException .INVALID_MAX_STACK_HEIGHT :
348
+ if exception == EOFException .INVALID_MAX_STACK_INCREASE :
349
349
# Lie about the max stack height to make the code be checked for stack overflow.
350
350
kwargs ["max_stack_height" ] = MAX_OPERAND_STACK_HEIGHT
351
351
You can’t perform that action at this time.
0 commit comments