Skip to content

Commit

Permalink
remove messages pallet owner relay argument (paritytech#1728)
Browse files Browse the repository at this point in the history
  • Loading branch information
svyatonik authored and serban300 committed Apr 9, 2024
1 parent dd275cc commit 6c2561c
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 101 deletions.
39 changes: 0 additions & 39 deletions bridges/relays/bin-substrate/src/cli/chain_schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.

use sp_core::Pair;
use structopt::StructOpt;
use strum::{EnumString, EnumVariantNames};

Expand Down Expand Up @@ -259,40 +258,6 @@ macro_rules! declare_chain_signing_params_cli_schema {
};
}

/// Create chain-specific set of messages pallet owner signing parameters.
#[macro_export]
macro_rules! declare_chain_messages_pallet_owner_signing_params_cli_schema {
($chain:ident, $chain_prefix:ident) => {
bp_runtime::paste::item! {
#[doc = "Parameters required to sign transaction on behalf of owner of the messages pallet at " $chain "."]
#[derive(StructOpt, Debug, PartialEq, Eq)]
pub struct [<$chain MessagesPalletOwnerSigningParams>] {
#[doc = "The SURI of secret key to use when transactions are submitted to the " $chain " node."]
#[structopt(long)]
pub [<$chain_prefix _messages_pallet_owner>]: Option<String>,
#[doc = "The password for the SURI of secret key to use when transactions are submitted to the " $chain " node."]
#[structopt(long)]
pub [<$chain_prefix _messages_pallet_owner_password>]: Option<String>,
}

#[allow(dead_code)]
impl [<$chain MessagesPalletOwnerSigningParams>] {
/// Parse signing params into chain-specific KeyPair.
pub fn to_keypair<Chain: CliChain>(&self) -> anyhow::Result<Option<Chain::KeyPair>> {
let [<$chain_prefix _messages_pallet_owner>] = match self.[<$chain_prefix _messages_pallet_owner>] {
Some(ref messages_pallet_owner) => messages_pallet_owner,
None => return Ok(None),
};
Chain::KeyPair::from_string(
[<$chain_prefix _messages_pallet_owner>],
self.[<$chain_prefix _messages_pallet_owner_password>].as_deref()
).map_err(|e| anyhow::format_err!("{:?}", e)).map(Some)
}
}
}
};
}

/// Create chain-specific set of configuration objects: connection parameters,
/// signing parameters and bridge initialization parameters.
#[macro_export]
Expand All @@ -301,10 +266,6 @@ macro_rules! declare_chain_cli_schema {
$crate::declare_chain_runtime_version_params_cli_schema!($chain, $chain_prefix);
$crate::declare_chain_connection_params_cli_schema!($chain, $chain_prefix);
$crate::declare_chain_signing_params_cli_schema!($chain, $chain_prefix);
$crate::declare_chain_messages_pallet_owner_signing_params_cli_schema!(
$chain,
$chain_prefix
);
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,6 @@ pub struct BridgeEndCommonParams<Chain: ChainWithTransactions + CliChain> {
pub sign: AccountKeyPairOf<Chain>,
/// Transactions mortality.
pub transactions_mortality: Option<u32>,
/// Account that "owns" messages pallet.
pub messages_pallet_owner: Option<AccountKeyPairOf<Chain>>,
/// Accounts, which balances are exposed as metrics by the relay process.
pub accounts: Vec<TaggedAccount<AccountIdOf<Chain>>>,
}
Expand Down Expand Up @@ -500,8 +498,6 @@ mod tests {
"9944",
"--millau-signer",
"//Charlie",
"--millau-messages-pallet-owner",
"//RialtoMessagesOwner",
"--millau-transactions-mortality",
"64",
"--rialto-host",
Expand All @@ -510,8 +506,6 @@ mod tests {
"9944",
"--rialto-signer",
"//Charlie",
"--rialto-messages-pallet-owner",
"//MillauMessagesOwner",
"--rialto-transactions-mortality",
"64",
"--lane",
Expand Down Expand Up @@ -555,10 +549,6 @@ mod tests {
millau_signer_password_file: None,
millau_transactions_mortality: Some(64),
},
left_messages_pallet_owner: MillauMessagesPalletOwnerSigningParams {
millau_messages_pallet_owner: Some("//RialtoMessagesOwner".into()),
millau_messages_pallet_owner_password: None,
},
left_headers_to_right_sign_override: MillauHeadersToRialtoSigningParams {
millau_headers_to_rialto_signer: None,
millau_headers_to_rialto_signer_password: None,
Expand All @@ -583,10 +573,6 @@ mod tests {
rialto_signer_password_file: None,
rialto_transactions_mortality: Some(64),
},
right_messages_pallet_owner: RialtoMessagesPalletOwnerSigningParams {
rialto_messages_pallet_owner: Some("//MillauMessagesOwner".into()),
rialto_messages_pallet_owner_password: None,
},
right_headers_to_left_sign_override: RialtoHeadersToMillauSigningParams {
rialto_headers_to_millau_signer: None,
rialto_headers_to_millau_signer_password: None,
Expand All @@ -612,8 +598,6 @@ mod tests {
"//Iden",
"--rialto-headers-to-millau-signer",
"//Ken",
"--millau-messages-pallet-owner",
"//RialtoParachainMessagesOwner",
"--millau-transactions-mortality",
"64",
"--rialto-parachain-host",
Expand All @@ -622,8 +606,6 @@ mod tests {
"9944",
"--rialto-parachain-signer",
"//George",
"--rialto-parachain-messages-pallet-owner",
"//MillauMessagesOwner",
"--rialto-parachain-transactions-mortality",
"64",
"--rialto-host",
Expand Down Expand Up @@ -667,10 +649,6 @@ mod tests {
millau_signer_password_file: None,
millau_transactions_mortality: Some(64),
},
left_messages_pallet_owner: MillauMessagesPalletOwnerSigningParams {
millau_messages_pallet_owner: Some("//RialtoParachainMessagesOwner".into()),
millau_messages_pallet_owner_password: None,
},
left_headers_to_right_sign_override:
MillauHeadersToRialtoParachainSigningParams {
millau_headers_to_rialto_parachain_signer: None,
Expand All @@ -696,12 +674,6 @@ mod tests {
rialto_parachain_signer_password_file: None,
rialto_parachain_transactions_mortality: Some(64),
},
right_messages_pallet_owner: RialtoParachainMessagesPalletOwnerSigningParams {
rialto_parachain_messages_pallet_owner: Some(
"//MillauMessagesOwner".into()
),
rialto_parachain_messages_pallet_owner_password: None,
},
right_relay_headers_to_left_sign_override: RialtoHeadersToMillauSigningParams {
rialto_headers_to_millau_signer: Some("//Ken".into()),
rialto_headers_to_millau_signer_password: None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,6 @@ macro_rules! declare_parachain_to_parachain_bridge_schema {
// default signer, which is always used to sign messages relay transactions on the left chain
#[structopt(flatten)]
left_sign: [<$left_parachain SigningParams>],
// signer used to sign parameter update transactions at the left parachain
#[structopt(flatten)]
left_messages_pallet_owner: [<$left_parachain MessagesPalletOwnerSigningParams>],

#[structopt(flatten)]
right: [<$right_parachain ConnectionParams>],
Expand All @@ -101,9 +98,6 @@ macro_rules! declare_parachain_to_parachain_bridge_schema {
// default signer, which is always used to sign messages relay transactions on the right chain
#[structopt(flatten)]
right_sign: [<$right_parachain SigningParams>],
// signer used to sign parameter update transactions at the right parachain
#[structopt(flatten)]
right_messages_pallet_owner: [<$right_parachain MessagesPalletOwnerSigningParams>],

// override for right_relay->left-parachain headers signer
#[structopt(flatten)]
Expand Down Expand Up @@ -142,14 +136,12 @@ macro_rules! declare_parachain_to_parachain_bridge_schema {
client: self.left.into_client::<Left>().await?,
sign: self.left_sign.to_keypair::<Left>()?,
transactions_mortality: self.left_sign.transactions_mortality()?,
messages_pallet_owner: self.left_messages_pallet_owner.to_keypair::<Left>()?,
accounts: vec![],
},
BridgeEndCommonParams {
client: self.right.into_client::<Right>().await?,
sign: self.right_sign.to_keypair::<Right>()?,
transactions_mortality: self.right_sign.transactions_mortality()?,
messages_pallet_owner: self.right_messages_pallet_owner.to_keypair::<Right>()?,
accounts: vec![],
},
)?,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,6 @@ macro_rules! declare_relay_to_parachain_bridge_schema {
// default signer, which is always used to sign messages relay transactions on the left chain
#[structopt(flatten)]
left_sign: [<$left_chain SigningParams>],
// signer used to sign parameter update transactions at the left chain
#[structopt(flatten)]
left_messages_pallet_owner: [<$left_chain MessagesPalletOwnerSigningParams>],

#[structopt(flatten)]
right: [<$right_parachain ConnectionParams>],
Expand All @@ -95,10 +92,6 @@ macro_rules! declare_relay_to_parachain_bridge_schema {
// default signer, which is always used to sign messages relay transactions on the right chain
#[structopt(flatten)]
right_sign: [<$right_parachain SigningParams>],
// signer used to sign parameter update transactions at the left chain
#[structopt(flatten)]
right_messages_pallet_owner: [<$right_parachain MessagesPalletOwnerSigningParams>],


// override for right_relay->left headers signer
#[structopt(flatten)]
Expand Down Expand Up @@ -131,14 +124,12 @@ macro_rules! declare_relay_to_parachain_bridge_schema {
client: self.left.into_client::<Left>().await?,
sign: self.left_sign.to_keypair::<Left>()?,
transactions_mortality: self.left_sign.transactions_mortality()?,
messages_pallet_owner: self.left_messages_pallet_owner.to_keypair::<Left>()?,
accounts: vec![],
},
BridgeEndCommonParams {
client: self.right.into_client::<Right>().await?,
sign: self.right_sign.to_keypair::<Right>()?,
transactions_mortality: self.right_sign.transactions_mortality()?,
messages_pallet_owner: self.right_messages_pallet_owner.to_keypair::<Right>()?,
accounts: vec![],
},
)?,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ macro_rules! declare_relay_to_relay_bridge_schema {
right_headers_to_left_sign_override: [<$right_chain HeadersTo $left_chain SigningParams>],
#[structopt(flatten)]
left_sign: [<$left_chain SigningParams>],
#[structopt(flatten)]
left_messages_pallet_owner: [<$left_chain MessagesPalletOwnerSigningParams>],
// default signer, which is always used to sign messages relay transactions on the right chain
#[structopt(flatten)]
right: [<$right_chain ConnectionParams>],
Expand All @@ -74,8 +72,6 @@ macro_rules! declare_relay_to_relay_bridge_schema {
left_headers_to_right_sign_override: [<$left_chain HeadersTo $right_chain SigningParams>],
#[structopt(flatten)]
right_sign: [<$right_chain SigningParams>],
#[structopt(flatten)]
right_messages_pallet_owner: [<$right_chain MessagesPalletOwnerSigningParams>],
}

impl [<$left_chain $right_chain HeadersAndMessages>] {
Expand All @@ -94,14 +90,12 @@ macro_rules! declare_relay_to_relay_bridge_schema {
client: self.left.into_client::<Left>().await?,
sign: self.left_sign.to_keypair::<Left>()?,
transactions_mortality: self.left_sign.transactions_mortality()?,
messages_pallet_owner: self.left_messages_pallet_owner.to_keypair::<Left>()?,
accounts: vec![],
},
BridgeEndCommonParams {
client: self.right.into_client::<Right>().await?,
sign: self.right_sign.to_keypair::<Right>()?,
transactions_mortality: self.right_sign.transactions_mortality()?,
messages_pallet_owner: self.right_messages_pallet_owner.to_keypair::<Right>()?,
accounts: vec![],
},
)?,
Expand Down
11 changes: 0 additions & 11 deletions bridges/relays/lib-substrate-relay/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,6 @@ pub enum TaggedAccount<AccountId> {
/// Name of the bridged chain, which sends us messages or delivery confirmations.
bridged_chain: String,
},
/// Account, used to sign messages with-bridged-chain pallet parameters update transactions.
MessagesPalletOwner {
/// Account id.
id: AccountId,
/// Name of the chain, bridged using messages pallet at our chain.
bridged_chain: String,
},
}

impl<AccountId> TaggedAccount<AccountId> {
Expand All @@ -79,7 +72,6 @@ impl<AccountId> TaggedAccount<AccountId> {
TaggedAccount::Headers { ref id, .. } => id,
TaggedAccount::Parachains { ref id, .. } => id,
TaggedAccount::Messages { ref id, .. } => id,
TaggedAccount::MessagesPalletOwner { ref id, .. } => id,
}
}

Expand All @@ -93,9 +85,6 @@ impl<AccountId> TaggedAccount<AccountId> {
TaggedAccount::Messages { ref bridged_chain, .. } => {
format!("{bridged_chain}Messages")
},
TaggedAccount::MessagesPalletOwner { ref bridged_chain, .. } => {
format!("{bridged_chain}MessagesPalletOwner")
},
}
}
}
Expand Down

0 comments on commit 6c2561c

Please sign in to comment.