Skip to content

Test Withdrawals

Documentation for test cases from tests/shanghai/eip4895_withdrawals/test_withdrawals.py.

Generate fixtures for these test cases with:

fill -v tests/shanghai/eip4895_withdrawals/test_withdrawals.py
Tests EIP-4895: Beacon chain withdrawals

Test cases for EIP-4895: Beacon chain push withdrawals as operations.

TestUseValueInTx

Test that the value from a withdrawal can be used in a transaction:

  1. tx_in_withdrawals_block: Test that the withdrawal value can not be used by a transaction in the same block as the withdrawal.

  2. tx_after_withdrawals_block: Test that the withdrawal value can be used by a transaction in the subsequent block.

Source code in tests/shanghai/eip4895_withdrawals/test_withdrawals.py
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
@pytest.mark.parametrize(
    "test_case",
    ["tx_in_withdrawals_block", "tx_after_withdrawals_block"],
    ids=lambda x: x,
)
class TestUseValueInTx:
    """
    Test that the value from a withdrawal can be used in a transaction:

    1. `tx_in_withdrawals_block`: Test that the withdrawal value can not be used by a transaction
        in the same block as the withdrawal.

    2. `tx_after_withdrawals_block`: Test that the withdrawal value can be used by a transaction
        in the subsequent block.
    """

    @pytest.fixture
    def tx(self):  # noqa: D102
        # Transaction sent from the `TestAddress`, which has 0 balance at start
        return Transaction(
            nonce=0,
            gas_price=ONE_GWEI,
            gas_limit=21000,
            to=to_address(0x100),
            data="0x",
        )

    @pytest.fixture
    def withdrawal(self, tx: Transaction):  # noqa: D102
        return Withdrawal(
            index=0,
            validator=0,
            address=TestAddress,
            amount=tx.gas_limit + 1,
        )

    @pytest.fixture
    def blocks(self, tx: Transaction, withdrawal: Withdrawal, test_case):  # noqa: D102
        if test_case == "tx_in_withdrawals_block":
            return [
                Block(
                    txs=[tx.with_error("intrinsic gas too low: have 0, want 21000")],
                    withdrawals=[
                        withdrawal,
                    ],
                    exception="Transaction without funds",
                )
            ]
        if test_case == "tx_after_withdrawals_block":
            return [
                Block(
                    txs=[],
                    withdrawals=[
                        withdrawal,
                    ],
                ),
                Block(
                    txs=[tx],
                    withdrawals=[],
                ),
            ]
        raise Exception("Invalid test case.")

    @pytest.fixture
    def post(self, test_case: str) -> Dict:  # noqa: D102
        if test_case == "tx_in_withdrawals_block":
            return {}
        if test_case == "tx_after_withdrawals_block":
            return {TestAddress: Account(balance=ONE_GWEI)}
        raise Exception("Invalid test case.")

    def test_use_value_in_tx(
        self,
        blockchain_test: BlockchainTestFiller,
        post: dict,
        blocks: List[Block],
    ):
        """
        Test sending withdrawal value in a transaction.
        """
        pre = {TestAddress: Account(balance=0)}
        blockchain_test(pre=pre, post=post, blocks=blocks)

test_use_value_in_tx(blockchain_test, post, blocks)

Test sending withdrawal value in a transaction.

Source code in tests/shanghai/eip4895_withdrawals/test_withdrawals.py
115
116
117
118
119
120
121
122
123
124
125
def test_use_value_in_tx(
    self,
    blockchain_test: BlockchainTestFiller,
    post: dict,
    blocks: List[Block],
):
    """
    Test sending withdrawal value in a transaction.
    """
    pre = {TestAddress: Account(balance=0)}
    blockchain_test(pre=pre, post=post, blocks=blocks)

test_use_value_in_contract(blockchain_test)

Test sending value from contract that has not received a withdrawal

Source code in tests/shanghai/eip4895_withdrawals/test_withdrawals.py
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
def test_use_value_in_contract(blockchain_test: BlockchainTestFiller):
    """
    Test sending value from contract that has not received a withdrawal
    """
    SEND_ONE_GWEI = Op.SSTORE(
        Op.NUMBER,
        Op.CALL(Op.GAS, 0x200, 1000000000, 0, 0, 0, 0),
    )

    pre = {
        TestAddress: Account(balance=1000000000000000000000, nonce=0),
        to_address(0x100): Account(balance=0, code=SEND_ONE_GWEI),
        to_address(0x200): Account(balance=0),
    }
    tx = Transaction(
        # Transaction sent from the `TestAddress`, which has 0 balance at start
        nonce=0,
        value=0,
        gas_price=10,
        gas_limit=100000,
        to=to_address(0x100),
        data="0x",
    )
    withdrawal = Withdrawal(
        index=0,
        validator=0,
        address=to_address(0x100),
        amount=1,
    )

    blocks = [
        Block(
            txs=[tx.with_nonce(0)],
            withdrawals=[withdrawal],
        ),
        Block(
            txs=[tx.with_nonce(1)],  # Same tx again, just increase nonce
        ),
    ]
    post = {
        to_address(0x100): Account(
            storage={
                0x1: 0x0,  # Call fails on the first attempt
                0x2: 0x1,  # Succeeds on the second attempt
            }
        ),
        to_address(0x200): Account(
            balance=ONE_GWEI,
        ),
    }

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

test_balance_within_block(blockchain_test)

Test Withdrawal balance increase within the same block, inside contract call.

Source code in tests/shanghai/eip4895_withdrawals/test_withdrawals.py
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
def test_balance_within_block(blockchain_test: BlockchainTestFiller):
    """
    Test Withdrawal balance increase within the same block,
    inside contract call.
    """
    SAVE_BALANCE_ON_BLOCK_NUMBER = Op.SSTORE(
        Op.NUMBER,
        Op.BALANCE(Op.CALLDATALOAD(0)),
    )
    pre = {
        TestAddress: Account(balance=1000000000000000000000, nonce=0),
        to_address(0x100): Account(
            code=SAVE_BALANCE_ON_BLOCK_NUMBER,
        ),
        to_address(0x200): Account(
            balance=ONE_GWEI,
        ),
    }
    blocks = [
        Block(
            txs=[
                Transaction(
                    nonce=0,
                    gas_limit=100000,
                    to=to_address(0x100),
                    data=to_hash(0x200),
                )
            ],
            withdrawals=[
                Withdrawal(
                    index=0,
                    validator=0,
                    address=to_address(0x200),
                    amount=1,
                )
            ],
        ),
        Block(
            txs=[
                Transaction(
                    nonce=1,
                    gas_limit=100000,
                    to=to_address(0x100),
                    data=to_hash(0x200),
                )
            ]
        ),
    ]

    post = {
        to_address(0x100): Account(
            storage={
                1: ONE_GWEI,
                2: 2 * ONE_GWEI,
            }
        )
    }

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

TestMultipleWithdrawalsSameAddress

Test that multiple withdrawals can be sent to the same address in:

  1. A single block.

  2. Multiple blocks.

Source code in tests/shanghai/eip4895_withdrawals/test_withdrawals.py
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
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
@pytest.mark.parametrize("test_case", ["single_block", "multiple_blocks"])
class TestMultipleWithdrawalsSameAddress:
    """
    Test that multiple withdrawals can be sent to the same address in:

    1. A single block.

    2. Multiple blocks.
    """

    ADDRESSES = [
        to_address(0x0),  # Zero address
        to_address(0x1),  # Pre-compiles
        to_address(0x2),
        to_address(0x3),
        to_address(0x4),
        to_address(0x5),
        to_address(0x6),
        to_address(0x7),
        to_address(0x8),
        to_address(0x9),
        to_address(2**160 - 1),
    ]

    @pytest.fixture
    def blocks(self, test_case: str):  # noqa: D102
        if test_case == "single_block":
            # Many repeating withdrawals of the same accounts in the same
            # block.
            return [
                Block(
                    withdrawals=[
                        Withdrawal(
                            index=i,
                            validator=i,
                            address=self.ADDRESSES[i % len(self.ADDRESSES)],
                            amount=1,
                        )
                        for i in range(len(self.ADDRESSES) * 16)
                    ],
                ),
            ]
        if test_case == "multiple_blocks":
            # Similar test but now use multiple blocks each with multiple
            # withdrawals to the same withdrawal address.
            return [
                Block(
                    withdrawals=[
                        Withdrawal(
                            index=i * 16 + j,
                            validator=i,
                            address=self.ADDRESSES[i],
                            amount=1,
                        )
                        for j in range(16)
                    ],
                )
                for i in range(len(self.ADDRESSES))
            ]
        raise Exception("Invalid test case.")

    def test_multiple_withdrawals_same_address(
        self,
        blockchain_test: BlockchainTestFiller,
        test_case: str,
        blocks: List[Block],
    ):
        """
        Test Withdrawals can be done to the same address multiple times in
        the same block.
        """
        pre = {
            TestAddress: Account(balance=1000000000000000000000, nonce=0),
        }
        for addr in self.ADDRESSES:
            pre[addr] = Account(
                # set a storage value unconditionally on call
                code=Op.SSTORE(Op.NUMBER, 1),
            )

        # Expected post is the same for both test cases.
        post = {}
        for addr in self.ADDRESSES:
            post[addr] = Account(
                balance=16 * ONE_GWEI,
                storage={},
            )

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

test_multiple_withdrawals_same_address(blockchain_test, test_case, blocks)

Test Withdrawals can be done to the same address multiple times in the same block.

Source code in tests/shanghai/eip4895_withdrawals/test_withdrawals.py
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
def test_multiple_withdrawals_same_address(
    self,
    blockchain_test: BlockchainTestFiller,
    test_case: str,
    blocks: List[Block],
):
    """
    Test Withdrawals can be done to the same address multiple times in
    the same block.
    """
    pre = {
        TestAddress: Account(balance=1000000000000000000000, nonce=0),
    }
    for addr in self.ADDRESSES:
        pre[addr] = Account(
            # set a storage value unconditionally on call
            code=Op.SSTORE(Op.NUMBER, 1),
        )

    # Expected post is the same for both test cases.
    post = {}
    for addr in self.ADDRESSES:
        post[addr] = Account(
            balance=16 * ONE_GWEI,
            storage={},
        )

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

test_many_withdrawals(blockchain_test)

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
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
def test_many_withdrawals(blockchain_test: BlockchainTestFiller):
    """
    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
    pre = {
        TestAddress: Account(balance=1000000000000000000000, nonce=0),
    }
    withdrawals = []
    post = {}
    for i in range(N):
        addr = to_address(0x100 * i)
        amount = i * 1
        pre[addr] = Account(
            code=Op.SSTORE(Op.NUMBER, 1),
        )
        withdrawals.append(
            Withdrawal(
                index=i,
                validator=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)

test_self_destructing_account(blockchain_test)

Test withdrawals can be done to self-destructed accounts. Account 0x100 self-destructs and sends all its balance to 0x200. Then, a withdrawal is received at 0x100 with 99 wei.

Source code in tests/shanghai/eip4895_withdrawals/test_withdrawals.py
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
def test_self_destructing_account(blockchain_test: BlockchainTestFiller):
    """
    Test withdrawals can be done to self-destructed accounts.
    Account `0x100` self-destructs and sends all its balance to `0x200`.
    Then, a withdrawal is received at `0x100` with 99 wei.
    """
    pre = {
        TestAddress: Account(balance=1000000000000000000000, nonce=0),
        to_address(0x100): Account(
            code=Op.SELFDESTRUCT(Op.CALLDATALOAD(0)),
            balance=(100 * ONE_GWEI),
        ),
        to_address(0x200): Account(
            balance=0,
        ),
    }

    tx_1 = Transaction(
        # Transaction sent from the `TestAddress`, that calls a
        # self-destructing contract.
        nonce=0,
        gas_price=10,
        gas_limit=100000,
        to=to_address(0x100),
        data=to_hash(0x200),
    )

    withdrawal = Withdrawal(
        index=0,
        validator=0,
        address=to_address(0x100),
        amount=(99),
    )

    block = Block(
        txs=[tx_1],
        withdrawals=[withdrawal],
    )

    post = {
        to_address(0x100): Account(
            code=None,
            balance=(99 * ONE_GWEI),
        ),
        to_address(0x200): Account(
            code=None,
            balance=(100 * ONE_GWEI),
        ),
    }

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

test_newly_created_contract(blockchain_test, include_value_in_tx, yul, request)

Test Withdrawing to a newly created contract.

Source code in tests/shanghai/eip4895_withdrawals/test_withdrawals.py
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
@pytest.mark.parametrize(
    "include_value_in_tx",
    [False, True],
    ids=["without_tx_value", "with_tx_value"],
)
def test_newly_created_contract(
    blockchain_test: BlockchainTestFiller,
    include_value_in_tx: bool,
    yul: YulCompiler,
    request,
):
    """
    Test Withdrawing to a newly created contract.
    """
    created_contract = compute_create_address(TestAddress, 0)

    pre = {
        TestAddress: Account(balance=1000000000000000000000, nonce=0),
    }

    initcode = yul(
        """
        {
            return(0, 1)
        }
        """
    )

    tx = Transaction(
        # Transaction sent from the `TestAddress`, that creates a
        # new contract.
        nonce=0,
        gas_price=10,
        gas_limit=1000000,
        to=None,
        data=initcode,
    )

    withdrawal = Withdrawal(
        index=0,
        validator=0,
        address=created_contract,
        amount=1,
    )

    block = Block(
        txs=[tx],
        withdrawals=[withdrawal],
    )

    post = {
        created_contract: Account(
            code="0x00",
            balance=ONE_GWEI,
        ),
    }
    if include_value_in_tx:
        tx.value = ONE_GWEI
        post[created_contract].balance = 2 * ONE_GWEI

    tag = request.node.callspec.id.split("-")[0]  # remove fork; brittle
    blockchain_test(pre=pre, post=post, blocks=[block], tag=tag)

test_no_evm_execution(blockchain_test)

Test Withdrawals don't trigger EVM execution.

Source code in tests/shanghai/eip4895_withdrawals/test_withdrawals.py
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
def test_no_evm_execution(blockchain_test: BlockchainTestFiller):
    """
    Test Withdrawals don't trigger EVM execution.
    """
    pre = {
        TestAddress: Account(balance=1000000000000000000000, nonce=0),
        to_address(0x100): Account(
            code=Op.SSTORE(Op.NUMBER, 1),
        ),
        to_address(0x200): Account(
            code=Op.SSTORE(Op.NUMBER, 1),
        ),
        to_address(0x300): Account(
            code=Op.SSTORE(Op.NUMBER, 1),
        ),
        to_address(0x400): Account(
            code=Op.SSTORE(Op.NUMBER, 1),
        ),
    }
    blocks = [
        Block(
            txs=[
                Transaction(
                    nonce=0,
                    gas_limit=100000,
                    to=to_address(0x300),
                ),
                Transaction(
                    nonce=1,
                    gas_limit=100000,
                    to=to_address(0x400),
                ),
            ],
            withdrawals=[
                Withdrawal(
                    index=0,
                    validator=0,
                    address=to_address(0x100),
                    amount=1,
                ),
                Withdrawal(
                    index=1,
                    validator=1,
                    address=to_address(0x200),
                    amount=1,
                ),
            ],
        ),
        Block(
            txs=[
                Transaction(
                    nonce=2,
                    gas_limit=100000,
                    to=to_address(0x100),
                ),
                Transaction(
                    nonce=3,
                    gas_limit=100000,
                    to=to_address(0x200),
                ),
            ],
            withdrawals=[
                Withdrawal(
                    index=0,
                    validator=0,
                    address=to_address(0x300),
                    amount=1,
                ),
                Withdrawal(
                    index=1,
                    validator=1,
                    address=to_address(0x400),
                    amount=1,
                ),
            ],
        ),
    ]

    post = {
        to_address(0x100): Account(storage={2: 1}),
        to_address(0x200): Account(storage={2: 1}),
        to_address(0x300): Account(storage={1: 1}),
        to_address(0x400): Account(storage={1: 1}),
    }

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

test_zero_amount(blockchain_test, test_case)

Test withdrawals with zero amount for the following cases, all withdrawals are included in one block:

  1. Two withdrawals of zero amount to two different addresses; one to an untouched account, one to an account with a balance.
  2. As 1., but with an additional withdrawal with positive value.
  3. As 2., but with an additional withdrawal containing the maximum value possible.
  4. As 3., but with order of withdrawals in the block reversed.
Source code in tests/shanghai/eip4895_withdrawals/test_withdrawals.py
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
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
@pytest.mark.parametrize(
    "test_case",
    [case for case in ZeroAmountTestCases],
    ids=[case.value for case in ZeroAmountTestCases],
)
def test_zero_amount(
    blockchain_test: BlockchainTestFiller,
    test_case: ZeroAmountTestCases,
):
    """
    Test withdrawals with zero amount for the following cases, all withdrawals
    are included in one block:

    1. Two withdrawals of zero amount to two different addresses; one to an
       untouched account, one to an account with a balance.
    2. As 1., but with an additional withdrawal with positive value.
    3. As 2., but with an additional withdrawal containing the maximum value
       possible.
    4. As 3., but with order of withdrawals in the block reversed.

    """
    pre = {
        TestAddress: Account(balance=1000000000000000000000, nonce=0),
        to_address(0x200): Account(
            code="0x00",
            balance=0,
        ),
    }

    all_withdrawals = [
        # No value, untouched account
        Withdrawal(
            index=0,
            validator=0,
            address=to_address(0x100),
            amount=0,
        ),
        # No value, touched account
        Withdrawal(
            index=0,
            validator=0,
            address=to_address(0x200),
            amount=0,
        ),
        # Withdrawal with value
        Withdrawal(
            index=1,
            validator=0,
            address=to_address(0x300),
            amount=1,
        ),
        # Withdrawal with maximum amount
        Withdrawal(
            index=2,
            validator=0,
            address=to_address(0x400),
            amount=2**64 - 1,
        ),
    ]
    all_post = {
        to_address(0x100): Account.NONEXISTENT,
        to_address(0x200): Account(code="0x00", balance=0),
        to_address(0x300): Account(balance=ONE_GWEI),
        to_address(0x400): Account(balance=(2**64 - 1) * ONE_GWEI),
    }

    withdrawals: List[Withdrawal] = []
    post: Mapping[str, Account | object] = {}
    if test_case == ZeroAmountTestCases.TWO_ZERO:
        withdrawals = all_withdrawals[0:2]
        post = {
            account: all_post[account]
            for account in post
            if account in [to_address(0x100), to_address(0x200)]
        }
    elif test_case == ZeroAmountTestCases.THREE_ONE_WITH_VALUE:
        withdrawals = all_withdrawals[0:3]
        post = {
            account: all_post[account]
            for account in post
            if account
            in [
                to_address(0x100),
                to_address(0x200),
                to_address(0x300),
            ]
        }
    elif test_case == ZeroAmountTestCases.FOUR_ONE_WITH_MAX:
        withdrawals = all_withdrawals
        post = all_post
    elif test_case == ZeroAmountTestCases.FOUR_ONE_WITH_MAX_REVERSED:
        withdrawals = all_withdrawals
        withdrawals.reverse()
        set_withdrawal_index(withdrawals)
        post = all_post
    else:
        raise Exception("Unknown test case.")

    blockchain_test(
        pre=pre,
        # TODO: Fix in BlockchainTest? post: Mapping[str, Account | object]
        # to allow for Account.NONEXISTENT
        post=post,  # type: ignore
        blocks=[Block(withdrawals=withdrawals)],
        tag=test_case.value,
    )

test_large_amount(blockchain_test)

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
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
def test_large_amount(blockchain_test: BlockchainTestFiller):
    """
    Test Withdrawals that have a large gwei amount, so that (gwei * 1e9)
    could overflow uint64 but not uint256.
    """
    pre = {
        TestAddress: Account(balance=1000000000000000000000, nonce=0),
    }

    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 = to_address(0x100 * (i + 1))
        withdrawals.append(
            Withdrawal(
                index=i,
                validator=i,
                address=addr,
                amount=amount,
            )
        )
        post[addr] = Account(balance=(amount * ONE_GWEI))

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