pub trait TargetHeaderChain<Payload, AccountId> {
    type MessagesDeliveryProof: Parameter + Size;

    // Required methods
    fn verify_message(payload: &Payload) -> Result<(), VerificationError>;
    fn verify_messages_delivery_proof(
        proof: Self::MessagesDeliveryProof
    ) -> Result<(LaneId, InboundLaneData<AccountId>), VerificationError>;
}
Expand description

Target chain API. Used by source chain to verify target chain proofs.

All implementations of this trait should only work with finalized data that can’t change. Wrong implementation may lead to invalid lane states (i.e. lane that’s stuck) and/or processing messages without paying fees.

The Payload type here means the payload of the message that is sent from the source chain to the target chain. The AccountId type here means the account type used by the source chain.

Required Associated Types§

source

type MessagesDeliveryProof: Parameter + Size

Proof that messages have been received by target chain.

Required Methods§

source

fn verify_message(payload: &Payload) -> Result<(), VerificationError>

Verify message payload before we accept it.

CAUTION: this is very important function. Incorrect implementation may lead to stuck lanes and/or relayers loses.

The proper implementation must ensure that the delivery-transaction with this payload would (at least) be accepted into target chain transaction pool AND eventually will be successfully mined. The most obvious incorrect implementation example would be implementation for BTC chain that accepts payloads larger than 1MB. BTC nodes aren’t accepting transactions that are larger than 1MB, so relayer will be unable to craft valid transaction => this (and all subsequent) messages will never be delivered.

source

fn verify_messages_delivery_proof( proof: Self::MessagesDeliveryProof ) -> Result<(LaneId, InboundLaneData<AccountId>), VerificationError>

Verify messages delivery proof and return lane && nonce of the latest received message.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<Payload, AccountId> TargetHeaderChain<Payload, AccountId> for ForbidOutboundMessages