Skip to content

test_many_withdrawals()

Documentation for tests/shanghai/eip4895_withdrawals/test_withdrawals.py::test_many_withdrawals@88e9fb8f.

Generate fixtures for these test cases for Osaka with:

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

Test an unexpected high number of withdrawals in a single block.

Source code in tests/shanghai/eip4895_withdrawals/test_withdrawals.py
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
def test_many_withdrawals(
    blockchain_test: BlockchainTestFiller,
    pre: Alloc,
) -> None:
    """
    Test an unexpected high number of withdrawals in a single block.
    """
    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