@pytest.mark.parametrize(
"log_argument,value",
[
pytest.param(arg, val)
for arg in EVENT_ARGUMENTS
for val in EVENT_ARGUMENT_VALUES
],
)
@pytest.mark.exception_test
@pytest.mark.eels_base_coverage
def test_invalid_layout(
blockchain_test: BlockchainTestFiller,
pre: Alloc,
log_argument: str,
value: str,
) -> None:
"""
Test deposit contract emitting logs with invalid layouts (sizes/offsets).
"""
log_params = {**DEFAULT_DEPOSIT_REQUEST_LOG_DATA_DICT}
log_params[log_argument] = 0 if value == "zero" else 2**256 - 1 # type: ignore
deposit_request_log = create_deposit_log_bytes(**log_params) # type: ignore
bytecode = Om.MSTORE(deposit_request_log) + Op.LOG1(
0,
len(deposit_request_log),
Spec.DEPOSIT_EVENT_SIGNATURE_HASH,
)
bytecode += Op.STOP
pre.update_account(DepositRequest.system_contract_address, code=bytecode)
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={},
)