Skip to content

test_bal_builder_request_invalid()

Documentation for tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists_eip8282.py::test_bal_builder_request_invalid@26332146.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists_eip8282.py::test_bal_builder_request_invalid --fork Amsterdam

Ensure BAL records only reads on a builder predeploy when the request call reverts for an insufficient fee: the reverted enqueue leaves no storage change and the system-call dequeue finds an empty queue.

Source code in tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists_eip8282.py
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
@pytest.mark.parametrize(
    "request_obj",
    [
        pytest.param(
            BuilderDepositRequest(
                pubkey=1,
                withdrawal_credentials=2,
                amount=Spec8282.BUILDER_MIN_DEPOSIT // 10**9,
                signature=3,
                fee=0,
                valid=False,
            ),
            id="deposit_insufficient_fee",
        ),
        pytest.param(
            BuilderExitRequest(pubkey=1, fee=0, valid=False),
            id="exit_insufficient_fee",
        ),
    ],
)
def test_bal_builder_request_invalid(
    pre: Alloc,
    blockchain_test: BlockchainTestFiller,
    request_obj: FeeSystemContractRequest,
) -> None:
    """
    Ensure BAL records only reads on a builder predeploy when the request
    call reverts for an insufficient fee: the reverted enqueue leaves no
    storage change and the system-call dequeue finds an empty queue.
    """
    interaction = SystemContractInteractionTransaction(requests=[request_obj])
    prepared = interaction.update_pre(pre)
    txs = prepared.transactions()
    sender = prepared.sender_account
    assert sender is not None

    contract = request_obj.interaction_contract_address

    block = Block(
        txs=txs,
        expected_block_access_list=BlockAccessListExpectation(
            account_expectations={
                sender: BalAccountExpectation(
                    nonce_changes=[
                        BalNonceChange(block_access_index=1, post_nonce=1)
                    ],
                ),
                contract: BalAccountExpectation(
                    storage_reads=[
                        Spec8282.EXCESS_STORAGE_SLOT,
                        Spec8282.COUNT_STORAGE_SLOT,
                        Spec8282.QUEUE_HEAD_STORAGE_SLOT,
                        Spec8282.QUEUE_TAIL_STORAGE_SLOT,
                    ],
                    storage_changes=[],
                ),
            }
        ),
    )

    blockchain_test(pre=pre, blocks=[block], post={})

Parametrized Test Cases

This test generates 2 parametrized test cases across 1 fork.