mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 08:41:02 +00:00
committed by
Bastian Köcher
parent
1dbfab83b4
commit
8c6dfc41c5
@@ -16,7 +16,7 @@
|
||||
|
||||
//! Primitives of messages module, that are used on the source chain.
|
||||
|
||||
use crate::{InboundLaneData, LaneId, MessageNonce, OutboundLaneData, VerificationError};
|
||||
use crate::{InboundLaneData, LaneId, MessageNonce, VerificationError};
|
||||
|
||||
use crate::UnrewardedRelayer;
|
||||
use bp_runtime::Size;
|
||||
@@ -64,24 +64,6 @@ pub trait TargetHeaderChain<Payload, AccountId> {
|
||||
) -> Result<(LaneId, InboundLaneData<AccountId>), VerificationError>;
|
||||
}
|
||||
|
||||
/// Lane message verifier.
|
||||
///
|
||||
/// Runtime developer may implement any additional validation logic over message-lane mechanism.
|
||||
/// E.g. if lanes should have some security (e.g. you can only accept Lane1 messages from
|
||||
/// Submitter1, Lane2 messages for those who has submitted first message to this lane, disable
|
||||
/// Lane3 until some block, ...), then it may be built using this verifier.
|
||||
///
|
||||
/// Any fee requirements should also be enforced here.
|
||||
pub trait LaneMessageVerifier<Payload> {
|
||||
/// Verify message payload and return Ok(()) if message is valid and allowed to be sent over the
|
||||
/// lane.
|
||||
fn verify_message(
|
||||
lane: &LaneId,
|
||||
outbound_data: &OutboundLaneData,
|
||||
payload: &Payload,
|
||||
) -> Result<(), VerificationError>;
|
||||
}
|
||||
|
||||
/// Manages payments that are happening at the source chain during delivery confirmation
|
||||
/// transaction.
|
||||
pub trait DeliveryConfirmationPayments<AccountId> {
|
||||
@@ -161,7 +143,7 @@ impl<Payload> MessagesBridge<Payload> for NoopMessagesBridge {
|
||||
}
|
||||
}
|
||||
|
||||
/// Structure that may be used in place of `TargetHeaderChain`, `LaneMessageVerifier` and
|
||||
/// Structure that may be used in place of `TargetHeaderChain` and
|
||||
/// `MessageDeliveryAndDispatchPayment` on chains, where outbound messages are forbidden.
|
||||
pub struct ForbidOutboundMessages;
|
||||
|
||||
@@ -183,16 +165,6 @@ impl<Payload, AccountId> TargetHeaderChain<Payload, AccountId> for ForbidOutboun
|
||||
}
|
||||
}
|
||||
|
||||
impl<Payload> LaneMessageVerifier<Payload> for ForbidOutboundMessages {
|
||||
fn verify_message(
|
||||
_lane: &LaneId,
|
||||
_outbound_data: &OutboundLaneData,
|
||||
_payload: &Payload,
|
||||
) -> Result<(), VerificationError> {
|
||||
Err(VerificationError::Other(ALL_OUTBOUND_MESSAGES_REJECTED))
|
||||
}
|
||||
}
|
||||
|
||||
impl<AccountId> DeliveryConfirmationPayments<AccountId> for ForbidOutboundMessages {
|
||||
type Error = &'static str;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user