diff --git a/README.md b/README.md index 852b493ed6..6eb828f5b5 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,8 @@ See [the `bridge-hubs` readme](parachains/runtimes/bridge-hubs/README.md) for de BridgeHub stuff uses external dependencies from repo `https://github.com/paritytech/parity-bridges-common.git`, which are mirrored to `./bridges` directory with `git subtree` feature. +See [readme](parachains/runtimes/bridge-hubs/README.md#git-subtree-bridges) for details + ## Rococo 👑 [Rococo](https://polkadot.js.org/apps/?rpc=wss://rococo-rpc.polkadot.io) is becoming a [Community Parachain Testbed](https://polkadot.network/blog/rococo-revamp-becoming-a-community-parachain-testbed/) for parachain teams in the Polkadot ecosystem. It supports multiple parachains with the differentiation of long-term connections and recurring short-term connections, to see which parachains are currently connected and how long they will be connected for [see here](https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Frococo-rpc.polkadot.io#/parachains). diff --git a/parachains/runtimes/bridge-hubs/README.md b/parachains/runtimes/bridge-hubs/README.md index 30832db75c..d6c5b20f50 100644 --- a/parachains/runtimes/bridge-hubs/README.md +++ b/parachains/runtimes/bridge-hubs/README.md @@ -12,6 +12,8 @@ Every _BridgeHub_ is meant to be **_common good parachain_** with main responsib - sync finality proofs between BridgeHub parachains - pass (XCM) messages between different BridgeHub parachains +![](/home/bparity/parity/cumulus/cumulus/parachains/runtimes/bridge-hubs/docs/bridge-hub-parachain-design.jpg "Basic deployment setup") + ## How to test locally Rococo <-> Wococo ### Deploy @@ -73,6 +75,9 @@ Add Bridges repo as a local remote and synchronize it with latest `master` from git remote add -f bridges git@github.com:paritytech/parity-bridges-common.git # (ran just only first time, when subtree was initialized) # git subtree add --prefix=bridges bridges master --squash + +# Synchro bridges repo +git fetch bridges --prune git subtree pull --prefix=bridges bridges master --squash ```` We use `--squash` to avoid adding individual commits and rather squashing them diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs index 7fe076ee29..7008fb385e 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs @@ -474,37 +474,62 @@ impl pallet_collator_selection::Config for Runtime { type WeightInfo = (); } -/// Add bridge pallets (GPA) +// Add bridge pallets (GPA) parameter_types! { - pub const MaxRequests: u32 = 50; + pub const MaxRequests: u32 = 64; pub const HeadersToKeep: u32 = 1024; } /// Add granda bridge pallet to track Wococo relay chain -pub type WococoGrandpaInstance = (); -impl pallet_bridge_grandpa::Config for Runtime { +pub type BridgeGrandpaWococoInstance = pallet_bridge_grandpa::Instance1; +impl pallet_bridge_grandpa::Config for Runtime { type BridgedChain = bp_wococo::Wococo; type MaxRequests = MaxRequests; type HeadersToKeep = HeadersToKeep; type WeightInfo = (); } -pub const PARAS_PALLET_NAME: &str = "WococoBridgeHubParachain"; +/// Add granda bridge pallet to track Wococo relay chain +pub type BridgeGrandpaRococoInstance = pallet_bridge_grandpa::Instance2; +impl pallet_bridge_grandpa::Config for Runtime { + type BridgedChain = bp_rococo::Rococo; + type MaxRequests = MaxRequests; + type HeadersToKeep = HeadersToKeep; + type WeightInfo = (); +} + +pub const ROCOCO_BRIDGE_PARA_PALLET_NAME: &str = "RococoBridgeHubParachainPallet"; +pub const WOCOCO_BRIDGE_PARA_PALLET_NAME: &str = "WococoBridgeHubParachainPallet"; parameter_types! { - pub const ParachainHeadsToKeep: u32 = 50; - pub const ParasPalletName: &'static str = PARAS_PALLET_NAME; + pub const ParachainHeadsToKeep: u32 = 64; + pub const RococoBridgeParachainPalletName: &'static str = ROCOCO_BRIDGE_PARA_PALLET_NAME; + pub const WococoBridgeParachainPalletName: &'static str = WOCOCO_BRIDGE_PARA_PALLET_NAME; pub GetTenFirstParachains: Vec = (0..10).map(ParaId).collect(); } /// Add parachain bridge pallet to track Wococo bridge hub parachain -impl pallet_bridge_parachains::Config for Runtime { +pub type BridgeParachainWococoInstance = pallet_bridge_parachains::Instance1; +impl pallet_bridge_parachains::Config for Runtime { type WeightInfo = (); - type BridgesGrandpaPalletInstance = WococoGrandpaInstance; - type ParasPalletName = ParasPalletName; + type BridgesGrandpaPalletInstance = BridgeGrandpaWococoInstance; + type ParasPalletName = RococoBridgeParachainPalletName; type TrackedParachains = IsInVec; type HeadsToKeep = ParachainHeadsToKeep; } +/// Add parachain bridge pallet to track Rococo bridge hub parachain +pub type BridgeParachainRococoInstance = pallet_bridge_parachains::Instance2; +impl pallet_bridge_parachains::Config for Runtime { + type WeightInfo = (); + type BridgesGrandpaPalletInstance = BridgeGrandpaRococoInstance; + type ParasPalletName = WococoBridgeParachainPalletName; + type TrackedParachains = IsInVec; + type HeadsToKeep = ParachainHeadsToKeep; +} + +/// Add shift session manager +impl pallet_shift_session_manager::Config for Runtime {} + // Create the runtime by composing the FRAME pallets that were previously configured. construct_runtime!( pub enum Runtime where @@ -539,9 +564,16 @@ construct_runtime!( CumulusXcm: cumulus_pallet_xcm::{Pallet, Event, Origin} = 32, DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event} = 33, - // Bridge pallets - BridgeWococoGrandpa: pallet_bridge_grandpa::{Pallet, Call, Storage}, - BridgeWococoParachains: pallet_bridge_parachains::{Pallet, Call, Storage}, + // Consensus support. + ShiftSessionManager: pallet_shift_session_manager::{Pallet}, + + // Wococo bridge modules + BridgeWococoGrandpa: pallet_bridge_grandpa::::{Pallet, Call, Storage}, + BridgeWococoParachain: pallet_bridge_parachains::::{Pallet, Call, Storage}, + + // Rococo bridge modules + BridgeRococoGrandpa: pallet_bridge_grandpa::::{Pallet, Call, Storage}, + BridgeRococoParachain: pallet_bridge_parachains::::{Pallet, Call, Storage}, } ); diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs index 28a8600d2e..216997bdf2 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs @@ -1,17 +1,15 @@ use super::{ AccountId, Balance, Balances, Call, Event, Origin, ParachainInfo, ParachainSystem, PolkadotXcm, Runtime, - WeightToFee, XcmpQueue, + XcmpQueue, }; -use core::marker::PhantomData; use frame_support::{ - log, match_types, parameter_types, + match_types, parameter_types, traits::{Everything, Nothing}, weights::Weight, }; use frame_support::weights::IdentityFee; use pallet_xcm::XcmPassthrough; use polkadot_parachain::primitives::Sibling; -use polkadot_runtime_common::impls::ToAuthor; use xcm::latest::prelude::*; use xcm_builder::{ AccountId32Aliases, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter, @@ -20,7 +18,7 @@ use xcm_builder::{ SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, }; -use xcm_executor::{traits::ShouldExecute, XcmExecutor}; +use xcm_executor::XcmExecutor; parameter_types! { pub const RelayLocation: MultiLocation = MultiLocation::parent(); diff --git a/parachains/runtimes/bridge-hubs/docs/bridge-hub-parachain-design.jpg b/parachains/runtimes/bridge-hubs/docs/bridge-hub-parachain-design.jpg new file mode 100644 index 0000000000..02feb11e10 Binary files /dev/null and b/parachains/runtimes/bridge-hubs/docs/bridge-hub-parachain-design.jpg differ