From 4862a542daa0740682eec57b07f935c9d0a3d656 Mon Sep 17 00:00:00 2001 From: Branislav Kontur Date: Tue, 14 Nov 2023 11:32:38 +0100 Subject: [PATCH] Remove Woococo related stuff (#2692) * Remove Woococo related stuff * More removes * Compilation * Added equvocation for Ro/We * We need chain-westend primitives --- .../chain-asset-hub-rococo/src/lib.rs | 3 - .../chain-asset-hub-wococo/Cargo.toml | 26 --- .../chain-asset-hub-wococo/src/lib.rs | 48 ----- .../chain-bridge-hub-kusama/Cargo.toml | 2 +- .../chain-bridge-hub-polkadot/Cargo.toml | 2 +- .../chain-bridge-hub-rococo/src/lib.rs | 3 - .../chain-bridge-hub-wococo/Cargo.toml | 34 ---- .../chain-bridge-hub-wococo/src/lib.rs | 90 ---------- bridges/primitives/chain-wococo/Cargo.toml | 34 ---- bridges/primitives/chain-wococo/src/lib.rs | 68 ------- bridges/primitives/runtime/src/extensions.rs | 2 +- bridges/primitives/runtime/src/lib.rs | 6 - bridges/relays/bin-substrate/Cargo.toml | 2 - .../relays/bin-substrate/src/bridges/mod.rs | 1 - ...ub_rococo_messages_to_bridge_hub_wococo.rs | 64 ------- ...ub_wococo_messages_to_bridge_hub_rococo.rs | 64 ------- .../src/bridges/rococo_wococo/mod.rs | 24 --- .../rococo_headers_to_bridge_hub_wococo.rs | 80 --------- .../rococo_parachains_to_bridge_hub_wococo.rs | 75 -------- .../wococo_headers_to_bridge_hub_rococo.rs | 80 --------- .../wococo_parachains_to_bridge_hub_rococo.rs | 75 -------- .../relays/bin-substrate/src/chains/mod.rs | 1 - .../relays/bin-substrate/src/chains/wococo.rs | 31 ---- .../relays/bin-substrate/src/cli/bridge.rs | 2 - .../src/cli/detect_equivocations.rs | 22 +-- .../bin-substrate/src/cli/init_bridge.rs | 34 ---- .../bin-substrate/src/cli/relay_headers.rs | 12 -- .../src/cli/relay_headers_and_messages/mod.rs | 69 ++++--- .../bin-substrate/src/cli/relay_messages.rs | 10 -- .../bin-substrate/src/cli/relay_parachains.rs | 12 -- .../client-bridge-hub-rococo/Cargo.toml | 2 - .../client-bridge-hub-wococo/Cargo.toml | 34 ---- .../client-bridge-hub-wococo/src/lib.rs | 169 ------------------ bridges/relays/client-wococo/Cargo.toml | 24 --- bridges/relays/client-wococo/src/lib.rs | 133 -------------- bridges/relays/lib-substrate-relay/Cargo.toml | 5 +- .../src/messages_source.rs | 4 +- 37 files changed, 48 insertions(+), 1299 deletions(-) delete mode 100644 bridges/primitives/chain-asset-hub-wococo/Cargo.toml delete mode 100644 bridges/primitives/chain-asset-hub-wococo/src/lib.rs delete mode 100644 bridges/primitives/chain-bridge-hub-wococo/Cargo.toml delete mode 100644 bridges/primitives/chain-bridge-hub-wococo/src/lib.rs delete mode 100644 bridges/primitives/chain-wococo/Cargo.toml delete mode 100644 bridges/primitives/chain-wococo/src/lib.rs delete mode 100644 bridges/relays/bin-substrate/src/bridges/rococo_wococo/bridge_hub_rococo_messages_to_bridge_hub_wococo.rs delete mode 100644 bridges/relays/bin-substrate/src/bridges/rococo_wococo/bridge_hub_wococo_messages_to_bridge_hub_rococo.rs delete mode 100644 bridges/relays/bin-substrate/src/bridges/rococo_wococo/mod.rs delete mode 100644 bridges/relays/bin-substrate/src/bridges/rococo_wococo/rococo_headers_to_bridge_hub_wococo.rs delete mode 100644 bridges/relays/bin-substrate/src/bridges/rococo_wococo/rococo_parachains_to_bridge_hub_wococo.rs delete mode 100644 bridges/relays/bin-substrate/src/bridges/rococo_wococo/wococo_headers_to_bridge_hub_rococo.rs delete mode 100644 bridges/relays/bin-substrate/src/bridges/rococo_wococo/wococo_parachains_to_bridge_hub_rococo.rs delete mode 100644 bridges/relays/bin-substrate/src/chains/wococo.rs delete mode 100644 bridges/relays/client-bridge-hub-wococo/Cargo.toml delete mode 100644 bridges/relays/client-bridge-hub-wococo/src/lib.rs delete mode 100644 bridges/relays/client-wococo/Cargo.toml delete mode 100644 bridges/relays/client-wococo/src/lib.rs diff --git a/bridges/primitives/chain-asset-hub-rococo/src/lib.rs b/bridges/primitives/chain-asset-hub-rococo/src/lib.rs index 6216b24d75c90..de2e9ae856d1f 100644 --- a/bridges/primitives/chain-asset-hub-rococo/src/lib.rs +++ b/bridges/primitives/chain-asset-hub-rococo/src/lib.rs @@ -34,9 +34,6 @@ pub use bp_xcm_bridge_hub_router::XcmBridgeHubRouterCall; #[allow(clippy::large_enum_variant)] #[derive(Encode, Decode, Debug, PartialEq, Eq, Clone, TypeInfo)] pub enum Call { - /// `ToWococoXcmRouter` bridge pallet. - #[codec(index = 43)] - ToWococoXcmRouter(XcmBridgeHubRouterCall), /// `ToWestendXcmRouter` bridge pallet. #[codec(index = 45)] ToWestendXcmRouter(XcmBridgeHubRouterCall), diff --git a/bridges/primitives/chain-asset-hub-wococo/Cargo.toml b/bridges/primitives/chain-asset-hub-wococo/Cargo.toml deleted file mode 100644 index d56205c3a1257..0000000000000 --- a/bridges/primitives/chain-asset-hub-wococo/Cargo.toml +++ /dev/null @@ -1,26 +0,0 @@ -[package] -name = "bp-asset-hub-wococo" -description = "Primitives of AssetHubWococo parachain runtime." -version = "0.1.0" -authors.workspace = true -edition.workspace = true -license = "GPL-3.0-or-later WITH Classpath-exception-2.0" - -[dependencies] -codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false } -scale-info = { version = "2.10.0", default-features = false, features = ["derive"] } - -# Substrate Dependencies -frame-support = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master", default-features = false } - -# Bridge Dependencies -bp-xcm-bridge-hub-router = { path = "../xcm-bridge-hub-router", default-features = false } - -[features] -default = [ "std" ] -std = [ - "bp-xcm-bridge-hub-router/std", - "codec/std", - "frame-support/std", - "scale-info/std", -] diff --git a/bridges/primitives/chain-asset-hub-wococo/src/lib.rs b/bridges/primitives/chain-asset-hub-wococo/src/lib.rs deleted file mode 100644 index c04eb04cce70b..0000000000000 --- a/bridges/primitives/chain-asset-hub-wococo/src/lib.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (C) 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 . - -//! Module with configuration which reflects AssetHubWococo runtime setup. - -#![cfg_attr(not(feature = "std"), no_std)] - -use codec::{Decode, Encode}; -use scale_info::TypeInfo; - -pub use bp_xcm_bridge_hub_router::XcmBridgeHubRouterCall; - -/// `AssetHubWococo` Runtime `Call` enum. -/// -/// The enum represents a subset of possible `Call`s we can send to `AssetHubWococo` chain. -/// Ideally this code would be auto-generated from metadata, because we want to -/// avoid depending directly on the ENTIRE runtime just to get the encoding of `Dispatchable`s. -/// -/// All entries here (like pretty much in the entire file) must be kept in sync with -/// `AssetHubWococo` `construct_runtime`, so that we maintain SCALE-compatibility. -#[allow(clippy::large_enum_variant)] -#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone, TypeInfo)] -pub enum Call { - /// `ToRococoXcmRouter` bridge pallet. - #[codec(index = 44)] - ToRococoXcmRouter(XcmBridgeHubRouterCall), -} - -frame_support::parameter_types! { - /// Some sane weight to execute `xcm::Transact(pallet-xcm-bridge-hub-router::Call::report_bridge_status)`. - pub const XcmBridgeHubRouterTransactCallMaxWeight: frame_support::weights::Weight = frame_support::weights::Weight::from_parts(200_000_000, 6144); -} - -/// Identifier of AssetHubWococo in the Wococo relay chain. -pub const ASSET_HUB_WOCOCO_PARACHAIN_ID: u32 = 1000; diff --git a/bridges/primitives/chain-bridge-hub-kusama/Cargo.toml b/bridges/primitives/chain-bridge-hub-kusama/Cargo.toml index d9fc32524c083..2d6b5ba424e00 100644 --- a/bridges/primitives/chain-bridge-hub-kusama/Cargo.toml +++ b/bridges/primitives/chain-bridge-hub-kusama/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bp-bridge-hub-kusama" -description = "Primitives of BridgeHubRococo parachain runtime." +description = "Primitives of BridgeHubKusama parachain runtime." version = "0.1.0" authors.workspace = true edition.workspace = true diff --git a/bridges/primitives/chain-bridge-hub-polkadot/Cargo.toml b/bridges/primitives/chain-bridge-hub-polkadot/Cargo.toml index 5e3516136c823..a4a116f0ce9fa 100644 --- a/bridges/primitives/chain-bridge-hub-polkadot/Cargo.toml +++ b/bridges/primitives/chain-bridge-hub-polkadot/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bp-bridge-hub-polkadot" -description = "Primitives of BridgeHubWococo parachain runtime." +description = "Primitives of BridgeHubPolkadot parachain runtime." version = "0.1.0" authors.workspace = true edition.workspace = true diff --git a/bridges/primitives/chain-bridge-hub-rococo/src/lib.rs b/bridges/primitives/chain-bridge-hub-rococo/src/lib.rs index e72e711de9270..59d293edf1c24 100644 --- a/bridges/primitives/chain-bridge-hub-rococo/src/lib.rs +++ b/bridges/primitives/chain-bridge-hub-rococo/src/lib.rs @@ -74,9 +74,6 @@ pub const WITH_BRIDGE_HUB_ROCOCO_MESSAGES_PALLET_NAME: &str = "BridgeRococoMessa /// chains. pub const WITH_BRIDGE_HUB_ROCOCO_RELAYERS_PALLET_NAME: &str = "BridgeRelayers"; -/// Pallet index of `BridgeWococoMessages: pallet_bridge_messages::`. -pub const WITH_BRIDGE_ROCOCO_TO_WOCOCO_MESSAGES_PALLET_INDEX: u8 = 46; - /// Pallet index of `BridgeWestendMessages: pallet_bridge_messages::`. pub const WITH_BRIDGE_ROCOCO_TO_WESTEND_MESSAGES_PALLET_INDEX: u8 = 51; diff --git a/bridges/primitives/chain-bridge-hub-wococo/Cargo.toml b/bridges/primitives/chain-bridge-hub-wococo/Cargo.toml deleted file mode 100644 index 28536dce1f7ca..0000000000000 --- a/bridges/primitives/chain-bridge-hub-wococo/Cargo.toml +++ /dev/null @@ -1,34 +0,0 @@ -[package] -name = "bp-bridge-hub-wococo" -description = "Primitives of BridgeHubWococo parachain runtime." -version = "0.1.0" -authors.workspace = true -edition.workspace = true -license = "GPL-3.0-or-later WITH Classpath-exception-2.0" - -[dependencies] - -# Bridge Dependencies - -bp-bridge-hub-cumulus = { path = "../chain-bridge-hub-cumulus", default-features = false } -bp-runtime = { path = "../../primitives/runtime", default-features = false } -bp-messages = { path = "../../primitives/messages", default-features = false } - -# Substrate Based Dependencies - -frame-support = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master", default-features = false } -sp-api = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master", default-features = false } -sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master", default-features = false } -sp-std = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master", default-features = false } - -[features] -default = [ "std" ] -std = [ - "bp-bridge-hub-cumulus/std", - "bp-messages/std", - "bp-runtime/std", - "frame-support/std", - "sp-api/std", - "sp-runtime/std", - "sp-std/std", -] diff --git a/bridges/primitives/chain-bridge-hub-wococo/src/lib.rs b/bridges/primitives/chain-bridge-hub-wococo/src/lib.rs deleted file mode 100644 index c8bd397cec561..0000000000000 --- a/bridges/primitives/chain-bridge-hub-wococo/src/lib.rs +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (C) 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 . - -//! Module with configuration which reflects BridgeHubWococo runtime setup -//! (AccountId, Headers, Hashes...) - -#![cfg_attr(not(feature = "std"), no_std)] - -pub use bp_bridge_hub_cumulus::*; -use bp_messages::*; -use bp_runtime::{ - decl_bridge_finality_runtime_apis, decl_bridge_messages_runtime_apis, Chain, Parachain, -}; -use frame_support::dispatch::DispatchClass; -use sp_runtime::RuntimeDebug; - -/// BridgeHubWococo parachain. -#[derive(RuntimeDebug)] -pub struct BridgeHubWococo; - -impl Chain for BridgeHubWococo { - type BlockNumber = BlockNumber; - type Hash = Hash; - type Hasher = Hasher; - type Header = Header; - - type AccountId = AccountId; - type Balance = Balance; - type Nonce = Nonce; - type Signature = Signature; - - fn max_extrinsic_size() -> u32 { - *BlockLength::get().max.get(DispatchClass::Normal) - } - - fn max_extrinsic_weight() -> Weight { - BlockWeights::get() - .get(DispatchClass::Normal) - .max_extrinsic - .unwrap_or(Weight::MAX) - } -} - -impl Parachain for BridgeHubWococo { - const PARACHAIN_ID: u32 = BRIDGE_HUB_WOCOCO_PARACHAIN_ID; -} - -/// Identifier of BridgeHubWococo in the Wococo relay chain. -pub const BRIDGE_HUB_WOCOCO_PARACHAIN_ID: u32 = 1014; - -/// Name of the With-BridgeHubWococo messages pallet instance that is deployed at bridged chains. -pub const WITH_BRIDGE_HUB_WOCOCO_MESSAGES_PALLET_NAME: &str = "BridgeWococoMessages"; - -/// Name of the With-BridgeHubWococo bridge-relayers pallet instance that is deployed at bridged -/// chains. -pub const WITH_BRIDGE_HUB_WOCOCO_RELAYERS_PALLET_NAME: &str = "BridgeRelayers"; - -/// Pallet index of `BridgeRococoMessages: pallet_bridge_messages::`. -pub const WITH_BRIDGE_WOCOCO_TO_ROCOCO_MESSAGES_PALLET_INDEX: u8 = 45; - -decl_bridge_finality_runtime_apis!(bridge_hub_wococo); -decl_bridge_messages_runtime_apis!(bridge_hub_wococo); - -frame_support::parameter_types! { - /// The XCM fee that is paid for executing XCM program (with `ExportMessage` instruction) at the Wococo - /// BridgeHub. - /// (initially was calculated by test `BridgeHubWococo::can_calculate_weight_for_paid_export_message_with_reserve_transfer` + `33%`) - pub const BridgeHubWococoBaseXcmFeeInWocs: u128 = 1624803349; - - /// Transaction fee that is paid at the Wococo BridgeHub for delivering single inbound message. - /// (initially was calculated by test `BridgeHubWococo::can_calculate_fee_for_complex_message_delivery_transaction` + `33%`) - pub const BridgeHubWococoBaseDeliveryFeeInWocs: u128 = 6417262881; - - /// Transaction fee that is paid at the Wococo BridgeHub for delivering single outbound message confirmation. - /// (initially was calculated by test `BridgeHubWococo::can_calculate_fee_for_complex_message_confirmation_transaction` + `33%`) - pub const BridgeHubWococoBaseConfirmationFeeInWocs: u128 = 6159996668; -} diff --git a/bridges/primitives/chain-wococo/Cargo.toml b/bridges/primitives/chain-wococo/Cargo.toml deleted file mode 100644 index ffe14b3bc914f..0000000000000 --- a/bridges/primitives/chain-wococo/Cargo.toml +++ /dev/null @@ -1,34 +0,0 @@ -[package] -name = "bp-wococo" -description = "Primitives of Wococo runtime." -version = "0.1.0" -authors.workspace = true -edition.workspace = true -license = "GPL-3.0-or-later WITH Classpath-exception-2.0" - -[dependencies] - -# Bridge Dependencies - -bp-header-chain = { path = "../header-chain", default-features = false } -bp-polkadot-core = { path = "../polkadot-core", default-features = false } -bp-runtime = { path = "../runtime", default-features = false } -bp-rococo = { path = "../chain-rococo", default-features = false } - -# Substrate Based Dependencies - -frame-support = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master", default-features = false } -sp-api = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master", default-features = false } -sp-std = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master", default-features = false } - -[features] -default = [ "std" ] -std = [ - "bp-header-chain/std", - "bp-polkadot-core/std", - "bp-rococo/std", - "bp-runtime/std", - "frame-support/std", - "sp-api/std", - "sp-std/std", -] diff --git a/bridges/primitives/chain-wococo/src/lib.rs b/bridges/primitives/chain-wococo/src/lib.rs deleted file mode 100644 index b1df65630beff..0000000000000 --- a/bridges/primitives/chain-wococo/src/lib.rs +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (C) 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 . - -#![cfg_attr(not(feature = "std"), no_std)] -// RuntimeApi generated functions -#![allow(clippy::too_many_arguments)] - -pub use bp_polkadot_core::*; -pub use bp_rococo::{ - SS58Prefix, MAX_AUTHORITIES_COUNT, MAX_NESTED_PARACHAIN_HEAD_DATA_SIZE, PARAS_PALLET_NAME, -}; - -use bp_header_chain::ChainWithGrandpa; -use bp_runtime::{decl_bridge_finality_runtime_apis, Chain}; -use frame_support::weights::Weight; - -/// Wococo Chain -pub struct Wococo; - -impl Chain for Wococo { - type BlockNumber = ::BlockNumber; - type Hash = ::Hash; - type Hasher = ::Hasher; - type Header = ::Header; - - type AccountId = ::AccountId; - type Balance = ::Balance; - type Nonce = ::Nonce; - type Signature = ::Signature; - - fn max_extrinsic_size() -> u32 { - PolkadotLike::max_extrinsic_size() - } - - fn max_extrinsic_weight() -> Weight { - PolkadotLike::max_extrinsic_weight() - } -} - -impl ChainWithGrandpa for Wococo { - const WITH_CHAIN_GRANDPA_PALLET_NAME: &'static str = WITH_WOCOCO_GRANDPA_PALLET_NAME; - const MAX_AUTHORITIES_COUNT: u32 = MAX_AUTHORITIES_COUNT; - const REASONABLE_HEADERS_IN_JUSTIFICATON_ANCESTRY: u32 = - REASONABLE_HEADERS_IN_JUSTIFICATON_ANCESTRY; - const MAX_HEADER_SIZE: u32 = MAX_HEADER_SIZE; - const AVERAGE_HEADER_SIZE_IN_JUSTIFICATION: u32 = AVERAGE_HEADER_SIZE_IN_JUSTIFICATION; -} - -// The SignedExtension used by Wococo. -pub use bp_rococo::CommonSignedExtension as SignedExtension; - -/// Name of the With-Wococo GRANDPA pallet instance that is deployed at bridged chains. -pub const WITH_WOCOCO_GRANDPA_PALLET_NAME: &str = "BridgeWococoGrandpa"; - -decl_bridge_finality_runtime_apis!(wococo, grandpa); diff --git a/bridges/primitives/runtime/src/extensions.rs b/bridges/primitives/runtime/src/extensions.rs index 44eeaad93c916..8a618721b23a6 100644 --- a/bridges/primitives/runtime/src/extensions.rs +++ b/bridges/primitives/runtime/src/extensions.rs @@ -88,7 +88,7 @@ pub type BridgeRejectObsoleteHeadersAndMessages = GenericSignedExtensionSchema<( /// wildcard/placeholder, which relies on the scale encoding for `()` or `((), ())`, or `((), (), /// ())` is the same. So runtime can contains any kind of tuple: /// `(BridgeRefundBridgeHubRococoMessages)` -/// `(BridgeRefundBridgeHubRococoMessages, BridgeRefundBridgeHubWococoMessages)` +/// `(BridgeRefundBridgeHubRococoMessages, BridgeRefundBridgeHubWestendMessages)` /// `(BridgeRefundParachainMessages1, ..., BridgeRefundParachainMessagesN)` pub type RefundBridgedParachainMessagesSchema = GenericSignedExtensionSchema<(), ()>; diff --git a/bridges/primitives/runtime/src/lib.rs b/bridges/primitives/runtime/src/lib.rs index 0b6f90fd934ff..0513cfa2a6c75 100644 --- a/bridges/primitives/runtime/src/lib.rs +++ b/bridges/primitives/runtime/src/lib.rs @@ -79,15 +79,9 @@ pub const ASSET_HUB_WESTEND_CHAIN_ID: ChainId = *b"ahwe"; /// Rococo chain id. pub const ROCOCO_CHAIN_ID: ChainId = *b"roco"; -/// Wococo chain id. -pub const WOCOCO_CHAIN_ID: ChainId = *b"woco"; - /// BridgeHubRococo chain id. pub const BRIDGE_HUB_ROCOCO_CHAIN_ID: ChainId = *b"bhro"; -/// BridgeHubWococo chain id. -pub const BRIDGE_HUB_WOCOCO_CHAIN_ID: ChainId = *b"bhwo"; - /// BridgeHubWestend chain id. pub const BRIDGE_HUB_WESTEND_CHAIN_ID: ChainId = *b"bhwd"; diff --git a/bridges/relays/bin-substrate/Cargo.toml b/bridges/relays/bin-substrate/Cargo.toml index b1ebcbbdcee9b..df2fc2ad169e1 100644 --- a/bridges/relays/bin-substrate/Cargo.toml +++ b/bridges/relays/bin-substrate/Cargo.toml @@ -35,7 +35,6 @@ relay-bridge-hub-kusama-client = { path = "../client-bridge-hub-kusama" } relay-bridge-hub-polkadot-client = { path = "../client-bridge-hub-polkadot" } relay-bridge-hub-rococo-client = { path = "../client-bridge-hub-rococo" } relay-bridge-hub-westend-client = { path = "../client-bridge-hub-westend" } -relay-bridge-hub-wococo-client = { path = "../client-bridge-hub-wococo" } relay-kusama-client = { path = "../client-kusama" } relay-polkadot-client = { path = "../client-polkadot" } relay-polkadot-bulletin-client = { path = "../client-polkadot-bulletin" } @@ -43,7 +42,6 @@ relay-rococo-client = { path = "../client-rococo" } relay-substrate-client = { path = "../client-substrate" } relay-utils = { path = "../utils" } relay-westend-client = { path = "../client-westend" } -relay-wococo-client = { path = "../client-wococo" } substrate-relay-helper = { path = "../lib-substrate-relay" } # Substrate Dependencies diff --git a/bridges/relays/bin-substrate/src/bridges/mod.rs b/bridges/relays/bin-substrate/src/bridges/mod.rs index 5a40b80cb9321..8dad329cf73be 100644 --- a/bridges/relays/bin-substrate/src/bridges/mod.rs +++ b/bridges/relays/bin-substrate/src/bridges/mod.rs @@ -19,4 +19,3 @@ pub mod kusama_polkadot; pub mod polkadot_bulletin; pub mod rococo_westend; -pub mod rococo_wococo; diff --git a/bridges/relays/bin-substrate/src/bridges/rococo_wococo/bridge_hub_rococo_messages_to_bridge_hub_wococo.rs b/bridges/relays/bin-substrate/src/bridges/rococo_wococo/bridge_hub_rococo_messages_to_bridge_hub_wococo.rs deleted file mode 100644 index 18d9c31089c31..0000000000000 --- a/bridges/relays/bin-substrate/src/bridges/rococo_wococo/bridge_hub_rococo_messages_to_bridge_hub_wococo.rs +++ /dev/null @@ -1,64 +0,0 @@ -// 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 . - -//! BridgeHubRococo-to-BridgeHubWococo messages sync entrypoint. - -use crate::cli::bridge::{CliBridgeBase, MessagesCliBridge}; -use relay_bridge_hub_rococo_client::BridgeHubRococo; -use relay_bridge_hub_wococo_client::BridgeHubWococo; -use substrate_relay_helper::{messages_lane::SubstrateMessageLane, UtilityPalletBatchCallBuilder}; - -pub struct BridgeHubRococoToBridgeHubWococoMessagesCliBridge {} - -impl CliBridgeBase for BridgeHubRococoToBridgeHubWococoMessagesCliBridge { - type Source = BridgeHubRococo; - type Target = BridgeHubWococo; -} - -impl MessagesCliBridge for BridgeHubRococoToBridgeHubWococoMessagesCliBridge { - type MessagesLane = BridgeHubRococoMessagesToBridgeHubWococoMessageLane; -} - -substrate_relay_helper::generate_receive_message_proof_call_builder!( - BridgeHubRococoMessagesToBridgeHubWococoMessageLane, - BridgeHubRococoMessagesToBridgeHubWococoMessageLaneReceiveMessagesProofCallBuilder, - relay_bridge_hub_wococo_client::RuntimeCall::BridgeRococoMessages, - relay_bridge_hub_wococo_client::BridgeMessagesCall::receive_messages_proof -); - -substrate_relay_helper::generate_receive_message_delivery_proof_call_builder!( - BridgeHubRococoMessagesToBridgeHubWococoMessageLane, - BridgeHubRococoMessagesToBridgeHubWococoMessageLaneReceiveMessagesDeliveryProofCallBuilder, - relay_bridge_hub_rococo_client::RuntimeCall::BridgeWococoMessages, - relay_bridge_hub_rococo_client::BridgeMessagesCall::receive_messages_delivery_proof -); - -/// Description of BridgeHubRococo -> BridgeHubWococo messages bridge. -#[derive(Clone, Debug)] -pub struct BridgeHubRococoMessagesToBridgeHubWococoMessageLane; - -impl SubstrateMessageLane for BridgeHubRococoMessagesToBridgeHubWococoMessageLane { - type SourceChain = BridgeHubRococo; - type TargetChain = BridgeHubWococo; - - type ReceiveMessagesProofCallBuilder = - BridgeHubRococoMessagesToBridgeHubWococoMessageLaneReceiveMessagesProofCallBuilder; - type ReceiveMessagesDeliveryProofCallBuilder = - BridgeHubRococoMessagesToBridgeHubWococoMessageLaneReceiveMessagesDeliveryProofCallBuilder; - - type SourceBatchCallBuilder = UtilityPalletBatchCallBuilder; - type TargetBatchCallBuilder = UtilityPalletBatchCallBuilder; -} diff --git a/bridges/relays/bin-substrate/src/bridges/rococo_wococo/bridge_hub_wococo_messages_to_bridge_hub_rococo.rs b/bridges/relays/bin-substrate/src/bridges/rococo_wococo/bridge_hub_wococo_messages_to_bridge_hub_rococo.rs deleted file mode 100644 index d327926823bf3..0000000000000 --- a/bridges/relays/bin-substrate/src/bridges/rococo_wococo/bridge_hub_wococo_messages_to_bridge_hub_rococo.rs +++ /dev/null @@ -1,64 +0,0 @@ -// 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 . - -//! BridgeHubWococo-to-BridgeHubRococo messages sync entrypoint. - -use crate::cli::bridge::{CliBridgeBase, MessagesCliBridge}; -use relay_bridge_hub_rococo_client::BridgeHubRococo; -use relay_bridge_hub_wococo_client::BridgeHubWococo; -use substrate_relay_helper::{messages_lane::SubstrateMessageLane, UtilityPalletBatchCallBuilder}; - -pub struct BridgeHubWococoToBridgeHubRococoMessagesCliBridge {} - -impl CliBridgeBase for BridgeHubWococoToBridgeHubRococoMessagesCliBridge { - type Source = BridgeHubWococo; - type Target = BridgeHubRococo; -} - -impl MessagesCliBridge for BridgeHubWococoToBridgeHubRococoMessagesCliBridge { - type MessagesLane = BridgeHubWococoMessagesToBridgeHubRococoMessageLane; -} - -substrate_relay_helper::generate_receive_message_proof_call_builder!( - BridgeHubWococoMessagesToBridgeHubRococoMessageLane, - BridgeHubWococoMessagesToBridgeHubRococoMessageLaneReceiveMessagesProofCallBuilder, - relay_bridge_hub_rococo_client::RuntimeCall::BridgeWococoMessages, - relay_bridge_hub_rococo_client::BridgeMessagesCall::receive_messages_proof -); - -substrate_relay_helper::generate_receive_message_delivery_proof_call_builder!( - BridgeHubWococoMessagesToBridgeHubRococoMessageLane, - BridgeHubWococoMessagesToBridgeHubRococoMessageLaneReceiveMessagesDeliveryProofCallBuilder, - relay_bridge_hub_wococo_client::RuntimeCall::BridgeRococoMessages, - relay_bridge_hub_wococo_client::BridgeMessagesCall::receive_messages_delivery_proof -); - -/// Description of BridgeHubWococo -> BridgeHubRococo messages bridge. -#[derive(Clone, Debug)] -pub struct BridgeHubWococoMessagesToBridgeHubRococoMessageLane; - -impl SubstrateMessageLane for BridgeHubWococoMessagesToBridgeHubRococoMessageLane { - type SourceChain = BridgeHubWococo; - type TargetChain = BridgeHubRococo; - - type ReceiveMessagesProofCallBuilder = - BridgeHubWococoMessagesToBridgeHubRococoMessageLaneReceiveMessagesProofCallBuilder; - type ReceiveMessagesDeliveryProofCallBuilder = - BridgeHubWococoMessagesToBridgeHubRococoMessageLaneReceiveMessagesDeliveryProofCallBuilder; - - type SourceBatchCallBuilder = UtilityPalletBatchCallBuilder; - type TargetBatchCallBuilder = UtilityPalletBatchCallBuilder; -} diff --git a/bridges/relays/bin-substrate/src/bridges/rococo_wococo/mod.rs b/bridges/relays/bin-substrate/src/bridges/rococo_wococo/mod.rs deleted file mode 100644 index 64330a92252cd..0000000000000 --- a/bridges/relays/bin-substrate/src/bridges/rococo_wococo/mod.rs +++ /dev/null @@ -1,24 +0,0 @@ -// 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 . - -//! 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; diff --git a/bridges/relays/bin-substrate/src/bridges/rococo_wococo/rococo_headers_to_bridge_hub_wococo.rs b/bridges/relays/bin-substrate/src/bridges/rococo_wococo/rococo_headers_to_bridge_hub_wococo.rs deleted file mode 100644 index b9b9a89ba0f52..0000000000000 --- a/bridges/relays/bin-substrate/src/bridges/rococo_wococo/rococo_headers_to_bridge_hub_wococo.rs +++ /dev/null @@ -1,80 +0,0 @@ -// 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 . - -//! Rococo-to-Wococo bridge hubs headers sync entrypoint. - -use crate::cli::bridge::{ - CliBridgeBase, RelayToRelayEquivocationDetectionCliBridge, RelayToRelayHeadersCliBridge, -}; - -use async_trait::async_trait; -use substrate_relay_helper::{ - equivocation::SubstrateEquivocationDetectionPipeline, - finality::SubstrateFinalitySyncPipeline, - finality_base::{engine::Grandpa as GrandpaFinalityEngine, SubstrateFinalityPipeline}, -}; - -/// Description of Rococo -> Wococo finalized headers bridge. -#[derive(Clone, Debug)] -pub struct RococoFinalityToBridgeHubWococo; - -substrate_relay_helper::generate_submit_finality_proof_call_builder!( - RococoFinalityToBridgeHubWococo, - SubmitFinalityProofCallBuilder, - relay_bridge_hub_wococo_client::RuntimeCall::BridgeRococoGrandpa, - relay_bridge_hub_wococo_client::BridgeGrandpaCall::submit_finality_proof -); - -substrate_relay_helper::generate_report_equivocation_call_builder!( - RococoFinalityToBridgeHubWococo, - ReportEquivocationCallBuilder, - relay_rococo_client::RuntimeCall::Grandpa, - relay_rococo_client::GrandpaCall::report_equivocation -); - -#[async_trait] -impl SubstrateFinalityPipeline for RococoFinalityToBridgeHubWococo { - type SourceChain = relay_rococo_client::Rococo; - type TargetChain = relay_bridge_hub_wococo_client::BridgeHubWococo; - - type FinalityEngine = GrandpaFinalityEngine; -} - -#[async_trait] -impl SubstrateFinalitySyncPipeline for RococoFinalityToBridgeHubWococo { - type SubmitFinalityProofCallBuilder = SubmitFinalityProofCallBuilder; -} - -#[async_trait] -impl SubstrateEquivocationDetectionPipeline for RococoFinalityToBridgeHubWococo { - type ReportEquivocationCallBuilder = ReportEquivocationCallBuilder; -} - -/// `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; -} - -impl RelayToRelayEquivocationDetectionCliBridge for RococoToBridgeHubWococoCliBridge { - type Equivocation = RococoFinalityToBridgeHubWococo; -} diff --git a/bridges/relays/bin-substrate/src/bridges/rococo_wococo/rococo_parachains_to_bridge_hub_wococo.rs b/bridges/relays/bin-substrate/src/bridges/rococo_wococo/rococo_parachains_to_bridge_hub_wococo.rs deleted file mode 100644 index b7296e0a38fb4..0000000000000 --- a/bridges/relays/bin-substrate/src/bridges/rococo_wococo/rococo_parachains_to_bridge_hub_wococo.rs +++ /dev/null @@ -1,75 +0,0 @@ -// 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 . - -//! Wococo-to-Rococo 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, -}; - -/// BridgeHub-to-BridgeHub parachain sync description. -#[derive(Clone, Debug)] -pub struct BridgeHubRococoToBridgeHubWococo; - -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; -} - -pub struct BridgeHubRococoToBridgeHubWococoCallBuilder; -impl SubmitParachainHeadsCallBuilder - for BridgeHubRococoToBridgeHubWococoCallBuilder -{ - fn build_submit_parachain_heads_call( - at_relay_block: HeaderIdOf, - parachains: Vec<(ParaId, ParaHash)>, - parachain_heads_proof: ParaHeadsProof, - ) -> CallOf { - relay_bridge_hub_wococo_client::RuntimeCall::BridgeRococoParachains( - relay_bridge_hub_wococo_client::BridgeParachainCall::submit_parachain_heads { - at_relay_block: (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::bridges::rococo_wococo::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; -} - -impl MessagesCliBridge for BridgeHubRococoToBridgeHubWococoCliBridge { - type MessagesLane = - crate::bridges::rococo_wococo::bridge_hub_rococo_messages_to_bridge_hub_wococo::BridgeHubRococoMessagesToBridgeHubWococoMessageLane; -} diff --git a/bridges/relays/bin-substrate/src/bridges/rococo_wococo/wococo_headers_to_bridge_hub_rococo.rs b/bridges/relays/bin-substrate/src/bridges/rococo_wococo/wococo_headers_to_bridge_hub_rococo.rs deleted file mode 100644 index c000a2764e26e..0000000000000 --- a/bridges/relays/bin-substrate/src/bridges/rococo_wococo/wococo_headers_to_bridge_hub_rococo.rs +++ /dev/null @@ -1,80 +0,0 @@ -// 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 . - -//! Wococo-to-Rococo bridge hubs headers sync entrypoint. - -use crate::cli::bridge::{ - CliBridgeBase, RelayToRelayEquivocationDetectionCliBridge, RelayToRelayHeadersCliBridge, -}; - -use async_trait::async_trait; -use substrate_relay_helper::{ - equivocation::SubstrateEquivocationDetectionPipeline, - finality::SubstrateFinalitySyncPipeline, - finality_base::{engine::Grandpa as GrandpaFinalityEngine, SubstrateFinalityPipeline}, -}; - -/// Description of Wococo -> Rococo finalized headers bridge. -#[derive(Clone, Debug)] -pub struct WococoFinalityToBridgeHubRococo; - -substrate_relay_helper::generate_submit_finality_proof_call_builder!( - WococoFinalityToBridgeHubRococo, - SubmitFinalityProofCallBuilder, - relay_bridge_hub_rococo_client::RuntimeCall::BridgeWococoGrandpa, - relay_bridge_hub_rococo_client::BridgeGrandpaCall::submit_finality_proof -); - -substrate_relay_helper::generate_report_equivocation_call_builder!( - WococoFinalityToBridgeHubRococo, - ReportEquivocationCallBuilder, - relay_wococo_client::RuntimeCall::Grandpa, - relay_wococo_client::GrandpaCall::report_equivocation -); - -#[async_trait] -impl SubstrateFinalityPipeline for WococoFinalityToBridgeHubRococo { - type SourceChain = relay_wococo_client::Wococo; - type TargetChain = relay_bridge_hub_rococo_client::BridgeHubRococo; - - type FinalityEngine = GrandpaFinalityEngine; -} - -#[async_trait] -impl SubstrateFinalitySyncPipeline for WococoFinalityToBridgeHubRococo { - type SubmitFinalityProofCallBuilder = SubmitFinalityProofCallBuilder; -} - -#[async_trait] -impl SubstrateEquivocationDetectionPipeline for WococoFinalityToBridgeHubRococo { - type ReportEquivocationCallBuilder = ReportEquivocationCallBuilder; -} - -/// `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; -} - -impl RelayToRelayEquivocationDetectionCliBridge for WococoToBridgeHubRococoCliBridge { - type Equivocation = WococoFinalityToBridgeHubRococo; -} diff --git a/bridges/relays/bin-substrate/src/bridges/rococo_wococo/wococo_parachains_to_bridge_hub_rococo.rs b/bridges/relays/bin-substrate/src/bridges/rococo_wococo/wococo_parachains_to_bridge_hub_rococo.rs deleted file mode 100644 index 165f4af11c8fe..0000000000000 --- a/bridges/relays/bin-substrate/src/bridges/rococo_wococo/wococo_parachains_to_bridge_hub_rococo.rs +++ /dev/null @@ -1,75 +0,0 @@ -// 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 . - -//! Rococo-to-Wococo 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, -}; - -/// BridgeHub-to-BridgeHub parachain sync description. -#[derive(Clone, Debug)] -pub struct BridgeHubWococoToBridgeHubRococo; - -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; -} - -pub struct BridgeHubWococoToBridgeHubRococoCallBuilder; -impl SubmitParachainHeadsCallBuilder - for BridgeHubWococoToBridgeHubRococoCallBuilder -{ - fn build_submit_parachain_heads_call( - at_relay_block: HeaderIdOf, - parachains: Vec<(ParaId, ParaHash)>, - parachain_heads_proof: ParaHeadsProof, - ) -> CallOf { - relay_bridge_hub_rococo_client::RuntimeCall::BridgeWococoParachains( - relay_bridge_hub_rococo_client::BridgeParachainCall::submit_parachain_heads { - at_relay_block: (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::bridges::rococo_wococo::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; -} - -impl MessagesCliBridge for BridgeHubWococoToBridgeHubRococoCliBridge { - type MessagesLane = - crate::bridges::rococo_wococo::bridge_hub_wococo_messages_to_bridge_hub_rococo::BridgeHubWococoMessagesToBridgeHubRococoMessageLane; -} diff --git a/bridges/relays/bin-substrate/src/chains/mod.rs b/bridges/relays/bin-substrate/src/chains/mod.rs index 442236997c8ba..ab15a9e679cd5 100644 --- a/bridges/relays/bin-substrate/src/chains/mod.rs +++ b/bridges/relays/bin-substrate/src/chains/mod.rs @@ -21,4 +21,3 @@ mod polkadot; mod polkadot_bulletin; mod rococo; mod westend; -mod wococo; diff --git a/bridges/relays/bin-substrate/src/chains/wococo.rs b/bridges/relays/bin-substrate/src/chains/wococo.rs deleted file mode 100644 index c9e3943d80865..0000000000000 --- a/bridges/relays/bin-substrate/src/chains/wococo.rs +++ /dev/null @@ -1,31 +0,0 @@ -// 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 . - -//! Wococo + Wococo parachains specification for CLI. - -use crate::cli::CliChain; -use relay_bridge_hub_wococo_client::BridgeHubWococo; -use relay_substrate_client::SimpleRuntimeVersion; -use relay_wococo_client::Wococo; - -impl CliChain for Wococo { - const RUNTIME_VERSION: Option = None; -} - -impl CliChain for BridgeHubWococo { - const RUNTIME_VERSION: Option = - Some(SimpleRuntimeVersion { spec_version: 9420, transaction_version: 3 }); -} diff --git a/bridges/relays/bin-substrate/src/cli/bridge.rs b/bridges/relays/bin-substrate/src/cli/bridge.rs index cc6dc8e43574e..2903a290c5b62 100644 --- a/bridges/relays/bin-substrate/src/cli/bridge.rs +++ b/bridges/relays/bin-substrate/src/cli/bridge.rs @@ -29,8 +29,6 @@ use substrate_relay_helper::{ #[strum(serialize_all = "kebab_case")] /// Supported full bridges (headers + messages). pub enum FullBridge { - BridgeHubRococoToBridgeHubWococo, - BridgeHubWococoToBridgeHubRococo, BridgeHubRococoToBridgeHubWestend, BridgeHubWestendToBridgeHubRococo, BridgeHubKusamaToBridgeHubPolkadot, diff --git a/bridges/relays/bin-substrate/src/cli/detect_equivocations.rs b/bridges/relays/bin-substrate/src/cli/detect_equivocations.rs index 704839db0e66f..970089453bd5a 100644 --- a/bridges/relays/bin-substrate/src/cli/detect_equivocations.rs +++ b/bridges/relays/bin-substrate/src/cli/detect_equivocations.rs @@ -20,9 +20,9 @@ use crate::{ kusama_headers_to_bridge_hub_polkadot::KusamaToBridgeHubPolkadotCliBridge, polkadot_headers_to_bridge_hub_kusama::PolkadotToBridgeHubKusamaCliBridge, }, - rococo_wococo::{ - rococo_headers_to_bridge_hub_wococo::RococoToBridgeHubWococoCliBridge, - wococo_headers_to_bridge_hub_rococo::WococoToBridgeHubRococoCliBridge, + rococo_westend::{ + rococo_headers_to_bridge_hub_westend::RococoToBridgeHubWestendCliBridge, + westend_headers_to_bridge_hub_rococo::WestendToBridgeHubRococoCliBridge, }, }, cli::{bridge::*, chain_schema::*, PrometheusParams}, @@ -53,10 +53,10 @@ pub struct DetectEquivocations { #[strum(serialize_all = "kebab_case")] /// Equivocations detection bridge. pub enum DetectEquivocationsBridge { - RococoToBridgeHubWococo, - WococoToBridgeHubRococo, KusamaToBridgeHubPolkadot, PolkadotToBridgeHubKusama, + RococoToBridgeHubWestend, + WestendToBridgeHubRococo, } #[async_trait] @@ -82,23 +82,23 @@ where } } -impl EquivocationsDetector for RococoToBridgeHubWococoCliBridge {} -impl EquivocationsDetector for WococoToBridgeHubRococoCliBridge {} impl EquivocationsDetector for KusamaToBridgeHubPolkadotCliBridge {} impl EquivocationsDetector for PolkadotToBridgeHubKusamaCliBridge {} +impl EquivocationsDetector for RococoToBridgeHubWestendCliBridge {} +impl EquivocationsDetector for WestendToBridgeHubRococoCliBridge {} impl DetectEquivocations { /// Run the command. pub async fn run(self) -> anyhow::Result<()> { match self.bridge { - DetectEquivocationsBridge::RococoToBridgeHubWococo => - RococoToBridgeHubWococoCliBridge::start(self), - DetectEquivocationsBridge::WococoToBridgeHubRococo => - WococoToBridgeHubRococoCliBridge::start(self), DetectEquivocationsBridge::KusamaToBridgeHubPolkadot => KusamaToBridgeHubPolkadotCliBridge::start(self), DetectEquivocationsBridge::PolkadotToBridgeHubKusama => PolkadotToBridgeHubKusamaCliBridge::start(self), + DetectEquivocationsBridge::RococoToBridgeHubWestend => + RococoToBridgeHubWestendCliBridge::start(self), + DetectEquivocationsBridge::WestendToBridgeHubRococo => + WestendToBridgeHubRococoCliBridge::start(self), } .await } diff --git a/bridges/relays/bin-substrate/src/cli/init_bridge.rs b/bridges/relays/bin-substrate/src/cli/init_bridge.rs index 21d95b4bfa0ea..30875e70cbb35 100644 --- a/bridges/relays/bin-substrate/src/cli/init_bridge.rs +++ b/bridges/relays/bin-substrate/src/cli/init_bridge.rs @@ -31,10 +31,6 @@ use crate::{ rococo_headers_to_bridge_hub_westend::RococoToBridgeHubWestendCliBridge, westend_headers_to_bridge_hub_rococo::WestendToBridgeHubRococoCliBridge, }, - rococo_wococo::{ - rococo_headers_to_bridge_hub_wococo::RococoToBridgeHubWococoCliBridge, - wococo_headers_to_bridge_hub_rococo::WococoToBridgeHubRococoCliBridge, - }, }, cli::{bridge::CliBridgeBase, chain_schema::*}, }; @@ -66,8 +62,6 @@ pub struct InitBridge { #[strum(serialize_all = "kebab_case")] /// Bridge to initialize. pub enum InitBridgeName { - RococoToBridgeHubWococo, - WococoToBridgeHubRococo, KusamaToBridgeHubPolkadot, PolkadotToBridgeHubKusama, PolkadotToPolkadotBulletin, @@ -116,30 +110,6 @@ where } } -impl BridgeInitializer for RococoToBridgeHubWococoCliBridge { - type Engine = GrandpaFinalityEngine; - - fn encode_init_bridge( - init_data: >::InitializationData, - ) -> ::Call { - relay_bridge_hub_wococo_client::RuntimeCall::BridgeRococoGrandpa( - relay_bridge_hub_wococo_client::BridgeGrandpaCall::initialize { init_data }, - ) - } -} - -impl BridgeInitializer for WococoToBridgeHubRococoCliBridge { - type Engine = GrandpaFinalityEngine; - - fn encode_init_bridge( - init_data: >::InitializationData, - ) -> ::Call { - relay_bridge_hub_rococo_client::RuntimeCall::BridgeWococoGrandpa( - relay_bridge_hub_rococo_client::BridgeGrandpaCall::initialize { init_data }, - ) - } -} - impl BridgeInitializer for RococoToBridgeHubWestendCliBridge { type Engine = GrandpaFinalityEngine; @@ -229,10 +199,6 @@ impl InitBridge { /// Run the command. pub async fn run(self) -> anyhow::Result<()> { match self.bridge { - InitBridgeName::RococoToBridgeHubWococo => - RococoToBridgeHubWococoCliBridge::init_bridge(self), - InitBridgeName::WococoToBridgeHubRococo => - WococoToBridgeHubRococoCliBridge::init_bridge(self), InitBridgeName::KusamaToBridgeHubPolkadot => KusamaToBridgeHubPolkadotCliBridge::init_bridge(self), InitBridgeName::PolkadotToBridgeHubKusama => diff --git a/bridges/relays/bin-substrate/src/cli/relay_headers.rs b/bridges/relays/bin-substrate/src/cli/relay_headers.rs index 95d93387a0728..032fe64ef9070 100644 --- a/bridges/relays/bin-substrate/src/cli/relay_headers.rs +++ b/bridges/relays/bin-substrate/src/cli/relay_headers.rs @@ -27,10 +27,6 @@ use crate::bridges::{ polkadot_bulletin_headers_to_bridge_hub_polkadot::PolkadotBulletinToBridgeHubPolkadotCliBridge, polkadot_headers_to_polkadot_bulletin::PolkadotToPolkadotBulletinCliBridge, }, - rococo_wococo::{ - rococo_headers_to_bridge_hub_wococo::RococoToBridgeHubWococoCliBridge, - wococo_headers_to_bridge_hub_rococo::WococoToBridgeHubRococoCliBridge, - }, }; use relay_utils::metrics::{GlobalMetrics, StandaloneMetric}; use substrate_relay_helper::finality::SubstrateFinalitySyncPipeline; @@ -61,8 +57,6 @@ pub struct RelayHeaders { #[strum(serialize_all = "kebab_case")] /// Headers relay bridge. pub enum RelayHeadersBridge { - RococoToBridgeHubWococo, - WococoToBridgeHubRococo, KusamaToBridgeHubPolkadot, PolkadotToBridgeHubKusama, PolkadotToPolkadotBulletin, @@ -100,8 +94,6 @@ trait HeadersRelayer: RelayToRelayHeadersCliBridge { } } -impl HeadersRelayer for RococoToBridgeHubWococoCliBridge {} -impl HeadersRelayer for WococoToBridgeHubRococoCliBridge {} impl HeadersRelayer for KusamaToBridgeHubPolkadotCliBridge {} impl HeadersRelayer for PolkadotToBridgeHubKusamaCliBridge {} impl HeadersRelayer for PolkadotToPolkadotBulletinCliBridge {} @@ -111,10 +103,6 @@ impl RelayHeaders { /// Run the command. pub async fn run(self) -> anyhow::Result<()> { match self.bridge { - RelayHeadersBridge::RococoToBridgeHubWococo => - RococoToBridgeHubWococoCliBridge::relay_headers(self), - RelayHeadersBridge::WococoToBridgeHubRococo => - WococoToBridgeHubRococoCliBridge::relay_headers(self), RelayHeadersBridge::KusamaToBridgeHubPolkadot => KusamaToBridgeHubPolkadotCliBridge::relay_headers(self), RelayHeadersBridge::PolkadotToBridgeHubKusama => diff --git a/bridges/relays/bin-substrate/src/cli/relay_headers_and_messages/mod.rs b/bridges/relays/bin-substrate/src/cli/relay_headers_and_messages/mod.rs index 7075e742e02d8..87d1c38fab10d 100644 --- a/bridges/relays/bin-substrate/src/cli/relay_headers_and_messages/mod.rs +++ b/bridges/relays/bin-substrate/src/cli/relay_headers_and_messages/mod.rs @@ -51,10 +51,6 @@ use crate::{ rococo_parachains_to_bridge_hub_westend::BridgeHubRococoToBridgeHubWestendCliBridge, westend_parachains_to_bridge_hub_rococo::BridgeHubWestendToBridgeHubRococoCliBridge, }, - rococo_wococo::{ - rococo_parachains_to_bridge_hub_wococo::BridgeHubRococoToBridgeHubWococoCliBridge, - wococo_parachains_to_bridge_hub_rococo::BridgeHubWococoToBridgeHubRococoCliBridge, - }, }, cli::{ bridge::{ @@ -196,8 +192,6 @@ where // All supported chains. declare_chain_cli_schema!(Rococo, rococo); declare_chain_cli_schema!(BridgeHubRococo, bridge_hub_rococo); -declare_chain_cli_schema!(Wococo, wococo); -declare_chain_cli_schema!(BridgeHubWococo, bridge_hub_wococo); declare_chain_cli_schema!(Westend, westend); declare_chain_cli_schema!(BridgeHubWestend, bridge_hub_westend); declare_chain_cli_schema!(Kusama, kusama); @@ -205,8 +199,37 @@ declare_chain_cli_schema!(BridgeHubKusama, bridge_hub_kusama); declare_chain_cli_schema!(Polkadot, polkadot); declare_chain_cli_schema!(BridgeHubPolkadot, bridge_hub_polkadot); declare_chain_cli_schema!(PolkadotBulletin, polkadot_bulletin); +// Means to override signers of different layer transactions. +declare_chain_cli_schema!(RococoHeadersToBridgeHubWestend, rococo_headers_to_bridge_hub_westend); +declare_chain_cli_schema!( + RococoParachainsToBridgeHubWestend, + rococo_parachains_to_bridge_hub_westend +); +declare_chain_cli_schema!(WestendHeadersToBridgeHubRococo, westend_headers_to_bridge_hub_rococo); +declare_chain_cli_schema!( + WestendParachainsToBridgeHubRococo, + westend_parachains_to_bridge_hub_rococo +); +declare_chain_cli_schema!(KusamaHeadersToBridgeHubPolkadot, kusama_headers_to_bridge_hub_polkadot); +declare_chain_cli_schema!( + KusamaParachainsToBridgeHubPolkadot, + kusama_parachains_to_bridge_hub_polkadot +); +declare_chain_cli_schema!(PolkadotHeadersToBridgeHubKusama, polkadot_headers_to_bridge_hub_kusama); +declare_chain_cli_schema!( + PolkadotParachainsToBridgeHubKusama, + polkadot_parachains_to_bridge_hub_kusama +); +declare_chain_cli_schema!( + PolkadotBulletinHeadersToBridgeHubPolkadot, + polkadot_bulletin_headers_to_bridge_hub_polkadot +); +declare_chain_cli_schema!(PolkadotHeadersToPolkadotBulletin, polkadot_headers_to_polkadot_bulletin); +declare_chain_cli_schema!( + PolkadotParachainsToPolkadotBulletin, + polkadot_parachains_to_polkadot_bulletin +); // All supported bridges. -declare_parachain_to_parachain_bridge_schema!(BridgeHubRococo, Rococo, BridgeHubWococo, Wococo); declare_parachain_to_parachain_bridge_schema!(BridgeHubRococo, Rococo, BridgeHubWestend, Westend); declare_parachain_to_parachain_bridge_schema!(BridgeHubKusama, Kusama, BridgeHubPolkadot, Polkadot); declare_relay_to_parachain_bridge_schema!(PolkadotBulletin, BridgeHubPolkadot, Polkadot); @@ -376,32 +399,6 @@ where } } -/// BridgeHubRococo <> BridgeHubWococo complex relay. -pub struct BridgeHubRococoBridgeHubWococoFull2WayBridge { - base: ::Base, -} - -#[async_trait] -impl Full2WayBridge for BridgeHubRococoBridgeHubWococoFull2WayBridge { - type Base = ParachainToParachainBridge; - type Left = relay_bridge_hub_rococo_client::BridgeHubRococo; - type Right = relay_bridge_hub_wococo_client::BridgeHubWococo; - type L2R = BridgeHubRococoToBridgeHubWococoCliBridge; - type R2L = BridgeHubWococoToBridgeHubRococoCliBridge; - - fn new(base: Self::Base) -> anyhow::Result { - Ok(Self { base }) - } - - fn base(&self) -> &Self::Base { - &self.base - } - - fn mut_base(&mut self) -> &mut Self::Base { - &mut self.base - } -} - /// BridgeHubRococo <> BridgeHubWestend complex relay. pub struct BridgeHubRococoBridgeHubWestendFull2WayBridge { base: ::Base, @@ -483,8 +480,6 @@ impl Full2WayBridge for PolkadotBulletinBridgeHubPolkadotFull2WayBridge { /// Complex headers+messages relay. #[derive(Debug, PartialEq, StructOpt)] pub enum RelayHeadersAndMessages { - /// BridgeHubRococo <> BridgeHubWococo relay. - BridgeHubRococoBridgeHubWococo(BridgeHubRococoBridgeHubWococoHeadersAndMessages), /// BridgeHubKusama <> BridgeHubPolkadot relay. BridgeHubKusamaBridgeHubPolkadot(BridgeHubKusamaBridgeHubPolkadotHeadersAndMessages), /// `PolkadotBulletin` <> `BridgeHubPolkadot` relay. @@ -497,10 +492,6 @@ impl RelayHeadersAndMessages { /// Run the command. pub async fn run(self) -> anyhow::Result<()> { match self { - RelayHeadersAndMessages::BridgeHubRococoBridgeHubWococo(params) => - BridgeHubRococoBridgeHubWococoFull2WayBridge::new(params.into_bridge().await?)? - .run() - .await, RelayHeadersAndMessages::BridgeHubRococoBridgeHubWestend(params) => BridgeHubRococoBridgeHubWestendFull2WayBridge::new(params.into_bridge().await?)? .run() diff --git a/bridges/relays/bin-substrate/src/cli/relay_messages.rs b/bridges/relays/bin-substrate/src/cli/relay_messages.rs index 7d01f8bcd7df4..477e9feff050a 100644 --- a/bridges/relays/bin-substrate/src/cli/relay_messages.rs +++ b/bridges/relays/bin-substrate/src/cli/relay_messages.rs @@ -32,10 +32,6 @@ use crate::bridges::{ bridge_hub_rococo_messages_to_bridge_hub_westend::BridgeHubRococoToBridgeHubWestendMessagesCliBridge, bridge_hub_westend_messages_to_bridge_hub_rococo::BridgeHubWestendToBridgeHubRococoMessagesCliBridge, }, - 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}; @@ -101,8 +97,6 @@ where } } -impl MessagesRelayer for BridgeHubRococoToBridgeHubWococoMessagesCliBridge {} -impl MessagesRelayer for BridgeHubWococoToBridgeHubRococoMessagesCliBridge {} impl MessagesRelayer for BridgeHubRococoToBridgeHubWestendMessagesCliBridge {} impl MessagesRelayer for BridgeHubWestendToBridgeHubRococoMessagesCliBridge {} impl MessagesRelayer for BridgeHubKusamaToBridgeHubPolkadotMessagesCliBridge {} @@ -114,10 +108,6 @@ impl RelayMessages { /// Run the command. pub async fn run(self) -> anyhow::Result<()> { match self.bridge { - FullBridge::BridgeHubRococoToBridgeHubWococo => - BridgeHubRococoToBridgeHubWococoMessagesCliBridge::relay_messages(self), - FullBridge::BridgeHubWococoToBridgeHubRococo => - BridgeHubWococoToBridgeHubRococoMessagesCliBridge::relay_messages(self), FullBridge::BridgeHubRococoToBridgeHubWestend => BridgeHubRococoToBridgeHubWestendMessagesCliBridge::relay_messages(self), FullBridge::BridgeHubWestendToBridgeHubRococo => diff --git a/bridges/relays/bin-substrate/src/cli/relay_parachains.rs b/bridges/relays/bin-substrate/src/cli/relay_parachains.rs index 668632320efa8..3038d1dfdb91d 100644 --- a/bridges/relays/bin-substrate/src/cli/relay_parachains.rs +++ b/bridges/relays/bin-substrate/src/cli/relay_parachains.rs @@ -24,10 +24,6 @@ use crate::bridges::{ rococo_parachains_to_bridge_hub_westend::BridgeHubRococoToBridgeHubWestendCliBridge, westend_parachains_to_bridge_hub_rococo::BridgeHubWestendToBridgeHubRococoCliBridge, }, - rococo_wococo::{ - rococo_parachains_to_bridge_hub_wococo::BridgeHubRococoToBridgeHubWococoCliBridge, - wococo_parachains_to_bridge_hub_rococo::BridgeHubWococoToBridgeHubRococoCliBridge, - }, }; use async_std::sync::Mutex; use async_trait::async_trait; @@ -68,8 +64,6 @@ pub struct RelayParachains { #[derive(Debug, EnumString, EnumVariantNames)] #[strum(serialize_all = "kebab_case")] pub enum RelayParachainsBridge { - RococoToBridgeHubWococo, - WococoToBridgeHubRococo, KusamaToBridgeHubPolkadot, PolkadotToBridgeHubKusama, PolkadotToPolkadotBulletin, @@ -118,8 +112,6 @@ where } } -impl ParachainsRelayer for BridgeHubRococoToBridgeHubWococoCliBridge {} -impl ParachainsRelayer for BridgeHubWococoToBridgeHubRococoCliBridge {} impl ParachainsRelayer for BridgeHubRococoToBridgeHubWestendCliBridge {} impl ParachainsRelayer for BridgeHubWestendToBridgeHubRococoCliBridge {} impl ParachainsRelayer for BridgeHubKusamaToBridgeHubPolkadotCliBridge {} @@ -130,10 +122,6 @@ impl RelayParachains { /// Run the command. pub async fn run(self) -> anyhow::Result<()> { match self.bridge { - RelayParachainsBridge::RococoToBridgeHubWococo => - BridgeHubRococoToBridgeHubWococoCliBridge::relay_parachains(self), - RelayParachainsBridge::WococoToBridgeHubRococo => - BridgeHubWococoToBridgeHubRococoCliBridge::relay_parachains(self), RelayParachainsBridge::RococoToBridgeHubWestend => BridgeHubRococoToBridgeHubWestendCliBridge::relay_parachains(self), RelayParachainsBridge::WestendToBridgeHubRococo => diff --git a/bridges/relays/client-bridge-hub-rococo/Cargo.toml b/bridges/relays/client-bridge-hub-rococo/Cargo.toml index f6fe83e1c556c..894965ababc77 100644 --- a/bridges/relays/client-bridge-hub-rococo/Cargo.toml +++ b/bridges/relays/client-bridge-hub-rococo/Cargo.toml @@ -13,13 +13,11 @@ subxt = { version = "0.32.1", default-features = false, features = [] } # Bridge dependencies bp-bridge-hub-rococo = { path = "../../primitives/chain-bridge-hub-rococo" } -bp-bridge-hub-wococo = { path = "../../primitives/chain-bridge-hub-wococo" } bp-header-chain = { path = "../../primitives/header-chain" } bp-messages = { path = "../../primitives/messages" } bp-parachains = { path = "../../primitives/parachains" } bp-polkadot-core = { path = "../../primitives/polkadot-core" } bp-runtime = { path = "../../primitives/runtime" } -bp-wococo = { path = "../../primitives/chain-wococo" } bridge-runtime-common = { path = "../../bin/runtime-common" } relay-substrate-client = { path = "../client-substrate" } diff --git a/bridges/relays/client-bridge-hub-wococo/Cargo.toml b/bridges/relays/client-bridge-hub-wococo/Cargo.toml deleted file mode 100644 index d90af65d3a0bb..0000000000000 --- a/bridges/relays/client-bridge-hub-wococo/Cargo.toml +++ /dev/null @@ -1,34 +0,0 @@ -[package] -name = "relay-bridge-hub-wococo-client" -version = "0.1.0" -authors = ["Parity Technologies "] -edition = "2021" -license = "GPL-3.0-or-later WITH Classpath-exception-2.0" - -[dependencies] -codec = { package = "parity-scale-codec", version = "3.1.5", features = ["derive"] } -scale-info = { version = "2.10.0", default-features = false, features = ["derive"] } -subxt = { version = "0.32.1", default-features = false, features = [] } - -# Bridge dependencies - -bp-bridge-hub-rococo = { path = "../../primitives/chain-bridge-hub-rococo" } -bp-bridge-hub-wococo = { path = "../../primitives/chain-bridge-hub-wococo" } -bp-header-chain = { path = "../../primitives/header-chain" } -bp-messages = { path = "../../primitives/messages" } -bp-parachains = { path = "../../primitives/parachains" } -bp-polkadot-core = { path = "../../primitives/polkadot-core" } -bp-runtime = { path = "../../primitives/runtime" } - -bridge-runtime-common = { path = "../../bin/runtime-common" } -relay-bridge-hub-rococo-client = { path = "../client-bridge-hub-rococo" } -relay-substrate-client = { path = "../client-substrate" } - -# Substrate Dependencies - -sp-core = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master" } -sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master" } -sp-weights = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master" } - -[dev-dependencies] -sp-consensus-grandpa = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master" } diff --git a/bridges/relays/client-bridge-hub-wococo/src/lib.rs b/bridges/relays/client-bridge-hub-wococo/src/lib.rs deleted file mode 100644 index b144093d3669c..0000000000000 --- a/bridges/relays/client-bridge-hub-wococo/src/lib.rs +++ /dev/null @@ -1,169 +0,0 @@ -// 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 . - -//! Types used to connect to the BridgeHub-Wococo-Substrate parachain. - -use bp_bridge_hub_wococo::{SignedExtension, AVERAGE_BLOCK_INTERVAL}; -use bp_messages::MessageNonce; -use bp_polkadot_core::SuffixedCommonSignedExtensionExt; -use bp_runtime::ChainId; -use codec::Encode; -use relay_substrate_client::{ - Chain, ChainWithBalances, ChainWithMessages, ChainWithTransactions, ChainWithUtilityPallet, - Error as SubstrateError, MockedRuntimeUtilityPallet, SignParam, UnderlyingChainProvider, - UnsignedTransaction, -}; -use sp_core::{storage::StorageKey, Pair}; -use sp_runtime::{generic::SignedPayload, traits::IdentifyAccount}; -use std::time::Duration; - -pub use codegen_runtime::api::runtime_types; -use relay_bridge_hub_rococo_client::codegen_runtime; - -pub type RuntimeCall = runtime_types::bridge_hub_rococo_runtime::RuntimeCall; -pub type BridgeMessagesCall = runtime_types::pallet_bridge_messages::pallet::Call; -pub type BridgeGrandpaCall = runtime_types::pallet_bridge_grandpa::pallet::Call; -pub type BridgeParachainCall = runtime_types::pallet_bridge_parachains::pallet::Call; -type UncheckedExtrinsic = bp_bridge_hub_wococo::UncheckedExtrinsic; - -/// Wococo chain definition -#[derive(Debug, Clone, Copy, PartialEq, Eq)] -pub struct BridgeHubWococo; - -impl UnderlyingChainProvider for BridgeHubWococo { - type Chain = bp_bridge_hub_wococo::BridgeHubWococo; -} - -impl Chain for BridgeHubWococo { - const ID: ChainId = bp_runtime::BRIDGE_HUB_WOCOCO_CHAIN_ID; - const NAME: &'static str = "BridgeHubWococo"; - const BEST_FINALIZED_HEADER_ID_METHOD: &'static str = - bp_bridge_hub_wococo::BEST_FINALIZED_BRIDGE_HUB_WOCOCO_HEADER_METHOD; - const AVERAGE_BLOCK_INTERVAL: Duration = AVERAGE_BLOCK_INTERVAL; - - type SignedBlock = bp_bridge_hub_wococo::SignedBlock; - type Call = RuntimeCall; -} - -impl ChainWithBalances for BridgeHubWococo { - fn account_info_storage_key(account_id: &Self::AccountId) -> StorageKey { - bp_bridge_hub_wococo::AccountInfoStorageMapKeyProvider::final_key(account_id) - } -} - -impl ChainWithUtilityPallet for BridgeHubWococo { - type UtilityPallet = MockedRuntimeUtilityPallet; -} - -impl ChainWithTransactions for BridgeHubWococo { - type AccountKeyPair = sp_core::sr25519::Pair; - type SignedTransaction = UncheckedExtrinsic; - - fn sign_transaction( - param: SignParam, - unsigned: UnsignedTransaction, - ) -> Result { - let raw_payload = SignedPayload::new( - unsigned.call, - SignedExtension::from_params( - param.spec_version, - param.transaction_version, - unsigned.era, - param.genesis_hash, - unsigned.nonce, - unsigned.tip, - (((), ()), ((), ())), - ), - )?; - - let signature = raw_payload.using_encoded(|payload| param.signer.sign(payload)); - let signer: sp_runtime::MultiSigner = param.signer.public().into(); - let (call, extra, _) = raw_payload.deconstruct(); - - Ok(UncheckedExtrinsic::new_signed( - call, - signer.into_account().into(), - signature.into(), - extra, - )) - } - - fn is_signed(tx: &Self::SignedTransaction) -> bool { - tx.signature.is_some() - } - - fn is_signed_by(signer: &Self::AccountKeyPair, tx: &Self::SignedTransaction) -> bool { - tx.signature - .as_ref() - .map(|(address, _, _)| { - *address == bp_bridge_hub_wococo::Address::Id(signer.public().into()) - }) - .unwrap_or(false) - } - - fn parse_transaction(tx: Self::SignedTransaction) -> Option> { - let extra = &tx.signature.as_ref()?.2; - Some(UnsignedTransaction::new(tx.function, extra.nonce()).tip(extra.tip())) - } -} - -impl ChainWithMessages for BridgeHubWococo { - const WITH_CHAIN_MESSAGES_PALLET_NAME: &'static str = - bp_bridge_hub_wococo::WITH_BRIDGE_HUB_WOCOCO_MESSAGES_PALLET_NAME; - const WITH_CHAIN_RELAYERS_PALLET_NAME: Option<&'static str> = - Some(bp_bridge_hub_wococo::WITH_BRIDGE_HUB_WOCOCO_RELAYERS_PALLET_NAME); - - const TO_CHAIN_MESSAGE_DETAILS_METHOD: &'static str = - bp_bridge_hub_wococo::TO_BRIDGE_HUB_WOCOCO_MESSAGE_DETAILS_METHOD; - const FROM_CHAIN_MESSAGE_DETAILS_METHOD: &'static str = - bp_bridge_hub_wococo::FROM_BRIDGE_HUB_WOCOCO_MESSAGE_DETAILS_METHOD; - - const MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX: MessageNonce = - bp_bridge_hub_wococo::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX; - const MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX: MessageNonce = - bp_bridge_hub_wococo::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX; -} - -#[cfg(test)] -mod tests { - use super::*; - use relay_substrate_client::TransactionEra; - - type SystemCall = runtime_types::frame_system::pallet::Call; - - #[test] - fn parse_transaction_works() { - let unsigned = UnsignedTransaction { - call: RuntimeCall::System(SystemCall::remark { remark: b"Hello world!".to_vec() }) - .into(), - nonce: 777, - tip: 888, - era: TransactionEra::immortal(), - }; - let signed_transaction = BridgeHubWococo::sign_transaction( - SignParam { - spec_version: 42, - transaction_version: 50000, - genesis_hash: [42u8; 32].into(), - signer: sp_core::sr25519::Pair::from_seed_slice(&[1u8; 32]).unwrap(), - }, - unsigned.clone(), - ) - .unwrap(); - let parsed_transaction = BridgeHubWococo::parse_transaction(signed_transaction).unwrap(); - assert_eq!(parsed_transaction, unsigned); - } -} diff --git a/bridges/relays/client-wococo/Cargo.toml b/bridges/relays/client-wococo/Cargo.toml deleted file mode 100644 index ab9e08aeef5f4..0000000000000 --- a/bridges/relays/client-wococo/Cargo.toml +++ /dev/null @@ -1,24 +0,0 @@ -[package] -name = "relay-wococo-client" -version = "0.1.0" -authors = ["Parity Technologies "] -edition = "2021" -license = "GPL-3.0-or-later WITH Classpath-exception-2.0" - -[dependencies] -codec = { package = "parity-scale-codec", version = "3.1.5", features = ["derive"] } - -# Bridge dependencies - -bp-polkadot-core = { path = "../../primitives/polkadot-core" } -bp-runtime = { path = "../../primitives/runtime" } -bp-wococo = { path = "../../primitives/chain-wococo" } - -relay-rococo-client = { path = "../client-rococo" } -relay-substrate-client = { path = "../client-substrate" } -relay-utils = { path = "../utils" } - -# Substrate Dependencies -sp-core = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master" } -sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master" } -sp-session = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master" } diff --git a/bridges/relays/client-wococo/src/lib.rs b/bridges/relays/client-wococo/src/lib.rs deleted file mode 100644 index bb4e1c0130452..0000000000000 --- a/bridges/relays/client-wococo/src/lib.rs +++ /dev/null @@ -1,133 +0,0 @@ -// 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 . - -//! Types used to connect to the Wococo-Substrate chain. - -use bp_polkadot_core::SuffixedCommonSignedExtensionExt; -use bp_runtime::ChainId; -use bp_wococo::WOCOCO_SYNCED_HEADERS_GRANDPA_INFO_METHOD; -use codec::Encode; -use relay_substrate_client::{ - Chain, ChainWithBalances, ChainWithGrandpa, ChainWithTransactions, Error as SubstrateError, - RelayChain, SignParam, UnderlyingChainProvider, UnsignedTransaction, -}; -use sp_core::{storage::StorageKey, Pair}; -use sp_runtime::{generic::SignedPayload, traits::IdentifyAccount, MultiAddress}; -use sp_session::MembershipProof; -use std::time::Duration; - -pub use codegen_runtime::api::runtime_types; -use relay_rococo_client::codegen_runtime; - -pub type RuntimeCall = runtime_types::rococo_runtime::RuntimeCall; - -pub type GrandpaCall = runtime_types::pallet_grandpa::pallet::Call; - -/// Wococo header id. -pub type HeaderId = relay_utils::HeaderId; - -/// Wococo header type used in headers sync. -pub type SyncHeader = relay_substrate_client::SyncHeader; - -/// The address format for describing accounts. -pub type Address = MultiAddress; - -/// Wococo chain definition -#[derive(Debug, Clone, Copy)] -pub struct Wococo; - -impl UnderlyingChainProvider for Wococo { - type Chain = bp_wococo::Wococo; -} - -impl Chain for Wococo { - const ID: ChainId = bp_runtime::WOCOCO_CHAIN_ID; - const NAME: &'static str = "Wococo"; - const BEST_FINALIZED_HEADER_ID_METHOD: &'static str = - bp_wococo::BEST_FINALIZED_WOCOCO_HEADER_METHOD; - const AVERAGE_BLOCK_INTERVAL: Duration = Duration::from_secs(6); - - type SignedBlock = bp_wococo::SignedBlock; - type Call = RuntimeCall; -} - -impl ChainWithGrandpa for Wococo { - const SYNCED_HEADERS_GRANDPA_INFO_METHOD: &'static str = - WOCOCO_SYNCED_HEADERS_GRANDPA_INFO_METHOD; - - type KeyOwnerProof = MembershipProof; -} - -impl ChainWithBalances for Wococo { - fn account_info_storage_key(account_id: &Self::AccountId) -> StorageKey { - bp_wococo::AccountInfoStorageMapKeyProvider::final_key(account_id) - } -} - -impl RelayChain for Wococo { - const PARAS_PALLET_NAME: &'static str = bp_wococo::PARAS_PALLET_NAME; -} - -impl ChainWithTransactions for Wococo { - type AccountKeyPair = sp_core::sr25519::Pair; - type SignedTransaction = - bp_polkadot_core::UncheckedExtrinsic; - - fn sign_transaction( - param: SignParam, - unsigned: UnsignedTransaction, - ) -> Result { - let raw_payload = SignedPayload::new( - unsigned.call, - bp_wococo::SignedExtension::from_params( - param.spec_version, - param.transaction_version, - unsigned.era, - param.genesis_hash, - unsigned.nonce, - unsigned.tip, - ((), ()), - ), - )?; - - let signature = raw_payload.using_encoded(|payload| param.signer.sign(payload)); - let signer: sp_runtime::MultiSigner = param.signer.public().into(); - let (call, extra, _) = raw_payload.deconstruct(); - - Ok(Self::SignedTransaction::new_signed( - call, - signer.into_account().into(), - signature.into(), - extra, - )) - } - - fn is_signed(tx: &Self::SignedTransaction) -> bool { - tx.signature.is_some() - } - - fn is_signed_by(signer: &Self::AccountKeyPair, tx: &Self::SignedTransaction) -> bool { - tx.signature - .as_ref() - .map(|(address, _, _)| *address == Address::Id(signer.public().into())) - .unwrap_or(false) - } - - fn parse_transaction(tx: Self::SignedTransaction) -> Option> { - let extra = &tx.signature.as_ref()?.2; - Some(UnsignedTransaction::new(tx.function, extra.nonce()).tip(extra.tip())) - } -} diff --git a/bridges/relays/lib-substrate-relay/Cargo.toml b/bridges/relays/lib-substrate-relay/Cargo.toml index 8a490a9d2756d..f4df31766fedb 100644 --- a/bridges/relays/lib-substrate-relay/Cargo.toml +++ b/bridges/relays/lib-substrate-relay/Cargo.toml @@ -51,8 +51,7 @@ sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "mas [dev-dependencies] bp-rococo = { path = "../../primitives/chain-rococo" } -bp-wococo = { path = "../../primitives/chain-wococo" } pallet-transaction-payment = { git = "https://github.com/paritytech/polkadot-sdk", branch = "master" } -relay-rococo-client = { path = "../client-rococo" } relay-bridge-hub-rococo-client = { path = "../client-bridge-hub-rococo" } -relay-bridge-hub-wococo-client = { path = "../client-bridge-hub-wococo" } +relay-bridge-hub-westend-client = { path = "../client-bridge-hub-westend" } +relay-rococo-client = { path = "../client-rococo" } diff --git a/bridges/relays/lib-substrate-relay/src/messages_source.rs b/bridges/relays/lib-substrate-relay/src/messages_source.rs index ed7a2d5924fb7..f128546bad3fb 100644 --- a/bridges/relays/lib-substrate-relay/src/messages_source.rs +++ b/bridges/relays/lib-substrate-relay/src/messages_source.rs @@ -556,7 +556,7 @@ mod tests { use super::*; use bp_runtime::Chain as ChainBase; use relay_bridge_hub_rococo_client::BridgeHubRococo; - use relay_bridge_hub_wococo_client::BridgeHubWococo; + use relay_bridge_hub_westend_client::BridgeHubWestend; fn message_details_from_rpc( nonces: RangeInclusive, @@ -644,7 +644,7 @@ mod tests { msgs_to_refine.push((payload, out_msg_details)); } - let maybe_batches = split_msgs_to_refine::( + let maybe_batches = split_msgs_to_refine::( Default::default(), msgs_to_refine, );