This repository was archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 373
Added new empty shell runtime for BridgeHubPolkadot (without bridging stuff) for onboarding parachain on Polkadot
#2137
Merged
Merged
Changes from 15 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
cc3459c
Added new empty shell runtime for `BridgeHubPolkadot` (without bridgi…
bkontur 6c05bc9
Fix benchmarks/try-runtime
bkontur 783e5db
".git/.scripts/commands/bench/bench.sh" pallet bridge-hub-polkadot br…
5c9834e
".git/.scripts/commands/bench/bench.sh" pallet bridge-hub-polkadot br…
863a3b5
Merge branch 'master' of https://github.com/paritytech/cumulus into HEAD
a03cf2d
".git/.scripts/commands/bench/bench.sh" pallet bridge-hub-polkadot br…
7d50ed3
".git/.scripts/commands/bench/bench.sh" pallet bridge-hub-polkadot br…
8e4a17f
Fixes
bkontur 49638be
".git/.scripts/commands/bench/bench.sh" pallet bridge-hub-polkadot br…
00e2533
".git/.scripts/commands/bench/bench.sh" pallet bridge-hub-polkadot br…
cd699f7
".git/.scripts/commands/bench/bench.sh" pallet bridge-hub-polkadot br…
0260645
Merge branch 'master' of https://github.com/paritytech/cumulus into HEAD
3c9656d
".git/.scripts/commands/bench/bench.sh" pallet bridge-hub-polkadot br…
71e7baf
Merge branch 'master' of https://github.com/paritytech/cumulus into HEAD
728f1ca
".git/.scripts/commands/bench/bench.sh" pallet bridge-hub-polkadot br…
728ac58
PR fixes
bkontur 488a4d7
Merge remote-tracking branch 'origin/master' into bko-bridge-hub-polk…
bkontur 16bf6d2
Rebase fix
bkontur af26254
Fix new runtime api
bkontur c7c2cf3
".git/.scripts/commands/bench/bench.sh" xcm bridge-hub-polkadot bridg…
82763cd
".git/.scripts/commands/bench/bench.sh" xcm bridge-hub-polkadot bridg…
fba5da5
Updated aura/bootNodes in `create_bridge_hub_polkadot_spec.sh`
bkontur File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,7 +20,7 @@ cd <base-cumulus-repo-directory> | |
| cargo build --release -p [email protected] | ||
|
|
||
| # script expect to have pre-built polkadot binary on the path: ../polkadot/target/release/polkadot | ||
| # if using kusama-local, build polkadot with `--features fast-runtime` | ||
| # if using `kusama-local` / `polkadot-local`, build polkadot with `--features fast-runtime` | ||
|
|
||
| # BridgeHubRococo | ||
| zombienet-linux --provider native spawn ./zombienet/examples/bridge_hub_rococo_local_network.toml | ||
|
|
@@ -29,4 +29,9 @@ zombienet-linux --provider native spawn ./zombienet/examples/bridge_hub_rococo_l | |
|
|
||
| # BridgeHubKusama | ||
| zombienet-linux --provider native spawn ./zombienet/examples/bridge_hub_kusama_local_network.toml | ||
|
|
||
| or | ||
|
|
||
| # BridgeHubPolkadot | ||
| zombienet-linux --provider native spawn ./zombienet/examples/bridge_hub_polkadot_local_network.toml | ||
| ``` | ||
169 changes: 169 additions & 0 deletions
169
parachains/runtimes/bridge-hubs/bridge-hub-polkadot/Cargo.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,169 @@ | ||
| [package] | ||
| name = "bridge-hub-polkadot-runtime" | ||
| version = "0.1.0" | ||
| authors = ["Parity Technologies <[email protected]>"] | ||
| edition = "2021" | ||
| description = "Polkadot's BridgeHub parachain runtime" | ||
|
|
||
| [build-dependencies] | ||
| substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", branch = "master" } | ||
|
|
||
| [dependencies] | ||
| codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } | ||
| hex-literal = { version = "0.3.4" } | ||
| log = { version = "0.4.17", default-features = false } | ||
| scale-info = { version = "2.3.1", default-features = false, features = ["derive"] } | ||
| serde = { version = "1.0.152", optional = true, features = ["derive"] } | ||
| smallvec = "1.8.1" | ||
|
|
||
| # Substrate | ||
| frame-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "master" } | ||
| frame-executive = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } | ||
| frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } | ||
| frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } | ||
| frame-system-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "master" } | ||
| frame-system-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } | ||
| frame-try-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "master" } | ||
| pallet-aura = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } | ||
| pallet-authorship = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } | ||
| pallet-balances = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } | ||
| pallet-multisig = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } | ||
| pallet-session = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } | ||
| pallet-sudo = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } | ||
| pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } | ||
| pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } | ||
| pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } | ||
| pallet-utility = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } | ||
| sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } | ||
| sp-block-builder = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } | ||
| sp-consensus-aura = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } | ||
| sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } | ||
| sp-inherents = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } | ||
| sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } | ||
| sp-offchain = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } | ||
| sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } | ||
| sp-session = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } | ||
| sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } | ||
| sp-transaction-pool = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } | ||
| sp-version = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } | ||
|
|
||
| # Polkadot | ||
| polkadot-runtime-constants = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } | ||
| pallet-xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } | ||
| pallet-xcm-benchmarks = { git = "https://github.com/paritytech/polkadot", branch = "master", default-features = false, optional = true } | ||
| polkadot-core-primitives = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } | ||
| polkadot-parachain = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } | ||
| polkadot-runtime-common = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } | ||
| xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } | ||
| xcm-builder = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } | ||
| xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } | ||
|
|
||
| # Cumulus | ||
| cumulus-pallet-aura-ext = { path = "../../../../pallets/aura-ext", default-features = false } | ||
| cumulus-pallet-dmp-queue = { path = "../../../../pallets/dmp-queue", default-features = false } | ||
| cumulus-pallet-parachain-system = { path = "../../../../pallets/parachain-system", default-features = false } | ||
| cumulus-pallet-session-benchmarking = {path = "../../../../pallets/session-benchmarking", default-features = false, version = "3.0.0"} | ||
| cumulus-pallet-xcm = { path = "../../../../pallets/xcm", default-features = false } | ||
| cumulus-pallet-xcmp-queue = { path = "../../../../pallets/xcmp-queue", default-features = false } | ||
| cumulus-primitives-core = { path = "../../../../primitives/core", default-features = false } | ||
| cumulus-primitives-timestamp = { path = "../../../../primitives/timestamp", default-features = false } | ||
| cumulus-primitives-utility = { path = "../../../../primitives/utility", default-features = false } | ||
| pallet-collator-selection = { path = "../../../../pallets/collator-selection", default-features = false } | ||
| parachain-info = { path = "../../../../parachains/pallets/parachain-info", default-features = false } | ||
| parachains-common = { path = "../../../../parachains/common", default-features = false } | ||
|
|
||
| [features] | ||
| default = [ | ||
| "std", | ||
| ] | ||
| std = [ | ||
| "codec/std", | ||
| "log/std", | ||
| "scale-info/std", | ||
| "serde", | ||
| "cumulus-pallet-aura-ext/std", | ||
| "cumulus-pallet-dmp-queue/std", | ||
| "cumulus-pallet-parachain-system/std", | ||
| "cumulus-pallet-xcm/std", | ||
| "cumulus-pallet-xcmp-queue/std", | ||
| "cumulus-primitives-core/std", | ||
| "cumulus-primitives-timestamp/std", | ||
| "cumulus-primitives-utility/std", | ||
| "frame-executive/std", | ||
| "frame-support/std", | ||
| "frame-system-rpc-runtime-api/std", | ||
| "frame-system/std", | ||
| "polkadot-runtime-constants/std", | ||
| "pallet-aura/std", | ||
| "pallet-authorship/std", | ||
| "pallet-balances/std", | ||
| "pallet-collator-selection/std", | ||
| "pallet-multisig/std", | ||
| "pallet-session/std", | ||
| "pallet-sudo/std", | ||
| "pallet-timestamp/std", | ||
| "pallet-transaction-payment-rpc-runtime-api/std", | ||
| "pallet-transaction-payment/std", | ||
| "pallet-utility/std", | ||
| "pallet-xcm/std", | ||
| "parachain-info/std", | ||
| "parachains-common/std", | ||
| "polkadot-core-primitives/std", | ||
| "polkadot-parachain/std", | ||
| "polkadot-runtime-common/std", | ||
| "sp-api/std", | ||
| "sp-block-builder/std", | ||
| "sp-consensus-aura/std", | ||
| "sp-core/std", | ||
| "sp-inherents/std", | ||
| "sp-io/std", | ||
| "sp-offchain/std", | ||
| "sp-runtime/std", | ||
| "sp-session/std", | ||
| "sp-std/std", | ||
| "sp-transaction-pool/std", | ||
| "sp-version/std", | ||
| "xcm-builder/std", | ||
| "xcm-executor/std", | ||
| "xcm/std", | ||
| ] | ||
|
|
||
| runtime-benchmarks = [ | ||
| "frame-benchmarking/runtime-benchmarks", | ||
| "frame-support/runtime-benchmarks", | ||
| "frame-system-benchmarking/runtime-benchmarks", | ||
| "frame-system/runtime-benchmarks", | ||
| "pallet-balances/runtime-benchmarks", | ||
| "pallet-multisig/runtime-benchmarks", | ||
| "pallet-timestamp/runtime-benchmarks", | ||
| "pallet-utility/runtime-benchmarks", | ||
| "pallet-xcm/runtime-benchmarks", | ||
| "sp-runtime/runtime-benchmarks", | ||
| "xcm-builder/runtime-benchmarks", | ||
| "cumulus-pallet-session-benchmarking/runtime-benchmarks", | ||
| "pallet-collator-selection/runtime-benchmarks", | ||
| "cumulus-pallet-xcmp-queue/runtime-benchmarks", | ||
| "pallet-xcm-benchmarks/runtime-benchmarks", | ||
| ] | ||
|
|
||
| try-runtime = [ | ||
| "cumulus-pallet-aura-ext/try-runtime", | ||
| "cumulus-pallet-dmp-queue/try-runtime", | ||
| "cumulus-pallet-parachain-system/try-runtime", | ||
| "cumulus-pallet-xcm/try-runtime", | ||
| "cumulus-pallet-xcmp-queue/try-runtime", | ||
| "frame-executive/try-runtime", | ||
| "frame-system/try-runtime", | ||
| "frame-try-runtime/try-runtime", | ||
| "pallet-aura/try-runtime", | ||
| "pallet-authorship/try-runtime", | ||
| "pallet-balances/try-runtime", | ||
| "pallet-collator-selection/try-runtime", | ||
| "pallet-multisig/try-runtime", | ||
| "pallet-session/try-runtime", | ||
| "pallet-timestamp/try-runtime", | ||
| "pallet-transaction-payment/try-runtime", | ||
| "pallet-utility/try-runtime", | ||
| "pallet-xcm/try-runtime", | ||
| "parachain-info/try-runtime", | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| use substrate_wasm_builder::WasmBuilder; | ||
|
|
||
| fn main() { | ||
| WasmBuilder::new() | ||
| .with_current_project() | ||
| .export_heap_base() | ||
| .import_memory() | ||
| .build() | ||
| } |
69 changes: 69 additions & 0 deletions
69
parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/constants.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| // Copyright (C) 2023 Parity Technologies (UK) Ltd. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| pub mod currency { | ||
| use polkadot_core_primitives::Balance; | ||
| use polkadot_runtime_constants as constants; | ||
|
|
||
| /// The existential deposit. Set to 1/10 of its parent Relay Chain. | ||
| pub const EXISTENTIAL_DEPOSIT: Balance = constants::currency::EXISTENTIAL_DEPOSIT / 10; | ||
|
|
||
| pub const UNITS: Balance = constants::currency::UNITS; | ||
| pub const CENTS: Balance = constants::currency::CENTS; | ||
| pub const MILLICENTS: Balance = constants::currency::MILLICENTS; | ||
|
|
||
| pub const fn deposit(items: u32, bytes: u32) -> Balance { | ||
| // 1/100 of Polkadot v9010 | ||
| constants::currency::deposit(items, bytes) / 100 | ||
| } | ||
| } | ||
|
|
||
| /// Fee-related. | ||
| pub mod fee { | ||
| use frame_support::weights::{ | ||
| constants::ExtrinsicBaseWeight, WeightToFeeCoefficient, WeightToFeeCoefficients, | ||
| WeightToFeePolynomial, | ||
| }; | ||
| use polkadot_core_primitives::Balance; | ||
| use smallvec::smallvec; | ||
| pub use sp_runtime::Perbill; | ||
|
|
||
| /// Handles converting a weight scalar to a fee value, based on the scale and granularity of the | ||
| /// node's balance type. | ||
| /// | ||
| /// This should typically create a mapping between the following ranges: | ||
| /// - [0, MAXIMUM_BLOCK_WEIGHT] | ||
| /// - [Balance::min, Balance::max] | ||
| /// | ||
| /// Yet, it can be used for any other sort of change to weight-fee. Some examples being: | ||
| /// - Setting it to `0` will essentially disable the weight fee. | ||
| /// - Setting it to `1` will cause the literal `#[weight = x]` values to be charged. | ||
| pub struct WeightToFee; | ||
| impl WeightToFeePolynomial for WeightToFee { | ||
| type Balance = Balance; | ||
| fn polynomial() -> WeightToFeeCoefficients<Self::Balance> { | ||
| // in Polkadot, extrinsic base weight (smallest non-zero weight) is mapped to 1/10 CENT: | ||
| // in BridgeHub, we map to 1/10 of that, or 1/100 CENT | ||
| let p = super::currency::CENTS; | ||
| let q = 100 * Balance::from(ExtrinsicBaseWeight::get().ref_time()); | ||
| smallvec![WeightToFeeCoefficient { | ||
| degree: 1, | ||
| negative: false, | ||
| coeff_frac: Perbill::from_rational(p % q, q), | ||
| coeff_integer: p / q, | ||
| }] | ||
| } | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.