Skip to content

test_withdrawal_requests_negative()

Documentation for tests/prague/eip7002_el_triggerable_withdrawals/test_withdrawal_requests.py::test_withdrawal_requests_negative@verkle@v0.0.6.

Generate fixtures for these test cases for Prague with:

Prague only:

fill -v tests/prague/eip7002_el_triggerable_withdrawals/test_withdrawal_requests.py::test_withdrawal_requests_negative --fork=Prague --evm-bin=/path/to/evm-tool-dev-version

For all forks up to and including Prague:

fill -v tests/prague/eip7002_el_triggerable_withdrawals/test_withdrawal_requests.py::test_withdrawal_requests_negative --until=Prague

Test blocks where the requests list and the actual withdrawal requests that happened in the block's transactions do not match.

Source code in tests/prague/eip7002_el_triggerable_withdrawals/test_withdrawal_requests.py
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
@pytest.mark.parametrize(
    "requests,block_body_override_requests,exception",
    [
        pytest.param(
            [],
            [
                WithdrawalRequest(
                    validator_pubkey=0x01,
                    amount=0,
                    source_address=Address(0),
                ),
            ],
            BlockException.INVALID_REQUESTS,
            id="no_withdrawals_non_empty_requests_list",
        ),
        pytest.param(
            [
                WithdrawalRequestTransaction(
                    requests=[
                        WithdrawalRequest(
                            validator_pubkey=0x01,
                            amount=0,
                            fee=Spec.get_fee(0),
                        ),
                    ]
                ),
            ],
            [],
            BlockException.INVALID_REQUESTS,
            id="single_withdrawal_request_empty_requests_list",
        ),
        pytest.param(
            [
                WithdrawalRequestTransaction(
                    requests=[
                        WithdrawalRequest(
                            validator_pubkey=0x01,
                            amount=0,
                            fee=Spec.get_fee(0),
                        ),
                    ]
                ),
            ],
            [
                WithdrawalRequest(
                    validator_pubkey=0x02,
                    amount=0,
                    source_address=TestAddress,
                )
            ],
            BlockException.INVALID_REQUESTS,
            id="single_withdrawal_request_public_key_mismatch",
        ),
        pytest.param(
            [
                WithdrawalRequestTransaction(
                    requests=[
                        WithdrawalRequest(
                            validator_pubkey=0x01,
                            amount=0,
                            fee=Spec.get_fee(0),
                        )
                    ],
                ),
            ],
            [
                WithdrawalRequest(
                    validator_pubkey=0x01,
                    amount=1,
                    source_address=TestAddress,
                )
            ],
            BlockException.INVALID_REQUESTS,
            id="single_withdrawal_request_amount_mismatch",
        ),
        pytest.param(
            [
                WithdrawalRequestTransaction(
                    requests=[
                        WithdrawalRequest(
                            validator_pubkey=0x01,
                            amount=0,
                            fee=Spec.get_fee(0),
                        )
                    ],
                ),
            ],
            [
                WithdrawalRequest(
                    validator_pubkey=0x01,
                    amount=0,
                    source_address=TestAddress2,
                )
            ],
            BlockException.INVALID_REQUESTS,
            id="single_withdrawal_request_source_address_mismatch",
        ),
        pytest.param(
            [
                WithdrawalRequestTransaction(
                    requests=[
                        WithdrawalRequest(
                            validator_pubkey=0x01,
                            amount=0,
                            fee=Spec.get_fee(0),
                        ),
                        WithdrawalRequest(
                            validator_pubkey=0x02,
                            amount=0,
                            fee=Spec.get_fee(0),
                        ),
                    ],
                ),
            ],
            [
                WithdrawalRequest(
                    validator_pubkey=0x02,
                    amount=0,
                    source_address=TestAddress,
                ),
                WithdrawalRequest(
                    validator_pubkey=0x01,
                    amount=0,
                    source_address=TestAddress,
                ),
            ],
            BlockException.INVALID_REQUESTS,
            id="two_withdrawal_requests_out_of_order",
        ),
        pytest.param(
            [
                WithdrawalRequestTransaction(
                    requests=[
                        WithdrawalRequest(
                            validator_pubkey=0x01,
                            amount=0,
                            fee=Spec.get_fee(0),
                        )
                    ],
                ),
            ],
            [
                WithdrawalRequest(
                    validator_pubkey=0x01,
                    amount=0,
                    source_address=TestAddress,
                ),
                WithdrawalRequest(
                    validator_pubkey=0x01,
                    amount=0,
                    source_address=TestAddress,
                ),
            ],
            BlockException.INVALID_REQUESTS,
            id="single_withdrawal_requests_duplicate_in_requests_list",
        ),
    ],
)
def test_withdrawal_requests_negative(
    pre: Alloc,
    blockchain_test: BlockchainTestFiller,
    requests: List[WithdrawalRequestInteractionBase],
    block_body_override_requests: List[WithdrawalRequest],
    exception: BlockException,
):
    """
    Test blocks where the requests list and the actual withdrawal requests that happened in the
    block's transactions do not match.
    """
    for d in requests:
        d.update_pre(pre)

    # No previous block so fee is the base
    fee = 1
    current_block_requests = []
    for w in requests:
        current_block_requests += w.valid_requests(fee)
    included_requests = current_block_requests[: Spec.MAX_WITHDRAWAL_REQUESTS_PER_BLOCK]

    blockchain_test(
        genesis_environment=Environment(),
        pre=pre,
        post={},
        blocks=[
            Block(
                txs=sum((r.transactions() for r in requests), []),
                header_verify=Header(
                    requests_root=included_requests,
                ),
                requests=block_body_override_requests,
                exception=exception,
            )
        ],
    )

Parametrized Test Cases

The interactive table below is also available as a standalone page.

Skipped Parameters

For more concise readability, the table below does not list the following parameter values: fork, blockchain_test, state_test, state_test_only, eof_test, eof_state_test.

Test ID requests block_body_override_requests exception
no_withdrawals_non_empty_requests_list [] [WithdrawalRequest(source_address=b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', validator_pubkey=b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01', amount=0, fee=0, valid=True, gas_limit=1000000, calldata_modifier= at 0x7f2c079dad40>)] BlockException.INVALID_REQUESTS
single_withdrawal_request_empty_requests_list [WithdrawalRequestTransaction(sender_balance=3200000000000000000000, sender_account=None, requests=[WithdrawalRequest(source_address=b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', validator_pubkey=b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01', amount=0, fee=1, valid=True, gas_limit=1000000, calldata_modifier= at 0x7f2c079dad40>)])] [] BlockException.INVALID_REQUESTS
single_withdrawal_request_public_key_mismatch [WithdrawalRequestTransaction(sender_balance=3200000000000000000000, sender_account=None, requests=[WithdrawalRequest(source_address=b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', validator_pubkey=b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01', amount=0, fee=1, valid=True, gas_limit=1000000, calldata_modifier= at 0x7f2c079dad40>)])] [WithdrawalRequest(source_address=b'\xa9OSt\xfc\xe5\xed\xbc\x8e*\x86\x97\xc1S1g~n\xbf\x0b', validator_pubkey=b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02', amount=0, fee=0, valid=True, gas_limit=1000000, calldata_modifier= at 0x7f2c079dad40>)] BlockException.INVALID_REQUESTS
single_withdrawal_request_amount_mismatch [WithdrawalRequestTransaction(sender_balance=3200000000000000000000, sender_account=None, requests=[WithdrawalRequest(source_address=b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', validator_pubkey=b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01', amount=0, fee=1, valid=True, gas_limit=1000000, calldata_modifier= at 0x7f2c079dad40>)])] [WithdrawalRequest(source_address=b'\xa9OSt\xfc\xe5\xed\xbc\x8e*\x86\x97\xc1S1g~n\xbf\x0b', validator_pubkey=b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01', amount=1, fee=0, valid=True, gas_limit=1000000, calldata_modifier= at 0x7f2c079dad40>)] BlockException.INVALID_REQUESTS
single_withdrawal_request_source_address_mismatch [WithdrawalRequestTransaction(sender_balance=3200000000000000000000, sender_account=None, requests=[WithdrawalRequest(source_address=b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', validator_pubkey=b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01', amount=0, fee=1, valid=True, gas_limit=1000000, calldata_modifier= at 0x7f2c079dad40>)])] [WithdrawalRequest(source_address=b'\x8a\n\x19X\x951iBP\xd5p\x04\n\x0cKtWi\x19\xb8', validator_pubkey=b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01', amount=0, fee=0, valid=True, gas_limit=1000000, calldata_modifier= at 0x7f2c079dad40>)] BlockException.INVALID_REQUESTS
two_withdrawal_requests_out_of_order [WithdrawalRequestTransaction(sender_balance=3200000000000000000000, sender_account=None, requests=[WithdrawalRequest(source_address=b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', validator_pubkey=b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01', amount=0, fee=1, valid=True, gas_limit=1000000, calldata_modifier= at 0x7f2c079dad40>), WithdrawalRequest(source_address=b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', validator_pubkey=b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02', amount=0, fee=1, valid=True, gas_limit=1000000, calldata_modifier= at 0x7f2c079dad40>)])] [WithdrawalRequest(source_address=b'\xa9OSt\xfc\xe5\xed\xbc\x8e*\x86\x97\xc1S1g~n\xbf\x0b', validator_pubkey=b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02', amount=0, fee=0, valid=True, gas_limit=1000000, calldata_modifier= at 0x7f2c079dad40>), WithdrawalRequest(source_address=b'\xa9OSt\xfc\xe5\xed\xbc\x8e*\x86\x97\xc1S1g~n\xbf\x0b', validator_pubkey=b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01', amount=0, fee=0, valid=True, gas_limit=1000000, calldata_modifier= at 0x7f2c079dad40>)] BlockException.INVALID_REQUESTS
single_withdrawal_requests_duplicate_in_requests_list [WithdrawalRequestTransaction(sender_balance=3200000000000000000000, sender_account=None, requests=[WithdrawalRequest(source_address=b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', validator_pubkey=b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01', amount=0, fee=1, valid=True, gas_limit=1000000, calldata_modifier= at 0x7f2c079dad40>)])] [WithdrawalRequest(source_address=b'\xa9OSt\xfc\xe5\xed\xbc\x8e*\x86\x97\xc1S1g~n\xbf\x0b', validator_pubkey=b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01', amount=0, fee=0, valid=True, gas_limit=1000000, calldata_modifier= at 0x7f2c079dad40>), WithdrawalRequest(source_address=b'\xa9OSt\xfc\xe5\xed\xbc\x8e*\x86\x97\xc1S1g~n\xbf\x0b', validator_pubkey=b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01', amount=0, fee=0, valid=True, gas_limit=1000000, calldata_modifier= at 0x7f2c079dad40>)] BlockException.INVALID_REQUESTS