Skip to content

Commit

Permalink
Removed unused trait SenderOrigin (paritytech#1611)
Browse files Browse the repository at this point in the history
  • Loading branch information
bkontur authored Oct 21, 2022
1 parent f89f721 commit 1d3ca90
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 55 deletions.
9 changes: 1 addition & 8 deletions bridges/bin/millau/runtime/src/rialto_messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
use crate::{OriginCaller, Runtime, RuntimeCall, RuntimeOrigin};

use bp_messages::{
source_chain::{SenderOrigin, TargetHeaderChain},
source_chain::TargetHeaderChain,
target_chain::{ProvedMessages, SourceHeaderChain},
InboundLaneData, LaneId, Message, MessageNonce, Parameter as MessagesParameter,
};
Expand Down Expand Up @@ -277,13 +277,6 @@ impl SourceHeaderChain<bp_rialto::Balance> for Rialto {
}
}

impl SenderOrigin<crate::AccountId> for RuntimeOrigin {
fn linked_account(&self) -> Option<crate::AccountId> {
// XCM deals wit fees in our deployments
None
}
}

/// Millau -> Rialto message lane pallet parameters.
#[derive(RuntimeDebug, Clone, Encode, Decode, PartialEq, Eq, TypeInfo)]
pub enum MillauToRialtoMessagesParameter {
Expand Down
12 changes: 1 addition & 11 deletions bridges/bin/rialto-parachain/runtime/src/millau_messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
use crate::{OriginCaller, Runtime, RuntimeCall, RuntimeOrigin};

use bp_messages::{
source_chain::{SenderOrigin, TargetHeaderChain},
source_chain::TargetHeaderChain,
target_chain::{ProvedMessages, SourceHeaderChain},
InboundLaneData, LaneId, Message, MessageNonce, Parameter as MessagesParameter,
};
Expand Down Expand Up @@ -284,16 +284,6 @@ impl SourceHeaderChain<bp_millau::Balance> for Millau {
}
}

impl SenderOrigin<crate::AccountId> for RuntimeOrigin {
fn linked_account(&self) -> Option<crate::AccountId> {
match self.caller {
crate::OriginCaller::system(frame_system::RawOrigin::Signed(ref submitter)) =>
Some(submitter.clone()),
_ => None,
}
}
}

/// RialtoParachain -> Millau message lane pallet parameters.
#[derive(RuntimeDebug, Clone, Encode, Decode, PartialEq, Eq, TypeInfo)]
pub enum RialtoParachainToMillauMessagesParameter {
Expand Down
9 changes: 1 addition & 8 deletions bridges/bin/rialto/runtime/src/millau_messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
use crate::{OriginCaller, Runtime, RuntimeCall, RuntimeOrigin};

use bp_messages::{
source_chain::{SenderOrigin, TargetHeaderChain},
source_chain::TargetHeaderChain,
target_chain::{ProvedMessages, SourceHeaderChain},
InboundLaneData, LaneId, Message, MessageNonce, Parameter as MessagesParameter,
};
Expand Down Expand Up @@ -275,13 +275,6 @@ impl SourceHeaderChain<bp_millau::Balance> for Millau {
}
}

impl SenderOrigin<crate::AccountId> for RuntimeOrigin {
fn linked_account(&self) -> Option<crate::AccountId> {
// XCM deals wit fees in our deployments
None
}
}

/// Rialto -> Millau message lane pallet parameters.
#[derive(RuntimeDebug, Clone, Encode, Decode, PartialEq, Eq, TypeInfo)]
pub enum RialtoToMillauMessagesParameter {
Expand Down
12 changes: 1 addition & 11 deletions bridges/modules/messages/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use bitvec::prelude::*;
use bp_messages::{
source_chain::{
LaneMessageVerifier, MessageDeliveryAndDispatchPayment, OnDeliveryConfirmed,
OnMessageAccepted, SenderOrigin, TargetHeaderChain,
OnMessageAccepted, TargetHeaderChain,
},
target_chain::{
DispatchMessage, MessageDispatch, ProvedLaneMessages, ProvedMessages, SourceHeaderChain,
Expand Down Expand Up @@ -185,16 +185,6 @@ impl Config for TestRuntime {
type BridgedChainId = TestBridgedChainId;
}

impl SenderOrigin<AccountId> for RuntimeOrigin {
fn linked_account(&self) -> Option<AccountId> {
match self.caller {
OriginCaller::system(frame_system::RawOrigin::Signed(ref submitter)) =>
Some(*submitter),
_ => None,
}
}
}

impl Size for TestPayload {
fn size(&self) -> u32 {
16 + self.extra.len() as u32
Expand Down
17 changes: 0 additions & 17 deletions bridges/primitives/messages/src/source_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,6 @@ use sp_std::{
ops::RangeInclusive,
};

/// The sender of the message on the source chain.
pub trait SenderOrigin<AccountId> {
/// Return id of the account that is sending this message.
///
/// In regular messages configuration, when regular message is sent you'll always get `Some(_)`
/// from this call. This is the account that is paying send costs. However, there are some
/// examples when `None` may be returned from the call:
///
/// - if the send-message call origin is either `frame_system::RawOrigin::Root` or
/// `frame_system::RawOrigin::None` and your configuration forbids such messages;
/// - if your configuration allows 'unpaid' messages sent by pallets. Then the pallet may just
/// use its own defined origin (not linked to any account) and the message will be accepted.
/// This may be useful for pallets that are sending important system-wide information (like
/// update of runtime version).
fn linked_account(&self) -> Option<AccountId>;
}

/// Relayers rewards, grouped by relayer account id.
pub type RelayersRewards<AccountId, Balance> = BTreeMap<AccountId, RelayerRewards<Balance>>;

Expand Down

0 comments on commit 1d3ca90

Please sign in to comment.