Skip to content

test_bal_builder_deposits_and_exits_same_block()

Documentation for tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists_eip8282.py::test_bal_builder_deposits_and_exits_same_block@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_deposits_and_exits_same_block --fork Amsterdam

Ensure BAL tracks both builder predeploys when a single block interleaves deposit and exit requests, pinning which transaction indices each contract's bus-slot changes carry.

Source code in tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists_eip8282.py
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
def test_bal_builder_deposits_and_exits_same_block(
    pre: Alloc,
    blockchain_test: BlockchainTestFiller,
) -> None:
    """
    Ensure BAL tracks both builder predeploys when a single block
    interleaves deposit and exit requests, pinning which transaction
    indices each contract's bus-slot changes carry.
    """
    deposit_fees = _fees(BuilderDepositRequest, 2)
    exit_fees = _fees(BuilderExitRequest, 2)
    interactions = [
        SystemContractInteractionTransaction(
            requests=[_request(BuilderDepositRequest, 0, deposit_fees[0])]
        ),
        SystemContractInteractionTransaction(
            requests=[_request(BuilderExitRequest, 0, exit_fees[0])]
        ),
        SystemContractInteractionTransaction(
            requests=[_request(BuilderDepositRequest, 1, deposit_fees[1])]
        ),
        SystemContractInteractionTransaction(
            requests=[_request(BuilderExitRequest, 1, exit_fees[1])]
        ),
    ]

    txs = []
    senders = []
    for interaction in interactions:
        prepared = interaction.update_pre(pre)
        txs += prepared.transactions()
        assert prepared.sender_account is not None
        senders.append(prepared.sender_account)
    system_call_index = len(txs) + 1

    account_expectations: Dict = {
        sender: BalAccountExpectation(
            nonce_changes=[
                BalNonceChange(block_access_index=i + 1, post_nonce=1)
            ],
        )
        for i, sender in enumerate(senders)
    }
    # Deposits are enqueued by transactions 1 and 3, exits by 2 and 4.
    account_expectations[
        BuilderDepositRequest.interaction_contract_address
    ] = _request_bus_expectation(
        BuilderDepositRequest, [(1, 1), (3, 2)], system_call_index
    )
    account_expectations[BuilderExitRequest.interaction_contract_address] = (
        _request_bus_expectation(
            BuilderExitRequest, [(2, 1), (4, 2)], system_call_index
        )
    )

    block = Block(
        txs=txs,
        expected_block_access_list=BlockAccessListExpectation(
            account_expectations=account_expectations
        ),
    )

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

Parametrized Test Cases

This test generates 1 parametrized test case across 1 fork.