Skip to content

test_multiple_transfers_same_block()

Documentation for tests/amsterdam/eip7708_eth_transfer_logs/test_transfer_logs.py::test_multiple_transfers_same_block@9c2813ee.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/amsterdam/eip7708_eth_transfer_logs/test_transfer_logs.py::test_multiple_transfers_same_block --fork Amsterdam

Test that multiple transfers in the same block have independent logs.

Each transaction should have its own transfer log in its receipt, verifying logs don't bleed across transactions.

Source code in tests/amsterdam/eip7708_eth_transfer_logs/test_transfer_logs.py
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
def test_multiple_transfers_same_block(
    blockchain_test: BlockchainTestFiller, pre: Alloc
) -> None:
    """
    Test that multiple transfers in the same block have independent logs.

    Each transaction should have its own transfer log in its receipt,
    verifying logs don't bleed across transactions.
    """
    sender = pre.fund_eoa()
    recipient1 = pre.nonexistent_account()
    recipient2 = pre.nonexistent_account()

    blocks = [
        Block(
            txs=[
                Transaction(
                    to=recipient1,
                    sender=sender,
                    nonce=0,
                    value=100,
                    gas_limit=21_000,
                    expected_receipt=TransactionReceipt(
                        logs=[transfer_log(sender, recipient1, 100)]
                    ),
                ),
                Transaction(
                    to=recipient2,
                    sender=sender,
                    nonce=1,
                    value=200,
                    gas_limit=21_000,
                    expected_receipt=TransactionReceipt(
                        logs=[transfer_log(sender, recipient2, 200)]
                    ),
                ),
            ],
        ),
    ]

    blockchain_test(
        pre=pre,
        blocks=blocks,
        post={
            recipient1: Account(balance=100),
            recipient2: Account(balance=200),
        },
    )

Parametrized Test Cases

This test generates 1 parametrized test case across 1 fork.