mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 12:11:02 +00:00
Kusama <> Polkadot relay prototype (#1982)
* moved bridge declarations to dedicated folder * Kusama <> Polkadot bridges declaration * support for Kusama <> Polkadot bridge in CLI * update dictionary
This commit is contained in:
committed by
Bastian Köcher
parent
fe050f6f50
commit
9b57f2181c
+65
@@ -0,0 +1,65 @@
|
||||
// Copyright 2022 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Parity Bridges Common.
|
||||
|
||||
// Parity Bridges Common is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Parity Bridges Common is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// 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/>.
|
||||
|
||||
//! BridgeHubKusama-to-BridgeHubPolkadot messages sync entrypoint.
|
||||
|
||||
use crate::cli::bridge::{CliBridgeBase, MessagesCliBridge};
|
||||
use relay_bridge_hub_kusama_client::BridgeHubKusama;
|
||||
use relay_bridge_hub_polkadot_client::BridgeHubPolkadot;
|
||||
use substrate_relay_helper::{messages_lane::SubstrateMessageLane, UtilityPalletBatchCallBuilder};
|
||||
|
||||
/// BridgeHubKusama-to-BridgeHubPolkadot messages bridge.
|
||||
pub struct BridgeHubKusamaToBridgeHubPolkadotMessagesCliBridge {}
|
||||
|
||||
impl CliBridgeBase for BridgeHubKusamaToBridgeHubPolkadotMessagesCliBridge {
|
||||
type Source = BridgeHubKusama;
|
||||
type Target = BridgeHubPolkadot;
|
||||
}
|
||||
|
||||
impl MessagesCliBridge for BridgeHubKusamaToBridgeHubPolkadotMessagesCliBridge {
|
||||
type MessagesLane = BridgeHubKusamaMessagesToBridgeHubPolkadotMessageLane;
|
||||
}
|
||||
|
||||
substrate_relay_helper::generate_receive_message_proof_call_builder!(
|
||||
BridgeHubKusamaMessagesToBridgeHubPolkadotMessageLane,
|
||||
BridgeHubKusamaMessagesToBridgeHubPolkadotMessageLaneReceiveMessagesProofCallBuilder,
|
||||
relay_bridge_hub_polkadot_client::runtime::Call::BridgeKusamaMessages,
|
||||
relay_bridge_hub_polkadot_client::runtime::BridgeKusamaMessagesCall::receive_messages_proof
|
||||
);
|
||||
|
||||
substrate_relay_helper::generate_receive_message_delivery_proof_call_builder!(
|
||||
BridgeHubKusamaMessagesToBridgeHubPolkadotMessageLane,
|
||||
BridgeHubKusamaMessagesToBridgeHubPolkadotMessageLaneReceiveMessagesDeliveryProofCallBuilder,
|
||||
relay_bridge_hub_kusama_client::runtime::Call::BridgePolkadotMessages,
|
||||
relay_bridge_hub_kusama_client::runtime::BridgePolkadotMessagesCall::receive_messages_delivery_proof
|
||||
);
|
||||
|
||||
/// BridgeHubKusama-to-BridgeHubPolkadot messages lane.
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct BridgeHubKusamaMessagesToBridgeHubPolkadotMessageLane;
|
||||
|
||||
impl SubstrateMessageLane for BridgeHubKusamaMessagesToBridgeHubPolkadotMessageLane {
|
||||
type SourceChain = BridgeHubKusama;
|
||||
type TargetChain = BridgeHubPolkadot;
|
||||
|
||||
type ReceiveMessagesProofCallBuilder =
|
||||
BridgeHubKusamaMessagesToBridgeHubPolkadotMessageLaneReceiveMessagesProofCallBuilder;
|
||||
type ReceiveMessagesDeliveryProofCallBuilder =
|
||||
BridgeHubKusamaMessagesToBridgeHubPolkadotMessageLaneReceiveMessagesDeliveryProofCallBuilder;
|
||||
|
||||
type SourceBatchCallBuilder = UtilityPalletBatchCallBuilder<BridgeHubKusama>;
|
||||
type TargetBatchCallBuilder = UtilityPalletBatchCallBuilder<BridgeHubPolkadot>;
|
||||
}
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
// Copyright 2022 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Parity Bridges Common.
|
||||
|
||||
// Parity Bridges Common is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Parity Bridges Common is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// 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/>.
|
||||
|
||||
//! BridgeHubPolkadot-to-BridgeHubKusama messages sync entrypoint.
|
||||
|
||||
use crate::cli::bridge::{CliBridgeBase, MessagesCliBridge};
|
||||
use relay_bridge_hub_kusama_client::BridgeHubKusama;
|
||||
use relay_bridge_hub_polkadot_client::BridgeHubPolkadot;
|
||||
use substrate_relay_helper::{messages_lane::SubstrateMessageLane, UtilityPalletBatchCallBuilder};
|
||||
|
||||
/// BridgeHubPolkadot-to-BridgeHubKusama messages bridge.
|
||||
pub struct BridgeHubPolkadotToBridgeHubKusamaMessagesCliBridge {}
|
||||
|
||||
impl CliBridgeBase for BridgeHubPolkadotToBridgeHubKusamaMessagesCliBridge {
|
||||
type Source = BridgeHubPolkadot;
|
||||
type Target = BridgeHubKusama;
|
||||
}
|
||||
|
||||
impl MessagesCliBridge for BridgeHubPolkadotToBridgeHubKusamaMessagesCliBridge {
|
||||
type MessagesLane = BridgeHubPolkadotMessagesToBridgeHubKusamaMessageLane;
|
||||
}
|
||||
|
||||
substrate_relay_helper::generate_receive_message_proof_call_builder!(
|
||||
BridgeHubPolkadotMessagesToBridgeHubKusamaMessageLane,
|
||||
BridgeHubPolkadotMessagesToBridgeHubKusamaMessageLaneReceiveMessagesProofCallBuilder,
|
||||
relay_bridge_hub_kusama_client::runtime::Call::BridgePolkadotMessages,
|
||||
relay_bridge_hub_kusama_client::runtime::BridgePolkadotMessagesCall::receive_messages_proof
|
||||
);
|
||||
|
||||
substrate_relay_helper::generate_receive_message_delivery_proof_call_builder!(
|
||||
BridgeHubPolkadotMessagesToBridgeHubKusamaMessageLane,
|
||||
BridgeHubPolkadotMessagesToBridgeHubKusamaMessageLaneReceiveMessagesDeliveryProofCallBuilder,
|
||||
relay_bridge_hub_polkadot_client::runtime::Call::BridgeKusamaMessages,
|
||||
relay_bridge_hub_polkadot_client::runtime::BridgeKusamaMessagesCall::receive_messages_delivery_proof
|
||||
);
|
||||
|
||||
/// BridgeHubPolkadot-to-BridgeHubKusama messages lane.
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct BridgeHubPolkadotMessagesToBridgeHubKusamaMessageLane;
|
||||
|
||||
impl SubstrateMessageLane for BridgeHubPolkadotMessagesToBridgeHubKusamaMessageLane {
|
||||
type SourceChain = BridgeHubPolkadot;
|
||||
type TargetChain = BridgeHubKusama;
|
||||
|
||||
type ReceiveMessagesProofCallBuilder =
|
||||
BridgeHubPolkadotMessagesToBridgeHubKusamaMessageLaneReceiveMessagesProofCallBuilder;
|
||||
type ReceiveMessagesDeliveryProofCallBuilder =
|
||||
BridgeHubPolkadotMessagesToBridgeHubKusamaMessageLaneReceiveMessagesDeliveryProofCallBuilder;
|
||||
|
||||
type SourceBatchCallBuilder = UtilityPalletBatchCallBuilder<BridgeHubPolkadot>;
|
||||
type TargetBatchCallBuilder = UtilityPalletBatchCallBuilder<BridgeHubKusama>;
|
||||
}
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
// Copyright 2022 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Parity Bridges Common.
|
||||
|
||||
// Parity Bridges Common is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Parity Bridges Common is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// 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/>.
|
||||
|
||||
//! Kusama-to-BridgeHubPolkadot headers sync entrypoint.
|
||||
|
||||
use crate::cli::bridge::{CliBridgeBase, RelayToRelayHeadersCliBridge};
|
||||
|
||||
use async_trait::async_trait;
|
||||
use relay_substrate_client::{AccountKeyPairOf, Client};
|
||||
use substrate_relay_helper::{
|
||||
finality::{engine::Grandpa as GrandpaFinalityEngine, SubstrateFinalitySyncPipeline},
|
||||
TransactionParams,
|
||||
};
|
||||
|
||||
/// Description of Kusama -> PolkadotBridgeHub finalized headers bridge.
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct KusamaFinalityToBridgeHubPolkadot;
|
||||
|
||||
substrate_relay_helper::generate_submit_finality_proof_call_builder!(
|
||||
KusamaFinalityToBridgeHubPolkadot,
|
||||
KusamaFinalityToBridgeHubPolkadotCallBuilder,
|
||||
relay_bridge_hub_polkadot_client::runtime::Call::BridgeKusamaGrandpa,
|
||||
relay_bridge_hub_polkadot_client::runtime::BridgeKusamaGrandpaCall::submit_finality_proof
|
||||
);
|
||||
|
||||
#[async_trait]
|
||||
impl SubstrateFinalitySyncPipeline for KusamaFinalityToBridgeHubPolkadot {
|
||||
type SourceChain = relay_kusama_client::Kusama;
|
||||
type TargetChain = relay_bridge_hub_polkadot_client::BridgeHubPolkadot;
|
||||
|
||||
type FinalityEngine = GrandpaFinalityEngine<Self::SourceChain>;
|
||||
type SubmitFinalityProofCallBuilder = KusamaFinalityToBridgeHubPolkadotCallBuilder;
|
||||
|
||||
async fn start_relay_guards(
|
||||
target_client: &Client<Self::TargetChain>,
|
||||
_transaction_params: &TransactionParams<AccountKeyPairOf<Self::TargetChain>>,
|
||||
enable_version_guard: bool,
|
||||
) -> relay_substrate_client::Result<()> {
|
||||
if enable_version_guard {
|
||||
relay_substrate_client::guard::abort_on_spec_version_change(
|
||||
target_client.clone(),
|
||||
target_client.simple_runtime_version().await?.spec_version,
|
||||
);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
/// `Kusama` to BridgeHub `Polkadot` bridge definition.
|
||||
pub struct KusamaToBridgeHubPolkadotCliBridge {}
|
||||
|
||||
impl CliBridgeBase for KusamaToBridgeHubPolkadotCliBridge {
|
||||
type Source = relay_kusama_client::Kusama;
|
||||
type Target = relay_bridge_hub_polkadot_client::BridgeHubPolkadot;
|
||||
}
|
||||
|
||||
impl RelayToRelayHeadersCliBridge for KusamaToBridgeHubPolkadotCliBridge {
|
||||
type Finality = KusamaFinalityToBridgeHubPolkadot;
|
||||
}
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
// Copyright 2019-2021 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Parity Bridges Common.
|
||||
|
||||
// Parity Bridges Common is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Parity Bridges Common is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// 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/>.
|
||||
|
||||
//! Kusama-to-BridgeHubPolkadot parachains sync entrypoint.
|
||||
|
||||
use crate::cli::bridge::{CliBridgeBase, MessagesCliBridge, ParachainToRelayHeadersCliBridge};
|
||||
use bp_polkadot_core::parachains::{ParaHash, ParaHeadsProof, ParaId};
|
||||
use relay_substrate_client::{CallOf, HeaderIdOf};
|
||||
use substrate_relay_helper::parachains::{
|
||||
SubmitParachainHeadsCallBuilder, SubstrateParachainsPipeline,
|
||||
};
|
||||
|
||||
/// Kusama-to-BridgeHubPolkadot parachain sync description.
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct BridgeHubKusamaToBridgeHubPolkadot;
|
||||
|
||||
impl SubstrateParachainsPipeline for BridgeHubKusamaToBridgeHubPolkadot {
|
||||
type SourceParachain = relay_bridge_hub_kusama_client::BridgeHubKusama;
|
||||
type SourceRelayChain = relay_kusama_client::Kusama;
|
||||
type TargetChain = relay_bridge_hub_polkadot_client::BridgeHubPolkadot;
|
||||
|
||||
type SubmitParachainHeadsCallBuilder = BridgeHubKusamaToBridgeHubPolkadotCallBuilder;
|
||||
}
|
||||
|
||||
pub struct BridgeHubKusamaToBridgeHubPolkadotCallBuilder;
|
||||
impl SubmitParachainHeadsCallBuilder<BridgeHubKusamaToBridgeHubPolkadot>
|
||||
for BridgeHubKusamaToBridgeHubPolkadotCallBuilder
|
||||
{
|
||||
fn build_submit_parachain_heads_call(
|
||||
at_relay_block: HeaderIdOf<relay_kusama_client::Kusama>,
|
||||
parachains: Vec<(ParaId, ParaHash)>,
|
||||
parachain_heads_proof: ParaHeadsProof,
|
||||
) -> CallOf<relay_bridge_hub_polkadot_client::BridgeHubPolkadot> {
|
||||
relay_bridge_hub_polkadot_client::runtime::Call::BridgeKusamaParachain(
|
||||
relay_bridge_hub_polkadot_client::runtime::BridgeParachainCall::submit_parachain_heads {
|
||||
at_relay_block: (at_relay_block.0, at_relay_block.1),
|
||||
parachains,
|
||||
parachain_heads_proof,
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/// Kusama-to-BridgeHubPolkadot parachain sync description for the CLI.
|
||||
pub struct BridgeHubKusamaToBridgeHubPolkadotCliBridge {}
|
||||
|
||||
impl ParachainToRelayHeadersCliBridge for BridgeHubKusamaToBridgeHubPolkadotCliBridge {
|
||||
type SourceRelay = relay_kusama_client::Kusama;
|
||||
type ParachainFinality = BridgeHubKusamaToBridgeHubPolkadot;
|
||||
type RelayFinality =
|
||||
crate::bridges::kusama_polkadot::kusama_headers_to_bridge_hub_polkadot::KusamaFinalityToBridgeHubPolkadot;
|
||||
}
|
||||
|
||||
impl CliBridgeBase for BridgeHubKusamaToBridgeHubPolkadotCliBridge {
|
||||
type Source = relay_bridge_hub_kusama_client::BridgeHubKusama;
|
||||
type Target = relay_bridge_hub_polkadot_client::BridgeHubPolkadot;
|
||||
}
|
||||
|
||||
impl MessagesCliBridge for BridgeHubKusamaToBridgeHubPolkadotCliBridge {
|
||||
type MessagesLane =
|
||||
crate::bridges::kusama_polkadot::bridge_hub_kusama_messages_to_bridge_hub_polkadot::BridgeHubKusamaMessagesToBridgeHubPolkadotMessageLane;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// Copyright 2019-2021 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Parity Bridges Common.
|
||||
|
||||
// Parity Bridges Common is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Parity Bridges Common is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// 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/>.
|
||||
|
||||
//! Declaration of all bridges between Kusama Bridge Hub and Polkadot Bridge Hub.
|
||||
|
||||
pub mod bridge_hub_kusama_messages_to_bridge_hub_polkadot;
|
||||
pub mod bridge_hub_polkadot_messages_to_bridge_hub_kusama;
|
||||
pub mod kusama_headers_to_bridge_hub_polkadot;
|
||||
pub mod kusama_parachains_to_bridge_hub_polkadot;
|
||||
pub mod polkadot_headers_to_bridge_hub_kusama;
|
||||
pub mod polkadot_parachains_to_bridge_hub_kusama;
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
// Copyright 2022 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Parity Bridges Common.
|
||||
|
||||
// Parity Bridges Common is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Parity Bridges Common is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// 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/>.
|
||||
|
||||
//! Polkadot-to-KusamaBridgeHub headers sync entrypoint.
|
||||
|
||||
use crate::cli::bridge::{CliBridgeBase, RelayToRelayHeadersCliBridge};
|
||||
|
||||
use async_trait::async_trait;
|
||||
use relay_substrate_client::{AccountKeyPairOf, Client};
|
||||
use substrate_relay_helper::{
|
||||
finality::{engine::Grandpa as GrandpaFinalityEngine, SubstrateFinalitySyncPipeline},
|
||||
TransactionParams,
|
||||
};
|
||||
|
||||
/// Description of Polkadot -> KusamaBridgeHub finalized headers bridge.
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct PolkadotFinalityToBridgeHubKusama;
|
||||
|
||||
substrate_relay_helper::generate_submit_finality_proof_call_builder!(
|
||||
PolkadotFinalityToBridgeHubKusama,
|
||||
PolkadotFinalityToBridgeHubKusamaCallBuilder,
|
||||
relay_bridge_hub_kusama_client::runtime::Call::BridgePolkadotGrandpa,
|
||||
relay_bridge_hub_kusama_client::runtime::BridgePolkadotGrandpaCall::submit_finality_proof
|
||||
);
|
||||
|
||||
#[async_trait]
|
||||
impl SubstrateFinalitySyncPipeline for PolkadotFinalityToBridgeHubKusama {
|
||||
type SourceChain = relay_polkadot_client::Polkadot;
|
||||
type TargetChain = relay_bridge_hub_kusama_client::BridgeHubKusama;
|
||||
|
||||
type FinalityEngine = GrandpaFinalityEngine<Self::SourceChain>;
|
||||
type SubmitFinalityProofCallBuilder = PolkadotFinalityToBridgeHubKusamaCallBuilder;
|
||||
|
||||
async fn start_relay_guards(
|
||||
target_client: &Client<Self::TargetChain>,
|
||||
_transaction_params: &TransactionParams<AccountKeyPairOf<Self::TargetChain>>,
|
||||
enable_version_guard: bool,
|
||||
) -> relay_substrate_client::Result<()> {
|
||||
if enable_version_guard {
|
||||
relay_substrate_client::guard::abort_on_spec_version_change(
|
||||
target_client.clone(),
|
||||
target_client.simple_runtime_version().await?.spec_version,
|
||||
);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
/// `Polkadot` to BridgeHub `Kusama` bridge definition.
|
||||
pub struct PolkadotToBridgeHubKusamaCliBridge {}
|
||||
|
||||
impl CliBridgeBase for PolkadotToBridgeHubKusamaCliBridge {
|
||||
type Source = relay_polkadot_client::Polkadot;
|
||||
type Target = relay_bridge_hub_kusama_client::BridgeHubKusama;
|
||||
}
|
||||
|
||||
impl RelayToRelayHeadersCliBridge for PolkadotToBridgeHubKusamaCliBridge {
|
||||
type Finality = PolkadotFinalityToBridgeHubKusama;
|
||||
}
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
// Copyright 2019-2021 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Parity Bridges Common.
|
||||
|
||||
// Parity Bridges Common is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Parity Bridges Common is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// 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/>.
|
||||
|
||||
//! Polkadot-to-BridgeHubKusama parachains sync entrypoint.
|
||||
|
||||
use crate::cli::bridge::{CliBridgeBase, MessagesCliBridge, ParachainToRelayHeadersCliBridge};
|
||||
use bp_polkadot_core::parachains::{ParaHash, ParaHeadsProof, ParaId};
|
||||
use relay_substrate_client::{CallOf, HeaderIdOf};
|
||||
use substrate_relay_helper::parachains::{
|
||||
SubmitParachainHeadsCallBuilder, SubstrateParachainsPipeline,
|
||||
};
|
||||
|
||||
/// Polkadot-to-BridgeHubKusama parachain sync description.
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct BridgeHubPolkadotToBridgeHubKusama;
|
||||
|
||||
impl SubstrateParachainsPipeline for BridgeHubPolkadotToBridgeHubKusama {
|
||||
type SourceParachain = relay_bridge_hub_polkadot_client::BridgeHubPolkadot;
|
||||
type SourceRelayChain = relay_polkadot_client::Polkadot;
|
||||
type TargetChain = relay_bridge_hub_kusama_client::BridgeHubKusama;
|
||||
|
||||
type SubmitParachainHeadsCallBuilder = BridgeHubPolkadotToBridgeHubKusamaCallBuilder;
|
||||
}
|
||||
|
||||
pub struct BridgeHubPolkadotToBridgeHubKusamaCallBuilder;
|
||||
impl SubmitParachainHeadsCallBuilder<BridgeHubPolkadotToBridgeHubKusama>
|
||||
for BridgeHubPolkadotToBridgeHubKusamaCallBuilder
|
||||
{
|
||||
fn build_submit_parachain_heads_call(
|
||||
at_relay_block: HeaderIdOf<relay_polkadot_client::Polkadot>,
|
||||
parachains: Vec<(ParaId, ParaHash)>,
|
||||
parachain_heads_proof: ParaHeadsProof,
|
||||
) -> CallOf<relay_bridge_hub_kusama_client::BridgeHubKusama> {
|
||||
relay_bridge_hub_kusama_client::runtime::Call::BridgePolkadotParachain(
|
||||
bp_parachains::BridgeParachainCall::submit_parachain_heads {
|
||||
at_relay_block: (at_relay_block.0, at_relay_block.1),
|
||||
parachains,
|
||||
parachain_heads_proof,
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/// Polkadot-to-BridgeHubKusama parachain sync description for the CLI.
|
||||
pub struct BridgeHubPolkadotToBridgeHubKusamaCliBridge {}
|
||||
|
||||
impl ParachainToRelayHeadersCliBridge for BridgeHubPolkadotToBridgeHubKusamaCliBridge {
|
||||
type SourceRelay = relay_polkadot_client::Polkadot;
|
||||
type ParachainFinality = BridgeHubPolkadotToBridgeHubKusama;
|
||||
type RelayFinality =
|
||||
crate::bridges::kusama_polkadot::polkadot_headers_to_bridge_hub_kusama::PolkadotFinalityToBridgeHubKusama;
|
||||
}
|
||||
|
||||
impl CliBridgeBase for BridgeHubPolkadotToBridgeHubKusamaCliBridge {
|
||||
type Source = relay_bridge_hub_polkadot_client::BridgeHubPolkadot;
|
||||
type Target = relay_bridge_hub_kusama_client::BridgeHubKusama;
|
||||
}
|
||||
|
||||
impl MessagesCliBridge for BridgeHubPolkadotToBridgeHubKusamaCliBridge {
|
||||
type MessagesLane =
|
||||
crate::bridges::kusama_polkadot::bridge_hub_polkadot_messages_to_bridge_hub_kusama::BridgeHubPolkadotMessagesToBridgeHubKusamaMessageLane;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
// Copyright 2019-2021 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Parity Bridges Common.
|
||||
|
||||
// Parity Bridges Common is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Parity Bridges Common is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// 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/>.
|
||||
|
||||
//! Declaration of all bridges that the relay is able to serve.
|
||||
|
||||
pub mod kusama_polkadot;
|
||||
pub mod rialto_millau;
|
||||
pub mod rialto_parachain_millau;
|
||||
pub mod rococo_wococo;
|
||||
pub mod westend_millau;
|
||||
+2
-1
@@ -51,5 +51,6 @@ impl RelayToRelayHeadersCliBridge for MillauToRialtoCliBridge {
|
||||
}
|
||||
|
||||
impl MessagesCliBridge for MillauToRialtoCliBridge {
|
||||
type MessagesLane = crate::chains::millau_messages_to_rialto::MillauMessagesToRialto;
|
||||
type MessagesLane =
|
||||
crate::bridges::rialto_millau::millau_messages_to_rialto::MillauMessagesToRialto;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// Copyright 2019-2021 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Parity Bridges Common.
|
||||
|
||||
// Parity Bridges Common is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Parity Bridges Common is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// 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/>.
|
||||
|
||||
//! Declaration of all bridges between Rialto and Millau.
|
||||
|
||||
pub mod millau_headers_to_rialto;
|
||||
pub mod millau_messages_to_rialto;
|
||||
pub mod rialto_headers_to_millau;
|
||||
pub mod rialto_messages_to_millau;
|
||||
+2
-1
@@ -51,5 +51,6 @@ impl RelayToRelayHeadersCliBridge for RialtoToMillauCliBridge {
|
||||
}
|
||||
|
||||
impl MessagesCliBridge for RialtoToMillauCliBridge {
|
||||
type MessagesLane = crate::chains::rialto_messages_to_millau::RialtoMessagesToMillau;
|
||||
type MessagesLane =
|
||||
crate::bridges::rialto_millau::rialto_messages_to_millau::RialtoMessagesToMillau;
|
||||
}
|
||||
+1
-1
@@ -72,5 +72,5 @@ impl RelayToRelayHeadersCliBridge for MillauToRialtoParachainCliBridge {
|
||||
|
||||
impl MessagesCliBridge for MillauToRialtoParachainCliBridge {
|
||||
type MessagesLane =
|
||||
crate::chains::millau_messages_to_rialto_parachain::MillauMessagesToRialtoParachain;
|
||||
crate::bridges::rialto_parachain_millau::millau_messages_to_rialto_parachain::MillauMessagesToRialtoParachain;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// Copyright 2019-2021 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Parity Bridges Common.
|
||||
|
||||
// Parity Bridges Common is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Parity Bridges Common is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// 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/>.
|
||||
|
||||
//! Declaration of all bridges between Rialto Parachain and Millau.
|
||||
|
||||
pub mod millau_headers_to_rialto_parachain;
|
||||
pub mod millau_messages_to_rialto_parachain;
|
||||
pub mod rialto_parachain_messages_to_millau;
|
||||
pub mod rialto_parachains_to_millau;
|
||||
+3
-2
@@ -55,10 +55,11 @@ impl CliBridgeBase for RialtoParachainToMillauCliBridge {
|
||||
impl ParachainToRelayHeadersCliBridge for RialtoParachainToMillauCliBridge {
|
||||
type SourceRelay = Rialto;
|
||||
type ParachainFinality = RialtoParachainsToMillau;
|
||||
type RelayFinality = crate::chains::rialto_headers_to_millau::RialtoFinalityToMillau;
|
||||
type RelayFinality =
|
||||
crate::bridges::rialto_millau::rialto_headers_to_millau::RialtoFinalityToMillau;
|
||||
}
|
||||
|
||||
impl MessagesCliBridge for RialtoParachainToMillauCliBridge {
|
||||
type MessagesLane =
|
||||
crate::chains::rialto_parachain_messages_to_millau::RialtoParachainMessagesToMillau;
|
||||
crate::bridges::rialto_parachain_millau::rialto_parachain_messages_to_millau::RialtoParachainMessagesToMillau;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// Copyright 2019-2021 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Parity Bridges Common.
|
||||
|
||||
// Parity Bridges Common is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Parity Bridges Common is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// 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/>.
|
||||
|
||||
//! Declaration of all bridges between Rococo Bridge Hub and Wococo Bridge Hub.
|
||||
|
||||
pub mod bridge_hub_rococo_messages_to_bridge_hub_wococo;
|
||||
pub mod bridge_hub_wococo_messages_to_bridge_hub_rococo;
|
||||
pub mod rococo_headers_to_bridge_hub_wococo;
|
||||
pub mod rococo_parachains_to_bridge_hub_wococo;
|
||||
pub mod wococo_headers_to_bridge_hub_rococo;
|
||||
pub mod wococo_parachains_to_bridge_hub_rococo;
|
||||
+2
-2
@@ -61,7 +61,7 @@ impl ParachainToRelayHeadersCliBridge for BridgeHubRococoToBridgeHubWococoCliBri
|
||||
type SourceRelay = relay_rococo_client::Rococo;
|
||||
type ParachainFinality = BridgeHubRococoToBridgeHubWococo;
|
||||
type RelayFinality =
|
||||
crate::chains::rococo_headers_to_bridge_hub_wococo::RococoFinalityToBridgeHubWococo;
|
||||
crate::bridges::rococo_wococo::rococo_headers_to_bridge_hub_wococo::RococoFinalityToBridgeHubWococo;
|
||||
}
|
||||
|
||||
impl CliBridgeBase for BridgeHubRococoToBridgeHubWococoCliBridge {
|
||||
@@ -71,5 +71,5 @@ impl CliBridgeBase for BridgeHubRococoToBridgeHubWococoCliBridge {
|
||||
|
||||
impl MessagesCliBridge for BridgeHubRococoToBridgeHubWococoCliBridge {
|
||||
type MessagesLane =
|
||||
crate::chains::bridge_hub_rococo_messages_to_bridge_hub_wococo::BridgeHubRococoMessagesToBridgeHubWococoMessageLane;
|
||||
crate::bridges::rococo_wococo::bridge_hub_rococo_messages_to_bridge_hub_wococo::BridgeHubRococoMessagesToBridgeHubWococoMessageLane;
|
||||
}
|
||||
+2
-2
@@ -61,7 +61,7 @@ impl ParachainToRelayHeadersCliBridge for BridgeHubWococoToBridgeHubRococoCliBri
|
||||
type SourceRelay = relay_wococo_client::Wococo;
|
||||
type ParachainFinality = BridgeHubWococoToBridgeHubRococo;
|
||||
type RelayFinality =
|
||||
crate::chains::wococo_headers_to_bridge_hub_rococo::WococoFinalityToBridgeHubRococo;
|
||||
crate::bridges::rococo_wococo::wococo_headers_to_bridge_hub_rococo::WococoFinalityToBridgeHubRococo;
|
||||
}
|
||||
|
||||
impl CliBridgeBase for BridgeHubWococoToBridgeHubRococoCliBridge {
|
||||
@@ -71,5 +71,5 @@ impl CliBridgeBase for BridgeHubWococoToBridgeHubRococoCliBridge {
|
||||
|
||||
impl MessagesCliBridge for BridgeHubWococoToBridgeHubRococoCliBridge {
|
||||
type MessagesLane =
|
||||
crate::chains::bridge_hub_wococo_messages_to_bridge_hub_rococo::BridgeHubWococoMessagesToBridgeHubRococoMessageLane;
|
||||
crate::bridges::rococo_wococo::bridge_hub_wococo_messages_to_bridge_hub_rococo::BridgeHubWococoMessagesToBridgeHubRococoMessageLane;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
// Copyright 2019-2021 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Parity Bridges Common.
|
||||
|
||||
// Parity Bridges Common is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Parity Bridges Common is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// 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/>.
|
||||
|
||||
//! Declaration of all bridges between Westend and Millau.
|
||||
|
||||
pub mod westend_headers_to_millau;
|
||||
pub mod westend_parachains_to_millau;
|
||||
+2
-1
@@ -49,7 +49,8 @@ pub struct WestmintToMillauCliBridge {}
|
||||
impl ParachainToRelayHeadersCliBridge for WestmintToMillauCliBridge {
|
||||
type SourceRelay = Westend;
|
||||
type ParachainFinality = WestendParachainsToMillau;
|
||||
type RelayFinality = crate::chains::westend_headers_to_millau::WestendFinalityToMillau;
|
||||
type RelayFinality =
|
||||
crate::bridges::westend_millau::westend_headers_to_millau::WestendFinalityToMillau;
|
||||
}
|
||||
|
||||
impl CliBridgeBase for WestmintToMillauCliBridge {
|
||||
@@ -0,0 +1,32 @@
|
||||
// Copyright 2022 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Parity Bridges Common.
|
||||
|
||||
// Parity Bridges Common is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Parity Bridges Common is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// 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/>.
|
||||
|
||||
//! Kusama + Kusama parachains specification for CLI.
|
||||
|
||||
use crate::cli::CliChain;
|
||||
use relay_bridge_hub_kusama_client::BridgeHubKusama;
|
||||
use relay_kusama_client::Kusama;
|
||||
use relay_substrate_client::SimpleRuntimeVersion;
|
||||
|
||||
impl CliChain for Kusama {
|
||||
const RUNTIME_VERSION: Option<SimpleRuntimeVersion> = None;
|
||||
}
|
||||
|
||||
impl CliChain for BridgeHubKusama {
|
||||
// TODO: fix me (https://github.com/paritytech/parity-bridges-common/issues/1945)
|
||||
const RUNTIME_VERSION: Option<SimpleRuntimeVersion> =
|
||||
Some(SimpleRuntimeVersion { spec_version: 4242, transaction_version: 42 });
|
||||
}
|
||||
@@ -16,24 +16,9 @@
|
||||
|
||||
//! Chain-specific relayer configuration.
|
||||
|
||||
pub mod bridge_hub_rococo_messages_to_bridge_hub_wococo;
|
||||
pub mod bridge_hub_wococo_messages_to_bridge_hub_rococo;
|
||||
pub mod millau_headers_to_rialto;
|
||||
pub mod millau_headers_to_rialto_parachain;
|
||||
pub mod millau_messages_to_rialto;
|
||||
pub mod millau_messages_to_rialto_parachain;
|
||||
pub mod rialto_headers_to_millau;
|
||||
pub mod rialto_messages_to_millau;
|
||||
pub mod rialto_parachain_messages_to_millau;
|
||||
pub mod rialto_parachains_to_millau;
|
||||
pub mod rococo_headers_to_bridge_hub_wococo;
|
||||
pub mod rococo_parachains_to_bridge_hub_wococo;
|
||||
pub mod westend_headers_to_millau;
|
||||
pub mod westend_parachains_to_millau;
|
||||
pub mod wococo_headers_to_bridge_hub_rococo;
|
||||
pub mod wococo_parachains_to_bridge_hub_rococo;
|
||||
|
||||
mod kusama;
|
||||
mod millau;
|
||||
mod polkadot;
|
||||
mod rialto;
|
||||
mod rialto_parachain;
|
||||
mod rococo;
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
// Copyright 2022 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Parity Bridges Common.
|
||||
|
||||
// Parity Bridges Common is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Parity Bridges Common is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// 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/>.
|
||||
|
||||
//! Polkadot + Polkadot parachains specification for CLI.
|
||||
|
||||
use crate::cli::CliChain;
|
||||
use relay_bridge_hub_polkadot_client::BridgeHubPolkadot;
|
||||
use relay_polkadot_client::Polkadot;
|
||||
use relay_substrate_client::SimpleRuntimeVersion;
|
||||
|
||||
impl CliChain for Polkadot {
|
||||
const RUNTIME_VERSION: Option<SimpleRuntimeVersion> = None;
|
||||
}
|
||||
|
||||
impl CliChain for BridgeHubPolkadot {
|
||||
// TODO: fix me (https://github.com/paritytech/parity-bridges-common/issues/1945)
|
||||
const RUNTIME_VERSION: Option<SimpleRuntimeVersion> =
|
||||
Some(SimpleRuntimeVersion { spec_version: 4242, transaction_version: 42 });
|
||||
}
|
||||
@@ -33,6 +33,8 @@ pub enum FullBridge {
|
||||
RialtoParachainToMillau,
|
||||
BridgeHubRococoToBridgeHubWococo,
|
||||
BridgeHubWococoToBridgeHubRococo,
|
||||
BridgeHubKusamaToBridgeHubPolkadot,
|
||||
BridgeHubPolkadotToBridgeHubKusama,
|
||||
}
|
||||
|
||||
impl FullBridge {
|
||||
@@ -43,7 +45,10 @@ impl FullBridge {
|
||||
Self::RialtoToMillau => RIALTO_TO_MILLAU_INDEX,
|
||||
Self::MillauToRialtoParachain => MILLAU_TO_RIALTO_PARACHAIN_INDEX,
|
||||
Self::RialtoParachainToMillau => RIALTO_PARACHAIN_TO_MILLAU_INDEX,
|
||||
Self::BridgeHubRococoToBridgeHubWococo | Self::BridgeHubWococoToBridgeHubRococo =>
|
||||
Self::BridgeHubRococoToBridgeHubWococo |
|
||||
Self::BridgeHubWococoToBridgeHubRococo |
|
||||
Self::BridgeHubKusamaToBridgeHubPolkadot |
|
||||
Self::BridgeHubPolkadotToBridgeHubKusama =>
|
||||
unimplemented!("Relay doesn't support send-message subcommand on bridge hubs"),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,13 +18,17 @@ use async_trait::async_trait;
|
||||
use codec::Encode;
|
||||
|
||||
use crate::{
|
||||
chains::{
|
||||
millau_headers_to_rialto::MillauToRialtoCliBridge,
|
||||
millau_headers_to_rialto_parachain::MillauToRialtoParachainCliBridge,
|
||||
rialto_headers_to_millau::RialtoToMillauCliBridge,
|
||||
rococo_headers_to_bridge_hub_wococo::RococoToBridgeHubWococoCliBridge,
|
||||
westend_headers_to_millau::WestendToMillauCliBridge,
|
||||
wococo_headers_to_bridge_hub_rococo::WococoToBridgeHubRococoCliBridge,
|
||||
bridges::{
|
||||
rialto_millau::{
|
||||
millau_headers_to_rialto::MillauToRialtoCliBridge,
|
||||
rialto_headers_to_millau::RialtoToMillauCliBridge,
|
||||
},
|
||||
rialto_parachain_millau::millau_headers_to_rialto_parachain::MillauToRialtoParachainCliBridge,
|
||||
rococo_wococo::{
|
||||
rococo_headers_to_bridge_hub_wococo::RococoToBridgeHubWococoCliBridge,
|
||||
wococo_headers_to_bridge_hub_rococo::WococoToBridgeHubRococoCliBridge,
|
||||
},
|
||||
westend_millau::westend_headers_to_millau::WestendToMillauCliBridge,
|
||||
},
|
||||
cli::{bridge::CliBridgeBase, chain_schema::*},
|
||||
};
|
||||
|
||||
@@ -20,13 +20,21 @@ use sp_core::Pair;
|
||||
use structopt::StructOpt;
|
||||
use strum::{EnumString, EnumVariantNames, VariantNames};
|
||||
|
||||
use crate::chains::{
|
||||
millau_headers_to_rialto::MillauToRialtoCliBridge,
|
||||
millau_headers_to_rialto_parachain::MillauToRialtoParachainCliBridge,
|
||||
rialto_headers_to_millau::RialtoToMillauCliBridge,
|
||||
rococo_headers_to_bridge_hub_wococo::RococoToBridgeHubWococoCliBridge,
|
||||
westend_headers_to_millau::WestendToMillauCliBridge,
|
||||
wococo_headers_to_bridge_hub_rococo::WococoToBridgeHubRococoCliBridge,
|
||||
use crate::bridges::{
|
||||
kusama_polkadot::{
|
||||
kusama_headers_to_bridge_hub_polkadot::KusamaToBridgeHubPolkadotCliBridge,
|
||||
polkadot_headers_to_bridge_hub_kusama::PolkadotToBridgeHubKusamaCliBridge,
|
||||
},
|
||||
rialto_millau::{
|
||||
millau_headers_to_rialto::MillauToRialtoCliBridge,
|
||||
rialto_headers_to_millau::RialtoToMillauCliBridge,
|
||||
},
|
||||
rialto_parachain_millau::millau_headers_to_rialto_parachain::MillauToRialtoParachainCliBridge,
|
||||
rococo_wococo::{
|
||||
rococo_headers_to_bridge_hub_wococo::RococoToBridgeHubWococoCliBridge,
|
||||
wococo_headers_to_bridge_hub_rococo::WococoToBridgeHubRococoCliBridge,
|
||||
},
|
||||
westend_millau::westend_headers_to_millau::WestendToMillauCliBridge,
|
||||
};
|
||||
use relay_utils::metrics::{GlobalMetrics, StandaloneMetric};
|
||||
use substrate_relay_helper::finality::SubstrateFinalitySyncPipeline;
|
||||
@@ -63,6 +71,8 @@ pub enum RelayHeadersBridge {
|
||||
MillauToRialtoParachain,
|
||||
RococoToBridgeHubWococo,
|
||||
WococoToBridgeHubRococo,
|
||||
KusamaToBridgeHubPolkadot,
|
||||
PolkadotToBridgeHubKusama,
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
@@ -109,6 +119,8 @@ impl HeadersRelayer for WestendToMillauCliBridge {}
|
||||
impl HeadersRelayer for MillauToRialtoParachainCliBridge {}
|
||||
impl HeadersRelayer for RococoToBridgeHubWococoCliBridge {}
|
||||
impl HeadersRelayer for WococoToBridgeHubRococoCliBridge {}
|
||||
impl HeadersRelayer for KusamaToBridgeHubPolkadotCliBridge {}
|
||||
impl HeadersRelayer for PolkadotToBridgeHubKusamaCliBridge {}
|
||||
|
||||
impl RelayHeaders {
|
||||
/// Run the command.
|
||||
@@ -123,6 +135,10 @@ impl RelayHeaders {
|
||||
RococoToBridgeHubWococoCliBridge::relay_headers(self),
|
||||
RelayHeadersBridge::WococoToBridgeHubRococo =>
|
||||
WococoToBridgeHubRococoCliBridge::relay_headers(self),
|
||||
RelayHeadersBridge::KusamaToBridgeHubPolkadot =>
|
||||
KusamaToBridgeHubPolkadotCliBridge::relay_headers(self),
|
||||
RelayHeadersBridge::PolkadotToBridgeHubKusama =>
|
||||
PolkadotToBridgeHubKusamaCliBridge::relay_headers(self),
|
||||
}
|
||||
.await
|
||||
}
|
||||
|
||||
@@ -39,13 +39,19 @@ use relay_to_parachain::*;
|
||||
use relay_to_relay::*;
|
||||
|
||||
use crate::{
|
||||
chains::{
|
||||
millau_headers_to_rialto::MillauToRialtoCliBridge,
|
||||
millau_headers_to_rialto_parachain::MillauToRialtoParachainCliBridge,
|
||||
rialto_headers_to_millau::RialtoToMillauCliBridge,
|
||||
rialto_parachains_to_millau::RialtoParachainToMillauCliBridge,
|
||||
rococo_parachains_to_bridge_hub_wococo::BridgeHubRococoToBridgeHubWococoCliBridge,
|
||||
wococo_parachains_to_bridge_hub_rococo::BridgeHubWococoToBridgeHubRococoCliBridge,
|
||||
bridges::{
|
||||
rialto_millau::{
|
||||
millau_headers_to_rialto::MillauToRialtoCliBridge,
|
||||
rialto_headers_to_millau::RialtoToMillauCliBridge,
|
||||
},
|
||||
rialto_parachain_millau::{
|
||||
millau_headers_to_rialto_parachain::MillauToRialtoParachainCliBridge,
|
||||
rialto_parachains_to_millau::RialtoParachainToMillauCliBridge,
|
||||
},
|
||||
rococo_wococo::{
|
||||
rococo_parachains_to_bridge_hub_wococo::BridgeHubRococoToBridgeHubWococoCliBridge,
|
||||
wococo_parachains_to_bridge_hub_rococo::BridgeHubWococoToBridgeHubRococoCliBridge,
|
||||
},
|
||||
},
|
||||
cli::{
|
||||
bridge::{
|
||||
|
||||
@@ -19,13 +19,23 @@ use sp_core::Pair;
|
||||
use structopt::StructOpt;
|
||||
use strum::VariantNames;
|
||||
|
||||
use crate::chains::{
|
||||
bridge_hub_rococo_messages_to_bridge_hub_wococo::BridgeHubRococoToBridgeHubWococoMessagesCliBridge,
|
||||
bridge_hub_wococo_messages_to_bridge_hub_rococo::BridgeHubWococoToBridgeHubRococoMessagesCliBridge,
|
||||
millau_headers_to_rialto::MillauToRialtoCliBridge,
|
||||
millau_headers_to_rialto_parachain::MillauToRialtoParachainCliBridge,
|
||||
rialto_headers_to_millau::RialtoToMillauCliBridge,
|
||||
rialto_parachains_to_millau::RialtoParachainToMillauCliBridge,
|
||||
use crate::bridges::{
|
||||
kusama_polkadot::{
|
||||
bridge_hub_kusama_messages_to_bridge_hub_polkadot::BridgeHubKusamaToBridgeHubPolkadotMessagesCliBridge,
|
||||
bridge_hub_polkadot_messages_to_bridge_hub_kusama::BridgeHubPolkadotToBridgeHubKusamaMessagesCliBridge,
|
||||
},
|
||||
rialto_millau::{
|
||||
millau_headers_to_rialto::MillauToRialtoCliBridge,
|
||||
rialto_headers_to_millau::RialtoToMillauCliBridge,
|
||||
},
|
||||
rialto_parachain_millau::{
|
||||
millau_headers_to_rialto_parachain::MillauToRialtoParachainCliBridge,
|
||||
rialto_parachains_to_millau::RialtoParachainToMillauCliBridge,
|
||||
},
|
||||
rococo_wococo::{
|
||||
bridge_hub_rococo_messages_to_bridge_hub_wococo::BridgeHubRococoToBridgeHubWococoMessagesCliBridge,
|
||||
bridge_hub_wococo_messages_to_bridge_hub_rococo::BridgeHubWococoToBridgeHubRococoMessagesCliBridge,
|
||||
},
|
||||
};
|
||||
use relay_substrate_client::{AccountIdOf, AccountKeyPairOf, BalanceOf, ChainWithTransactions};
|
||||
use substrate_relay_helper::{messages_lane::MessagesRelayParams, TransactionParams};
|
||||
@@ -96,6 +106,8 @@ impl MessagesRelayer for MillauToRialtoParachainCliBridge {}
|
||||
impl MessagesRelayer for RialtoParachainToMillauCliBridge {}
|
||||
impl MessagesRelayer for BridgeHubRococoToBridgeHubWococoMessagesCliBridge {}
|
||||
impl MessagesRelayer for BridgeHubWococoToBridgeHubRococoMessagesCliBridge {}
|
||||
impl MessagesRelayer for BridgeHubKusamaToBridgeHubPolkadotMessagesCliBridge {}
|
||||
impl MessagesRelayer for BridgeHubPolkadotToBridgeHubKusamaMessagesCliBridge {}
|
||||
|
||||
impl RelayMessages {
|
||||
/// Run the command.
|
||||
@@ -111,6 +123,10 @@ impl RelayMessages {
|
||||
BridgeHubRococoToBridgeHubWococoMessagesCliBridge::relay_messages(self),
|
||||
FullBridge::BridgeHubWococoToBridgeHubRococo =>
|
||||
BridgeHubWococoToBridgeHubRococoMessagesCliBridge::relay_messages(self),
|
||||
FullBridge::BridgeHubKusamaToBridgeHubPolkadot =>
|
||||
BridgeHubKusamaToBridgeHubPolkadotMessagesCliBridge::relay_messages(self),
|
||||
FullBridge::BridgeHubPolkadotToBridgeHubKusama =>
|
||||
BridgeHubPolkadotToBridgeHubKusamaMessagesCliBridge::relay_messages(self),
|
||||
}
|
||||
.await
|
||||
}
|
||||
|
||||
@@ -14,11 +14,17 @@
|
||||
// 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::chains::{
|
||||
rialto_parachains_to_millau::RialtoParachainToMillauCliBridge,
|
||||
rococo_parachains_to_bridge_hub_wococo::BridgeHubRococoToBridgeHubWococoCliBridge,
|
||||
westend_parachains_to_millau::WestmintToMillauCliBridge,
|
||||
wococo_parachains_to_bridge_hub_rococo::BridgeHubWococoToBridgeHubRococoCliBridge,
|
||||
use crate::bridges::{
|
||||
kusama_polkadot::{
|
||||
kusama_parachains_to_bridge_hub_polkadot::BridgeHubKusamaToBridgeHubPolkadotCliBridge,
|
||||
polkadot_parachains_to_bridge_hub_kusama::BridgeHubPolkadotToBridgeHubKusamaCliBridge,
|
||||
},
|
||||
rialto_parachain_millau::rialto_parachains_to_millau::RialtoParachainToMillauCliBridge,
|
||||
rococo_wococo::{
|
||||
rococo_parachains_to_bridge_hub_wococo::BridgeHubRococoToBridgeHubWococoCliBridge,
|
||||
wococo_parachains_to_bridge_hub_rococo::BridgeHubWococoToBridgeHubRococoCliBridge,
|
||||
},
|
||||
westend_millau::westend_parachains_to_millau::WestmintToMillauCliBridge,
|
||||
};
|
||||
use async_std::sync::Mutex;
|
||||
use async_trait::async_trait;
|
||||
@@ -60,10 +66,11 @@ pub struct RelayParachains {
|
||||
#[strum(serialize_all = "kebab_case")]
|
||||
pub enum RelayParachainsBridge {
|
||||
RialtoToMillau,
|
||||
// TODO:check-parameter - rename to WestmintToMillau?
|
||||
WestendToMillau,
|
||||
BridgeHubRococoToBridgeHubWococo,
|
||||
BridgeHubWococoToBridgeHubRococo,
|
||||
RococoToBridgeHubWococo,
|
||||
WococoToBridgeHubRococo,
|
||||
KusamaToBridgeHubPolkadot,
|
||||
PolkadotToBridgeHubKusama,
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
@@ -75,7 +82,7 @@ where
|
||||
TargetClient<ParachainsPipelineAdapter<Self::ParachainFinality>>,
|
||||
<Self as CliBridgeBase>::Source: Parachain,
|
||||
{
|
||||
async fn relay_headers(data: RelayParachains) -> anyhow::Result<()> {
|
||||
async fn relay_parachains(data: RelayParachains) -> anyhow::Result<()> {
|
||||
let source_client = data.source.into_client::<Self::SourceRelay>().await?;
|
||||
let source_client = ParachainsSource::<Self::ParachainFinality>::new(
|
||||
source_client,
|
||||
@@ -108,25 +115,28 @@ where
|
||||
}
|
||||
|
||||
impl ParachainsRelayer for RialtoParachainToMillauCliBridge {}
|
||||
|
||||
impl ParachainsRelayer for WestmintToMillauCliBridge {}
|
||||
|
||||
impl ParachainsRelayer for BridgeHubRococoToBridgeHubWococoCliBridge {}
|
||||
|
||||
impl ParachainsRelayer for BridgeHubWococoToBridgeHubRococoCliBridge {}
|
||||
impl ParachainsRelayer for BridgeHubKusamaToBridgeHubPolkadotCliBridge {}
|
||||
impl ParachainsRelayer for BridgeHubPolkadotToBridgeHubKusamaCliBridge {}
|
||||
|
||||
impl RelayParachains {
|
||||
/// Run the command.
|
||||
pub async fn run(self) -> anyhow::Result<()> {
|
||||
match self.bridge {
|
||||
RelayParachainsBridge::RialtoToMillau =>
|
||||
RialtoParachainToMillauCliBridge::relay_headers(self),
|
||||
RialtoParachainToMillauCliBridge::relay_parachains(self),
|
||||
RelayParachainsBridge::WestendToMillau =>
|
||||
WestmintToMillauCliBridge::relay_headers(self),
|
||||
RelayParachainsBridge::BridgeHubRococoToBridgeHubWococo =>
|
||||
BridgeHubRococoToBridgeHubWococoCliBridge::relay_headers(self),
|
||||
RelayParachainsBridge::BridgeHubWococoToBridgeHubRococo =>
|
||||
BridgeHubWococoToBridgeHubRococoCliBridge::relay_headers(self),
|
||||
WestmintToMillauCliBridge::relay_parachains(self),
|
||||
RelayParachainsBridge::RococoToBridgeHubWococo =>
|
||||
BridgeHubRococoToBridgeHubWococoCliBridge::relay_parachains(self),
|
||||
RelayParachainsBridge::WococoToBridgeHubRococo =>
|
||||
BridgeHubWococoToBridgeHubRococoCliBridge::relay_parachains(self),
|
||||
RelayParachainsBridge::KusamaToBridgeHubPolkadot =>
|
||||
BridgeHubKusamaToBridgeHubPolkadotCliBridge::relay_parachains(self),
|
||||
RelayParachainsBridge::PolkadotToBridgeHubKusama =>
|
||||
BridgeHubPolkadotToBridgeHubKusamaCliBridge::relay_parachains(self),
|
||||
}
|
||||
.await
|
||||
}
|
||||
|
||||
@@ -15,11 +15,15 @@
|
||||
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{
|
||||
chains::{
|
||||
millau_headers_to_rialto::MillauToRialtoCliBridge,
|
||||
millau_headers_to_rialto_parachain::MillauToRialtoParachainCliBridge,
|
||||
rialto_headers_to_millau::RialtoToMillauCliBridge,
|
||||
rialto_parachains_to_millau::RialtoParachainToMillauCliBridge,
|
||||
bridges::{
|
||||
rialto_millau::{
|
||||
millau_headers_to_rialto::MillauToRialtoCliBridge,
|
||||
rialto_headers_to_millau::RialtoToMillauCliBridge,
|
||||
},
|
||||
rialto_parachain_millau::{
|
||||
millau_headers_to_rialto_parachain::MillauToRialtoParachainCliBridge,
|
||||
rialto_parachains_to_millau::RialtoParachainToMillauCliBridge,
|
||||
},
|
||||
},
|
||||
cli::{
|
||||
bridge::{FullBridge, MessagesCliBridge},
|
||||
@@ -114,6 +118,12 @@ impl SendMessage {
|
||||
FullBridge::BridgeHubWococoToBridgeHubRococo => unimplemented!(
|
||||
"Sending message from BridgeHubWococo to BridgeHubRococo is not supported"
|
||||
),
|
||||
FullBridge::BridgeHubKusamaToBridgeHubPolkadot => unimplemented!(
|
||||
"Sending message from BridgeHubKusama to BridgeHubPolkadot is not supported"
|
||||
),
|
||||
FullBridge::BridgeHubPolkadotToBridgeHubKusama => unimplemented!(
|
||||
"Sending message from BridgeHubPolkadot to BridgeHubKusama is not supported"
|
||||
),
|
||||
}
|
||||
.await
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
#![warn(missing_docs)]
|
||||
|
||||
mod bridges;
|
||||
mod chains;
|
||||
mod cli;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user