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):
266266 EOFException .INVALID_RJUMP_DESTINATION : "err: invalid_rjump_destination" ,
267267 EOFException .UNREACHABLE_CODE_SECTIONS : "err: unreachable_code_sections" ,
268268 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 " ,
270270 EOFException .STACK_HIGHER_THAN_OUTPUTS : "err: stack_higher_than_outputs_required" ,
271271 EOFException .JUMPF_DESTINATION_INCOMPATIBLE_OUTPUTS : (
272272 "err: jumpf_destination_incompatible_outputs"
273273 ),
274- EOFException .INVALID_MAX_STACK_HEIGHT : "err: invalid_max_stack_height " ,
274+ EOFException .INVALID_MAX_STACK_INCREASE : "err: invalid_max_stack_increase " ,
275275 EOFException .INVALID_DATALOADN_INDEX : "err: invalid_dataloadn_index" ,
276276 EOFException .TRUNCATED_INSTRUCTION : "err: truncated_instruction" ,
277277 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):
9696 EOFException .INVALID_RJUMP_DESTINATION : "err: invalid_rjump_destination" ,
9797 EOFException .UNREACHABLE_CODE_SECTIONS : "err: unreachable_code_sections" ,
9898 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 " ,
100100 EOFException .STACK_HIGHER_THAN_OUTPUTS : "err: stack_higher_than_outputs_required" ,
101101 EOFException .JUMPF_DESTINATION_INCOMPATIBLE_OUTPUTS : (
102102 "err: jumpf_destination_incompatible_outputs"
103103 ),
104- EOFException .INVALID_MAX_STACK_HEIGHT : "err: invalid_max_stack_height " ,
104+ EOFException .INVALID_MAX_STACK_INCREASE : "err: invalid_max_stack_increase " ,
105105 EOFException .INVALID_DATALOADN_INDEX : "err: invalid_dataloadn_index" ,
106106 EOFException .TRUNCATED_INSTRUCTION : "err: truncated_instruction" ,
107107 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):
105105 EOFException .UNREACHABLE_CODE_SECTIONS : "err: unreachable_code_sections" ,
106106 EOFException .STACK_UNDERFLOW : "err: stack_underflow" ,
107107 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 " ,
109109 EOFException .STACK_HIGHER_THAN_OUTPUTS : "err: stack_higher_than_outputs_required" ,
110110 EOFException .JUMPF_DESTINATION_INCOMPATIBLE_OUTPUTS : (
111111 "err: jumpf_destination_incompatible_outputs"
112112 ),
113- EOFException .INVALID_MAX_STACK_HEIGHT : "err: invalid_max_stack_height " ,
113+ EOFException .INVALID_MAX_STACK_INCREASE : "err: invalid_max_stack_increase " ,
114114 EOFException .INVALID_DATALOADN_INDEX : "err: invalid_dataloadn_index" ,
115115 EOFException .TRUNCATED_INSTRUCTION : "err: truncated_instruction" ,
116116 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):
182182 EOFException .INVALID_RJUMP_DESTINATION : "err: invalid_rjump_destination" ,
183183 EOFException .UNREACHABLE_CODE_SECTIONS : "err: unreachable_code_sections" ,
184184 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 " ,
186186 EOFException .STACK_HIGHER_THAN_OUTPUTS : "err: stack_higher_than_outputs_required" ,
187187 EOFException .JUMPF_DESTINATION_INCOMPATIBLE_OUTPUTS : (
188188 "err: jumpf_destination_incompatible_outputs"
189189 ),
190- EOFException .INVALID_MAX_STACK_HEIGHT : "err: invalid_max_stack_height " ,
190+ EOFException .INVALID_MAX_STACK_INCREASE : "err: invalid_max_stack_increase " ,
191191 EOFException .INVALID_DATALOADN_INDEX : "err: invalid_dataloadn_index" ,
192192 EOFException .TRUNCATED_INSTRUCTION : "err: truncated_instruction" ,
193193 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):
7575 EOFException .INVALID_RJUMP_DESTINATION : "err: invalid_rjump_destination" ,
7676 EOFException .UNREACHABLE_CODE_SECTIONS : "err: unreachable_code_sections" ,
7777 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 " ,
7979 EOFException .STACK_HIGHER_THAN_OUTPUTS : "err: stack_higher_than_outputs_required" ,
8080 EOFException .JUMPF_DESTINATION_INCOMPATIBLE_OUTPUTS : (
8181 "err: jumpf_destination_incompatible_outputs"
8282 ),
83- EOFException .INVALID_MAX_STACK_HEIGHT : "err: invalid_max_stack_height " ,
83+ EOFException .INVALID_MAX_STACK_INCREASE : "err: invalid_max_stack_increase " ,
8484 EOFException .INVALID_DATALOADN_INDEX : "err: invalid_dataloadn_index" ,
8585 EOFException .TRUNCATED_INSTRUCTION : "err: truncated_instruction" ,
8686 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):
114114 EOFException .INVALID_RJUMP_DESTINATION : "err: invalid_rjump_destination" ,
115115 EOFException .UNREACHABLE_CODE_SECTIONS : "err: unreachable_code_sections" ,
116116 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 " ,
118118 EOFException .STACK_HIGHER_THAN_OUTPUTS : "err: stack_higher_than_outputs_required" ,
119119 EOFException .JUMPF_DESTINATION_INCOMPATIBLE_OUTPUTS : (
120120 "err: jumpf_destination_incompatible_outputs"
121121 ),
122- EOFException .INVALID_MAX_STACK_HEIGHT : "err: invalid_max_stack_height " ,
122+ EOFException .INVALID_MAX_STACK_INCREASE : "err: invalid_max_stack_increase " ,
123123 EOFException .INVALID_DATALOADN_INDEX : "err: invalid_dataloadn_index" ,
124124 EOFException .TRUNCATED_INSTRUCTION : "err: truncated_instruction" ,
125125 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):
710710 """
711711 EOF container section stack height mismatch.
712712 """
713- MAX_STACK_HEIGHT_ABOVE_LIMIT = auto ()
713+ MAX_STACK_INCREASE_ABOVE_LIMIT = auto ()
714714 """
715- EOF container's specified max stack height is above the limit.
715+ EOF container's specified max stack increase is above the limit.
716716 """
717717 STACK_HIGHER_THAN_OUTPUTS = auto ()
718718 """
@@ -723,9 +723,9 @@ class EOFException(ExceptionBase):
723723 """
724724 EOF container section JUMPF's to a destination section with incompatible outputs.
725725 """
726- INVALID_MAX_STACK_HEIGHT = auto ()
726+ INVALID_MAX_STACK_INCREASE = auto ()
727727 """
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.
729729 """
730730 INVALID_DATALOADN_INDEX = auto ()
731731 """
Original file line number Diff line number Diff line change @@ -199,12 +199,12 @@ def type_definition(self) -> bytes:
199199 auto_code_outputs ,
200200 )
201201
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"
204204 return (
205205 code_inputs .to_bytes (length = TYPES_INPUTS_BYTE_LENGTH , byteorder = "big" )
206206 + 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" )
208208 )
209209
210210 def with_max_stack_height (self , max_stack_height ) -> "Section" :
Original file line number Diff line number Diff line change 293293 ),
294294 """
295295 ef0001 01 0004 02 0001 0001 ff 0000 00
296- 01800001
296+ 01800000
297297 00
298298 """ ,
299299 ),
310310 ),
311311 """
312312 ef0001 01 0004 02 0001 0001 ff 0000 00
313- ff8000ff
313+ ff800000
314314 00
315315 """ ,
316316 ),
Original file line number Diff line number Diff line change @@ -326,7 +326,7 @@ def test_all_unreachable_terminating_opcodes_before_stop(
326326 # for stack overflow.
327327 # 2. Max stack height above limit, where we don't modify the `max_stack_height` field of the
328328 # 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 ],
330330)
331331def test_all_opcodes_stack_overflow (
332332 eof_test : EOFTestFiller ,
@@ -345,7 +345,7 @@ def test_all_opcodes_stack_overflow(
345345
346346 kwargs : Dict [str , Any ] = {"code" : bytecode }
347347
348- if exception == EOFException .INVALID_MAX_STACK_HEIGHT :
348+ if exception == EOFException .INVALID_MAX_STACK_INCREASE :
349349 # Lie about the max stack height to make the code be checked for stack overflow.
350350 kwargs ["max_stack_height" ] = MAX_OPERAND_STACK_HEIGHT
351351
You can’t perform that action at this time.
0 commit comments