You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: tx_change_consensus_key.rs
    path of file: ./repos/namada/wasm/wasm_source/src
    
    the code of the file until where you have to start completion: //! A tx for a validator to change their consensus key.

use namada_tx_prelude::
    
fn apply_tx(ctx: &mut Ctx, tx_data: Tx) -> TxResult {
    let signed = tx_data;
    let data = signed.data().ok_or_err_msg("Missing data")?;
    let ConsensusKeyChange {
        validator,
        consensus_key,
    } = transaction::pos::ConsensusKeyChange::try_from_slice(&data[..])
        .wrap_err("failed to decode Dec value")?;

    // Check that the tx has been signed with the new consensus key
    if !matches!(
        verify_signatures_of_pks(ctx, &signed, vec![consensus_key.clone()]),
        Ok(true)
    ) {
        debug_log!("Consensus key ownership signature verification failed");
        panic!()
    }

    ctx.change_validator_consensus_key(&validator, &consensus_key)
}