This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 378
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BridgeHub] Added bridge-hub-kusama - empty runtime/chain_spec setup
- Loading branch information
Showing
19 changed files
with
1,502 additions
and
40 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 @@ | ||
TODO: setup |
144 changes: 144 additions & 0 deletions
144
parachains/runtimes/bridge-hubs/bridge-hub-kusama/Cargo.toml
This file contains 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,144 @@ | ||
[package] | ||
name = "bridge-hub-kusama-runtime" | ||
version = "0.1.0" | ||
authors = ["Parity Technologies <admin@parity.io>"] | ||
edition = "2021" | ||
description = "Kusama'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", optional = true } | ||
log = { version = "0.4.17", default-features = false } | ||
scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } | ||
serde = { version = "1.0.137", 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-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" } | ||
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 | ||
kusama-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" } | ||
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", | ||
"kusama-runtime-constants/std", | ||
"pallet-aura/std", | ||
"pallet-authorship/std", | ||
"pallet-balances/std", | ||
"pallet-collator-selection/std", | ||
"pallet-session/std", | ||
"pallet-sudo/std", | ||
"pallet-timestamp/std", | ||
"pallet-transaction-payment-rpc-runtime-api/std", | ||
"pallet-transaction-payment/std", | ||
"pallet-xcm/std", | ||
"parachain-info/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 = [ | ||
"hex-literal", | ||
"frame-benchmarking/runtime-benchmarks", | ||
"frame-support/runtime-benchmarks", | ||
"frame-system-benchmarking", | ||
"frame-system/runtime-benchmarks", | ||
"pallet-balances/runtime-benchmarks", | ||
"pallet-collator-selection/runtime-benchmarks", | ||
"pallet-timestamp/runtime-benchmarks", | ||
"pallet-xcm/runtime-benchmarks", | ||
"sp-runtime/runtime-benchmarks", | ||
"xcm-builder/runtime-benchmarks", | ||
"cumulus-pallet-session-benchmarking/runtime-benchmarks", | ||
"cumulus-pallet-xcmp-queue/runtime-benchmarks", | ||
] | ||
|
||
try-runtime = [ | ||
"frame-executive/try-runtime", | ||
"frame-try-runtime", | ||
] |
This file contains 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() | ||
} |
63 changes: 63 additions & 0 deletions
63
parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/constants.rs
This file contains 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,63 @@ | ||
// Copyright (C) 2022 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 kusama_runtime_constants as constants; | ||
use polkadot_core_primitives::Balance; | ||
|
||
/// The existential deposit. Set to 1/10 of its parent Relay Chain. | ||
pub const EXISTENTIAL_DEPOSIT: Balance = constants::currency::EXISTENTIAL_DEPOSIT / 10; | ||
|
||
pub const CENTS: Balance = constants::currency::CENTS; | ||
pub const MILLICENTS: Balance = constants::currency::MILLICENTS; | ||
} | ||
|
||
/// 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 Kusama, 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.