pub trait MessageDispatch {
    type DispatchPayload: Decode;
    type DispatchLevelResult: Clone + Debug + Eq;

    // Required methods
    fn dispatch_weight(
        message: &mut DispatchMessage<Self::DispatchPayload>
    ) -> Weight;
    fn dispatch(
        message: DispatchMessage<Self::DispatchPayload>
    ) -> MessageDispatchResult<Self::DispatchLevelResult>;
}
Expand description

Called when inbound message is received.

Required Associated Types§

source

type DispatchPayload: Decode

Decoded message payload type. Valid message may contain invalid payload. In this case message is delivered, but dispatch fails. Therefore, two separate types of payload (opaque MessagePayload used in delivery and this DispatchPayload used in dispatch).

source

type DispatchLevelResult: Clone + Debug + Eq

Fine-grained result of single message dispatch (for better diagnostic purposes)

Required Methods§

source

fn dispatch_weight( message: &mut DispatchMessage<Self::DispatchPayload> ) -> Weight

Estimate dispatch weight.

This function must return correct upper bound of dispatch weight. The return value of this function is expected to match return value of the corresponding From<Chain>InboundLaneApi::message_details().dispatch_weight call.

source

fn dispatch( message: DispatchMessage<Self::DispatchPayload> ) -> MessageDispatchResult<Self::DispatchLevelResult>

Called when inbound message is received.

It is up to the implementers of this trait to determine whether the message is invalid (i.e. improperly encoded, has too large weight, …) or not.

Implementors§

source§

impl<MessagesProof, DispatchPayload: Decode> MessageDispatch for ForbidInboundMessages<MessagesProof, DispatchPayload>

§

type DispatchPayload = DispatchPayload

§

type DispatchLevelResult = ()