[BridgeHub] Setup both rococo/wococo bridge grandpa/parachain pallets

This commit is contained in:
Branislav Kontur
2022-08-02 15:53:09 +02:00
parent 170c908a9f
commit 2def98a1ef
5 changed files with 55 additions and 18 deletions
+2
View File
@@ -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).
@@ -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
@@ -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<BridgeGrandpaWococoInstance> 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<BridgeGrandpaRococoInstance> 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<ParaId> = (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<BridgeParachainWococoInstance> for Runtime {
type WeightInfo = ();
type BridgesGrandpaPalletInstance = WococoGrandpaInstance;
type ParasPalletName = ParasPalletName;
type BridgesGrandpaPalletInstance = BridgeGrandpaWococoInstance;
type ParasPalletName = RococoBridgeParachainPalletName;
type TrackedParachains = IsInVec<GetTenFirstParachains>;
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<BridgeParachainRococoInstance> for Runtime {
type WeightInfo = ();
type BridgesGrandpaPalletInstance = BridgeGrandpaRococoInstance;
type ParasPalletName = WococoBridgeParachainPalletName;
type TrackedParachains = IsInVec<GetTenFirstParachains>;
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<T>, Origin} = 32,
DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event<T>} = 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::<Instance1>::{Pallet, Call, Storage},
BridgeWococoParachain: pallet_bridge_parachains::<Instance1>::{Pallet, Call, Storage},
// Rococo bridge modules
BridgeRococoGrandpa: pallet_bridge_grandpa::<Instance2>::{Pallet, Call, Storage},
BridgeRococoParachain: pallet_bridge_parachains::<Instance2>::{Pallet, Call, Storage},
}
);
@@ -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();
Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB