Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Bridge hub kusama/polkadot runtime upgrade with bridging #2528

Open
wants to merge 83 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 46 commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
a261ffb
Added bridging pallets to `BridgeHubKusama`
bkontur May 5, 2023
42d0367
Nits (merge before separatelly)
bkontur May 5, 2023
113b2ea
TODO: tmp - for polkadot
bkontur May 5, 2023
c4168db
TODO: tmp - will be replaced with git subtree update
bkontur May 5, 2023
c840a7e
Merge branch 'master' of https://github.com/paritytech/cumulus into HEAD
May 6, 2023
3c4937f
".git/.scripts/commands/bench/bench.sh" pallet bridge-hub-kusama brid…
May 6, 2023
6c012d3
".git/.scripts/commands/bench/bench.sh" pallet bridge-hub-kusama brid…
May 6, 2023
924975a
Merge remote-tracking branch 'origin/master' into bridge-hub-kusama-p…
bkontur May 9, 2023
96bab46
".git/.scripts/commands/bench/bench.sh" pallet bridge-hub-kusama brid…
May 9, 2023
082d219
Merge branch 'master' of https://github.com/paritytech/cumulus into HEAD
May 9, 2023
65cd9d5
".git/.scripts/commands/bench/bench.sh" xcm bridge-hub-kusama bridge-…
May 9, 2023
dd93ce0
Added bridging pallets to `BridgeHubPolkadot`
bkontur May 10, 2023
3db315a
Merge remote-tracking branch 'origin/master' into bridge-hub-kusama-p…
bkontur May 10, 2023
96845f7
".git/.scripts/commands/bench/bench.sh" pallet bridge-hub-polkadot br…
May 10, 2023
da8583e
".git/.scripts/commands/bench/bench.sh" pallet bridge-hub-polkadot br…
May 10, 2023
2f81d26
".git/.scripts/commands/bench/bench.sh" pallet bridge-hub-polkadot br…
May 10, 2023
4f355d6
".git/.scripts/commands/bench/bench.sh" pallet bridge-hub-polkadot br…
May 10, 2023
264de1b
".git/.scripts/commands/bench/bench.sh" xcm bridge-hub-polkadot bridg…
May 10, 2023
950f19f
Merge remote-tracking branch 'origin/master' into bridge-hub-kusama-p…
bkontur May 11, 2023
c440a69
Updated README.md and scripts for local run Kusama/Polkadot bridge an…
bkontur May 12, 2023
659c9f5
Small cosmetics for Rococo/Wococo bridge local run
bkontur May 12, 2023
f7718ed
Merge remote-tracking branch 'origin/master' into bridge-hub-kusama-p…
bkontur May 12, 2023
5fc3a6d
Merge remote-tracking branch 'origin/master' into bridge-hub-kusama-p…
bkontur May 17, 2023
f8d72e4
Fix
bkontur May 17, 2023
2144157
Merge remote-tracking branch 'origin/master' into bridge-hub-kusama-p…
bkontur May 17, 2023
15733a5
Refactored lane setup
bkontur May 17, 2023
69f388d
Merge remote-tracking branch 'origin/master' into bridge-hub-kusama-p…
bkontur May 18, 2023
3b57df0
Added tests
bkontur May 19, 2023
6e263ef
Merge remote-tracking branch 'origin/master' into bridge-hub-kusama-p…
bkontur May 19, 2023
975fbd3
Merge remote-tracking branch 'origin/master' into bridge-hub-kusama-p…
May 19, 2023
8749ac1
Merge remote-tracking branch 'origin/master' into bridge-hub-kusama-p…
May 19, 2023
0e13016
Change SA for Rococo/Statemine_1000 + removed `CheckedExtrinsic`
bkontur May 23, 2023
3695791
Removed `CheckedExtrinsic` from checked runtimes
bkontur May 23, 2023
af60a55
Merge remote-tracking branch 'origin/master' into bridge-hub-kusama-p…
bkontur May 23, 2023
1f53d17
Updated README.md
bkontur May 24, 2023
f3ffa07
Script nits with SA + TODOs update
bkontur May 24, 2023
638f514
Merge remote-tracking branch 'origin/master' into bridge-hub-kusama-p…
bkontur May 24, 2023
8b63678
merge master
joepetrowski Jun 2, 2023
5cf8502
Merge branch 'master' of github.com:paritytech/cumulus into bridge-hu…
acatangiu Jun 12, 2023
3b6d9b7
Fix test
bkontur Jun 13, 2023
f37d87e
Fixed test when WithUniqueTopic is not used (for polkadot)
bkontur Jun 13, 2023
afc1db2
Merge remote-tracking branch 'origin/master' into bridge-hub-kusama-p…
bkontur Jun 13, 2023
e8c9027
fixed PriorityBoostPerMessage constant
svyatonik Jun 13, 2023
5c7216c
trivial: use existing PARAS_PALLET_NAME constant
svyatonik Jun 13, 2023
437b80c
increased RelayerStakeLease constant value from 8 to 7_200
svyatonik Jun 13, 2023
e458304
changed RelayChainHeadersToKeep and ParachainHeadsToKeep constants to…
svyatonik Jun 13, 2023
df055bb
minor fix docs
acatangiu Jun 13, 2023
4eb5ef7
Merge remote-tracking branch 'origin/master' into bridge-hub-kusama-p…
Jun 14, 2023
d67d22d
Update parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/bridge_h…
bkontur Jun 15, 2023
1c613e1
Update parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/bridge_h…
bkontur Jun 15, 2023
85b133b
Update parachains/runtimes/bridge-hubs/bridge-hub-polkadot/tests/test…
bkontur Jun 15, 2023
3190f3f
Update parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/lib.rs
bkontur Jun 15, 2023
6c16a9d
Update parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/bridge_h…
bkontur Jun 15, 2023
a2ea275
Update parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/bridge_h…
bkontur Jun 15, 2023
53fd196
Update parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/lib.rs
bkontur Jun 15, 2023
541b9a3
Review fixes
bkontur Jun 15, 2023
cf5b411
Merge remote-tracking branch 'origin/bridge-hub-kusama-polkadot' into…
bkontur Jun 15, 2023
656689e
Merge remote-tracking branch 'origin/master' into bridge-hub-kusama-p…
bkontur Jun 15, 2023
62b21fd
Merge remote-tracking branch 'origin/master' into bridge-hub-kusama-p…
bkontur Jun 16, 2023
6791b8c
Fix compile
bkontur Jun 19, 2023
7624861
PR README/script fixes
bkontur Jun 19, 2023
5c37cff
Merge remote-tracking branch 'origin/master' into bridge-hub-kusama-p…
bkontur Jun 19, 2023
b9c400b
7_200 -> parachains_common::DAYS
svyatonik Jun 20, 2023
c7b4687
relayer required stake to be configured by governance
acatangiu Jul 3, 2023
659ffe0
Merge remote-tracking branch 'origin/master' into bridge-hub-kusama-p…
Jul 3, 2023
5fffb18
Added BridgeInstance to BridgeBlobDispatcher for BHK/P
bkontur Jul 4, 2023
8df7ec3
Merge remote-tracking branch 'origin/master' into bridge-hub-kusama-p…
bkontur Jul 4, 2023
3828fd1
Fix tests
bkontur Jul 4, 2023
689c668
Copyright
bkontur Jul 4, 2023
98883c5
Align "bridge hub" to "BridgeHub"
bkontur Jul 4, 2023
b49ee9f
Merge remote-tracking branch 'origin/master' into bridge-hub-kusama-p…
Jul 4, 2023
afe0b8f
Merge remote-tracking branch 'origin/master' into bridge-hub-kusama-p…
bkontur Jul 19, 2023
2e6b5ba
Merge remote-tracking branch 'origin/master' into bridge-hub-kusama-p…
bkontur Jul 19, 2023
2755ee8
Merge remote-tracking branch 'origin/master' into bridge-hub-kusama-p…
bkontur Jul 24, 2023
4ec0be6
Merge remote-tracking branch 'origin/master' into bridge-hub-kusama-p…
bkontur Jul 26, 2023
b312f18
Align REAMDE.md and scripts
bkontur Jul 26, 2023
1557c2c
Fix benchmarks for `register/deregister/slash_and_deregister`
bkontur Jul 31, 2023
9a667b6
Merge remote-tracking branch 'origin/master' into bridge-hub-kusama-p…
bkontur Jul 31, 2023
4416c0d
Merge remote-tracking branch 'origin/master' into bridge-hub-kusama-p…
bkontur Aug 10, 2023
e1d0001
BHK/P fixes
bkontur Aug 10, 2023
d701b6a
Merge remote-tracking branch 'origin/master' into bridge-hub-kusama-p…
bkontur Aug 16, 2023
d83c193
Merge remote-tracking branch 'origin/master' into bridge-hub-kusama-p…
bkontur Aug 17, 2023
69db677
Align with bridges subtree
bkontur Aug 17, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 78 additions & 1 deletion Cargo.lock

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

16 changes: 16 additions & 0 deletions parachains/integration-tests/emulated/common/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,14 @@ pub mod bridge_hub_kusama {
polkadot_xcm: bridge_hub_kusama_runtime::PolkadotXcmConfig {
safe_xcm_version: Some(SAFE_XCM_VERSION),
},
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()
},
};

genesis_config.build_storage().unwrap()
Expand Down Expand Up @@ -790,6 +798,14 @@ pub mod bridge_hub_polkadot {
polkadot_xcm: bridge_hub_polkadot_runtime::PolkadotXcmConfig {
safe_xcm_version: Some(SAFE_XCM_VERSION),
},
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()
},
};

genesis_config.build_storage().unwrap()
Expand Down
3 changes: 1 addition & 2 deletions parachains/runtimes/assets/asset-hub-kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -775,8 +775,7 @@ pub type SignedExtra = (
/// Unchecked extrinsic type as expected by this runtime.
pub type UncheckedExtrinsic =
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;
/// Extrinsic type that has already been checked.
pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, RuntimeCall, SignedExtra>;

/// Migrations to apply on runtime upgrade.
pub type Migrations = (pallet_collator_selection::migration::v1::MigrateToV1<Runtime>,);

Expand Down
3 changes: 1 addition & 2 deletions parachains/runtimes/assets/asset-hub-polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -789,8 +789,7 @@ pub type SignedExtra = (
/// Unchecked extrinsic type as expected by this runtime.
pub type UncheckedExtrinsic =
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;
/// Extrinsic type that has already been checked.
pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, RuntimeCall, SignedExtra>;

/// Migrations to apply on runtime upgrade.
pub type Migrations = (pallet_collator_selection::migration::v1::MigrateToV1<Runtime>,);

Expand Down
65 changes: 51 additions & 14 deletions parachains/runtimes/bridge-hubs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
+ [Send messages](#send-messages)
- [Local zombienet run](#local-zombienet-run)
- [Live Rockmine2 to Wockmint](#live-rockmine2-to-wockmint)
* [How to test local BridgeHubKusama](#how-to-test-local-bridgehubkusama)
* [How to test local BridgeHubPolkadot](#how-to-test-local-bridgehubpolkadot)
* [How to test locally Kusama <-> Polkadot bridge](#how-to-test-locally-kusama-----polkadot-bridge)
+ [1. Run chains (Kusama + BridgeHub, Polkadot + BridgeHub) with zombienet](#1-run-chains--kusama---bridgehub--polkadot---bridgehub--with-zombienet)
+ [2. Init bridge and run relayer (BridgeHubKusama, BridgeHubPolkadot)](#2-init-bridge-and-run-relayer--bridgehubkusama--bridgehubpolkadot-)
+ [3. Test bridge transfer](#3-test-bridge-transfer)

# Bridge-hub Parachains

Expand Down Expand Up @@ -234,22 +236,57 @@ RUST_LOG=runtime=trace,rpc=trace,bridge=trace \
- Wockmint (see `xcmpQueue.Success` for `transfer-asset` and `xcmpQueue.Fail` for `ping-via-bridge`) https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fws-wococo-wockmint-collator-node-0.parity-testnet.parity.io#/explorer
- BridgeHubRococo (see `bridgeWococoMessages.MessagesDelivered`)

## How to test local BridgeHubKusama
## How to test locally Kusama <-> Polkadot bridge

Check [requirements](#requirements-for-local-runtesting) for "sudo pallet + fast-runtime".

### 1. Run chains (Kusama + BridgeHub, Polkadot + BridgeHub) with zombienet

```
# Kusama + BridgeHubKusama + Statemine
POLKADOT_BINARY_PATH=~/local_bridge_testing/bin/polkadot \
POLKADOT_PARACHAIN_BINARY_PATH=~/local_bridge_testing/bin/polkadot-parachain \
POLKADOT_PARACHAIN_BINARY_PATH_FOR_STATEMINE=~/local_bridge_testing/bin/polkadot-parachain-mint \
~/local_bridge_testing/bin/zombienet-linux --provider native spawn ./zombienet/bridge-hubs/bridge_hub_kusama_local_network.toml
```

```
# TODO:check-parameter - once Statemint is ready, switch it here instead of Westmint
# Polkadot + BridgeHubPolkadot + Westmint
POLKADOT_BINARY_PATH=~/local_bridge_testing/bin/polkadot \
POLKADOT_PARACHAIN_BINARY_PATH=~/local_bridge_testing/bin/polkadot-parachain \
POLKADOT_PARACHAIN_BINARY_PATH_FOR_STATEMINT=~/local_bridge_testing/bin/polkadot-parachain-mint \
STATEMINT_CHAIN=westmint-local \
~/local_bridge_testing/bin/zombienet-linux --provider native spawn ./zombienet/bridge-hubs/bridge_hub_polkadot_local_network.toml
bkontur marked this conversation as resolved.
Show resolved Hide resolved
```
cd <base-cumulus-repo-directory>
cargo build --release -p polkadot-parachain-bin

# script expect to have pre-built polkadot binary on the path: ../polkadot/target/release/polkadot
# if using `kusama-local` / `polkadot-local`, build polkadot with `--features fast-runtime`
### 2. Init bridge and run relayer (BridgeHubKusama, BridgeHubPolkadot)

# BridgeHubKusama
zombienet-linux --provider native spawn ./zombienet/examples/bridge_hub_kusama_local_network.toml
```
cd <cumulus-git-repo-dir>
./scripts/bridges_kusama_polkadot.sh run-relay
```

or
### 3. Test bridge transfer

# BridgeHubPolkadot
zombienet-linux --provider native spawn ./zombienet/examples/bridge_hub_polkadot_local_network.toml
Allow bridge transfer on statemine/statemint (governance-like):
bkontur marked this conversation as resolved.
Show resolved Hide resolved
```
./scripts/bridges_kusama_polkadot.sh allow-transfers-local
```

## How to test local BridgeHubPolkadot
TODO: from master
Do (asset) transfer from statemine to statemint
bkontur marked this conversation as resolved.
Show resolved Hide resolved
```
./scripts/bridges_kusama_polkadot.sh transfer-asset-from-statemine-local
```

Do (ping) transfer from statemine to statemint
bkontur marked this conversation as resolved.
Show resolved Hide resolved
```
./scripts/bridges_kusama_polkadot.sh ping-via-bridge-from-statemine-local
```

- open explorers: (see zombienets)
- Statemine (see events `xcmpQueue.XcmpMessageSent`, `bridgeTransfer.ReserveAssetsDeposited`, `bridgeTransfer.TransferInitiated`) https://polkadot.js.org/apps/?rpc=ws://127.0.0.1:9910#/explorer
bkontur marked this conversation as resolved.
Show resolved Hide resolved
- BridgeHubKusama (see `bridgePolkadotMessages.MessageAccepted`) https://polkadot.js.org/apps/?rpc=ws://127.0.0.1:8943#/explorer
- BridgeHubPolkadot (see `bridgeKusamaMessages.MessagesReceived`) https://polkadot.js.org/apps/?rpc=ws://127.0.0.1:8945#/explorer
- Westmint (see `xcmpQueue.Success` for `transfer-asset` and `xcmpQueue.Fail` for `ping-via-bridge`) https://polkadot.js.org/apps/?rpc=ws://127.0.0.1:9010#/explorer
bkontur marked this conversation as resolved.
Show resolved Hide resolved
- BridgeHubKusama (see `bridgePolkadotMessages.MessagesDelivered`) https://polkadot.js.org/apps/?rpc=ws://127.0.0.1:8943#/explorer
42 changes: 42 additions & 0 deletions parachains/runtimes/bridge-hubs/bridge-hub-kusama/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,42 @@ pallet-collator-selection = { path = "../../../../pallets/collator-selection", d
parachain-info = { path = "../../../../parachains/pallets/parachain-info", default-features = false }
parachains-common = { path = "../../../../parachains/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-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 = { git = "https://github.com/paritytech/substrate", branch = "master" }

[features]
default = [
"std",
]
std = [
"bp-bridge-hub-kusama/std",
"bp-bridge-hub-polkadot/std",
"bp-messages/std",
"bp-parachains/std",
"bp-polkadot-core/std",
"bp-relayers/std",
"bp-runtime/std",
"bp-polkadot/std",
"bridge-runtime-common/std",
"codec/std",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"codec/std",
"codec/std",
"cumulus-pallet-parachain-system/std",

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"cumulus-pallet-parachain-system/std" is five lines bellow

"log/std",
"scale-info/std",
Expand All @@ -99,6 +127,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 @@ -131,12 +163,18 @@ std = [
]

runtime-benchmarks = [
"bridge-runtime-common/runtime-benchmarks",
"frame-benchmarking/runtime-benchmarks",
"frame-support/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-multisig/runtime-benchmarks",
"cumulus-pallet-parachain-system/runtime-benchmarks",
"pallet-timestamp/runtime-benchmarks",
"pallet-utility/runtime-benchmarks",
"pallet-xcm/runtime-benchmarks",
Expand All @@ -149,6 +187,10 @@ runtime-benchmarks = [
]

try-runtime = [
"pallet-bridge-grandpa/try-runtime",
"pallet-bridge-messages/try-runtime",
"pallet-bridge-parachains/try-runtime",
"pallet-bridge-relayers/try-runtime",
"cumulus-pallet-aura-ext/try-runtime",
"cumulus-pallet-dmp-queue/try-runtime",
"cumulus-pallet-parachain-system/try-runtime",
Expand Down
Loading