Skip to content

Commit 6a9a515

Browse files
authored
refactor(tests): change RJUMP validation tests to max_stack_increase (#1448)
Convert all EOF validation tests for EIP-4200 (relative jumps) to use `max_stack_increase`. The conversion here is simple because all these tests use the code section 0 and therefore `max_stack_increase` is equivalent to `max_stack_height`.
1 parent 91687b7 commit 6a9a515

File tree

3 files changed

+119
-119
lines changed

3 files changed

+119
-119
lines changed

tests/osaka/eip7692_eof_v1/eip4200_relative_jumps/test_rjump.py

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ def test_rjump_into_self_pre_code(
275275
sections=[
276276
Section.Code(
277277
code=Op.RJUMP[0] + Op.STOP,
278-
max_stack_height=0,
278+
max_stack_increase=0,
279279
),
280280
],
281281
expected_bytecode="ef00010100040200010004ff00000000800000e0000000",
@@ -285,7 +285,7 @@ def test_rjump_into_self_pre_code(
285285
sections=[
286286
Section.Code(
287287
code=Op.PUSH0 + Op.PUSH1[0] + Op.RJUMPI[3] + Op.RJUMP[1] + Op.NOT + Op.STOP,
288-
max_stack_height=2,
288+
max_stack_increase=2,
289289
),
290290
],
291291
expected_bytecode="ef0001010004020001000bff000000008000025f6000e10003e000011900",
@@ -303,7 +303,7 @@ def test_rjump_into_self_pre_code(
303303
+ Op.RJUMP[1]
304304
+ Op.NOT
305305
+ Op.STOP,
306-
max_stack_height=2,
306+
max_stack_increase=2,
307307
),
308308
],
309309
expected_bytecode="ef00010100040200010013ff000000008000025f6000e100086000e10006e00004e000011900",
@@ -313,7 +313,7 @@ def test_rjump_into_self_pre_code(
313313
sections=[
314314
Section.Code(
315315
code=Op.PUSH0 + Op.PUSH1[0] + Op.RJUMPI[3] + Op.RJUMP[1] + Op.PUSH0 + Op.STOP,
316-
max_stack_height=2,
316+
max_stack_increase=2,
317317
),
318318
],
319319
expected_bytecode="ef0001010004020001000bff000000008000025f6000e10003e000015f00",
@@ -332,7 +332,7 @@ def test_rjump_into_self_pre_code(
332332
+ Op.RJUMP[1]
333333
+ Op.NOT
334334
+ Op.STOP,
335-
max_stack_height=2,
335+
max_stack_increase=2,
336336
),
337337
],
338338
expected_bytecode="ef00010100040200010014ff000000008000025f6000e100086000e10007e000055fe000011900",
@@ -348,7 +348,7 @@ def test_rjump_into_self_pre_code(
348348
+ Op.PUSH0
349349
+ Op.RJUMP[0]
350350
+ Op.STOP,
351-
max_stack_height=3,
351+
max_stack_increase=3,
352352
),
353353
],
354354
expected_bytecode="ef0001010004020001000cff000000008000035f6000e100025f5fe0000000",
@@ -368,7 +368,7 @@ def test_rjump_into_self_pre_code(
368368
+ Op.RJUMP[1]
369369
+ Op.NOT
370370
+ Op.STOP,
371-
max_stack_height=5,
371+
max_stack_increase=5,
372372
),
373373
],
374374
expected_bytecode="ef00010100040200010013ff000000008000055f6000e100025f5f5f6000e10003e000011900",
@@ -391,7 +391,7 @@ def test_rjump_into_self_pre_code(
391391
+ Op.RJUMP[1]
392392
+ Op.NOT
393393
+ Op.STOP,
394-
max_stack_height=5,
394+
max_stack_increase=5,
395395
),
396396
],
397397
expected_bytecode="ef0001010004020001001bff000000008000055f6000e100025f5f5f6000e100086000e10006e00004e000011900",
@@ -411,7 +411,7 @@ def test_rjump_into_self_pre_code(
411411
+ Op.RJUMP[1]
412412
+ Op.PUSH0
413413
+ Op.STOP,
414-
max_stack_height=5,
414+
max_stack_increase=5,
415415
),
416416
],
417417
expected_bytecode="ef00010100040200010013ff000000008000055f6000e100025f5f5f6000e10003e000015f00",
@@ -434,7 +434,7 @@ def test_rjump_into_self_pre_code(
434434
+ Op.RJUMP[1]
435435
+ Op.NOT
436436
+ Op.STOP,
437-
max_stack_height=4,
437+
max_stack_increase=4,
438438
),
439439
],
440440
expected_bytecode="ef0001010004020001001bff000000008000045f6000e100025f5f6000e100086000e10007e000055fe000011900",
@@ -461,7 +461,7 @@ def test_rjump_valid_forward(
461461
sections=[
462462
Section.Code(
463463
code=Op.PUSH0 + Op.POP + Op.RJUMP[-5],
464-
max_stack_height=1,
464+
max_stack_increase=1,
465465
),
466466
],
467467
expected_bytecode="ef00010100040200010005ff000000008000015f50e0fffb",
@@ -476,7 +476,7 @@ def test_rjump_valid_forward(
476476
+ Op.RJUMPI[3]
477477
+ Op.RJUMP[-8]
478478
+ Op.RJUMP[-11],
479-
max_stack_height=1,
479+
max_stack_increase=1,
480480
),
481481
],
482482
expected_bytecode="ef0001010004020001000dff000000008000015f506001e10003e0fff8e0fff5",
@@ -491,7 +491,7 @@ def test_rjump_valid_forward(
491491
+ Op.PUSH0
492492
+ Op.PUSH0
493493
+ Op.RJUMP[-3],
494-
max_stack_height=3,
494+
max_stack_increase=3,
495495
),
496496
],
497497
expected_bytecode="ef0001010004020001000bff000000008000035f6000e100025f5fe0fffd",
@@ -508,7 +508,7 @@ def test_rjump_valid_forward(
508508
+ Op.PUSH0
509509
+ Op.POP
510510
+ Op.RJUMP[-5],
511-
max_stack_height=4,
511+
max_stack_increase=4,
512512
),
513513
],
514514
expected_bytecode="ef0001010004020001000dff000000008000045f6000e100025f5f5f50e0fffb",
@@ -530,7 +530,7 @@ def test_rjump_valid_forward(
530530
+ Op.RJUMP[-8]
531531
+ Op.RJUMP[-11]
532532
),
533-
max_stack_height=4,
533+
max_stack_increase=4,
534534
),
535535
],
536536
expected_bytecode="ef00010100040200010015ff000000008000045f6000e100025f5f5f506001e10003e0fff8e0fff5",
@@ -585,7 +585,7 @@ def test_rjump_into_stack_height_diff_2(
585585
+ Op.RJUMP[-8]
586586
+ Op.PUSH0
587587
+ Op.RJUMP[-12],
588-
max_stack_height=1,
588+
max_stack_increase=1,
589589
),
590590
],
591591
expected_bytecode="ef0001010004020001000eff000000008000015f506001e10003e0fff85fe0fff4",
@@ -595,7 +595,7 @@ def test_rjump_into_stack_height_diff_2(
595595
sections=[
596596
Section.Code(
597597
code=Op.PUSH0 + Op.RJUMP[-4],
598-
max_stack_height=1,
598+
max_stack_increase=1,
599599
),
600600
],
601601
expected_bytecode="ef00010100040200010004ff000000008000015fe0fffc",
@@ -605,7 +605,7 @@ def test_rjump_into_stack_height_diff_2(
605605
sections=[
606606
Section.Code(
607607
code=Op.PUSH0 + Op.POP + Op.RJUMP[-4],
608-
max_stack_height=1,
608+
max_stack_increase=1,
609609
),
610610
],
611611
expected_bytecode="ef00010100040200010005ff000000008000015f50e0fffc",
@@ -620,7 +620,7 @@ def test_rjump_into_stack_height_diff_2(
620620
+ Op.RJUMPI[-7]
621621
+ Op.PUSH0
622622
+ Op.RJUMP[-11],
623-
max_stack_height=1,
623+
max_stack_increase=1,
624624
),
625625
],
626626
expected_bytecode="ef0001010004020001000bff000000008000015f506000e1fff95fe0fff5",
@@ -643,7 +643,7 @@ def test_rjump_into_stack_height_diff_2(
643643
+ Op.PUSH0
644644
+ Op.RJUMP[-12]
645645
),
646-
max_stack_height=4,
646+
max_stack_increase=4,
647647
),
648648
],
649649
expected_bytecode="ef00010100040200010016ff000000008000045f6000e100025f5f5f506001e10003e0fff85fe0fff4",
@@ -663,7 +663,7 @@ def test_rjump_into_stack_height_diff_2(
663663
+ Op.PUSH0
664664
+ Op.RJUMP[-7]
665665
),
666-
max_stack_height=4,
666+
max_stack_increase=4,
667667
),
668668
],
669669
expected_bytecode="ef00010100040200010011ff000000008000045f6000e100025f5f6000e100015fe0fff9",
@@ -683,7 +683,7 @@ def test_rjump_into_stack_height_diff_2(
683683
+ Op.POP
684684
+ Op.RJUMP[-7]
685685
),
686-
max_stack_height=4,
686+
max_stack_increase=4,
687687
),
688688
],
689689
expected_bytecode="ef00010100040200010011ff000000008000045f6000e100025f5f6000e1000150e0fff9",
@@ -699,7 +699,7 @@ def test_rjump_into_stack_height_diff_2(
699699
+ Op.PUSH0
700700
+ Op.PUSH0
701701
+ Op.RJUMP[-4],
702-
max_stack_height=4,
702+
max_stack_increase=4,
703703
),
704704
],
705705
expected_bytecode="ef0001010004020001000cff000000008000045f6000e100025f5f5fe0fffc",
@@ -716,7 +716,7 @@ def test_rjump_into_stack_height_diff_2(
716716
+ Op.PUSH0
717717
+ Op.POP
718718
+ Op.RJUMP[-4],
719-
max_stack_height=3,
719+
max_stack_increase=3,
720720
),
721721
],
722722
expected_bytecode="ef0001010004020001000dff000000008000035f6000e100025f5f5f50e0fffc",
@@ -736,7 +736,7 @@ def test_rjump_into_stack_height_diff_2(
736736
+ Op.RJUMPI[-7]
737737
+ Op.PUSH0
738738
+ Op.RJUMP[-11],
739-
max_stack_height=4,
739+
max_stack_increase=4,
740740
),
741741
],
742742
expected_bytecode="ef00010100040200010013ff000000008000045f6000e100025f5f5f506000e1fff95fe0fff5",
@@ -1067,7 +1067,7 @@ def test_rjump_backwards_illegal_stack_height(
10671067
+ Op.PUSH3[0x015500]
10681068
+ Op.RJUMP[-10]
10691069
),
1070-
max_stack_height=0x24,
1070+
max_stack_increase=0x24,
10711071
),
10721072
expect_exception=EOFException.STACK_HEIGHT_MISMATCH,
10731073
)

0 commit comments

Comments
 (0)