Limit max number of messages in delivery transaction (#541)

* limit max number of messages in delivery tx

* support max-messages-in-delivery-tx in relayer

* clippy

* clippy

* Update modules/message-lane/src/lib.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
This commit is contained in:
Svyatoslav Nikolsky
2020-12-03 09:44:52 +03:00
committed by Bastian Köcher
parent a872ee6ff1
commit f1949c6342
15 changed files with 427 additions and 68 deletions
@@ -16,7 +16,7 @@
//! Primitives of message lane module, that are used on the target chain.
use crate::{LaneId, Message, MessageData, MessageKey, OutboundLaneData};
use crate::{LaneId, Message, MessageData, MessageKey, MessageNonce, OutboundLaneData};
use codec::{Decode, Encode, Error as CodecError};
use frame_support::{weights::Weight, Parameter, RuntimeDebug};
@@ -67,9 +67,15 @@ pub trait SourceHeaderChain<Fee> {
/// Verify messages proof and return proved messages.
///
/// Returns error if either proof is incorrect, or the number of messages in the proof
/// is larger than `max_messages`.
///
/// Messages vector is required to be sorted by nonce within each lane. Out-of-order
/// messages will be rejected.
fn verify_messages_proof(proof: Self::MessagesProof) -> Result<ProvedMessages<Message<Fee>>, Self::Error>;
fn verify_messages_proof(
proof: Self::MessagesProof,
max_messages: MessageNonce,
) -> Result<ProvedMessages<Message<Fee>>, Self::Error>;
}
/// Called when inbound message is received.