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@622620d8.

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
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
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,
                    expected_receipt=TransactionReceipt(
                        logs=[transfer_log(sender, recipient1, 100)]
                    ),
                ),
                Transaction(
                    to=recipient2,
                    sender=sender,
                    nonce=1,
                    value=200,
                    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.