Skip to content

test_invalid_layout_with_swapped_decodable_offsets()

Documentation for tests/prague/eip6110_deposits/test_modified_contract.py::test_invalid_layout_with_swapped_decodable_offsets@8acae1b0.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/prague/eip6110_deposits/test_modified_contract.py::test_invalid_layout_with_swapped_decodable_offsets --fork Amsterdam

Test a deposit log whose ABI offsets are noncanonical but still decodable.

Source code in tests/prague/eip6110_deposits/test_modified_contract.py
236
237
238
239
240
241
242
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
@pytest.mark.exception_test
@pytest.mark.eels_base_coverage
def test_invalid_layout_with_swapped_decodable_offsets(
    blockchain_test: BlockchainTestFiller, pre: Alloc
) -> None:
    """
    Test a deposit log whose ABI offsets are noncanonical but still decodable.
    """
    changed_log = create_deposit_log_bytes_with_swapped_amount_and_signature()

    bytecode = Om.MSTORE(changed_log) + Op.LOG1(
        0,
        len(changed_log),
        Spec.DEPOSIT_EVENT_SIGNATURE_HASH,
    )
    bytecode += Op.STOP

    pre[DepositRequest.system_contract_address] = Account(
        code=bytecode,
        nonce=1,
        balance=0,
    )
    sender = pre.fund_eoa()

    tx = Transaction(
        to=DepositRequest.system_contract_address,
        sender=sender,
        gas_limit=100_000,
    )

    blockchain_test(
        pre=pre,
        blocks=[
            Block(
                txs=[tx],
                exception=[
                    BlockException.INVALID_DEPOSIT_EVENT_LAYOUT,
                ],
            ),
        ],
        post={},
    )

Parametrized Test Cases

This test generates 1 parametrized test case across 3 forks.