Skip to content

test_builder_exit_inhibited()

Documentation for tests/amsterdam/eip8282_builder_execution_requests/test_builder_exit_disable.py::test_builder_exit_inhibited@26332146.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/amsterdam/eip8282_builder_execution_requests/test_builder_exit_disable.py::test_builder_exit_inhibited --fork Amsterdam

An exit to an inhibited predeploy reverts and produces no request, the end-of-block system call clears the inhibitor back to zero, and an identical exit in the next block is queued and dequeued normally.

Source code in tests/amsterdam/eip8282_builder_execution_requests/test_builder_exit_disable.py
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
def test_builder_exit_inhibited(
    blockchain_test: BlockchainTestFiller,
    inhibited_pre: Alloc,
) -> None:
    """
    An exit to an inhibited predeploy reverts and produces no request, the
    end-of-block system call clears the inhibitor back to zero, and an
    identical exit in the next block is queued and dequeued normally.
    """
    rejected = SystemContractInteractionTransaction(
        requests=[exit_request()]
    ).update_pre(inhibited_pre)
    accepted = SystemContractInteractionTransaction(
        requests=[exit_request()]
    ).update_pre(inhibited_pre)

    source_address = accepted.request_source_address
    assert source_address is not None

    # The dequeue advances past the record but does not zero its slots. The
    # exit record is stored as caller ++ pubkey[0:32] ++ pubkey[32:48].
    calldata = exit_request().calldata
    residual_record_slots = {
        Spec.QUEUE_STORAGE_OFFSET: source_address,
        Spec.QUEUE_STORAGE_OFFSET + 1: calldata[0:32],
        Spec.QUEUE_STORAGE_OFFSET + 2: calldata[32:48].ljust(32, b"\x00"),
    }

    blockchain_test(
        pre=inhibited_pre,
        blocks=[
            Block(
                txs=rejected.transactions(),
                header_verify=Header(requests_hash=Requests()),
            ),
            Block(
                txs=accepted.transactions(),
                header_verify=Header(
                    requests_hash=Requests(
                        *(
                            request.with_source_address(source_address)
                            for request in accepted.requests
                        )
                    )
                ),
            ),
        ],
        post={
            Spec.BUILDER_EXIT_CONTRACT_ADDRESS: Account(
                storage={
                    Spec.EXCESS_STORAGE_SLOT: 0,
                    **residual_record_slots,
                },
            ),
        },
    )

Parametrized Test Cases

This test generates 1 parametrized test case across 1 fork.