mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 07:31:02 +00:00
Rococo/Wococo bridge hub relay integration (#1565)
* [BridgeHub] Added bridge-hub-rococo/wococo clients with bridge-hub-rococo-runtime * [BridgeHub] Add init-bridge stuff for bridge-hub-rococo/wococo * [BridgeHub] Add init-bridge stuff for bridge-hub-rococo/wococo * [BridgeHub] Fixed Call-encoding for init-bridge rococo runtime wrapper * Final index update to runtime calls * [BridgeHub] Add init-bridge stuff for bridge-hub-rococo/wococo (otherside) * Added runtime best_finalized functions + relay-headers init * Renaming and change BridgeHubRococo/Wococo to Rococo/Wococo config * [BridgeHub] Add relay-parachains (Rococo/Wococo) * Missing stuff for adding xcm messaging to BridgeHub * extracted parachain IDs to the primitives * fix compilation * Fixes * Init setup for Rococo->Wococo messaging support * Removed unused AccountId from `trait MessagesBridge` * Removed unused trait SenderOrigin * Small fixes * Cleaning after master-merge * Fixes * Fixes * Fixes * Fixes * Fixes: - align WeightToFee with BridgeHubRococo runtime - MAX_HEADER_SIZE - updated TODOs * Added relay_messages cfg for BridgeHubWococo -> BridgeHubRococo Co-authored-by: Svyatoslav Nikolsky <svyatonik@gmail.com>
This commit is contained in:
committed by
Bastian Köcher
parent
3c76889948
commit
6c4728f1cc
+78
@@ -0,0 +1,78 @@
|
||||
// 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/>.
|
||||
|
||||
//! BridgeHubRococo-to-BridgeHubWococo messages sync entrypoint.
|
||||
|
||||
use crate::cli::bridge::{CliBridgeBase, MessagesCliBridge};
|
||||
use bp_messages::Weight;
|
||||
use messages_relay::relay_strategy::MixStrategy;
|
||||
use relay_bridge_hub_rococo_client::BridgeHubRococo;
|
||||
use relay_bridge_hub_wococo_client::BridgeHubWococo;
|
||||
use substrate_relay_helper::messages_lane::SubstrateMessageLane;
|
||||
|
||||
pub struct BridgeHubRococoToBridgeHubWococoMessagesCliBridge {}
|
||||
|
||||
impl CliBridgeBase for BridgeHubRococoToBridgeHubWococoMessagesCliBridge {
|
||||
type Source = BridgeHubRococo;
|
||||
type Target = BridgeHubWococo;
|
||||
}
|
||||
|
||||
impl MessagesCliBridge for BridgeHubRococoToBridgeHubWococoMessagesCliBridge {
|
||||
const ESTIMATE_MESSAGE_FEE_METHOD: &'static str =
|
||||
"TODO: not needed now, used for send_message and estimate_fee CLI";
|
||||
type MessagesLane = BridgeHubRococoMessagesToBridgeHubWococoMessageLane;
|
||||
}
|
||||
|
||||
substrate_relay_helper::generate_mocked_receive_message_proof_call_builder!(
|
||||
BridgeHubRococoMessagesToBridgeHubWococoMessageLane,
|
||||
BridgeHubRococoMessagesToBridgeHubWococoMessageLaneReceiveMessagesProofCallBuilder,
|
||||
relay_bridge_hub_wococo_client::runtime::Call::BridgeRococoMessages,
|
||||
relay_bridge_hub_wococo_client::runtime::BridgeRococoMessagesCall::receive_messages_proof
|
||||
);
|
||||
|
||||
substrate_relay_helper::generate_mocked_receive_message_delivery_proof_call_builder!(
|
||||
BridgeHubRococoMessagesToBridgeHubWococoMessageLane,
|
||||
BridgeHubRococoMessagesToBridgeHubWococoMessageLaneReceiveMessagesDeliveryProofCallBuilder,
|
||||
relay_bridge_hub_rococo_client::runtime::Call::BridgeWococoMessages,
|
||||
relay_bridge_hub_rococo_client::runtime::BridgeWococoMessagesCall::receive_messages_delivery_proof
|
||||
);
|
||||
|
||||
/// Description of BridgeHubRococo -> BridgeHubWococo messages bridge.
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct BridgeHubRococoMessagesToBridgeHubWococoMessageLane;
|
||||
|
||||
impl SubstrateMessageLane for BridgeHubRococoMessagesToBridgeHubWococoMessageLane {
|
||||
const SOURCE_TO_TARGET_CONVERSION_RATE_PARAMETER_NAME: Option<&'static str> = None;
|
||||
const TARGET_TO_SOURCE_CONVERSION_RATE_PARAMETER_NAME: Option<&'static str> = None;
|
||||
|
||||
const SOURCE_FEE_MULTIPLIER_PARAMETER_NAME: Option<&'static str> = None;
|
||||
const TARGET_FEE_MULTIPLIER_PARAMETER_NAME: Option<&'static str> = None;
|
||||
|
||||
const AT_SOURCE_TRANSACTION_PAYMENT_PALLET_NAME: Option<&'static str> = None;
|
||||
const AT_TARGET_TRANSACTION_PAYMENT_PALLET_NAME: Option<&'static str> = None;
|
||||
|
||||
type SourceChain = BridgeHubRococo;
|
||||
type TargetChain = BridgeHubWococo;
|
||||
|
||||
type ReceiveMessagesProofCallBuilder =
|
||||
BridgeHubRococoMessagesToBridgeHubWococoMessageLaneReceiveMessagesProofCallBuilder;
|
||||
type ReceiveMessagesDeliveryProofCallBuilder =
|
||||
BridgeHubRococoMessagesToBridgeHubWococoMessageLaneReceiveMessagesDeliveryProofCallBuilder;
|
||||
|
||||
type TargetToSourceChainConversionRateUpdateBuilder = ();
|
||||
|
||||
type RelayStrategy = MixStrategy;
|
||||
}
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
// 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/>.
|
||||
|
||||
//! BridgeHubWococo-to-BridgeHubRococo messages sync entrypoint.
|
||||
|
||||
use crate::cli::bridge::{CliBridgeBase, MessagesCliBridge};
|
||||
use bp_messages::Weight;
|
||||
use messages_relay::relay_strategy::MixStrategy;
|
||||
use relay_bridge_hub_rococo_client::BridgeHubRococo;
|
||||
use relay_bridge_hub_wococo_client::BridgeHubWococo;
|
||||
use substrate_relay_helper::messages_lane::SubstrateMessageLane;
|
||||
|
||||
pub struct BridgeHubWococoToBridgeHubRococoMessagesCliBridge {}
|
||||
|
||||
impl CliBridgeBase for BridgeHubWococoToBridgeHubRococoMessagesCliBridge {
|
||||
type Source = BridgeHubWococo;
|
||||
type Target = BridgeHubRococo;
|
||||
}
|
||||
|
||||
impl MessagesCliBridge for BridgeHubWococoToBridgeHubRococoMessagesCliBridge {
|
||||
const ESTIMATE_MESSAGE_FEE_METHOD: &'static str =
|
||||
"TODO: not needed now, used for send_message and estimate_fee CLI";
|
||||
type MessagesLane = BridgeHubWococoMessagesToBridgeHubRococoMessageLane;
|
||||
}
|
||||
|
||||
substrate_relay_helper::generate_mocked_receive_message_proof_call_builder!(
|
||||
BridgeHubWococoMessagesToBridgeHubRococoMessageLane,
|
||||
BridgeHubWococoMessagesToBridgeHubRococoMessageLaneReceiveMessagesProofCallBuilder,
|
||||
relay_bridge_hub_rococo_client::runtime::Call::BridgeWococoMessages,
|
||||
relay_bridge_hub_rococo_client::runtime::BridgeWococoMessagesCall::receive_messages_proof
|
||||
);
|
||||
|
||||
substrate_relay_helper::generate_mocked_receive_message_delivery_proof_call_builder!(
|
||||
BridgeHubWococoMessagesToBridgeHubRococoMessageLane,
|
||||
BridgeHubWococoMessagesToBridgeHubRococoMessageLaneReceiveMessagesDeliveryProofCallBuilder,
|
||||
relay_bridge_hub_wococo_client::runtime::Call::BridgeRococoMessages,
|
||||
relay_bridge_hub_wococo_client::runtime::BridgeRococoMessagesCall::receive_messages_delivery_proof
|
||||
);
|
||||
|
||||
/// Description of BridgeHubWococo -> BridgeHubRococo messages bridge.
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct BridgeHubWococoMessagesToBridgeHubRococoMessageLane;
|
||||
|
||||
impl SubstrateMessageLane for BridgeHubWococoMessagesToBridgeHubRococoMessageLane {
|
||||
const SOURCE_TO_TARGET_CONVERSION_RATE_PARAMETER_NAME: Option<&'static str> = None;
|
||||
const TARGET_TO_SOURCE_CONVERSION_RATE_PARAMETER_NAME: Option<&'static str> = None;
|
||||
|
||||
const SOURCE_FEE_MULTIPLIER_PARAMETER_NAME: Option<&'static str> = None;
|
||||
const TARGET_FEE_MULTIPLIER_PARAMETER_NAME: Option<&'static str> = None;
|
||||
|
||||
const AT_SOURCE_TRANSACTION_PAYMENT_PALLET_NAME: Option<&'static str> = None;
|
||||
const AT_TARGET_TRANSACTION_PAYMENT_PALLET_NAME: Option<&'static str> = None;
|
||||
|
||||
type SourceChain = BridgeHubWococo;
|
||||
type TargetChain = BridgeHubRococo;
|
||||
|
||||
type ReceiveMessagesProofCallBuilder =
|
||||
BridgeHubWococoMessagesToBridgeHubRococoMessageLaneReceiveMessagesProofCallBuilder;
|
||||
type ReceiveMessagesDeliveryProofCallBuilder =
|
||||
BridgeHubWococoMessagesToBridgeHubRococoMessageLaneReceiveMessagesDeliveryProofCallBuilder;
|
||||
|
||||
type TargetToSourceChainConversionRateUpdateBuilder = ();
|
||||
|
||||
type RelayStrategy = MixStrategy;
|
||||
}
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
//! 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;
|
||||
@@ -24,14 +26,20 @@ 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 millau;
|
||||
mod rialto;
|
||||
mod rialto_parachain;
|
||||
mod rococo;
|
||||
mod statemine;
|
||||
mod westend;
|
||||
mod wococo;
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
// 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/>.
|
||||
|
||||
//! Rococo + Rococo parachains specification for CLI.
|
||||
|
||||
use crate::cli::CliChain;
|
||||
use relay_bridge_hub_rococo_client::BridgeHubRococo;
|
||||
use relay_rococo_client::Rococo;
|
||||
use sp_version::RuntimeVersion;
|
||||
|
||||
impl CliChain for Rococo {
|
||||
const RUNTIME_VERSION: Option<RuntimeVersion> = None;
|
||||
|
||||
type KeyPair = sp_core::sr25519::Pair;
|
||||
|
||||
fn ss58_format() -> u16 {
|
||||
bp_rococo::SS58Prefix::get() as u16
|
||||
}
|
||||
}
|
||||
|
||||
impl CliChain for BridgeHubRococo {
|
||||
const RUNTIME_VERSION: Option<RuntimeVersion> = None;
|
||||
|
||||
type KeyPair = sp_core::sr25519::Pair;
|
||||
|
||||
fn ss58_format() -> u16 {
|
||||
relay_bridge_hub_rococo_client::runtime::SS58Prefix::get()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
// 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/>.
|
||||
|
||||
//! Rococo-to-Wococo bridge hubs headers sync entrypoint.
|
||||
|
||||
use crate::cli::bridge::{CliBridgeBase, RelayToRelayHeadersCliBridge};
|
||||
use substrate_relay_helper::finality::{
|
||||
engine::Grandpa as GrandpaFinalityEngine, SubstrateFinalitySyncPipeline,
|
||||
};
|
||||
|
||||
/// Description of Rococo -> Wococo finalized headers bridge.
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct RococoFinalityToBridgeHubWococo;
|
||||
|
||||
substrate_relay_helper::generate_mocked_submit_finality_proof_call_builder!(
|
||||
RococoFinalityToBridgeHubWococo,
|
||||
RococoFinalityToBridgeHubWococoCallBuilder,
|
||||
relay_bridge_hub_wococo_client::runtime::Call::BridgeRococoGrandpa,
|
||||
relay_bridge_hub_wococo_client::runtime::BridgeGrandpaRococoCall::submit_finality_proof
|
||||
);
|
||||
|
||||
impl SubstrateFinalitySyncPipeline for RococoFinalityToBridgeHubWococo {
|
||||
type SourceChain = relay_rococo_client::Rococo;
|
||||
type TargetChain = relay_bridge_hub_wococo_client::BridgeHubWococo;
|
||||
|
||||
type FinalityEngine = GrandpaFinalityEngine<Self::SourceChain>;
|
||||
type SubmitFinalityProofCallBuilder = RococoFinalityToBridgeHubWococoCallBuilder;
|
||||
}
|
||||
|
||||
/// `Rococo` to BridgeHub `Wococo` bridge definition.
|
||||
pub struct RococoToBridgeHubWococoCliBridge {}
|
||||
|
||||
impl CliBridgeBase for RococoToBridgeHubWococoCliBridge {
|
||||
type Source = relay_rococo_client::Rococo;
|
||||
type Target = relay_bridge_hub_wococo_client::BridgeHubWococo;
|
||||
}
|
||||
|
||||
impl RelayToRelayHeadersCliBridge for RococoToBridgeHubWococoCliBridge {
|
||||
type Finality = RococoFinalityToBridgeHubWococo;
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
// 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/>.
|
||||
|
||||
//! Wococo-to-Rococo parachains sync entrypoint.
|
||||
|
||||
use crate::cli::bridge::{CliBridgeBase, ParachainToRelayHeadersCliBridge};
|
||||
use bp_polkadot_core::parachains::{ParaHash, ParaHeadsProof, ParaId};
|
||||
use parachains_relay::ParachainsPipeline;
|
||||
use relay_substrate_client::{CallOf, HeaderIdOf};
|
||||
use substrate_relay_helper::parachains::{
|
||||
SubmitParachainHeadsCallBuilder, SubstrateParachainsPipeline,
|
||||
};
|
||||
|
||||
/// BridgeHub-to-BridgeHub parachain sync description.
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct BridgeHubRococoToBridgeHubWococo;
|
||||
|
||||
impl ParachainsPipeline for BridgeHubRococoToBridgeHubWococo {
|
||||
type SourceChain = relay_rococo_client::Rococo;
|
||||
type TargetChain = relay_bridge_hub_wococo_client::BridgeHubWococo;
|
||||
}
|
||||
|
||||
impl SubstrateParachainsPipeline for BridgeHubRococoToBridgeHubWococo {
|
||||
type SourceParachain = relay_bridge_hub_rococo_client::BridgeHubRococo;
|
||||
type SourceRelayChain = relay_rococo_client::Rococo;
|
||||
type TargetChain = relay_bridge_hub_wococo_client::BridgeHubWococo;
|
||||
|
||||
type SubmitParachainHeadsCallBuilder = BridgeHubRococoToBridgeHubWococoCallBuilder;
|
||||
|
||||
const SOURCE_PARACHAIN_PARA_ID: u32 = bp_bridge_hub_rococo::BRIDGE_HUB_ROCOCO_PARACHAIN_ID;
|
||||
}
|
||||
|
||||
pub struct BridgeHubRococoToBridgeHubWococoCallBuilder;
|
||||
impl SubmitParachainHeadsCallBuilder<BridgeHubRococoToBridgeHubWococo>
|
||||
for BridgeHubRococoToBridgeHubWococoCallBuilder
|
||||
{
|
||||
fn build_submit_parachain_heads_call(
|
||||
at_relay_block: HeaderIdOf<relay_rococo_client::Rococo>,
|
||||
parachains: Vec<(ParaId, ParaHash)>,
|
||||
parachain_heads_proof: ParaHeadsProof,
|
||||
) -> CallOf<relay_bridge_hub_wococo_client::BridgeHubWococo> {
|
||||
relay_bridge_hub_wococo_client::runtime::Call::BridgeRococoParachain(
|
||||
relay_bridge_hub_wococo_client::runtime::BridgeParachainCall::submit_parachain_heads(
|
||||
(at_relay_block.0, at_relay_block.1),
|
||||
parachains,
|
||||
parachain_heads_proof,
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/// `BridgeHubParachain` to `BridgeHubParachain` bridge definition.
|
||||
pub struct BridgeHubRococoToBridgeHubWococoCliBridge {}
|
||||
|
||||
impl ParachainToRelayHeadersCliBridge for BridgeHubRococoToBridgeHubWococoCliBridge {
|
||||
type SourceRelay = relay_rococo_client::Rococo;
|
||||
type ParachainFinality = BridgeHubRococoToBridgeHubWococo;
|
||||
type RelayFinality =
|
||||
crate::chains::rococo_headers_to_bridge_hub_wococo::RococoFinalityToBridgeHubWococo;
|
||||
}
|
||||
|
||||
impl CliBridgeBase for BridgeHubRococoToBridgeHubWococoCliBridge {
|
||||
type Source = relay_bridge_hub_rococo_client::BridgeHubRococo;
|
||||
type Target = relay_bridge_hub_wococo_client::BridgeHubWococo;
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
// 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/>.
|
||||
|
||||
//! Wococo + Wococo parachains specification for CLI.
|
||||
|
||||
use crate::cli::CliChain;
|
||||
use relay_bridge_hub_wococo_client::BridgeHubWococo;
|
||||
use relay_wococo_client::Wococo;
|
||||
use sp_version::RuntimeVersion;
|
||||
|
||||
impl CliChain for Wococo {
|
||||
const RUNTIME_VERSION: Option<RuntimeVersion> = None;
|
||||
|
||||
type KeyPair = sp_core::sr25519::Pair;
|
||||
|
||||
fn ss58_format() -> u16 {
|
||||
bp_wococo::SS58Prefix::get() as u16
|
||||
}
|
||||
}
|
||||
|
||||
impl CliChain for BridgeHubWococo {
|
||||
const RUNTIME_VERSION: Option<RuntimeVersion> = None;
|
||||
|
||||
type KeyPair = sp_core::sr25519::Pair;
|
||||
|
||||
fn ss58_format() -> u16 {
|
||||
relay_bridge_hub_wococo_client::runtime::SS58Prefix::get()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
// 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/>.
|
||||
|
||||
//! Wococo-to-Rococo bridge hubs headers sync entrypoint.
|
||||
|
||||
use crate::cli::bridge::{CliBridgeBase, RelayToRelayHeadersCliBridge};
|
||||
use substrate_relay_helper::finality::{
|
||||
engine::Grandpa as GrandpaFinalityEngine, SubstrateFinalitySyncPipeline,
|
||||
};
|
||||
|
||||
/// Description of Wococo -> Rococo finalized headers bridge.
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct WococoFinalityToBridgeHubRococo;
|
||||
|
||||
substrate_relay_helper::generate_mocked_submit_finality_proof_call_builder!(
|
||||
WococoFinalityToBridgeHubRococo,
|
||||
WococoFinalityToBridgeHubRococoCallBuilder,
|
||||
relay_bridge_hub_rococo_client::runtime::Call::BridgeWococoGrandpa,
|
||||
relay_bridge_hub_rococo_client::runtime::BridgeWococoGrandpaCall::submit_finality_proof
|
||||
);
|
||||
|
||||
impl SubstrateFinalitySyncPipeline for WococoFinalityToBridgeHubRococo {
|
||||
type SourceChain = relay_wococo_client::Wococo;
|
||||
type TargetChain = relay_bridge_hub_rococo_client::BridgeHubRococo;
|
||||
|
||||
type FinalityEngine = GrandpaFinalityEngine<Self::SourceChain>;
|
||||
type SubmitFinalityProofCallBuilder = WococoFinalityToBridgeHubRococoCallBuilder;
|
||||
}
|
||||
|
||||
/// `Wococo` to BridgeHub `Rococo` bridge definition.
|
||||
pub struct WococoToBridgeHubRococoCliBridge {}
|
||||
|
||||
impl CliBridgeBase for WococoToBridgeHubRococoCliBridge {
|
||||
type Source = relay_wococo_client::Wococo;
|
||||
type Target = relay_bridge_hub_rococo_client::BridgeHubRococo;
|
||||
}
|
||||
|
||||
impl RelayToRelayHeadersCliBridge for WococoToBridgeHubRococoCliBridge {
|
||||
type Finality = WococoFinalityToBridgeHubRococo;
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
// 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/>.
|
||||
|
||||
//! Rococo-to-Wococo parachains sync entrypoint.
|
||||
|
||||
use crate::cli::bridge::{CliBridgeBase, ParachainToRelayHeadersCliBridge};
|
||||
use bp_polkadot_core::parachains::{ParaHash, ParaHeadsProof, ParaId};
|
||||
use parachains_relay::ParachainsPipeline;
|
||||
use relay_substrate_client::{CallOf, HeaderIdOf};
|
||||
use substrate_relay_helper::parachains::{
|
||||
SubmitParachainHeadsCallBuilder, SubstrateParachainsPipeline,
|
||||
};
|
||||
|
||||
/// BridgeHub-to-BridgeHub parachain sync description.
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct BridgeHubWococoToBridgeHubRococo;
|
||||
|
||||
impl ParachainsPipeline for BridgeHubWococoToBridgeHubRococo {
|
||||
type SourceChain = relay_wococo_client::Wococo;
|
||||
type TargetChain = relay_bridge_hub_rococo_client::BridgeHubRococo;
|
||||
}
|
||||
|
||||
impl SubstrateParachainsPipeline for BridgeHubWococoToBridgeHubRococo {
|
||||
type SourceParachain = relay_bridge_hub_wococo_client::BridgeHubWococo;
|
||||
type SourceRelayChain = relay_wococo_client::Wococo;
|
||||
type TargetChain = relay_bridge_hub_rococo_client::BridgeHubRococo;
|
||||
|
||||
type SubmitParachainHeadsCallBuilder = BridgeHubWococoToBridgeHubRococoCallBuilder;
|
||||
|
||||
const SOURCE_PARACHAIN_PARA_ID: u32 = bp_bridge_hub_wococo::BRIDGE_HUB_WOCOCO_PARACHAIN_ID;
|
||||
}
|
||||
|
||||
pub struct BridgeHubWococoToBridgeHubRococoCallBuilder;
|
||||
impl SubmitParachainHeadsCallBuilder<BridgeHubWococoToBridgeHubRococo>
|
||||
for BridgeHubWococoToBridgeHubRococoCallBuilder
|
||||
{
|
||||
fn build_submit_parachain_heads_call(
|
||||
at_relay_block: HeaderIdOf<relay_wococo_client::Wococo>,
|
||||
parachains: Vec<(ParaId, ParaHash)>,
|
||||
parachain_heads_proof: ParaHeadsProof,
|
||||
) -> CallOf<relay_bridge_hub_rococo_client::BridgeHubRococo> {
|
||||
relay_bridge_hub_rococo_client::runtime::Call::BridgeWococoParachain(
|
||||
relay_bridge_hub_rococo_client::runtime::BridgeParachainCall::submit_parachain_heads(
|
||||
(at_relay_block.0, at_relay_block.1),
|
||||
parachains,
|
||||
parachain_heads_proof,
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/// `BridgeHubParachain` to `BridgeHubParachain` bridge definition.
|
||||
pub struct BridgeHubWococoToBridgeHubRococoCliBridge {}
|
||||
|
||||
impl ParachainToRelayHeadersCliBridge for BridgeHubWococoToBridgeHubRococoCliBridge {
|
||||
type SourceRelay = relay_wococo_client::Wococo;
|
||||
type ParachainFinality = BridgeHubWococoToBridgeHubRococo;
|
||||
type RelayFinality =
|
||||
crate::chains::wococo_headers_to_bridge_hub_rococo::WococoFinalityToBridgeHubRococo;
|
||||
}
|
||||
|
||||
impl CliBridgeBase for BridgeHubWococoToBridgeHubRococoCliBridge {
|
||||
type Source = relay_bridge_hub_wococo_client::BridgeHubWococo;
|
||||
type Target = relay_bridge_hub_rococo_client::BridgeHubRococo;
|
||||
}
|
||||
@@ -33,6 +33,8 @@ pub enum FullBridge {
|
||||
RialtoToMillau,
|
||||
MillauToRialtoParachain,
|
||||
RialtoParachainToMillau,
|
||||
BridgeHubRococoToBridgeHubWococo,
|
||||
BridgeHubWococoToBridgeHubRococo,
|
||||
}
|
||||
|
||||
impl FullBridge {
|
||||
@@ -43,6 +45,8 @@ 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 =>
|
||||
unimplemented!("TODO: (bridge_instance_index) do we need it or refactor or remove?"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,6 +125,9 @@ impl EstimateFee {
|
||||
MillauToRialtoParachainCliBridge::estimate_fee(self),
|
||||
FullBridge::RialtoParachainToMillau =>
|
||||
RialtoParachainToMillauCliBridge::estimate_fee(self),
|
||||
FullBridge::BridgeHubRococoToBridgeHubWococo |
|
||||
FullBridge::BridgeHubWococoToBridgeHubRococo =>
|
||||
unimplemented!("TODO: (EstimateFee) do we need it or refactor or remove?"),
|
||||
}
|
||||
.await
|
||||
}
|
||||
|
||||
@@ -21,7 +21,9 @@ use crate::{
|
||||
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,
|
||||
},
|
||||
cli::{bridge::CliBridgeBase, chain_schema::*},
|
||||
};
|
||||
@@ -54,6 +56,8 @@ pub enum InitBridgeName {
|
||||
RialtoToMillau,
|
||||
WestendToMillau,
|
||||
MillauToRialtoParachain,
|
||||
RococoToBridgeHubWococo,
|
||||
WococoToBridgeHubRococo,
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
@@ -163,6 +167,30 @@ impl BridgeInitializer for WestendToMillauCliBridge {
|
||||
}
|
||||
}
|
||||
|
||||
impl BridgeInitializer for RococoToBridgeHubWococoCliBridge {
|
||||
type Engine = GrandpaFinalityEngine<Self::Source>;
|
||||
|
||||
fn encode_init_bridge(
|
||||
init_data: <Self::Engine as Engine<Self::Source>>::InitializationData,
|
||||
) -> <Self::Target as Chain>::Call {
|
||||
relay_bridge_hub_wococo_client::runtime::Call::BridgeRococoGrandpa(
|
||||
relay_bridge_hub_wococo_client::runtime::BridgeGrandpaRococoCall::initialize(init_data),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl BridgeInitializer for WococoToBridgeHubRococoCliBridge {
|
||||
type Engine = GrandpaFinalityEngine<Self::Source>;
|
||||
|
||||
fn encode_init_bridge(
|
||||
init_data: <Self::Engine as Engine<Self::Source>>::InitializationData,
|
||||
) -> <Self::Target as Chain>::Call {
|
||||
relay_bridge_hub_rococo_client::runtime::Call::BridgeWococoGrandpa(
|
||||
relay_bridge_hub_rococo_client::runtime::BridgeWococoGrandpaCall::initialize(init_data),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl InitBridge {
|
||||
/// Run the command.
|
||||
pub async fn run(self) -> anyhow::Result<()> {
|
||||
@@ -172,6 +200,10 @@ impl InitBridge {
|
||||
InitBridgeName::WestendToMillau => WestendToMillauCliBridge::init_bridge(self),
|
||||
InitBridgeName::MillauToRialtoParachain =>
|
||||
MillauToRialtoParachainCliBridge::init_bridge(self),
|
||||
InitBridgeName::RococoToBridgeHubWococo =>
|
||||
RococoToBridgeHubWococoCliBridge::init_bridge(self),
|
||||
InitBridgeName::WococoToBridgeHubRococo =>
|
||||
WococoToBridgeHubRococoCliBridge::init_bridge(self),
|
||||
}
|
||||
.await
|
||||
}
|
||||
|
||||
@@ -24,7 +24,9 @@ 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 relay_utils::metrics::{GlobalMetrics, StandaloneMetric};
|
||||
use substrate_relay_helper::finality::SubstrateFinalitySyncPipeline;
|
||||
@@ -59,6 +61,8 @@ pub enum RelayHeadersBridge {
|
||||
RialtoToMillau,
|
||||
WestendToMillau,
|
||||
MillauToRialtoParachain,
|
||||
RococoToBridgeHubWococo,
|
||||
WococoToBridgeHubRococo,
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
@@ -102,6 +106,8 @@ impl HeadersRelayer for MillauToRialtoCliBridge {}
|
||||
impl HeadersRelayer for RialtoToMillauCliBridge {}
|
||||
impl HeadersRelayer for WestendToMillauCliBridge {}
|
||||
impl HeadersRelayer for MillauToRialtoParachainCliBridge {}
|
||||
impl HeadersRelayer for RococoToBridgeHubWococoCliBridge {}
|
||||
impl HeadersRelayer for WococoToBridgeHubRococoCliBridge {}
|
||||
|
||||
impl RelayHeaders {
|
||||
/// Run the command.
|
||||
@@ -112,6 +118,10 @@ impl RelayHeaders {
|
||||
RelayHeadersBridge::WestendToMillau => WestendToMillauCliBridge::relay_headers(self),
|
||||
RelayHeadersBridge::MillauToRialtoParachain =>
|
||||
MillauToRialtoParachainCliBridge::relay_headers(self),
|
||||
RelayHeadersBridge::RococoToBridgeHubWococo =>
|
||||
RococoToBridgeHubWococoCliBridge::relay_headers(self),
|
||||
RelayHeadersBridge::WococoToBridgeHubRococo =>
|
||||
WococoToBridgeHubRococoCliBridge::relay_headers(self),
|
||||
}
|
||||
.await
|
||||
}
|
||||
|
||||
@@ -20,6 +20,8 @@ use structopt::StructOpt;
|
||||
use strum::{EnumString, EnumVariantNames, 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,
|
||||
@@ -119,6 +121,8 @@ impl MessagesRelayer for MillauToRialtoCliBridge {}
|
||||
impl MessagesRelayer for RialtoToMillauCliBridge {}
|
||||
impl MessagesRelayer for MillauToRialtoParachainCliBridge {}
|
||||
impl MessagesRelayer for RialtoParachainToMillauCliBridge {}
|
||||
impl MessagesRelayer for BridgeHubRococoToBridgeHubWococoMessagesCliBridge {}
|
||||
impl MessagesRelayer for BridgeHubWococoToBridgeHubRococoMessagesCliBridge {}
|
||||
|
||||
impl RelayMessages {
|
||||
/// Run the command.
|
||||
@@ -130,6 +134,10 @@ impl RelayMessages {
|
||||
MillauToRialtoParachainCliBridge::relay_messages(self),
|
||||
FullBridge::RialtoParachainToMillau =>
|
||||
RialtoParachainToMillauCliBridge::relay_messages(self),
|
||||
FullBridge::BridgeHubRococoToBridgeHubWococo =>
|
||||
BridgeHubRococoToBridgeHubWococoMessagesCliBridge::relay_messages(self),
|
||||
FullBridge::BridgeHubWococoToBridgeHubRococo =>
|
||||
BridgeHubWococoToBridgeHubRococoMessagesCliBridge::relay_messages(self),
|
||||
}
|
||||
.await
|
||||
}
|
||||
|
||||
@@ -16,7 +16,9 @@
|
||||
|
||||
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 async_std::sync::Mutex;
|
||||
use async_trait::async_trait;
|
||||
@@ -29,7 +31,10 @@ use std::sync::Arc;
|
||||
use structopt::StructOpt;
|
||||
use strum::{EnumString, EnumVariantNames, VariantNames};
|
||||
use substrate_relay_helper::{
|
||||
parachains::{source::ParachainsSource, target::ParachainsTarget, ParachainsPipelineAdapter},
|
||||
parachains::{
|
||||
source::ParachainsSource, target::ParachainsTarget, ParachainsPipelineAdapter,
|
||||
SubstrateParachainsPipeline,
|
||||
},
|
||||
TransactionParams,
|
||||
};
|
||||
|
||||
@@ -56,7 +61,10 @@ pub struct RelayParachains {
|
||||
#[strum(serialize_all = "kebab_case")]
|
||||
pub enum RelayParachainsBridge {
|
||||
RialtoToMillau,
|
||||
// TODO:check-parameter - rename to WestmintToMillau?
|
||||
WestendToMillau,
|
||||
BridgeHubRococoToBridgeHubWococo,
|
||||
BridgeHubWococoToBridgeHubRococo,
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
@@ -92,7 +100,7 @@ where
|
||||
target_client,
|
||||
ParachainSyncParams {
|
||||
parachains: vec![
|
||||
ParaId(<Self::ParachainFinality as substrate_relay_helper::parachains::SubstrateParachainsPipeline>::SOURCE_PARACHAIN_PARA_ID)
|
||||
ParaId(<Self::ParachainFinality as SubstrateParachainsPipeline>::SOURCE_PARACHAIN_PARA_ID)
|
||||
],
|
||||
stall_timeout: std::time::Duration::from_secs(60),
|
||||
strategy: parachains_relay::parachains_loop::ParachainSyncStrategy::Any,
|
||||
@@ -109,6 +117,10 @@ impl ParachainsRelayer for RialtoParachainToMillauCliBridge {}
|
||||
|
||||
impl ParachainsRelayer for WestmintToMillauCliBridge {}
|
||||
|
||||
impl ParachainsRelayer for BridgeHubRococoToBridgeHubWococoCliBridge {}
|
||||
|
||||
impl ParachainsRelayer for BridgeHubWococoToBridgeHubRococoCliBridge {}
|
||||
|
||||
impl RelayParachains {
|
||||
/// Run the command.
|
||||
pub async fn run(self) -> anyhow::Result<()> {
|
||||
@@ -117,6 +129,10 @@ impl RelayParachains {
|
||||
RialtoParachainToMillauCliBridge::relay_headers(self),
|
||||
RelayParachainsBridge::WestendToMillau =>
|
||||
WestmintToMillauCliBridge::relay_headers(self),
|
||||
RelayParachainsBridge::BridgeHubRococoToBridgeHubWococo =>
|
||||
BridgeHubRococoToBridgeHubWococoCliBridge::relay_headers(self),
|
||||
RelayParachainsBridge::BridgeHubWococoToBridgeHubRococo =>
|
||||
BridgeHubWococoToBridgeHubRococoCliBridge::relay_headers(self),
|
||||
}
|
||||
.await
|
||||
}
|
||||
|
||||
@@ -211,6 +211,12 @@ impl SendMessage {
|
||||
MillauToRialtoParachainCliBridge::send_message(self),
|
||||
FullBridge::RialtoParachainToMillau =>
|
||||
RialtoParachainToMillauCliBridge::send_message(self),
|
||||
FullBridge::BridgeHubRococoToBridgeHubWococo => unimplemented!(
|
||||
"Sending message from BridgeHubRococo to BridgeHubWococo is not supported"
|
||||
),
|
||||
FullBridge::BridgeHubWococoToBridgeHubRococo => unimplemented!(
|
||||
"Sending message from BridgeHubWococo to BridgeHubRococo is not supported"
|
||||
),
|
||||
}
|
||||
.await
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user