Skip to content

test_many_withdrawals()

Documentation for tests/shanghai/eip4895_withdrawals/test_withdrawals.py::test_many_withdrawals@21fb11c8.

Generate fixtures for these test cases for Prague with:

fill -v tests/shanghai/eip4895_withdrawals/test_withdrawals.py::test_many_withdrawals --fork Prague

Test Withdrawals with a count of N withdrawals in a single block where N is a high number not expected to be seen in mainnet.

Source code in tests/shanghai/eip4895_withdrawals/test_withdrawals.py
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
def test_many_withdrawals(
    blockchain_test: BlockchainTestFiller,
    pre: Alloc,
):
    """
    Test Withdrawals with a count of N withdrawals in a single block where
    N is a high number not expected to be seen in mainnet.
    """
    n = 400
    withdrawals = []
    post = {}
    for i in range(n):
        addr = pre.deploy_contract(Op.SSTORE(Op.NUMBER, 1))
        amount = i * 1
        withdrawals.append(
            Withdrawal(
                index=i,
                validator_index=i,
                address=addr,
                amount=amount,
            )
        )
        post[addr] = Account(
            code=Op.SSTORE(Op.NUMBER, 1),
            balance=amount * ONE_GWEI,
            storage={},
        )

    blocks = [
        Block(
            withdrawals=withdrawals,
        ),
    ]

    blockchain_test(pre=pre, post=post, blocks=blocks)

Parametrized Test Cases

This test case is only parametrized by fork.

Test ID (Abbreviated)
...fork_Shanghai-blockchain_test
...fork_Cancun-blockchain_test
...fork_Prague-blockchain_test
...fork_Osaka-blockchain_test