mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 19:51:02 +00:00
[CLI] Remove some macros
Refactor the implementations for the following CLI methods in order to avoid using macros: - init_bridge - relay_headers - relay_parachains Signed-off-by: Serban Iorga <serban@parity.io>
This commit is contained in:
committed by
Bastian Köcher
parent
4929493f83
commit
46c0400f26
@@ -14,7 +14,10 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::cli::CliChain;
|
||||
use relay_substrate_client::{AccountKeyPairOf, Chain, TransactionSignScheme};
|
||||
use strum::{EnumString, EnumVariantNames};
|
||||
use substrate_relay_helper::finality::SubstrateFinalitySyncPipeline;
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, EnumString, EnumVariantNames)]
|
||||
#[strum(serialize_all = "kebab_case")]
|
||||
@@ -218,3 +221,137 @@ macro_rules! select_full_bridge {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/// Minimal bridge representation that can be used from the CLI.
|
||||
/// It connects a source chain to a target chain.
|
||||
pub trait CliBridgeBase: Sized {
|
||||
/// The source chain.
|
||||
type Source: Chain + CliChain;
|
||||
/// The target chain.
|
||||
type Target: Chain
|
||||
+ TransactionSignScheme<Chain = Self::Target>
|
||||
+ CliChain<KeyPair = AccountKeyPairOf<Self::Target>>;
|
||||
}
|
||||
|
||||
/// Bridge representation that can be used from the CLI.
|
||||
pub trait CliBridge: CliBridgeBase {
|
||||
/// Finality proofs synchronization pipeline.
|
||||
type Finality: SubstrateFinalitySyncPipeline<
|
||||
SourceChain = Self::Source,
|
||||
TargetChain = Self::Target,
|
||||
TransactionSignScheme = Self::Target,
|
||||
>;
|
||||
}
|
||||
|
||||
//// `Millau` to `Rialto` bridge definition.
|
||||
pub struct MillauToRialtoCliBridge {}
|
||||
|
||||
impl CliBridgeBase for MillauToRialtoCliBridge {
|
||||
type Source = relay_millau_client::Millau;
|
||||
type Target = relay_rialto_client::Rialto;
|
||||
}
|
||||
|
||||
impl CliBridge for MillauToRialtoCliBridge {
|
||||
type Finality = crate::chains::millau_headers_to_rialto::MillauFinalityToRialto;
|
||||
}
|
||||
|
||||
//// `Rialto` to `Millau` bridge definition.
|
||||
pub struct RialtoToMillauCliBridge {}
|
||||
|
||||
impl CliBridgeBase for RialtoToMillauCliBridge {
|
||||
type Source = relay_rialto_client::Rialto;
|
||||
type Target = relay_millau_client::Millau;
|
||||
}
|
||||
|
||||
impl CliBridge for RialtoToMillauCliBridge {
|
||||
type Finality = crate::chains::rialto_headers_to_millau::RialtoFinalityToMillau;
|
||||
}
|
||||
|
||||
//// `Westend` to `Millau` bridge definition.
|
||||
pub struct WestendToMillauCliBridge {}
|
||||
|
||||
impl CliBridgeBase for WestendToMillauCliBridge {
|
||||
type Source = relay_westend_client::Westend;
|
||||
type Target = relay_millau_client::Millau;
|
||||
}
|
||||
|
||||
impl CliBridge for WestendToMillauCliBridge {
|
||||
type Finality = crate::chains::westend_headers_to_millau::WestendFinalityToMillau;
|
||||
}
|
||||
|
||||
//// `Rococo` to `Wococo` bridge definition.
|
||||
pub struct RococoToWococoCliBridge {}
|
||||
|
||||
impl CliBridgeBase for RococoToWococoCliBridge {
|
||||
type Source = relay_rococo_client::Rococo;
|
||||
type Target = relay_wococo_client::Wococo;
|
||||
}
|
||||
|
||||
impl CliBridge for RococoToWococoCliBridge {
|
||||
type Finality = crate::chains::rococo_headers_to_wococo::RococoFinalityToWococo;
|
||||
}
|
||||
|
||||
//// `Wococo` to `Rococo` bridge definition.
|
||||
pub struct WococoToRococoCliBridge {}
|
||||
|
||||
impl CliBridgeBase for WococoToRococoCliBridge {
|
||||
type Source = relay_wococo_client::Wococo;
|
||||
type Target = relay_rococo_client::Rococo;
|
||||
}
|
||||
|
||||
impl CliBridge for WococoToRococoCliBridge {
|
||||
type Finality = crate::chains::wococo_headers_to_rococo::WococoFinalityToRococo;
|
||||
}
|
||||
|
||||
//// `Kusama` to `Polkadot` bridge definition.
|
||||
pub struct KusamaToPolkadotCliBridge {}
|
||||
|
||||
impl CliBridgeBase for KusamaToPolkadotCliBridge {
|
||||
type Source = relay_kusama_client::Kusama;
|
||||
type Target = relay_polkadot_client::Polkadot;
|
||||
}
|
||||
|
||||
impl CliBridge for KusamaToPolkadotCliBridge {
|
||||
type Finality = crate::chains::kusama_headers_to_polkadot::KusamaFinalityToPolkadot;
|
||||
}
|
||||
|
||||
//// `Polkadot` to `Kusama` bridge definition.
|
||||
pub struct PolkadotToKusamaCliBridge {}
|
||||
|
||||
impl CliBridgeBase for PolkadotToKusamaCliBridge {
|
||||
type Source = relay_polkadot_client::Polkadot;
|
||||
type Target = relay_kusama_client::Kusama;
|
||||
}
|
||||
|
||||
impl CliBridge for PolkadotToKusamaCliBridge {
|
||||
type Finality = crate::chains::polkadot_headers_to_kusama::PolkadotFinalityToKusama;
|
||||
}
|
||||
|
||||
//// `Millau` to `RialtoParachain` bridge definition.
|
||||
pub struct MillauToRialtoParachainCliBridge {}
|
||||
|
||||
impl CliBridgeBase for MillauToRialtoParachainCliBridge {
|
||||
type Source = relay_millau_client::Millau;
|
||||
type Target = relay_rialto_parachain_client::RialtoParachain;
|
||||
}
|
||||
|
||||
impl CliBridge for MillauToRialtoParachainCliBridge {
|
||||
type Finality =
|
||||
crate::chains::millau_headers_to_rialto_parachain::MillauFinalityToRialtoParachain;
|
||||
}
|
||||
|
||||
//// `RialtoParachain` to `Millau` bridge definition.
|
||||
pub struct RialtoParachainToMillauCliBridge {}
|
||||
|
||||
impl CliBridgeBase for RialtoParachainToMillauCliBridge {
|
||||
type Source = relay_rialto_parachain_client::RialtoParachain;
|
||||
type Target = relay_millau_client::Millau;
|
||||
}
|
||||
|
||||
//// `WestendParachain` to `Millau` bridge definition.
|
||||
pub struct WestmintToMillauCliBridge {}
|
||||
|
||||
impl CliBridgeBase for WestmintToMillauCliBridge {
|
||||
type Source = relay_westend_client::Westmint;
|
||||
type Target = relay_millau_client::Millau;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user