Skip to content

test_request_overpayment()

Documentation for tests/amsterdam/eip8282_builder_execution_requests/test_request_predeploys.py::test_request_overpayment@52161d99.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/amsterdam/eip8282_builder_execution_requests/test_request_predeploys.py::test_request_overpayment --fork Amsterdam

A request paying one wei more than required is queued and the surplus stays in the predeploy.

Source code in tests/amsterdam/eip8282_builder_execution_requests/test_request_predeploys.py
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
@EIPChecklist.SystemContract.Test.ValueTransfer.Fee.Over()
def test_request_overpayment(
    blockchain_test: BlockchainTestFiller,
    pre: Alloc,
    request_class: Type[FeeSystemContractRequest],
) -> None:
    """
    A request paying one wei more than required is queued and the surplus
    stays in the predeploy.
    """
    request = request_class.from_index(0).copy(
        fee=request_class.get_fee(0) + 1
    )
    predeploy = request_class.system_contract_address
    sender = pre.fund_eoa()
    txs = SystemContractInteractionTransaction(
        sender_account=sender, requests=[request]
    ).transactions()

    blockchain_test(
        pre=pre,
        blocks=[
            Block(
                txs=txs,
                header_verify=Header(
                    requests_hash=Requests(request.with_source_address(sender))
                ),
                expected_block_access_list=BlockAccessListExpectation(
                    account_expectations={
                        predeploy: BalAccountExpectation(
                            balance_changes=[
                                BalBalanceChange(
                                    block_access_index=1,
                                    post_balance=request.value,
                                )
                            ],
                            storage_changes=[
                                queued_count_changes(request_class, 1, 2)
                            ],
                        ),
                    }
                ),
            )
        ],
        post={predeploy: Account(balance=request.value)},
    )

Parametrized Test Cases

This test generates 4 parametrized test cases across 1 fork.