Skip to content

Commit 2b5f461

Browse files
authored
feat(tests): add consolidations & withdrawal requests with call_depth>2 (#1415)
* feat(tests): add consolidations & withdrawal requests with `call_depth>2` * fix(tests): increase `gas_limit`; reduce depth * fix(tests): fix tx_gas_limit, reduce depth, make test id consistent
1 parent 973e220 commit 2b5f461

File tree

3 files changed

+245
-1
lines changed

3 files changed

+245
-1
lines changed

tests/prague/eip6110_deposits/test_deposits.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,7 @@
692692
tx_gas_limit=2_500_000_000_000,
693693
),
694694
],
695-
id="single_deposit_from_contract_call_high_depth",
695+
id="single_deposit_from_contract_call_depth_high",
696696
),
697697
# TODO: Send eth with the transaction to the contract
698698
],

tests/prague/eip7002_el_triggerable_withdrawals/test_withdrawal_requests.py

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,41 @@
297297
],
298298
id="single_block_single_withdrawal_request_from_contract",
299299
),
300+
pytest.param(
301+
[
302+
[
303+
WithdrawalRequestContract(
304+
requests=[
305+
WithdrawalRequest(
306+
validator_pubkey=0x01,
307+
amount=0,
308+
fee=Spec.get_fee(0),
309+
),
310+
],
311+
call_depth=3,
312+
),
313+
],
314+
],
315+
id="single_block_single_withdrawal_request_from_contract_call_depth_3",
316+
),
317+
pytest.param(
318+
[
319+
[
320+
WithdrawalRequestContract(
321+
requests=[
322+
WithdrawalRequest(
323+
validator_pubkey=0x01,
324+
amount=0,
325+
fee=Spec.get_fee(0),
326+
),
327+
],
328+
call_depth=100,
329+
tx_gas_limit=30_000_000,
330+
),
331+
],
332+
],
333+
id="single_block_single_withdrawal_request_from_contract_call_depth_high",
334+
),
300335
pytest.param(
301336
[
302337
[
@@ -505,6 +540,92 @@
505540
],
506541
id="single_block_single_withdrawal_request_delegatecall_staticcall_callcode",
507542
),
543+
pytest.param(
544+
[
545+
[
546+
WithdrawalRequestContract(
547+
requests=[
548+
WithdrawalRequest(
549+
validator_pubkey=0x01,
550+
amount=0,
551+
fee=Spec.get_fee(0),
552+
valid=False,
553+
)
554+
],
555+
call_type=Op.DELEGATECALL,
556+
call_depth=3,
557+
),
558+
WithdrawalRequestContract(
559+
requests=[
560+
WithdrawalRequest(
561+
validator_pubkey=0x01,
562+
amount=0,
563+
fee=Spec.get_fee(0),
564+
valid=False,
565+
)
566+
],
567+
call_type=Op.STATICCALL,
568+
call_depth=3,
569+
),
570+
WithdrawalRequestContract(
571+
requests=[
572+
WithdrawalRequest(
573+
validator_pubkey=0x01,
574+
amount=0,
575+
fee=Spec.get_fee(0),
576+
valid=False,
577+
)
578+
],
579+
call_type=Op.CALLCODE,
580+
call_depth=3,
581+
),
582+
],
583+
],
584+
id="single_block_single_withdrawal_request_delegatecall_staticcall_callcode_call_depth_3",
585+
),
586+
pytest.param(
587+
[
588+
[
589+
WithdrawalRequestContract(
590+
requests=[
591+
WithdrawalRequest(
592+
validator_pubkey=0x01,
593+
amount=0,
594+
fee=Spec.get_fee(0),
595+
valid=False,
596+
)
597+
],
598+
call_type=Op.DELEGATECALL,
599+
call_depth=1024,
600+
),
601+
WithdrawalRequestContract(
602+
requests=[
603+
WithdrawalRequest(
604+
validator_pubkey=0x01,
605+
amount=0,
606+
fee=Spec.get_fee(0),
607+
valid=False,
608+
)
609+
],
610+
call_type=Op.STATICCALL,
611+
call_depth=1024,
612+
),
613+
WithdrawalRequestContract(
614+
requests=[
615+
WithdrawalRequest(
616+
validator_pubkey=0x01,
617+
amount=0,
618+
fee=Spec.get_fee(0),
619+
valid=False,
620+
)
621+
],
622+
call_type=Op.CALLCODE,
623+
call_depth=1024,
624+
),
625+
],
626+
],
627+
id="single_block_single_withdrawal_request_delegatecall_staticcall_callcode_call_depth_high",
628+
),
508629
],
509630
)
510631
def test_withdrawal_requests(

tests/prague/eip7251_consolidations/test_consolidations.py

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,43 @@
344344
],
345345
id="single_block_multiple_consolidation_requests_from_contract",
346346
),
347+
pytest.param(
348+
[
349+
[
350+
ConsolidationRequestContract(
351+
requests=[
352+
ConsolidationRequest(
353+
source_pubkey=i * 2,
354+
target_pubkey=i * 2 + 1,
355+
fee=Spec.get_fee(0),
356+
)
357+
for i in range(Spec.MAX_CONSOLIDATION_REQUESTS_PER_BLOCK * 5)
358+
],
359+
call_depth=3,
360+
),
361+
],
362+
],
363+
id="single_block_multiple_consolidation_requests_from_contract_call_depth_3",
364+
),
365+
pytest.param(
366+
[
367+
[
368+
ConsolidationRequestContract(
369+
requests=[
370+
ConsolidationRequest(
371+
source_pubkey=i * 2,
372+
target_pubkey=i * 2 + 1,
373+
fee=Spec.get_fee(0),
374+
gas_limit=6_000_000,
375+
)
376+
for i in range(Spec.MAX_CONSOLIDATION_REQUESTS_PER_BLOCK * 5)
377+
],
378+
call_depth=100,
379+
),
380+
],
381+
],
382+
id="single_block_multiple_consolidation_requests_from_contract_call_depth_high",
383+
),
347384
pytest.param(
348385
[
349386
[
@@ -531,6 +568,92 @@
531568
],
532569
id="single_block_single_consolidation_request_delegatecall_staticcall_callcode",
533570
),
571+
pytest.param(
572+
[
573+
[
574+
ConsolidationRequestContract(
575+
requests=[
576+
ConsolidationRequest(
577+
source_pubkey=0x01,
578+
target_pubkey=0x02,
579+
fee=Spec.get_fee(0),
580+
valid=False,
581+
)
582+
],
583+
call_type=Op.DELEGATECALL,
584+
call_depth=3,
585+
),
586+
ConsolidationRequestContract(
587+
requests=[
588+
ConsolidationRequest(
589+
source_pubkey=0x01,
590+
target_pubkey=0x02,
591+
fee=Spec.get_fee(0),
592+
valid=False,
593+
)
594+
],
595+
call_type=Op.STATICCALL,
596+
call_depth=3,
597+
),
598+
ConsolidationRequestContract(
599+
requests=[
600+
ConsolidationRequest(
601+
source_pubkey=0x01,
602+
target_pubkey=0x02,
603+
fee=Spec.get_fee(0),
604+
valid=False,
605+
)
606+
],
607+
call_type=Op.CALLCODE,
608+
call_depth=3,
609+
),
610+
],
611+
],
612+
id="single_block_single_consolidation_request_delegatecall_staticcall_callcode_call_depth_3",
613+
),
614+
pytest.param(
615+
[
616+
[
617+
ConsolidationRequestContract(
618+
requests=[
619+
ConsolidationRequest(
620+
source_pubkey=0x01,
621+
target_pubkey=0x02,
622+
fee=Spec.get_fee(0),
623+
valid=False,
624+
)
625+
],
626+
call_type=Op.DELEGATECALL,
627+
call_depth=1024,
628+
),
629+
ConsolidationRequestContract(
630+
requests=[
631+
ConsolidationRequest(
632+
source_pubkey=0x01,
633+
target_pubkey=0x02,
634+
fee=Spec.get_fee(0),
635+
valid=False,
636+
)
637+
],
638+
call_type=Op.STATICCALL,
639+
call_depth=1024,
640+
),
641+
ConsolidationRequestContract(
642+
requests=[
643+
ConsolidationRequest(
644+
source_pubkey=0x01,
645+
target_pubkey=0x02,
646+
fee=Spec.get_fee(0),
647+
valid=False,
648+
)
649+
],
650+
call_type=Op.CALLCODE,
651+
call_depth=1024,
652+
),
653+
],
654+
],
655+
id="single_block_single_consolidation_request_delegatecall_staticcall_callcode_call_depth_high",
656+
),
534657
],
535658
)
536659
def test_consolidation_requests(

0 commit comments

Comments
 (0)