Skip to content

Commit 6eb8972

Browse files
committed
fillers/withdrawals: Add another withdrawals test
1 parent b4cfe83 commit 6eb8972

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

fillers/withdrawals/withdrawals.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -664,3 +664,44 @@ def test_withdrawals_overflowing_balance(_):
664664
),
665665
}
666666
yield BlockchainTest(pre=pre, post=post, blocks=blocks)
667+
668+
669+
@test_from(WITHDRAWALS_FORK)
670+
def test_large_withdrawals(_: str):
671+
"""
672+
Test Withdrawals that have a large gwei amount, so that (gwei * 1e9)
673+
could overflow uint64 but not uint256.
674+
"""
675+
pre = {
676+
TestAddress: Account(balance=1000000000000000000000, nonce=0),
677+
}
678+
679+
withdrawals: List[Withdrawal] = []
680+
amounts: List[int] = [
681+
(2**35),
682+
(2**64) - 1,
683+
(2**63) + 1,
684+
(2**63),
685+
(2**63) - 1,
686+
]
687+
688+
post = {}
689+
690+
for i, amount in enumerate(amounts):
691+
addr = to_address(0x100 * (i + 1))
692+
withdrawals.append(
693+
Withdrawal(
694+
index=i,
695+
validator=i,
696+
address=addr,
697+
amount=amount,
698+
)
699+
)
700+
post[addr] = Account(balance=(amount * ONE_GWEI))
701+
702+
blocks = [
703+
Block(
704+
withdrawals=withdrawals,
705+
)
706+
]
707+
yield BlockchainTest(pre=pre, post=post, blocks=blocks)

0 commit comments

Comments
 (0)