Trait bp_messages::target_chain::SourceHeaderChain
source · pub trait SourceHeaderChain {
type MessagesProof: Parameter + Size;
// Required method
fn verify_messages_proof(
proof: Self::MessagesProof,
messages_count: u32,
) -> Result<ProvedMessages<Message>, VerificationError>;
}
Expand description
Source chain API. Used by target chain, to verify source 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.
Required Associated Types§
sourcetype MessagesProof: Parameter + Size
type MessagesProof: Parameter + Size
Proof that messages are sent from source chain. This may also include proof of corresponding outbound lane states.
Required Methods§
sourcefn verify_messages_proof(
proof: Self::MessagesProof,
messages_count: u32,
) -> Result<ProvedMessages<Message>, VerificationError>
fn verify_messages_proof( proof: Self::MessagesProof, messages_count: u32, ) -> Result<ProvedMessages<Message>, VerificationError>
Verify messages proof and return proved messages.
Returns error if either proof is incorrect, or the number of messages in the proof
is not matching the messages_count
.
Messages vector is required to be sorted by nonce within each lane. Out-of-order messages will be rejected.
The messages_count
argument verification (sane limits) is supposed to be made
outside this function. This function only verifies that the proof declares exactly
messages_count
messages.