Skip to content

test_large_amount()

Documentation for tests/shanghai/eip4895_withdrawals/test_withdrawals.py::test_large_amount@f6ab9733.

Generate fixtures for these test cases for Shanghai with:

Shanghai only:

fill -v tests/shanghai/eip4895_withdrawals/test_withdrawals.py::test_large_amount --fork=Shanghai --evm-bin=/path/to/evm-tool-dev-version

For all forks up to and including Shanghai:

fill -v tests/shanghai/eip4895_withdrawals/test_withdrawals.py::test_large_amount --until=Shanghai

Test Withdrawals that have a large gwei amount, so that (gwei * 1e9) could overflow uint64 but not uint256.

Source code in tests/shanghai/eip4895_withdrawals/test_withdrawals.py
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
def test_large_amount(
    blockchain_test: BlockchainTestFiller,
    pre: Alloc,
):
    """
    Test Withdrawals that have a large gwei amount, so that (gwei * 1e9)
    could overflow uint64 but not uint256.
    """
    withdrawals: List[Withdrawal] = []
    amounts: List[int] = [
        (2**35),
        (2**64) - 1,
        (2**63) + 1,
        (2**63),
        (2**63) - 1,
    ]

    post = {}

    for i, amount in enumerate(amounts):
        addr = pre.fund_eoa(0)
        withdrawals.append(
            Withdrawal(
                index=i,
                validator_index=i,
                address=addr,
                amount=amount,
            )
        )
        post[addr] = Account(balance=(amount * ONE_GWEI))

    blocks = [
        Block(
            withdrawals=withdrawals,
        )
    ]
    blockchain_test(pre=pre, post=post, blocks=blocks)