def METHOD_NAME(msg: MsgInSignTx) -> None:
    data_length = msg.data_length  # local_cache_attribute
    if data_length > 0:
        if not msg.data_initial_chunk:
            raise DataError("Data length provided, but no initial chunk")
        # Our encoding only supports transactions up to 2^24 bytes. To
        # prevent exceeding the limit we use a stricter limit on data length.
        if data_length > 16_000_000:
            raise DataError("Data length exceeds limit")
        if len(msg.data_initial_chunk) > data_length:
            raise DataError("Invalid size of initial chunk")
    if len(msg.to) not in (0, 40, 42):
        raise DataError("Invalid recipient address")
    if not msg.to and data_length == 0:
        # sending transaction to address 0 (contract creation) without a data field
        raise DataError("Contract creation without data")
    if msg.chain_id == 0:
        raise DataError("Chain ID out of bounds")