Skip to content

Commit

Permalink
Kusama/Polkadot BridgeHub allows bridging between Kusama/Polkadot (re…
Browse files Browse the repository at this point in the history
…lay, para) chains

Add bridging pallets to Bridge Hub runtime configuration:
- `pallet-bridge-grandpa` is an on-chain GRANDPA light client, used for verifying GRANDPA finality proofs on-chain.
- `pallet-bridge-parachains` is a Parachain finality module.
- `pallet-bridge-messages` module that allows sending and receiving messages using lane concept.
- `pallet-bridge-relayers` module that is used to store relayer rewards.

Kusma Bridge Hub and Polkadot Bridge Hub runtimes are configred with those pallets in the way that:
- allows to verify bridged relay chain GRANDPA finality proofs, e.g. Kusama Bridge Hub can track and verify Polkadot relay chain GRANDPA proofs and Polkadot Bridge Hub can track and verify Kusama relay chain GRANDPA proofs.
- allows to verify bridged parachain finality proofs e.g. Kusama Bridge Hub can track and verify Polkadot Bridge Hub proofs and vice versa.
- allows to relay messages between them which can be verified with mentioned finality modules.

Add tests for simulation:
- handling `ExportMessage` on both sides
- handling message dispatch and routing to target on both side
- relayer can submit proofs with `submit_finality_proof` / `submit_parachain_heads` and relay messages with `receive_messages_proof`

To the lane concept mentioned above, actual bridging configuration allows to send/relay/receive messages only with one hard-coded lane `[0, 0, 0, 0]`,
which is dedicated lane for Kusama Asset Hub and Polkadot Asset Hub communication.

Next stage will be focused on adding support to allow bridging between arbitrary parachains.
More about [Bridges V2](https://github.com/paritytech/parity-bridges-common/milestone/17).

Signed-off-by: Branislav Kontur <bkontur@gmail.com>
Signed-off-by: Adrian Catangiu <adrian@parity.io>
Signed-off-by: Svyatoslav Nikolsky <svyatonik@gmail.com>
Signed-off-by: Serban Iorga <serban@parity.io>

Co-authored-by: Adrian Catangiu <adrian@parity.io>
Co-authored-by: Svyatoslav Nikolsky <svyatonik@gmail.com>
Co-authored-by: Serban Iorga <serban@parity.io>
  • Loading branch information
4 people authored and claravanstaden committed Sep 19, 2023
1 parent f85ee91 commit 92a75db
Show file tree
Hide file tree
Showing 33 changed files with 3,034 additions and 69 deletions.
35 changes: 34 additions & 1 deletion Cargo.lock

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

Original file line number Diff line number Diff line change
Expand Up @@ -966,6 +966,14 @@ pub mod bridge_hub_kusama {
safe_xcm_version: Some(SAFE_XCM_VERSION),
..Default::default()
},
bridge_polkadot_grandpa: bridge_hub_kusama_runtime::BridgePolkadotGrandpaConfig {
owner: Some(get_account_id_from_seed::<sr25519::Public>(accounts::BOB)),
..Default::default()
},
bridge_polkadot_messages: bridge_hub_kusama_runtime::BridgePolkadotMessagesConfig {
owner: Some(get_account_id_from_seed::<sr25519::Public>(accounts::BOB)),
..Default::default()
},
..Default::default()
};

Expand Down Expand Up @@ -1023,6 +1031,14 @@ pub mod bridge_hub_polkadot {
safe_xcm_version: Some(SAFE_XCM_VERSION),
..Default::default()
},
bridge_kusama_grandpa: bridge_hub_polkadot_runtime::BridgeKusamaGrandpaConfig {
owner: Some(get_account_id_from_seed::<sr25519::Public>(accounts::BOB)),
..Default::default()
},
bridge_kusama_messages: bridge_hub_polkadot_runtime::BridgeKusamaMessagesConfig {
owner: Some(get_account_id_from_seed::<sr25519::Public>(accounts::BOB)),
..Default::default()
},
..Default::default()
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,42 @@ pallet-collator-selection = { path = "../../../../pallets/collator-selection", d
parachain-info = { path = "../../../pallets/parachain-info", default-features = false }
parachains-common = { path = "../../../common", default-features = false }

# Bridges
bp-bridge-hub-kusama = { path = "../../../../bridges/primitives/chain-bridge-hub-kusama", default-features = false }
bp-bridge-hub-polkadot = { path = "../../../../bridges/primitives/chain-bridge-hub-polkadot", default-features = false }
bp-header-chain = { path = "../../../../bridges/primitives/header-chain", default-features = false }
bp-messages = { path = "../../../../bridges/primitives/messages", default-features = false }
bp-parachains = { path = "../../../../bridges/primitives/parachains", default-features = false }
bp-polkadot-core = { path = "../../../../bridges/primitives/polkadot-core", default-features = false }
bp-relayers = { path = "../../../../bridges/primitives/relayers", default-features = false }
bp-runtime = { path = "../../../../bridges/primitives/runtime", default-features = false }
bp-polkadot = { path = "../../../../bridges/primitives/chain-polkadot", default-features = false }
bridge-runtime-common = { path = "../../../../bridges/bin/runtime-common", default-features = false }
pallet-bridge-grandpa = { path = "../../../../bridges/modules/grandpa", default-features = false }
pallet-bridge-messages = { path = "../../../../bridges/modules/messages", default-features = false }
pallet-bridge-parachains = { path = "../../../../bridges/modules/parachains", default-features = false }
pallet-bridge-relayers = { path = "../../../../bridges/modules/relayers", default-features = false }

[dev-dependencies]
static_assertions = "1.1"
bridge-hub-test-utils = { path = "../test-utils" }
bridge-runtime-common = { path = "../../../../bridges/bin/runtime-common", features = ["integrity-test"] }
bp-kusama = { path = "../../../../bridges/primitives/chain-kusama" }
sp-keyring = { path = "../../../../../substrate/primitives/keyring" }

[features]
default = [ "std" ]
std = [
"bp-bridge-hub-kusama/std",
"bp-bridge-hub-polkadot/std",
"bp-header-chain/std",
"bp-messages/std",
"bp-parachains/std",
"bp-polkadot-core/std",
"bp-polkadot/std",
"bp-relayers/std",
"bp-runtime/std",
"bridge-runtime-common/std",
"codec/std",
"cumulus-pallet-aura-ext/std",
"cumulus-pallet-dmp-queue/std",
Expand All @@ -98,6 +128,10 @@ std = [
"pallet-aura/std",
"pallet-authorship/std",
"pallet-balances/std",
"pallet-bridge-grandpa/std",
"pallet-bridge-messages/std",
"pallet-bridge-parachains/std",
"pallet-bridge-relayers/std",
"pallet-collator-selection/std",
"pallet-multisig/std",
"pallet-session/std",
Expand Down Expand Up @@ -134,6 +168,7 @@ std = [
]

runtime-benchmarks = [
"bridge-runtime-common/runtime-benchmarks",
"cumulus-pallet-parachain-system/runtime-benchmarks",
"cumulus-pallet-session-benchmarking/runtime-benchmarks",
"cumulus-pallet-xcmp-queue/runtime-benchmarks",
Expand All @@ -142,6 +177,10 @@ runtime-benchmarks = [
"frame-system-benchmarking/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
"pallet-bridge-grandpa/runtime-benchmarks",
"pallet-bridge-messages/runtime-benchmarks",
"pallet-bridge-parachains/runtime-benchmarks",
"pallet-bridge-relayers/runtime-benchmarks",
"pallet-collator-selection/runtime-benchmarks",
"pallet-multisig/runtime-benchmarks",
"pallet-timestamp/runtime-benchmarks",
Expand All @@ -168,6 +207,10 @@ try-runtime = [
"pallet-aura/try-runtime",
"pallet-authorship/try-runtime",
"pallet-balances/try-runtime",
"pallet-bridge-grandpa/try-runtime",
"pallet-bridge-messages/try-runtime",
"pallet-bridge-parachains/try-runtime",
"pallet-bridge-relayers/try-runtime",
"pallet-collator-selection/try-runtime",
"pallet-multisig/try-runtime",
"pallet-session/try-runtime",
Expand Down
Loading

0 comments on commit 92a75db

Please sign in to comment.