Skip to content

Commit

Permalink
Inject bridging pallets and cfg for BridgeHubWestend
Browse files Browse the repository at this point in the history
  • Loading branch information
bkontur committed Oct 24, 2023
1 parent e0620fd commit f941f65
Show file tree
Hide file tree
Showing 15 changed files with 1,946 additions and 116 deletions.
39 changes: 39 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,19 @@ members = [
"bridges/primitives/chain-asset-hub-kusama",
"bridges/primitives/chain-asset-hub-polkadot",
"bridges/primitives/chain-asset-hub-rococo",
"bridges/primitives/chain-asset-hub-westend",
"bridges/primitives/chain-asset-hub-wococo",
"bridges/primitives/chain-bridge-hub-cumulus",
"bridges/primitives/chain-bridge-hub-kusama",
"bridges/primitives/chain-bridge-hub-polkadot",
"bridges/primitives/chain-bridge-hub-rococo",
"bridges/primitives/chain-bridge-hub-westend",
"bridges/primitives/chain-bridge-hub-wococo",
"bridges/primitives/chain-kusama",
"bridges/primitives/chain-polkadot",
"bridges/primitives/chain-polkadot-bulletin",
"bridges/primitives/chain-rococo",
"bridges/primitives/chain-westend",
"bridges/primitives/chain-wococo",
"bridges/primitives/header-chain",
"bridges/primitives/messages",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,10 @@ parachains-common = { path = "../../../common", default-features = false }

# Bridges
bp-asset-hub-rococo = { path = "../../../../../bridges/primitives/chain-asset-hub-rococo", default-features = false }
bp-asset-hub-westend = { path = "../../../../../bridges/primitives/chain-asset-hub-westend", default-features = false }
bp-asset-hub-wococo = { path = "../../../../../bridges/primitives/chain-asset-hub-wococo", default-features = false }
bp-bridge-hub-rococo = { path = "../../../../../bridges/primitives/chain-bridge-hub-rococo", default-features = false }
bp-bridge-hub-westend = { path = "../../../../../bridges/primitives/chain-bridge-hub-westend", default-features = false }
bp-bridge-hub-wococo = { path = "../../../../../bridges/primitives/chain-bridge-hub-wococo", default-features = false }
bp-header-chain = { path = "../../../../../bridges/primitives/header-chain", default-features = false }
bp-messages = { path = "../../../../../bridges/primitives/messages", default-features = false }
Expand All @@ -84,6 +86,7 @@ bp-polkadot-core = { path = "../../../../../bridges/primitives/polkadot-core", d
bp-relayers = { path = "../../../../../bridges/primitives/relayers", default-features = false }
bp-runtime = { path = "../../../../../bridges/primitives/runtime", default-features = false }
bp-rococo = { path = "../../../../../bridges/primitives/chain-rococo", default-features = false }
bp-westend = { path = "../../../../../bridges/primitives/chain-westend", default-features = false }
bp-wococo = { path = "../../../../../bridges/primitives/chain-wococo", default-features = false }
pallet-bridge-grandpa = { path = "../../../../../bridges/modules/grandpa", default-features = false }
pallet-bridge-messages = { path = "../../../../../bridges/modules/messages", default-features = false }
Expand All @@ -101,8 +104,10 @@ sp-keyring = { path = "../../../../../substrate/primitives/keyring" }
default = [ "std" ]
std = [
"bp-asset-hub-rococo/std",
"bp-asset-hub-westend/std",
"bp-asset-hub-wococo/std",
"bp-bridge-hub-rococo/std",
"bp-bridge-hub-westend/std",
"bp-bridge-hub-wococo/std",
"bp-header-chain/std",
"bp-messages/std",
Expand All @@ -111,6 +116,7 @@ std = [
"bp-relayers/std",
"bp-rococo/std",
"bp-runtime/std",
"bp-westend/std",
"bp-wococo/std",
"bridge-runtime-common/std",
"codec/std",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ parameter_types! {
pub const MaxRococoParaHeadDataSize: u32 = bp_rococo::MAX_NESTED_PARACHAIN_HEAD_DATA_SIZE;
pub const WococoBridgeParachainPalletName: &'static str = "Paras";
pub const MaxWococoParaHeadDataSize: u32 = bp_wococo::MAX_NESTED_PARACHAIN_HEAD_DATA_SIZE;
pub const WestendBridgeParachainPalletName: &'static str = "Paras";
pub const MaxWestendParaHeadDataSize: u32 = bp_westend::MAX_NESTED_PARACHAIN_HEAD_DATA_SIZE;

pub storage RequiredStakeForStakeAndSlash: Balance = 1_000_000;
pub const RelayerStakeLease: u32 = 8;
Expand Down Expand Up @@ -87,6 +89,29 @@ impl pallet_bridge_parachains::Config<BridgeParachainRococoInstance> for Runtime
type MaxParaHeadDataSize = MaxRococoParaHeadDataSize;
}

/// Add GRANDPA bridge pallet to track Westend relay chain.
pub type BridgeGrandpaWestendInstance = pallet_bridge_grandpa::Instance3;
impl pallet_bridge_grandpa::Config<BridgeGrandpaWestendInstance> for Runtime {
type RuntimeEvent = RuntimeEvent;
type BridgedChain = bp_westend::Westend;
type MaxFreeMandatoryHeadersPerBlock = ConstU32<4>;
type HeadersToKeep = RelayChainHeadersToKeep;
type WeightInfo = weights::pallet_bridge_grandpa_westend_finality::WeightInfo<Runtime>;
}

/// Add parachain bridge pallet to track Westend BridgeHub parachain
pub type BridgeParachainWestendInstance = pallet_bridge_parachains::Instance3;
impl pallet_bridge_parachains::Config<BridgeParachainWestendInstance> for Runtime {
type RuntimeEvent = RuntimeEvent;
type WeightInfo = weights::pallet_bridge_parachains_within_westend::WeightInfo<Runtime>;
type BridgesGrandpaPalletInstance = BridgeGrandpaWestendInstance;
type ParasPalletName = WestendBridgeParachainPalletName;
type ParaStoredHeaderDataBuilder =
SingleParaStoredHeaderDataBuilder<bp_bridge_hub_westend::BridgeHubWestend>;
type HeadsToKeep = ParachainHeadsToKeep;
type MaxParaHeadDataSize = MaxWestendParaHeadDataSize;
}

/// Allows collect and claim rewards for relayers
impl pallet_bridge_relayers::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
Expand Down
Loading

0 comments on commit f941f65

Please sign in to comment.