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@2119b382.

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
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
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
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.