From f5754f174c842cdd718ca316658ffcd9ff9defa1 Mon Sep 17 00:00:00 2001 From: Svyatoslav Nikolsky Date: Mon, 19 Dec 2022 14:22:50 +0300 Subject: [PATCH] remove messages pallet owner relay argument (#1728) --- .../bin-substrate/src/cli/chain_schema.rs | 39 ------------------- .../src/cli/relay_headers_and_messages/mod.rs | 28 ------------- .../parachain_to_parachain.rs | 8 ---- .../relay_to_parachain.rs | 9 ----- .../relay_to_relay.rs | 6 --- bridges/relays/lib-substrate-relay/src/lib.rs | 11 ------ 6 files changed, 101 deletions(-) diff --git a/bridges/relays/bin-substrate/src/cli/chain_schema.rs b/bridges/relays/bin-substrate/src/cli/chain_schema.rs index 8023fd9b0f7f6..6fc0fac18b230 100644 --- a/bridges/relays/bin-substrate/src/cli/chain_schema.rs +++ b/bridges/relays/bin-substrate/src/cli/chain_schema.rs @@ -15,7 +15,6 @@ // along with Parity Bridges Common. If not, see . -use sp_core::Pair; use structopt::StructOpt; use strum::{EnumString, EnumVariantNames}; @@ -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, - #[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, - } - - #[allow(dead_code)] - impl [<$chain MessagesPalletOwnerSigningParams>] { - /// Parse signing params into chain-specific KeyPair. - pub fn to_keypair(&self) -> anyhow::Result> { - 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] @@ -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 - ); }; } diff --git a/bridges/relays/bin-substrate/src/cli/relay_headers_and_messages/mod.rs b/bridges/relays/bin-substrate/src/cli/relay_headers_and_messages/mod.rs index 1ee7172228c06..1a809a1f483c3 100644 --- a/bridges/relays/bin-substrate/src/cli/relay_headers_and_messages/mod.rs +++ b/bridges/relays/bin-substrate/src/cli/relay_headers_and_messages/mod.rs @@ -125,8 +125,6 @@ pub struct BridgeEndCommonParams { pub sign: AccountKeyPairOf, /// Transactions mortality. pub transactions_mortality: Option, - /// Account that "owns" messages pallet. - pub messages_pallet_owner: Option>, /// Accounts, which balances are exposed as metrics by the relay process. pub accounts: Vec>>, } @@ -500,8 +498,6 @@ mod tests { "9944", "--millau-signer", "//Charlie", - "--millau-messages-pallet-owner", - "//RialtoMessagesOwner", "--millau-transactions-mortality", "64", "--rialto-host", @@ -510,8 +506,6 @@ mod tests { "9944", "--rialto-signer", "//Charlie", - "--rialto-messages-pallet-owner", - "//MillauMessagesOwner", "--rialto-transactions-mortality", "64", "--lane", @@ -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, @@ -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, @@ -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", @@ -622,8 +606,6 @@ mod tests { "9944", "--rialto-parachain-signer", "//George", - "--rialto-parachain-messages-pallet-owner", - "//MillauMessagesOwner", "--rialto-parachain-transactions-mortality", "64", "--rialto-host", @@ -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, @@ -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, diff --git a/bridges/relays/bin-substrate/src/cli/relay_headers_and_messages/parachain_to_parachain.rs b/bridges/relays/bin-substrate/src/cli/relay_headers_and_messages/parachain_to_parachain.rs index 48fc0fab49b9b..f832722c6b346 100644 --- a/bridges/relays/bin-substrate/src/cli/relay_headers_and_messages/parachain_to_parachain.rs +++ b/bridges/relays/bin-substrate/src/cli/relay_headers_and_messages/parachain_to_parachain.rs @@ -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>], @@ -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)] @@ -142,14 +136,12 @@ macro_rules! declare_parachain_to_parachain_bridge_schema { client: self.left.into_client::().await?, sign: self.left_sign.to_keypair::()?, transactions_mortality: self.left_sign.transactions_mortality()?, - messages_pallet_owner: self.left_messages_pallet_owner.to_keypair::()?, accounts: vec![], }, BridgeEndCommonParams { client: self.right.into_client::().await?, sign: self.right_sign.to_keypair::()?, transactions_mortality: self.right_sign.transactions_mortality()?, - messages_pallet_owner: self.right_messages_pallet_owner.to_keypair::()?, accounts: vec![], }, )?, diff --git a/bridges/relays/bin-substrate/src/cli/relay_headers_and_messages/relay_to_parachain.rs b/bridges/relays/bin-substrate/src/cli/relay_headers_and_messages/relay_to_parachain.rs index aa4aaf16d70e1..281996534e23f 100644 --- a/bridges/relays/bin-substrate/src/cli/relay_headers_and_messages/relay_to_parachain.rs +++ b/bridges/relays/bin-substrate/src/cli/relay_headers_and_messages/relay_to_parachain.rs @@ -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>], @@ -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)] @@ -131,14 +124,12 @@ macro_rules! declare_relay_to_parachain_bridge_schema { client: self.left.into_client::().await?, sign: self.left_sign.to_keypair::()?, transactions_mortality: self.left_sign.transactions_mortality()?, - messages_pallet_owner: self.left_messages_pallet_owner.to_keypair::()?, accounts: vec![], }, BridgeEndCommonParams { client: self.right.into_client::().await?, sign: self.right_sign.to_keypair::()?, transactions_mortality: self.right_sign.transactions_mortality()?, - messages_pallet_owner: self.right_messages_pallet_owner.to_keypair::()?, accounts: vec![], }, )?, diff --git a/bridges/relays/bin-substrate/src/cli/relay_headers_and_messages/relay_to_relay.rs b/bridges/relays/bin-substrate/src/cli/relay_headers_and_messages/relay_to_relay.rs index 625f1e66328d6..a2815bb613916 100644 --- a/bridges/relays/bin-substrate/src/cli/relay_headers_and_messages/relay_to_relay.rs +++ b/bridges/relays/bin-substrate/src/cli/relay_headers_and_messages/relay_to_relay.rs @@ -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>], @@ -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>] { @@ -94,14 +90,12 @@ macro_rules! declare_relay_to_relay_bridge_schema { client: self.left.into_client::().await?, sign: self.left_sign.to_keypair::()?, transactions_mortality: self.left_sign.transactions_mortality()?, - messages_pallet_owner: self.left_messages_pallet_owner.to_keypair::()?, accounts: vec![], }, BridgeEndCommonParams { client: self.right.into_client::().await?, sign: self.right_sign.to_keypair::()?, transactions_mortality: self.right_sign.transactions_mortality()?, - messages_pallet_owner: self.right_messages_pallet_owner.to_keypair::()?, accounts: vec![], }, )?, diff --git a/bridges/relays/lib-substrate-relay/src/lib.rs b/bridges/relays/lib-substrate-relay/src/lib.rs index 2181f0935836f..4f8f9640305a3 100644 --- a/bridges/relays/lib-substrate-relay/src/lib.rs +++ b/bridges/relays/lib-substrate-relay/src/lib.rs @@ -63,13 +63,6 @@ pub enum TaggedAccount { /// 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 TaggedAccount { @@ -79,7 +72,6 @@ impl TaggedAccount { TaggedAccount::Headers { ref id, .. } => id, TaggedAccount::Parachains { ref id, .. } => id, TaggedAccount::Messages { ref id, .. } => id, - TaggedAccount::MessagesPalletOwner { ref id, .. } => id, } } @@ -93,9 +85,6 @@ impl TaggedAccount { TaggedAccount::Messages { ref bridged_chain, .. } => { format!("{bridged_chain}Messages") }, - TaggedAccount::MessagesPalletOwner { ref bridged_chain, .. } => { - format!("{bridged_chain}MessagesPalletOwner") - }, } } }