Move Relay-Specific Shared Code to One Place (#1193)

* add common libs

* asset hubs

* add westend

* bridge hubs

* collectives

* contracts

* emulated tests

* parachain bin

* delete collectives constants and update docs

* integration tests should have apache license (some missing, some needed changing)

* propagate features

* fmt
This commit is contained in:
joe petrowski
2023-09-05 08:13:19 +02:00
committed by GitHub
parent 7217a5da65
commit a14691804d
68 changed files with 523 additions and 998 deletions
Generated
+6
View File
@@ -10978,6 +10978,7 @@ dependencies = [
"cumulus-primitives-utility", "cumulus-primitives-utility",
"frame-support", "frame-support",
"frame-system", "frame-system",
"kusama-runtime-constants",
"log", "log",
"num-traits", "num-traits",
"pallet-asset-tx-payment", "pallet-asset-tx-payment",
@@ -10986,8 +10987,12 @@ dependencies = [
"pallet-balances", "pallet-balances",
"pallet-collator-selection", "pallet-collator-selection",
"parity-scale-codec", "parity-scale-codec",
"polkadot-core-primitives",
"polkadot-primitives", "polkadot-primitives",
"polkadot-runtime-constants",
"rococo-runtime-constants",
"scale-info", "scale-info",
"smallvec",
"sp-consensus-aura", "sp-consensus-aura",
"sp-core", "sp-core",
"sp-io", "sp-io",
@@ -10997,6 +11002,7 @@ dependencies = [
"staging-xcm-builder", "staging-xcm-builder",
"staging-xcm-executor", "staging-xcm-executor",
"substrate-wasm-builder", "substrate-wasm-builder",
"westend-runtime-constants",
] ]
[[package]] [[package]]
+11
View File
@@ -13,6 +13,7 @@ codec = { package = "parity-scale-codec", version = "3.0.0", features = ["derive
log = { version = "0.4.19", default-features = false } log = { version = "0.4.19", default-features = false }
scale-info = { version = "2.9.0", default-features = false, features = ["derive"] } scale-info = { version = "2.9.0", default-features = false, features = ["derive"] }
num-traits = { version = "0.2", default-features = false} num-traits = { version = "0.2", default-features = false}
smallvec = "1.11.0"
# Substrate # Substrate
frame-support = { path = "../../../substrate/frame/support", default-features = false } frame-support = { path = "../../../substrate/frame/support", default-features = false }
@@ -28,6 +29,11 @@ sp-runtime = { path = "../../../substrate/primitives/runtime", default-features
sp-std = { path = "../../../substrate/primitives/std", default-features = false } sp-std = { path = "../../../substrate/primitives/std", default-features = false }
# Polkadot # Polkadot
kusama-runtime-constants = { path = "../../../polkadot/runtime/kusama/constants", default-features = false}
polkadot-runtime-constants = { path = "../../../polkadot/runtime/polkadot/constants", default-features = false}
rococo-runtime-constants = { path = "../../../polkadot/runtime/rococo/constants", default-features = false}
westend-runtime-constants = { path = "../../../polkadot/runtime/westend/constants", default-features = false}
polkadot-core-primitives = { path = "../../../polkadot/core-primitives", default-features = false}
polkadot-primitives = { path = "../../../polkadot/primitives", default-features = false} polkadot-primitives = { path = "../../../polkadot/primitives", default-features = false}
xcm = { package = "staging-xcm", path = "../../../polkadot/xcm", default-features = false} xcm = { package = "staging-xcm", path = "../../../polkadot/xcm", default-features = false}
xcm-builder = { package = "staging-xcm-builder", path = "../../../polkadot/xcm/xcm-builder", default-features = false} xcm-builder = { package = "staging-xcm-builder", path = "../../../polkadot/xcm/xcm-builder", default-features = false}
@@ -52,18 +58,23 @@ std = [
"cumulus-primitives-utility/std", "cumulus-primitives-utility/std",
"frame-support/std", "frame-support/std",
"frame-system/std", "frame-system/std",
"kusama-runtime-constants/std",
"log/std", "log/std",
"pallet-asset-tx-payment/std", "pallet-asset-tx-payment/std",
"pallet-assets/std", "pallet-assets/std",
"pallet-authorship/std", "pallet-authorship/std",
"pallet-balances/std", "pallet-balances/std",
"pallet-collator-selection/std", "pallet-collator-selection/std",
"polkadot-core-primitives/std",
"polkadot-primitives/std", "polkadot-primitives/std",
"polkadot-runtime-constants/std",
"rococo-runtime-constants/std",
"sp-consensus-aura/std", "sp-consensus-aura/std",
"sp-core/std", "sp-core/std",
"sp-io/std", "sp-io/std",
"sp-runtime/std", "sp-runtime/std",
"sp-std/std", "sp-std/std",
"westend-runtime-constants/std",
"xcm-builder/std", "xcm-builder/std",
"xcm-executor/std", "xcm-executor/std",
"xcm/std", "xcm/std",
@@ -13,6 +13,19 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
/// Consensus-related.
pub mod consensus {
/// Maximum number of blocks simultaneously accepted by the Runtime, not yet included
/// into the relay chain.
pub const UNINCLUDED_SEGMENT_CAPACITY: u32 = 1;
/// How many parachain blocks are processed by the relay chain per parent. Limits the
/// number of blocks authored per slot.
pub const BLOCK_PROCESSING_VELOCITY: u32 = 1;
/// Relay chain slot duration, in milliseconds.
pub const RELAY_CHAIN_SLOT_DURATION_MILLIS: u32 = 6000;
}
/// Constants relating to KSM.
pub mod currency { pub mod currency {
use kusama_runtime_constants as constants; use kusama_runtime_constants as constants;
use polkadot_core_primitives::Balance; use polkadot_core_primitives::Balance;
@@ -31,7 +44,7 @@ pub mod currency {
} }
} }
/// Fee-related. /// Constants related to Kusama fee payment.
pub mod fee { pub mod fee {
use frame_support::{ use frame_support::{
pallet_prelude::Weight, pallet_prelude::Weight,
@@ -75,8 +88,8 @@ pub mod fee {
impl WeightToFeePolynomial for RefTimeToFee { impl WeightToFeePolynomial for RefTimeToFee {
type Balance = Balance; type Balance = Balance;
fn polynomial() -> WeightToFeeCoefficients<Self::Balance> { fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {
// in Kusama, extrinsic base weight (smallest non-zero weight) is mapped to 1/10 CENT: // In Kusama, extrinsic base weight (smallest non-zero weight) is mapped to 1/10 CENT:
// in Rococo Contracts, we map to 1/10 of that, or 1/100 CENT // The standard system parachain configuration is 1/10 of that, as in 1/100 CENT.
let p = super::currency::CENTS; let p = super::currency::CENTS;
let q = 100 * Balance::from(ExtrinsicBaseWeight::get().ref_time()); let q = 100 * Balance::from(ExtrinsicBaseWeight::get().ref_time());
@@ -107,15 +120,3 @@ pub mod fee {
} }
} }
} }
/// Consensus-related.
pub mod consensus {
/// Maximum number of blocks simultaneously accepted by the Runtime, not yet included
/// into the relay chain.
pub const UNINCLUDED_SEGMENT_CAPACITY: u32 = 1;
/// How many parachain blocks are processed by the relay chain per parent. Limits the
/// number of blocks authored per slot.
pub const BLOCK_PROCESSING_VELOCITY: u32 = 1;
/// Relay chain slot duration, in milliseconds.
pub const RELAY_CHAIN_SLOT_DURATION_MILLIS: u32 = 6000;
}
+4
View File
@@ -16,6 +16,10 @@
#![cfg_attr(not(feature = "std"), no_std)] #![cfg_attr(not(feature = "std"), no_std)]
pub mod impls; pub mod impls;
pub mod kusama;
pub mod polkadot;
pub mod rococo;
pub mod westend;
pub mod xcm_config; pub mod xcm_config;
pub use constants::*; pub use constants::*;
pub use opaque::*; pub use opaque::*;
@@ -13,6 +13,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
/// Universally recognized accounts.
pub mod account { pub mod account {
use frame_support::PalletId; use frame_support::PalletId;
@@ -28,6 +29,19 @@ pub mod account {
pub const REFERENDA_PALLET_ID: PalletId = PalletId(*b"py/refer"); pub const REFERENDA_PALLET_ID: PalletId = PalletId(*b"py/refer");
} }
/// Consensus-related.
pub mod consensus {
/// Maximum number of blocks simultaneously accepted by the Runtime, not yet included
/// into the relay chain.
pub const UNINCLUDED_SEGMENT_CAPACITY: u32 = 1;
/// How many parachain blocks are processed by the relay chain per parent. Limits the
/// number of blocks authored per slot.
pub const BLOCK_PROCESSING_VELOCITY: u32 = 1;
/// Relay chain slot duration, in milliseconds.
pub const RELAY_CHAIN_SLOT_DURATION_MILLIS: u32 = 6000;
}
/// Constants relating to DOT.
pub mod currency { pub mod currency {
use polkadot_core_primitives::Balance; use polkadot_core_primitives::Balance;
use polkadot_runtime_constants as constants; use polkadot_runtime_constants as constants;
@@ -41,12 +55,12 @@ pub mod currency {
pub const MILLICENTS: Balance = constants::currency::MILLICENTS; pub const MILLICENTS: Balance = constants::currency::MILLICENTS;
pub const fn deposit(items: u32, bytes: u32) -> Balance { pub const fn deposit(items: u32, bytes: u32) -> Balance {
// 1/100 of Polkadot. // 1/100 of Polkadot
constants::currency::deposit(items, bytes) / 100 constants::currency::deposit(items, bytes) / 100
} }
} }
/// Fee-related. /// Constants related to Polkadot fee payment.
pub mod fee { pub mod fee {
use frame_support::{ use frame_support::{
pallet_prelude::Weight, pallet_prelude::Weight,
@@ -90,8 +104,8 @@ pub mod fee {
impl WeightToFeePolynomial for RefTimeToFee { impl WeightToFeePolynomial for RefTimeToFee {
type Balance = Balance; type Balance = Balance;
fn polynomial() -> WeightToFeeCoefficients<Self::Balance> { fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {
// in Polkadot, extrinsic base weight (smallest non-zero weight) is mapped to 1/10 CENT: // In Polkadot, extrinsic base weight (smallest non-zero weight) is mapped to 1/10 CENT:
// in a parachain, we map to 1/10 of that, or 1/100 CENT // The standard system parachain configuration is 1/10 of that, as in 1/100 CENT.
let p = super::currency::CENTS; let p = super::currency::CENTS;
let q = 100 * Balance::from(ExtrinsicBaseWeight::get().ref_time()); let q = 100 * Balance::from(ExtrinsicBaseWeight::get().ref_time());
@@ -122,15 +136,3 @@ pub mod fee {
} }
} }
} }
/// Consensus-related.
pub mod consensus {
/// Maximum number of blocks simultaneously accepted by the Runtime, not yet included
/// into the relay chain.
pub const UNINCLUDED_SEGMENT_CAPACITY: u32 = 1;
/// How many parachain blocks are processed by the relay chain per parent. Limits the
/// number of blocks authored per slot.
pub const BLOCK_PROCESSING_VELOCITY: u32 = 1;
/// Relay chain slot duration, in milliseconds.
pub const RELAY_CHAIN_SLOT_DURATION_MILLIS: u32 = 6000;
}
@@ -73,8 +73,8 @@ pub mod fee {
impl WeightToFeePolynomial for RefTimeToFee { impl WeightToFeePolynomial for RefTimeToFee {
type Balance = Balance; type Balance = Balance;
fn polynomial() -> WeightToFeeCoefficients<Self::Balance> { fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {
// in Rococo, extrinsic base weight (smallest non-zero weight) is mapped to 1/10 CENT: // In Rococo, extrinsic base weight (smallest non-zero weight) is mapped to 1/10 CENT:
// in Bridge Hub, we map to 1/10 of that, or 1/100 CENT // The standard system parachain configuration is 1/10 of that, as in 1/100 CENT.
let p = super::currency::CENTS; let p = super::currency::CENTS;
let q = 100 * Balance::from(ExtrinsicBaseWeight::get().ref_time()); let q = 100 * Balance::from(ExtrinsicBaseWeight::get().ref_time());
@@ -75,8 +75,8 @@ pub mod fee {
impl WeightToFeePolynomial for RefTimeToFee { impl WeightToFeePolynomial for RefTimeToFee {
type Balance = Balance; type Balance = Balance;
fn polynomial() -> WeightToFeeCoefficients<Self::Balance> { fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {
// in Westend, extrinsic base weight (smallest non-zero weight) is mapped to 1/10 CENT: // In Westend, extrinsic base weight (smallest non-zero weight) is mapped to 1/10 CENT:
// in Asset Hub, we map to 1/10 of that, or 1/100 CENT // The standard system parachain configuration is 1/10 of that, as in 1/100 CENT.
let p = super::currency::CENTS; let p = super::currency::CENTS;
let q = 100 * Balance::from(ExtrinsicBaseWeight::get().ref_time()); let q = 100 * Balance::from(ExtrinsicBaseWeight::get().ref_time());
@@ -3,6 +3,7 @@ name = "asset-hub-kusama-integration-tests"
version = "1.0.0" version = "1.0.0"
authors.workspace = true authors.workspace = true
edition.workspace = true edition.workspace = true
license = "Apache-2.0"
description = "Asset Hub Kusama runtime integration tests with xcm-emulator" description = "Asset Hub Kusama runtime integration tests with xcm-emulator"
publish = false publish = false
@@ -1,18 +1,17 @@
// Copyright (C) Parity Technologies (UK) Ltd. // Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus. // SPDX-License-Identifier: Apache-2.0
// Cumulus is free software: you can redistribute it and/or modify // Licensed under the Apache License, Version 2.0 (the "License");
// it under the terms of the GNU General Public License as published by // you may not use this file except in compliance with the License.
// the Free Software Foundation, either version 3 of the License, or // You may obtain a copy of the License at
// (at your option) any later version. //
// http://www.apache.org/licenses/LICENSE-2.0
// Cumulus is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of // Unless required by applicable law or agreed to in writing, software
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // distributed under the License is distributed on an "AS IS" BASIS,
// GNU General Public License for more details. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// You should have received a copy of the GNU General Public License // limitations under the License.
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
pub use codec::Encode; pub use codec::Encode;
pub use frame_support::{ pub use frame_support::{
@@ -1,18 +1,17 @@
// Copyright (C) Parity Technologies (UK) Ltd. // Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus. // SPDX-License-Identifier: Apache-2.0
// Cumulus is free software: you can redistribute it and/or modify // Licensed under the Apache License, Version 2.0 (the "License");
// it under the terms of the GNU General Public License as published by // you may not use this file except in compliance with the License.
// the Free Software Foundation, either version 3 of the License, or // You may obtain a copy of the License at
// (at your option) any later version. //
// http://www.apache.org/licenses/LICENSE-2.0
// Cumulus is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of // Unless required by applicable law or agreed to in writing, software
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // distributed under the License is distributed on an "AS IS" BASIS,
// GNU General Public License for more details. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// You should have received a copy of the GNU General Public License // limitations under the License.
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
use crate::*; use crate::*;
@@ -1,18 +1,17 @@
// Copyright (C) Parity Technologies (UK) Ltd. // Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus. // SPDX-License-Identifier: Apache-2.0
// Cumulus is free software: you can redistribute it and/or modify // Licensed under the Apache License, Version 2.0 (the "License");
// it under the terms of the GNU General Public License as published by // you may not use this file except in compliance with the License.
// the Free Software Foundation, either version 3 of the License, or // You may obtain a copy of the License at
// (at your option) any later version. //
// http://www.apache.org/licenses/LICENSE-2.0
// Cumulus is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of // Unless required by applicable law or agreed to in writing, software
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // distributed under the License is distributed on an "AS IS" BASIS,
// GNU General Public License for more details. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// You should have received a copy of the GNU General Public License // limitations under the License.
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
mod hrmp_channels; mod hrmp_channels;
mod reserve_transfer; mod reserve_transfer;
@@ -1,18 +1,17 @@
// Copyright (C) Parity Technologies (UK) Ltd. // Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus. // SPDX-License-Identifier: Apache-2.0
// Cumulus is free software: you can redistribute it and/or modify // Licensed under the Apache License, Version 2.0 (the "License");
// it under the terms of the GNU General Public License as published by // you may not use this file except in compliance with the License.
// the Free Software Foundation, either version 3 of the License, or // You may obtain a copy of the License at
// (at your option) any later version. //
// http://www.apache.org/licenses/LICENSE-2.0
// Cumulus is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of // Unless required by applicable law or agreed to in writing, software
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // distributed under the License is distributed on an "AS IS" BASIS,
// GNU General Public License for more details. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// You should have received a copy of the GNU General Public License // limitations under the License.
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
use crate::*; use crate::*;
@@ -1,18 +1,17 @@
// Copyright (C) Parity Technologies (UK) Ltd. // Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus. // SPDX-License-Identifier: Apache-2.0
// Cumulus is free software: you can redistribute it and/or modify // Licensed under the Apache License, Version 2.0 (the "License");
// it under the terms of the GNU General Public License as published by // you may not use this file except in compliance with the License.
// the Free Software Foundation, either version 3 of the License, or // You may obtain a copy of the License at
// (at your option) any later version. //
// http://www.apache.org/licenses/LICENSE-2.0
// Cumulus is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of // Unless required by applicable law or agreed to in writing, software
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // distributed under the License is distributed on an "AS IS" BASIS,
// GNU General Public License for more details. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// You should have received a copy of the GNU General Public License // limitations under the License.
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
use crate::*; use crate::*;
@@ -1,18 +1,17 @@
// Copyright (C) Parity Technologies (UK) Ltd. // Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus. // SPDX-License-Identifier: Apache-2.0
// Cumulus is free software: you can redistribute it and/or modify // Licensed under the Apache License, Version 2.0 (the "License");
// it under the terms of the GNU General Public License as published by // you may not use this file except in compliance with the License.
// the Free Software Foundation, either version 3 of the License, or // You may obtain a copy of the License at
// (at your option) any later version. //
// http://www.apache.org/licenses/LICENSE-2.0
// Cumulus is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of // Unless required by applicable law or agreed to in writing, software
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // distributed under the License is distributed on an "AS IS" BASIS,
// GNU General Public License for more details. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// You should have received a copy of the GNU General Public License // limitations under the License.
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
use crate::*; use crate::*;
@@ -1,22 +1,21 @@
// Copyright (C) Parity Technologies (UK) Ltd. // Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus. // SPDX-License-Identifier: Apache-2.0
// Cumulus is free software: you can redistribute it and/or modify // Licensed under the Apache License, Version 2.0 (the "License");
// it under the terms of the GNU General Public License as published by // you may not use this file except in compliance with the License.
// the Free Software Foundation, either version 3 of the License, or // You may obtain a copy of the License at
// (at your option) any later version. //
// http://www.apache.org/licenses/LICENSE-2.0
// Cumulus is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of // Unless required by applicable law or agreed to in writing, software
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // distributed under the License is distributed on an "AS IS" BASIS,
// GNU General Public License for more details. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// You should have received a copy of the GNU General Public License // limitations under the License.
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
use crate::*; use crate::*;
use asset_hub_kusama_runtime::constants::currency::EXISTENTIAL_DEPOSIT;
use frame_support::{instances::Instance2, BoundedVec}; use frame_support::{instances::Instance2, BoundedVec};
use parachains_common::kusama::currency::EXISTENTIAL_DEPOSIT;
use sp_runtime::{DispatchError, ModuleError}; use sp_runtime::{DispatchError, ModuleError};
#[test] #[test]
@@ -183,11 +182,9 @@ fn swap_locally_on_chain_using_foreign_assets() {
.encode() .encode()
.into(); .into();
let buy_execution_fee_amount = let buy_execution_fee_amount = parachains_common::kusama::fee::WeightToFee::weight_to_fee(
asset_hub_kusama_runtime::constants::fee::WeightToFee::weight_to_fee(&Weight::from_parts( &Weight::from_parts(10_100_000_000_000, 300_000),
10_100_000_000_000, );
300_000,
));
let buy_execution_fee = MultiAsset { let buy_execution_fee = MultiAsset {
id: Concrete(MultiLocation { parents: 1, interior: Here }), id: Concrete(MultiLocation { parents: 1, interior: Here }),
fun: Fungible(buy_execution_fee_amount), fun: Fungible(buy_execution_fee_amount),
@@ -1,18 +1,17 @@
// Copyright (C) Parity Technologies (UK) Ltd. // Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus. // SPDX-License-Identifier: Apache-2.0
// Cumulus is free software: you can redistribute it and/or modify // Licensed under the Apache License, Version 2.0 (the "License");
// it under the terms of the GNU General Public License as published by // you may not use this file except in compliance with the License.
// the Free Software Foundation, either version 3 of the License, or // You may obtain a copy of the License at
// (at your option) any later version. //
// http://www.apache.org/licenses/LICENSE-2.0
// Cumulus is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of // Unless required by applicable law or agreed to in writing, software
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // distributed under the License is distributed on an "AS IS" BASIS,
// GNU General Public License for more details. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// You should have received a copy of the GNU General Public License // limitations under the License.
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
#![allow(dead_code)] // <https://github.com/paritytech/cumulus/issues/3027> #![allow(dead_code)] // <https://github.com/paritytech/cumulus/issues/3027>
@@ -3,6 +3,7 @@ name = "asset-hub-polkadot-integration-tests"
version = "1.0.0" version = "1.0.0"
authors.workspace = true authors.workspace = true
edition.workspace = true edition.workspace = true
license = "Apache-2.0"
description = "Asset Hub Polkadot runtime integration tests with xcm-emulator" description = "Asset Hub Polkadot runtime integration tests with xcm-emulator"
publish = false publish = false
@@ -1,18 +1,17 @@
// Copyright (C) Parity Technologies (UK) Ltd. // Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus. // SPDX-License-Identifier: Apache-2.0
// Cumulus is free software: you can redistribute it and/or modify // Licensed under the Apache License, Version 2.0 (the "License");
// it under the terms of the GNU General Public License as published by // you may not use this file except in compliance with the License.
// the Free Software Foundation, either version 3 of the License, or // You may obtain a copy of the License at
// (at your option) any later version. //
// http://www.apache.org/licenses/LICENSE-2.0
// Cumulus is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of // Unless required by applicable law or agreed to in writing, software
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // distributed under the License is distributed on an "AS IS" BASIS,
// GNU General Public License for more details. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// You should have received a copy of the GNU General Public License // limitations under the License.
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
pub use codec::Encode; pub use codec::Encode;
pub use frame_support::{ pub use frame_support::{
@@ -1,18 +1,17 @@
// Copyright (C) Parity Technologies (UK) Ltd. // Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus. // SPDX-License-Identifier: Apache-2.0
// Cumulus is free software: you can redistribute it and/or modify // Licensed under the Apache License, Version 2.0 (the "License");
// it under the terms of the GNU General Public License as published by // you may not use this file except in compliance with the License.
// the Free Software Foundation, either version 3 of the License, or // You may obtain a copy of the License at
// (at your option) any later version. //
// http://www.apache.org/licenses/LICENSE-2.0
// Cumulus is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of // Unless required by applicable law or agreed to in writing, software
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // distributed under the License is distributed on an "AS IS" BASIS,
// GNU General Public License for more details. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// You should have received a copy of the GNU General Public License // limitations under the License.
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
use crate::*; use crate::*;
@@ -1,18 +1,17 @@
// Copyright (C) Parity Technologies (UK) Ltd. // Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus. // SPDX-License-Identifier: Apache-2.0
// Cumulus is free software: you can redistribute it and/or modify // Licensed under the Apache License, Version 2.0 (the "License");
// it under the terms of the GNU General Public License as published by // you may not use this file except in compliance with the License.
// the Free Software Foundation, either version 3 of the License, or // You may obtain a copy of the License at
// (at your option) any later version. //
// http://www.apache.org/licenses/LICENSE-2.0
// Cumulus is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of // Unless required by applicable law or agreed to in writing, software
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // distributed under the License is distributed on an "AS IS" BASIS,
// GNU General Public License for more details. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// You should have received a copy of the GNU General Public License // limitations under the License.
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
mod hrmp_channels; mod hrmp_channels;
mod reserve_transfer; mod reserve_transfer;
@@ -1,18 +1,17 @@
// Copyright (C) Parity Technologies (UK) Ltd. // Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus. // SPDX-License-Identifier: Apache-2.0
// Cumulus is free software: you can redistribute it and/or modify // Licensed under the Apache License, Version 2.0 (the "License");
// it under the terms of the GNU General Public License as published by // you may not use this file except in compliance with the License.
// the Free Software Foundation, either version 3 of the License, or // You may obtain a copy of the License at
// (at your option) any later version. //
// http://www.apache.org/licenses/LICENSE-2.0
// Cumulus is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of // Unless required by applicable law or agreed to in writing, software
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // distributed under the License is distributed on an "AS IS" BASIS,
// GNU General Public License for more details. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// You should have received a copy of the GNU General Public License // limitations under the License.
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
use crate::*; use crate::*;
@@ -1,18 +1,17 @@
// Copyright (C) Parity Technologies (UK) Ltd. // Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus. // SPDX-License-Identifier: Apache-2.0
// Cumulus is free software: you can redistribute it and/or modify // Licensed under the Apache License, Version 2.0 (the "License");
// it under the terms of the GNU General Public License as published by // you may not use this file except in compliance with the License.
// the Free Software Foundation, either version 3 of the License, or // You may obtain a copy of the License at
// (at your option) any later version. //
// http://www.apache.org/licenses/LICENSE-2.0
// Cumulus is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of // Unless required by applicable law or agreed to in writing, software
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // distributed under the License is distributed on an "AS IS" BASIS,
// GNU General Public License for more details. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// You should have received a copy of the GNU General Public License // limitations under the License.
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
use crate::*; use crate::*;
@@ -1,18 +1,17 @@
// Copyright (C) Parity Technologies (UK) Ltd. // Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus. // SPDX-License-Identifier: Apache-2.0
// Cumulus is free software: you can redistribute it and/or modify // Licensed under the Apache License, Version 2.0 (the "License");
// it under the terms of the GNU General Public License as published by // you may not use this file except in compliance with the License.
// the Free Software Foundation, either version 3 of the License, or // You may obtain a copy of the License at
// (at your option) any later version. //
// http://www.apache.org/licenses/LICENSE-2.0
// Cumulus is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of // Unless required by applicable law or agreed to in writing, software
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // distributed under the License is distributed on an "AS IS" BASIS,
// GNU General Public License for more details. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// You should have received a copy of the GNU General Public License // limitations under the License.
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
use crate::*; use crate::*;
@@ -1,18 +1,17 @@
// Copyright (C) Parity Technologies (UK) Ltd. // Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus. // SPDX-License-Identifier: Apache-2.0
// Cumulus is free software: you can redistribute it and/or modify // Licensed under the Apache License, Version 2.0 (the "License");
// it under the terms of the GNU General Public License as published by // you may not use this file except in compliance with the License.
// the Free Software Foundation, either version 3 of the License, or // You may obtain a copy of the License at
// (at your option) any later version. //
// http://www.apache.org/licenses/LICENSE-2.0
// Cumulus is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of // Unless required by applicable law or agreed to in writing, software
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // distributed under the License is distributed on an "AS IS" BASIS,
// GNU General Public License for more details. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// You should have received a copy of the GNU General Public License // limitations under the License.
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
#![allow(dead_code)] // <https://github.com/paritytech/cumulus/issues/3027> #![allow(dead_code)] // <https://github.com/paritytech/cumulus/issues/3027>
@@ -3,6 +3,7 @@ name = "asset-hub-westend-integration-tests"
version = "1.0.0" version = "1.0.0"
authors.workspace = true authors.workspace = true
edition.workspace = true edition.workspace = true
license = "Apache-2.0"
description = "Asset Hub Westend runtime integration tests with xcm-emulator" description = "Asset Hub Westend runtime integration tests with xcm-emulator"
publish = false publish = false
@@ -1,18 +1,17 @@
// Copyright (C) Parity Technologies (UK) Ltd. // Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus. // SPDX-License-Identifier: Apache-2.0
// Cumulus is free software: you can redistribute it and/or modify // Licensed under the Apache License, Version 2.0 (the "License");
// it under the terms of the GNU General Public License as published by // you may not use this file except in compliance with the License.
// the Free Software Foundation, either version 3 of the License, or // You may obtain a copy of the License at
// (at your option) any later version. //
// http://www.apache.org/licenses/LICENSE-2.0
// Cumulus is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of // Unless required by applicable law or agreed to in writing, software
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // distributed under the License is distributed on an "AS IS" BASIS,
// GNU General Public License for more details. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// You should have received a copy of the GNU General Public License // limitations under the License.
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
pub use codec::Encode; pub use codec::Encode;
pub use frame_support::{ pub use frame_support::{
@@ -1,18 +1,17 @@
// Copyright (C) Parity Technologies (UK) Ltd. // Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus. // SPDX-License-Identifier: Apache-2.0
// Cumulus is free software: you can redistribute it and/or modify // Licensed under the Apache License, Version 2.0 (the "License");
// it under the terms of the GNU General Public License as published by // you may not use this file except in compliance with the License.
// the Free Software Foundation, either version 3 of the License, or // You may obtain a copy of the License at
// (at your option) any later version. //
// http://www.apache.org/licenses/LICENSE-2.0
// Cumulus is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of // Unless required by applicable law or agreed to in writing, software
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // distributed under the License is distributed on an "AS IS" BASIS,
// GNU General Public License for more details. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// You should have received a copy of the GNU General Public License // limitations under the License.
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
mod reserve_transfer; mod reserve_transfer;
mod send; mod send;
@@ -1,18 +1,17 @@
// Copyright (C) Parity Technologies (UK) Ltd. // Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus. // SPDX-License-Identifier: Apache-2.0
// Cumulus is free software: you can redistribute it and/or modify // Licensed under the Apache License, Version 2.0 (the "License");
// it under the terms of the GNU General Public License as published by // you may not use this file except in compliance with the License.
// the Free Software Foundation, either version 3 of the License, or // You may obtain a copy of the License at
// (at your option) any later version. //
// http://www.apache.org/licenses/LICENSE-2.0
// Cumulus is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of // Unless required by applicable law or agreed to in writing, software
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // distributed under the License is distributed on an "AS IS" BASIS,
// GNU General Public License for more details. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// You should have received a copy of the GNU General Public License // limitations under the License.
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
use crate::*; use crate::*;
@@ -1,18 +1,17 @@
// Copyright (C) Parity Technologies (UK) Ltd. // Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus. // SPDX-License-Identifier: Apache-2.0
// Cumulus is free software: you can redistribute it and/or modify // Licensed under the Apache License, Version 2.0 (the "License");
// it under the terms of the GNU General Public License as published by // you may not use this file except in compliance with the License.
// the Free Software Foundation, either version 3 of the License, or // You may obtain a copy of the License at
// (at your option) any later version. //
// http://www.apache.org/licenses/LICENSE-2.0
// Cumulus is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of // Unless required by applicable law or agreed to in writing, software
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // distributed under the License is distributed on an "AS IS" BASIS,
// GNU General Public License for more details. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// You should have received a copy of the GNU General Public License // limitations under the License.
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
use crate::*; use crate::*;
@@ -1,18 +1,17 @@
// Copyright (C) Parity Technologies (UK) Ltd. // Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus. // SPDX-License-Identifier: Apache-2.0
// Cumulus is free software: you can redistribute it and/or modify // Licensed under the Apache License, Version 2.0 (the "License");
// it under the terms of the GNU General Public License as published by // you may not use this file except in compliance with the License.
// the Free Software Foundation, either version 3 of the License, or // You may obtain a copy of the License at
// (at your option) any later version. //
// http://www.apache.org/licenses/LICENSE-2.0
// Cumulus is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of // Unless required by applicable law or agreed to in writing, software
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // distributed under the License is distributed on an "AS IS" BASIS,
// GNU General Public License for more details. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// You should have received a copy of the GNU General Public License // limitations under the License.
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
use crate::*; use crate::*;
@@ -1,18 +1,17 @@
// Copyright (C) Parity Technologies (UK) Ltd. // Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus. // SPDX-License-Identifier: Apache-2.0
// Cumulus is free software: you can redistribute it and/or modify // Licensed under the Apache License, Version 2.0 (the "License");
// it under the terms of the GNU General Public License as published by // you may not use this file except in compliance with the License.
// the Free Software Foundation, either version 3 of the License, or // You may obtain a copy of the License at
// (at your option) any later version. //
// http://www.apache.org/licenses/LICENSE-2.0
// Cumulus is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of // Unless required by applicable law or agreed to in writing, software
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // distributed under the License is distributed on an "AS IS" BASIS,
// GNU General Public License for more details. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// You should have received a copy of the GNU General Public License // limitations under the License.
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
use crate::*; use crate::*;
@@ -171,11 +170,9 @@ fn swap_locally_on_chain_using_foreign_assets() {
.encode() .encode()
.into(); .into();
let buy_execution_fee_amount = let buy_execution_fee_amount = parachains_common::westend::fee::WeightToFee::weight_to_fee(
asset_hub_westend_runtime::constants::fee::WeightToFee::weight_to_fee(&Weight::from_parts( &Weight::from_parts(10_100_000_000_000, 300_000),
10_100_000_000_000, );
300_000,
));
let buy_execution_fee = MultiAsset { let buy_execution_fee = MultiAsset {
id: Concrete(MultiLocation { parents: 1, interior: Here }), id: Concrete(MultiLocation { parents: 1, interior: Here }),
fun: Fungible(buy_execution_fee_amount), fun: Fungible(buy_execution_fee_amount),
@@ -1,18 +1,17 @@
// Copyright (C) Parity Technologies (UK) Ltd. // Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus. // SPDX-License-Identifier: Apache-2.0
// Cumulus is free software: you can redistribute it and/or modify // Licensed under the Apache License, Version 2.0 (the "License");
// it under the terms of the GNU General Public License as published by // you may not use this file except in compliance with the License.
// the Free Software Foundation, either version 3 of the License, or // You may obtain a copy of the License at
// (at your option) any later version. //
// http://www.apache.org/licenses/LICENSE-2.0
// Cumulus is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of // Unless required by applicable law or agreed to in writing, software
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // distributed under the License is distributed on an "AS IS" BASIS,
// GNU General Public License for more details. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// You should have received a copy of the GNU General Public License // limitations under the License.
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
#![allow(dead_code)] // <https://github.com/paritytech/cumulus/issues/3027> #![allow(dead_code)] // <https://github.com/paritytech/cumulus/issues/3027>
@@ -3,6 +3,7 @@ name = "bridge-hub-rococo-integration-tests"
version = "1.0.0" version = "1.0.0"
authors.workspace = true authors.workspace = true
edition.workspace = true edition.workspace = true
license = "Apache-2.0"
description = "Bridge Hub Rococo runtime integration tests with xcm-emulator" description = "Bridge Hub Rococo runtime integration tests with xcm-emulator"
publish = false publish = false
@@ -1,18 +1,17 @@
// Copyright (C) Parity Technologies (UK) Ltd. // Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus. // SPDX-License-Identifier: Apache-2.0
// Cumulus is free software: you can redistribute it and/or modify // Licensed under the Apache License, Version 2.0 (the "License");
// it under the terms of the GNU General Public License as published by // you may not use this file except in compliance with the License.
// the Free Software Foundation, either version 3 of the License, or // You may obtain a copy of the License at
// (at your option) any later version. //
// http://www.apache.org/licenses/LICENSE-2.0
// Cumulus is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of // Unless required by applicable law or agreed to in writing, software
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // distributed under the License is distributed on an "AS IS" BASIS,
// GNU General Public License for more details. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// You should have received a copy of the GNU General Public License // limitations under the License.
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
pub use bp_messages::LaneId; pub use bp_messages::LaneId;
pub use frame_support::assert_ok; pub use frame_support::assert_ok;
@@ -1,18 +1,17 @@
// Copyright (C) Parity Technologies (UK) Ltd. // Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus. // SPDX-License-Identifier: Apache-2.0
// Cumulus is free software: you can redistribute it and/or modify // Licensed under the Apache License, Version 2.0 (the "License");
// it under the terms of the GNU General Public License as published by // you may not use this file except in compliance with the License.
// the Free Software Foundation, either version 3 of the License, or // You may obtain a copy of the License at
// (at your option) any later version. //
// http://www.apache.org/licenses/LICENSE-2.0
// Cumulus is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of // Unless required by applicable law or agreed to in writing, software
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // distributed under the License is distributed on an "AS IS" BASIS,
// GNU General Public License for more details. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// You should have received a copy of the GNU General Public License // limitations under the License.
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
use crate::*; use crate::*;
@@ -1,17 +1,16 @@
// Copyright (C) Parity Technologies (UK) Ltd. // Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus. // SPDX-License-Identifier: Apache-2.0
// Cumulus is free software: you can redistribute it and/or modify // Licensed under the Apache License, Version 2.0 (the "License");
// it under the terms of the GNU General Public License as published by // you may not use this file except in compliance with the License.
// the Free Software Foundation, either version 3 of the License, or // You may obtain a copy of the License at
// (at your option) any later version. //
// http://www.apache.org/licenses/LICENSE-2.0
// Cumulus is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of // Unless required by applicable law or agreed to in writing, software
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // distributed under the License is distributed on an "AS IS" BASIS,
// GNU General Public License for more details. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// You should have received a copy of the GNU General Public License // limitations under the License.
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
mod example; mod example;
@@ -3,6 +3,7 @@ name = "collectives-polkadot-integration-tests"
version = "0.1.0" version = "0.1.0"
authors.workspace = true authors.workspace = true
edition.workspace = true edition.workspace = true
license = "Apache-2.0"
description = "Polkadot Collectives parachain runtime integration tests based on xcm-emulator" description = "Polkadot Collectives parachain runtime integration tests based on xcm-emulator"
publish = false publish = false
@@ -1,18 +1,17 @@
// Copyright (C) Parity Technologies (UK) Ltd. // Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus. // SPDX-License-Identifier: Apache-2.0
// Cumulus is free software: you can redistribute it and/or modify // Licensed under the Apache License, Version 2.0 (the "License");
// it under the terms of the GNU General Public License as published by // you may not use this file except in compliance with the License.
// the Free Software Foundation, either version 3 of the License, or // You may obtain a copy of the License at
// (at your option) any later version. //
// http://www.apache.org/licenses/LICENSE-2.0
// Cumulus is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of // Unless required by applicable law or agreed to in writing, software
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // distributed under the License is distributed on an "AS IS" BASIS,
// GNU General Public License for more details. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// You should have received a copy of the GNU General Public License // limitations under the License.
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
pub use codec::Encode; pub use codec::Encode;
pub use frame_support::{assert_ok, sp_runtime::AccountId32}; pub use frame_support::{assert_ok, sp_runtime::AccountId32};
@@ -1,18 +1,17 @@
// Copyright (C) Parity Technologies (UK) Ltd. // Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus. // SPDX-License-Identifier: Apache-2.0
// Cumulus is free software: you can redistribute it and/or modify // Licensed under the Apache License, Version 2.0 (the "License");
// it under the terms of the GNU General Public License as published by // you may not use this file except in compliance with the License.
// the Free Software Foundation, either version 3 of the License, or // You may obtain a copy of the License at
// (at your option) any later version. //
// http://www.apache.org/licenses/LICENSE-2.0
// Cumulus is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of // Unless required by applicable law or agreed to in writing, software
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // distributed under the License is distributed on an "AS IS" BASIS,
// GNU General Public License for more details. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// You should have received a copy of the GNU General Public License // limitations under the License.
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
//! Integration tests concerning the Fellowship. //! Integration tests concerning the Fellowship.
@@ -1,17 +1,16 @@
// Copyright (C) Parity Technologies (UK) Ltd. // Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus. // SPDX-License-Identifier: Apache-2.0
// Cumulus is free software: you can redistribute it and/or modify // Licensed under the Apache License, Version 2.0 (the "License");
// it under the terms of the GNU General Public License as published by // you may not use this file except in compliance with the License.
// the Free Software Foundation, either version 3 of the License, or // You may obtain a copy of the License at
// (at your option) any later version. //
// http://www.apache.org/licenses/LICENSE-2.0
// Cumulus is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of // Unless required by applicable law or agreed to in writing, software
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // distributed under the License is distributed on an "AS IS" BASIS,
// GNU General Public License for more details. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// You should have received a copy of the GNU General Public License // limitations under the License.
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
mod fellowship; mod fellowship;
@@ -3,6 +3,7 @@ name = "integration-tests-common"
version = "1.0.0" version = "1.0.0"
authors.workspace = true authors.workspace = true
edition.workspace = true edition.workspace = true
license = "Apache-2.0"
description = "Common resources for integration testing with xcm-emulator" description = "Common resources for integration testing with xcm-emulator"
publish = false publish = false
@@ -1,18 +1,17 @@
// Copyright (C) Parity Technologies (UK) Ltd. // Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus. // SPDX-License-Identifier: Apache-2.0
// Cumulus is free software: you can redistribute it and/or modify // Licensed under the Apache License, Version 2.0 (the "License");
// it under the terms of the GNU General Public License as published by // you may not use this file except in compliance with the License.
// the Free Software Foundation, either version 3 of the License, or // You may obtain a copy of the License at
// (at your option) any later version. //
// http://www.apache.org/licenses/LICENSE-2.0
// Cumulus is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of // Unless required by applicable law or agreed to in writing, software
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // distributed under the License is distributed on an "AS IS" BASIS,
// GNU General Public License for more details. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// You should have received a copy of the GNU General Public License // limitations under the License.
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
// Substrate // Substrate
use beefy_primitives::ecdsa_crypto::AuthorityId as BeefyId; use beefy_primitives::ecdsa_crypto::AuthorityId as BeefyId;
@@ -632,7 +631,7 @@ pub mod rococo {
pub mod asset_hub_polkadot { pub mod asset_hub_polkadot {
use super::*; use super::*;
pub const PARA_ID: u32 = 1000; pub const PARA_ID: u32 = 1000;
pub const ED: Balance = asset_hub_polkadot_runtime::constants::currency::EXISTENTIAL_DEPOSIT; pub const ED: Balance = parachains_common::polkadot::currency::EXISTENTIAL_DEPOSIT;
pub fn genesis() -> Storage { pub fn genesis() -> Storage {
let genesis_config = asset_hub_polkadot_runtime::RuntimeGenesisConfig { let genesis_config = asset_hub_polkadot_runtime::RuntimeGenesisConfig {
@@ -689,7 +688,7 @@ pub mod asset_hub_polkadot {
pub mod asset_hub_westend { pub mod asset_hub_westend {
use super::*; use super::*;
pub const PARA_ID: u32 = 1000; pub const PARA_ID: u32 = 1000;
pub const ED: Balance = asset_hub_westend_runtime::constants::currency::EXISTENTIAL_DEPOSIT; pub const ED: Balance = parachains_common::westend::currency::EXISTENTIAL_DEPOSIT;
pub fn genesis() -> Storage { pub fn genesis() -> Storage {
let genesis_config = asset_hub_westend_runtime::RuntimeGenesisConfig { let genesis_config = asset_hub_westend_runtime::RuntimeGenesisConfig {
@@ -746,7 +745,7 @@ pub mod asset_hub_westend {
pub mod asset_hub_kusama { pub mod asset_hub_kusama {
use super::*; use super::*;
pub const PARA_ID: u32 = 1000; pub const PARA_ID: u32 = 1000;
pub const ED: Balance = asset_hub_kusama_runtime::constants::currency::EXISTENTIAL_DEPOSIT; pub const ED: Balance = parachains_common::kusama::currency::EXISTENTIAL_DEPOSIT;
pub fn genesis() -> Storage { pub fn genesis() -> Storage {
let genesis_config = asset_hub_kusama_runtime::RuntimeGenesisConfig { let genesis_config = asset_hub_kusama_runtime::RuntimeGenesisConfig {
@@ -864,7 +863,7 @@ pub mod penpal {
pub mod collectives { pub mod collectives {
use super::*; use super::*;
pub const PARA_ID: u32 = 1001; pub const PARA_ID: u32 = 1001;
pub const ED: Balance = collectives_polkadot_runtime::constants::currency::EXISTENTIAL_DEPOSIT; pub const ED: Balance = parachains_common::polkadot::currency::EXISTENTIAL_DEPOSIT;
pub fn genesis() -> Storage { pub fn genesis() -> Storage {
let genesis_config = collectives_polkadot_runtime::RuntimeGenesisConfig { let genesis_config = collectives_polkadot_runtime::RuntimeGenesisConfig {
@@ -921,7 +920,7 @@ pub mod collectives {
pub mod bridge_hub_kusama { pub mod bridge_hub_kusama {
use super::*; use super::*;
pub const PARA_ID: u32 = 1002; pub const PARA_ID: u32 = 1002;
pub const ED: Balance = bridge_hub_kusama_runtime::constants::currency::EXISTENTIAL_DEPOSIT; pub const ED: Balance = parachains_common::kusama::currency::EXISTENTIAL_DEPOSIT;
pub fn genesis() -> Storage { pub fn genesis() -> Storage {
let genesis_config = bridge_hub_kusama_runtime::RuntimeGenesisConfig { let genesis_config = bridge_hub_kusama_runtime::RuntimeGenesisConfig {
@@ -978,7 +977,7 @@ pub mod bridge_hub_kusama {
pub mod bridge_hub_polkadot { pub mod bridge_hub_polkadot {
use super::*; use super::*;
pub const PARA_ID: u32 = 1002; pub const PARA_ID: u32 = 1002;
pub const ED: Balance = bridge_hub_polkadot_runtime::constants::currency::EXISTENTIAL_DEPOSIT; pub const ED: Balance = parachains_common::polkadot::currency::EXISTENTIAL_DEPOSIT;
pub fn genesis() -> Storage { pub fn genesis() -> Storage {
let genesis_config = bridge_hub_polkadot_runtime::RuntimeGenesisConfig { let genesis_config = bridge_hub_polkadot_runtime::RuntimeGenesisConfig {
@@ -1035,7 +1034,7 @@ pub mod bridge_hub_polkadot {
pub mod bridge_hub_rococo { pub mod bridge_hub_rococo {
use super::*; use super::*;
pub const PARA_ID: u32 = 1013; pub const PARA_ID: u32 = 1013;
pub const ED: Balance = bridge_hub_rococo_runtime::constants::currency::EXISTENTIAL_DEPOSIT; pub const ED: Balance = parachains_common::rococo::currency::EXISTENTIAL_DEPOSIT;
pub fn genesis() -> Storage { pub fn genesis() -> Storage {
let genesis_config = bridge_hub_rococo_runtime::RuntimeGenesisConfig { let genesis_config = bridge_hub_rococo_runtime::RuntimeGenesisConfig {
@@ -1,18 +1,17 @@
// Copyright (C) Parity Technologies (UK) Ltd. // Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus. // SPDX-License-Identifier: Apache-2.0
// Cumulus is free software: you can redistribute it and/or modify // Licensed under the Apache License, Version 2.0 (the "License");
// it under the terms of the GNU General Public License as published by // you may not use this file except in compliance with the License.
// the Free Software Foundation, either version 3 of the License, or // You may obtain a copy of the License at
// (at your option) any later version. //
// http://www.apache.org/licenses/LICENSE-2.0
// Cumulus is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of // Unless required by applicable law or agreed to in writing, software
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // distributed under the License is distributed on an "AS IS" BASIS,
// GNU General Public License for more details. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// You should have received a copy of the GNU General Public License // limitations under the License.
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
pub use codec::{Decode, Encode}; pub use codec::{Decode, Encode};
pub use paste; pub use paste;
@@ -1,18 +1,17 @@
// Copyright (C) Parity Technologies (UK) Ltd. // Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Cumulus. // SPDX-License-Identifier: Apache-2.0
// Cumulus is free software: you can redistribute it and/or modify // Licensed under the Apache License, Version 2.0 (the "License");
// it under the terms of the GNU General Public License as published by // you may not use this file except in compliance with the License.
// the Free Software Foundation, either version 3 of the License, or // You may obtain a copy of the License at
// (at your option) any later version. //
// http://www.apache.org/licenses/LICENSE-2.0
// Cumulus is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of // Unless required by applicable law or agreed to in writing, software
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // distributed under the License is distributed on an "AS IS" BASIS,
// GNU General Public License for more details. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// You should have received a copy of the GNU General Public License // limitations under the License.
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
pub mod constants; pub mod constants;
pub mod impls; pub mod impls;
@@ -1,118 +0,0 @@
// Copyright (C) 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 UNITS: Balance = constants::currency::UNITS;
pub const CENTS: Balance = constants::currency::CENTS;
pub const GRAND: Balance = constants::currency::GRAND;
pub const MILLICENTS: Balance = constants::currency::MILLICENTS;
pub const fn deposit(items: u32, bytes: u32) -> Balance {
// map to 1/100 of what the kusama relay chain charges (v9020)
constants::currency::deposit(items, bytes) / 100
}
}
/// Fee-related.
pub mod fee {
use frame_support::weights::{
constants::ExtrinsicBaseWeight, FeePolynomial, Weight, WeightToFeeCoefficient,
WeightToFeeCoefficients, WeightToFeePolynomial,
};
use polkadot_core_primitives::Balance;
use smallvec::smallvec;
pub use sp_runtime::Perbill;
/// The block saturation level. Fees will be updates based on this value.
pub const TARGET_BLOCK_FULLNESS: Perbill = Perbill::from_percent(25);
/// 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 frame_support::weights::WeightToFee for WeightToFee {
type Balance = Balance;
fn weight_to_fee(weight: &Weight) -> Self::Balance {
let time_poly: FeePolynomial<Balance> = RefTimeToFee::polynomial().into();
let proof_poly: FeePolynomial<Balance> = ProofSizeToFee::polynomial().into();
// Take the maximum instead of the sum to charge by the more scarce resource.
time_poly.eval(weight.ref_time()).max(proof_poly.eval(weight.proof_size()))
}
}
/// Maps the reference time component of `Weight` to a fee.
pub struct RefTimeToFee;
impl WeightToFeePolynomial for RefTimeToFee {
type Balance = Balance;
fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {
// in Kusama, extrinsic base weight (smallest non-zero weight) is mapped to 1/10 CENT:
// in Asset Hub, 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,
}]
}
}
/// Maps the proof size component of `Weight` to a fee.
pub struct ProofSizeToFee;
impl WeightToFeePolynomial for ProofSizeToFee {
type Balance = Balance;
fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {
// Map 10kb proof to 1 CENT.
let p = super::currency::CENTS;
let q = 10_000;
smallvec![WeightToFeeCoefficient {
degree: 1,
negative: false,
coeff_frac: Perbill::from_rational(p % q, q),
coeff_integer: p / q,
}]
}
}
}
/// Consensus-related.
pub mod consensus {
/// Maximum number of blocks simultaneously accepted by the Runtime, not yet included
/// into the relay chain.
pub const UNINCLUDED_SEGMENT_CAPACITY: u32 = 1;
/// How many parachain blocks are processed by the relay chain per parent. Limits the
/// number of blocks authored per slot.
pub const BLOCK_PROCESSING_VELOCITY: u32 = 1;
/// Relay chain slot duration, in milliseconds.
pub const RELAY_CHAIN_SLOT_DURATION_MILLIS: u32 = 6000;
}
@@ -24,7 +24,6 @@
#[cfg(feature = "std")] #[cfg(feature = "std")]
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
pub mod constants;
mod weights; mod weights;
pub mod xcm_config; pub mod xcm_config;
@@ -50,7 +49,6 @@ use sp_version::NativeVersion;
use sp_version::RuntimeVersion; use sp_version::RuntimeVersion;
use codec::{Decode, Encode, MaxEncodedLen}; use codec::{Decode, Encode, MaxEncodedLen};
use constants::{consensus::*, currency::*, fee::WeightToFee};
use frame_support::{ use frame_support::{
construct_runtime, construct_runtime,
dispatch::DispatchClass, dispatch::DispatchClass,
@@ -70,8 +68,10 @@ use pallet_asset_conversion_tx_payment::AssetConversionAdapter;
use pallet_nfts::PalletFeatures; use pallet_nfts::PalletFeatures;
pub use parachains_common as common; pub use parachains_common as common;
use parachains_common::{ use parachains_common::{
impls::DealWithFees, AccountId, AssetIdForTrustBackedAssets, AuraId, Balance, BlockNumber, impls::DealWithFees,
Hash, Header, Nonce, Signature, AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT, kusama::{consensus::*, currency::*, fee::WeightToFee},
AccountId, AssetIdForTrustBackedAssets, AuraId, Balance, BlockNumber, Hash, Header, Nonce,
Signature, AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT,
NORMAL_DISPATCH_RATIO, SLOT_DURATION, NORMAL_DISPATCH_RATIO, SLOT_DURATION,
}; };
use sp_runtime::RuntimeDebug; use sp_runtime::RuntimeDebug;
@@ -1395,8 +1395,9 @@ fn ensure_key_ss58() {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::{constants::fee, *}; use super::*;
use crate::{CENTS, MILLICENTS}; use crate::{CENTS, MILLICENTS};
use parachains_common::kusama::fee;
use sp_runtime::traits::Zero; use sp_runtime::traits::Zero;
use sp_weights::WeightToFee; use sp_weights::WeightToFee;
@@ -21,7 +21,6 @@ use asset_hub_kusama_runtime::xcm_config::{
AssetFeeAsExistentialDepositMultiplierFeeCharger, KsmLocation, TrustBackedAssetsPalletLocation, AssetFeeAsExistentialDepositMultiplierFeeCharger, KsmLocation, TrustBackedAssetsPalletLocation,
}; };
pub use asset_hub_kusama_runtime::{ pub use asset_hub_kusama_runtime::{
constants::fee::WeightToFee,
xcm_config::{CheckingAccount, ForeignCreatorsSovereignAccountOf, XcmConfig}, xcm_config::{CheckingAccount, ForeignCreatorsSovereignAccountOf, XcmConfig},
AllPalletsWithoutSystem, AssetDeposit, Assets, Balances, ExistentialDeposit, ForeignAssets, AllPalletsWithoutSystem, AssetDeposit, Assets, Balances, ExistentialDeposit, ForeignAssets,
ForeignAssetsInstance, MetadataDepositBase, MetadataDepositPerByte, ParachainSystem, Runtime, ForeignAssetsInstance, MetadataDepositBase, MetadataDepositPerByte, ParachainSystem, Runtime,
@@ -35,7 +34,9 @@ use frame_support::{
traits::fungibles::InspectEnumerable, traits::fungibles::InspectEnumerable,
weights::{Weight, WeightToFee as WeightToFeeT}, weights::{Weight, WeightToFee as WeightToFeeT},
}; };
use parachains_common::{AccountId, AssetIdForTrustBackedAssets, AuraId, Balance}; use parachains_common::{
kusama::fee::WeightToFee, AccountId, AssetIdForTrustBackedAssets, AuraId, Balance,
};
use sp_runtime::traits::MaybeEquivalence; use sp_runtime::traits::MaybeEquivalence;
use xcm::latest::prelude::*; use xcm::latest::prelude::*;
use xcm_executor::traits::{Identity, JustTry, WeightTrader}; use xcm_executor::traits::{Identity, JustTry, WeightTrader};
@@ -1,119 +0,0 @@
// Copyright (C) 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 DOLLARS: Balance = constants::currency::DOLLARS;
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
constants::currency::deposit(items, bytes) / 100
}
}
/// Fee-related.
pub mod fee {
use frame_support::weights::{
constants::ExtrinsicBaseWeight, FeePolynomial, WeightToFeeCoefficient,
WeightToFeeCoefficients, WeightToFeePolynomial,
};
use polkadot_core_primitives::Balance;
use smallvec::smallvec;
pub use sp_runtime::Perbill;
use sp_weights::Weight;
/// The block saturation level. Fees will be updates based on this value.
pub const TARGET_BLOCK_FULLNESS: Perbill = Perbill::from_percent(25);
/// 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 frame_support::weights::WeightToFee for WeightToFee {
type Balance = Balance;
fn weight_to_fee(weight: &Weight) -> Self::Balance {
let time_poly: FeePolynomial<Balance> = RefTimeToFee::polynomial().into();
let proof_poly: FeePolynomial<Balance> = ProofSizeToFee::polynomial().into();
// Take the maximum instead of the sum to charge by the more scarce resource.
time_poly.eval(weight.ref_time()).max(proof_poly.eval(weight.proof_size()))
}
}
/// Maps the reference time component of `Weight` to a fee.
pub struct RefTimeToFee;
impl WeightToFeePolynomial for RefTimeToFee {
type Balance = Balance;
fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {
// in Polkadot, extrinsic base weight (smallest non-zero weight) is mapped to 1/10 CENT:
// in Asset Hub, 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,
}]
}
}
/// Maps the proof size component of `Weight` to a fee.
pub struct ProofSizeToFee;
impl WeightToFeePolynomial for ProofSizeToFee {
type Balance = Balance;
fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {
// Map 10kb proof to 1 CENT.
let p = super::currency::CENTS;
let q = 10_000;
smallvec![WeightToFeeCoefficient {
degree: 1,
negative: false,
coeff_frac: Perbill::from_rational(p % q, q),
coeff_integer: p / q,
}]
}
}
}
/// Consensus-related.
pub mod consensus {
/// Maximum number of blocks simultaneously accepted by the Runtime, not yet included
/// into the relay chain.
pub const UNINCLUDED_SEGMENT_CAPACITY: u32 = 1;
/// How many parachain blocks are processed by the relay chain per parent. Limits the
/// number of blocks authored per slot.
pub const BLOCK_PROCESSING_VELOCITY: u32 = 1;
/// Relay chain slot duration, in milliseconds.
pub const RELAY_CHAIN_SLOT_DURATION_MILLIS: u32 = 6000;
}
@@ -59,7 +59,6 @@
#[cfg(feature = "std")] #[cfg(feature = "std")]
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
pub mod constants;
mod weights; mod weights;
pub mod xcm_config; pub mod xcm_config;
@@ -82,7 +81,6 @@ use sp_version::NativeVersion;
use sp_version::RuntimeVersion; use sp_version::RuntimeVersion;
use codec::{Decode, Encode, MaxEncodedLen}; use codec::{Decode, Encode, MaxEncodedLen};
use constants::{consensus::*, currency::*, fee::WeightToFee};
use frame_support::{ use frame_support::{
construct_runtime, construct_runtime,
dispatch::DispatchClass, dispatch::DispatchClass,
@@ -102,6 +100,7 @@ use pallet_nfts::PalletFeatures;
pub use parachains_common as common; pub use parachains_common as common;
use parachains_common::{ use parachains_common::{
impls::{AssetsToBlockAuthor, DealWithFees}, impls::{AssetsToBlockAuthor, DealWithFees},
polkadot::{consensus::*, currency::*, fee::WeightToFee},
AccountId, AssetHubPolkadotAuraId as AuraId, AssetIdForTrustBackedAssets, Balance, BlockNumber, AccountId, AssetHubPolkadotAuraId as AuraId, AssetIdForTrustBackedAssets, Balance, BlockNumber,
Hash, Header, Nonce, Signature, AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT, Hash, Header, Nonce, Signature, AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT,
NORMAL_DISPATCH_RATIO, SLOT_DURATION, NORMAL_DISPATCH_RATIO, SLOT_DURATION,
@@ -1228,8 +1227,9 @@ cumulus_pallet_parachain_system::register_validate_block! {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::{constants::fee, *}; use super::*;
use crate::{CENTS, MILLICENTS}; use crate::{CENTS, MILLICENTS};
use parachains_common::polkadot::fee;
use sp_runtime::traits::Zero; use sp_runtime::traits::Zero;
use sp_weights::WeightToFee; use sp_weights::WeightToFee;
@@ -22,10 +22,9 @@ use asset_hub_polkadot_runtime::xcm_config::{
ForeignCreatorsSovereignAccountOf, TrustBackedAssetsPalletLocation, XcmConfig, ForeignCreatorsSovereignAccountOf, TrustBackedAssetsPalletLocation, XcmConfig,
}; };
pub use asset_hub_polkadot_runtime::{ pub use asset_hub_polkadot_runtime::{
constants::fee::WeightToFee, AllPalletsWithoutSystem, AssetDeposit, Assets, Balances, AllPalletsWithoutSystem, AssetDeposit, Assets, Balances, ExistentialDeposit, ForeignAssets,
ExistentialDeposit, ForeignAssets, ForeignAssetsInstance, MetadataDepositBase, ForeignAssetsInstance, MetadataDepositBase, MetadataDepositPerByte, ParachainSystem, Runtime,
MetadataDepositPerByte, ParachainSystem, Runtime, RuntimeCall, RuntimeEvent, SessionKeys, RuntimeCall, RuntimeEvent, SessionKeys, System, TrustBackedAssetsInstance,
System, TrustBackedAssetsInstance,
}; };
use asset_test_utils::{CollatorSessionKeys, ExtBuilder}; use asset_test_utils::{CollatorSessionKeys, ExtBuilder};
use codec::{Decode, Encode}; use codec::{Decode, Encode};
@@ -36,7 +35,8 @@ use frame_support::{
weights::{Weight, WeightToFee as WeightToFeeT}, weights::{Weight, WeightToFee as WeightToFeeT},
}; };
use parachains_common::{ use parachains_common::{
AccountId, AssetHubPolkadotAuraId as AuraId, AssetIdForTrustBackedAssets, Balance, polkadot::fee::WeightToFee, AccountId, AssetHubPolkadotAuraId as AuraId,
AssetIdForTrustBackedAssets, Balance,
}; };
use sp_runtime::traits::MaybeEquivalence; use sp_runtime::traits::MaybeEquivalence;
use xcm::latest::prelude::*; use xcm::latest::prelude::*;
@@ -24,7 +24,6 @@
#[cfg(feature = "std")] #[cfg(feature = "std")]
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
pub mod constants;
mod weights; mod weights;
pub mod xcm_config; pub mod xcm_config;
@@ -36,7 +35,6 @@ use assets_common::{
AssetIdForTrustBackedAssetsConvert, AssetIdForTrustBackedAssetsConvert,
}; };
use codec::{Decode, Encode, MaxEncodedLen}; use codec::{Decode, Encode, MaxEncodedLen};
use constants::{consensus::*, currency::*, fee::WeightToFee};
use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases; use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases;
use frame_support::{ use frame_support::{
construct_runtime, construct_runtime,
@@ -57,8 +55,10 @@ use pallet_asset_conversion_tx_payment::AssetConversionAdapter;
use pallet_nfts::PalletFeatures; use pallet_nfts::PalletFeatures;
pub use parachains_common as common; pub use parachains_common as common;
use parachains_common::{ use parachains_common::{
impls::DealWithFees, AccountId, AssetIdForTrustBackedAssets, AuraId, Balance, BlockNumber, impls::DealWithFees,
Hash, Header, Nonce, Signature, AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT, westend::{consensus::*, currency::*, fee::WeightToFee},
AccountId, AssetIdForTrustBackedAssets, AuraId, Balance, BlockNumber, Hash, Header, Nonce,
Signature, AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT,
NORMAL_DISPATCH_RATIO, SLOT_DURATION, NORMAL_DISPATCH_RATIO, SLOT_DURATION,
}; };
use sp_api::impl_runtime_apis; use sp_api::impl_runtime_apis;
@@ -17,13 +17,6 @@
//! Tests for the Westmint (Westend Assets Hub) chain. //! Tests for the Westmint (Westend Assets Hub) chain.
pub use asset_hub_westend_runtime::{
constants::fee::WeightToFee,
xcm_config::{CheckingAccount, TrustBackedAssetsPalletLocation, XcmConfig},
AllowMultiAssetPools, AssetDeposit, Assets, Balances, ExistentialDeposit, ForeignAssets,
ForeignAssetsInstance, ParachainSystem, Runtime, SessionKeys, System,
TrustBackedAssetsInstance,
};
use asset_hub_westend_runtime::{ use asset_hub_westend_runtime::{
xcm_config::{ xcm_config::{
AssetFeeAsExistentialDepositMultiplierFeeCharger, ForeignCreatorsSovereignAccountOf, AssetFeeAsExistentialDepositMultiplierFeeCharger, ForeignCreatorsSovereignAccountOf,
@@ -32,6 +25,12 @@ use asset_hub_westend_runtime::{
AllPalletsWithoutSystem, MetadataDepositBase, MetadataDepositPerByte, RuntimeCall, AllPalletsWithoutSystem, MetadataDepositBase, MetadataDepositPerByte, RuntimeCall,
RuntimeEvent, RuntimeEvent,
}; };
pub use asset_hub_westend_runtime::{
xcm_config::{CheckingAccount, TrustBackedAssetsPalletLocation, XcmConfig},
AllowMultiAssetPools, AssetDeposit, Assets, Balances, ExistentialDeposit, ForeignAssets,
ForeignAssetsInstance, ParachainSystem, Runtime, SessionKeys, System,
TrustBackedAssetsInstance,
};
use asset_test_utils::{CollatorSessionKeys, ExtBuilder, XcmReceivedFrom}; use asset_test_utils::{CollatorSessionKeys, ExtBuilder, XcmReceivedFrom};
use codec::{Decode, DecodeLimit, Encode}; use codec::{Decode, DecodeLimit, Encode};
use cumulus_primitives_utility::ChargeWeightInFungibles; use cumulus_primitives_utility::ChargeWeightInFungibles;
@@ -40,7 +39,9 @@ use frame_support::{
traits::fungibles::InspectEnumerable, traits::fungibles::InspectEnumerable,
weights::{Weight, WeightToFee as WeightToFeeT}, weights::{Weight, WeightToFee as WeightToFeeT},
}; };
use parachains_common::{AccountId, AssetIdForTrustBackedAssets, AuraId, Balance}; use parachains_common::{
westend::fee::WeightToFee, AccountId, AssetIdForTrustBackedAssets, AuraId, Balance,
};
use sp_io; use sp_io;
use sp_runtime::traits::MaybeEquivalence; use sp_runtime::traits::MaybeEquivalence;
use std::convert::Into; use std::convert::Into;
@@ -1,117 +0,0 @@
// Copyright (C) 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 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 {
// map to 1/100 of what the kusama relay chain charges (v9020)
constants::currency::deposit(items, bytes) / 100
}
}
/// Fee-related.
pub mod fee {
use frame_support::{
pallet_prelude::Weight,
weights::{
constants::ExtrinsicBaseWeight, FeePolynomial, 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 frame_support::weights::WeightToFee for WeightToFee {
type Balance = Balance;
fn weight_to_fee(weight: &Weight) -> Self::Balance {
let time_poly: FeePolynomial<Balance> = RefTimeToFee::polynomial().into();
let proof_poly: FeePolynomial<Balance> = ProofSizeToFee::polynomial().into();
// Take the maximum instead of the sum to charge by the more scarce resource.
time_poly.eval(weight.ref_time()).max(proof_poly.eval(weight.proof_size()))
}
}
/// Maps the reference time component of `Weight` to a fee.
pub struct RefTimeToFee;
impl WeightToFeePolynomial for RefTimeToFee {
type Balance = Balance;
fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {
// in Kusama, extrinsic base weight (smallest non-zero weight) is mapped to 1/10 CENT:
// in Bridge Hub, 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,
}]
}
}
/// Maps the proof size component of `Weight` to a fee.
pub struct ProofSizeToFee;
impl WeightToFeePolynomial for ProofSizeToFee {
type Balance = Balance;
fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {
// Map 10kb proof to 1 CENT.
let p = super::currency::CENTS;
let q = 10_000;
smallvec![WeightToFeeCoefficient {
degree: 1,
negative: false,
coeff_frac: Perbill::from_rational(p % q, q),
coeff_integer: p / q,
}]
}
}
}
/// Consensus-related.
pub mod consensus {
/// Maximum number of blocks simultaneously accepted by the Runtime, not yet included
/// into the relay chain.
pub const UNINCLUDED_SEGMENT_CAPACITY: u32 = 1;
/// How many parachain blocks are processed by the relay chain per parent. Limits the
/// number of blocks authored per slot.
pub const BLOCK_PROCESSING_VELOCITY: u32 = 1;
/// Relay chain slot duration, in milliseconds.
pub const RELAY_CHAIN_SLOT_DURATION_MILLIS: u32 = 6000;
}
@@ -22,7 +22,6 @@
#[cfg(feature = "std")] #[cfg(feature = "std")]
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
pub mod constants;
mod weights; mod weights;
pub mod xcm_config; pub mod xcm_config;
@@ -41,7 +40,6 @@ use sp_std::prelude::*;
use sp_version::NativeVersion; use sp_version::NativeVersion;
use sp_version::RuntimeVersion; use sp_version::RuntimeVersion;
use constants::{consensus::*, currency::*, fee::WeightToFee};
use frame_support::{ use frame_support::{
construct_runtime, construct_runtime,
dispatch::DispatchClass, dispatch::DispatchClass,
@@ -69,8 +67,10 @@ use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate};
use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight}; use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight};
use parachains_common::{ use parachains_common::{
impls::DealWithFees, AccountId, Balance, BlockNumber, Hash, Header, Nonce, Signature, impls::DealWithFees,
AVERAGE_ON_INITIALIZE_RATIO, HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION, kusama::{consensus::*, currency::*, fee::WeightToFee},
AccountId, Balance, BlockNumber, Hash, Header, Nonce, Signature, AVERAGE_ON_INITIALIZE_RATIO,
HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION,
}; };
// XCM Imports // XCM Imports
@@ -15,12 +15,12 @@
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>. // along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
pub use bridge_hub_kusama_runtime::{ pub use bridge_hub_kusama_runtime::{
constants::fee::WeightToFee, xcm_config::XcmConfig, AllPalletsWithoutSystem, Balances, xcm_config::XcmConfig, AllPalletsWithoutSystem, Balances, ExistentialDeposit, ParachainSystem,
ExistentialDeposit, ParachainSystem, PolkadotXcm, Runtime, RuntimeEvent, SessionKeys, PolkadotXcm, Runtime, RuntimeEvent, SessionKeys,
}; };
use codec::Decode; use codec::Decode;
use frame_support::parameter_types; use frame_support::parameter_types;
use parachains_common::{AccountId, AuraId}; use parachains_common::{kusama::fee::WeightToFee, AccountId, AuraId};
const ALICE: [u8; 32] = [1u8; 32]; const ALICE: [u8; 32] = [1u8; 32];
@@ -1,117 +0,0 @@
// Copyright (C) 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
constants::currency::deposit(items, bytes) / 100
}
}
/// Fee-related.
pub mod fee {
use frame_support::{
pallet_prelude::Weight,
weights::{
constants::ExtrinsicBaseWeight, FeePolynomial, 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 frame_support::weights::WeightToFee for WeightToFee {
type Balance = Balance;
fn weight_to_fee(weight: &Weight) -> Self::Balance {
let time_poly: FeePolynomial<Balance> = RefTimeToFee::polynomial().into();
let proof_poly: FeePolynomial<Balance> = ProofSizeToFee::polynomial().into();
// Take the maximum instead of the sum to charge by the more scarce resource.
time_poly.eval(weight.ref_time()).max(proof_poly.eval(weight.proof_size()))
}
}
/// Maps the reference time component of `Weight` to a fee.
pub struct RefTimeToFee;
impl WeightToFeePolynomial for RefTimeToFee {
type Balance = Balance;
fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {
// in Polkadot, extrinsic base weight (smallest non-zero weight) is mapped to 1/10 CENT:
// in Bridge Hub, 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,
}]
}
}
/// Maps the proof size component of `Weight` to a fee.
pub struct ProofSizeToFee;
impl WeightToFeePolynomial for ProofSizeToFee {
type Balance = Balance;
fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {
// Map 10kb proof to 1 CENT.
let p = super::currency::CENTS;
let q = 10_000;
smallvec![WeightToFeeCoefficient {
degree: 1,
negative: false,
coeff_frac: Perbill::from_rational(p % q, q),
coeff_integer: p / q,
}]
}
}
}
/// Consensus-related.
pub mod consensus {
/// Maximum number of blocks simultaneously accepted by the Runtime, not yet included
/// into the relay chain.
pub const UNINCLUDED_SEGMENT_CAPACITY: u32 = 1;
/// How many parachain blocks are processed by the relay chain per parent. Limits the
/// number of blocks authored per slot.
pub const BLOCK_PROCESSING_VELOCITY: u32 = 1;
/// Relay chain slot duration, in milliseconds.
pub const RELAY_CHAIN_SLOT_DURATION_MILLIS: u32 = 6000;
}
@@ -22,7 +22,6 @@
#[cfg(feature = "std")] #[cfg(feature = "std")]
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
pub mod constants;
mod weights; mod weights;
pub mod xcm_config; pub mod xcm_config;
@@ -41,7 +40,6 @@ use sp_std::prelude::*;
use sp_version::NativeVersion; use sp_version::NativeVersion;
use sp_version::RuntimeVersion; use sp_version::RuntimeVersion;
use constants::{consensus::*, currency::*, fee::WeightToFee};
use frame_support::{ use frame_support::{
construct_runtime, construct_runtime,
dispatch::DispatchClass, dispatch::DispatchClass,
@@ -70,8 +68,10 @@ use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate};
use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight}; use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight};
use parachains_common::{ use parachains_common::{
impls::DealWithFees, AccountId, Balance, BlockNumber, Hash, Header, Nonce, Signature, impls::DealWithFees,
AVERAGE_ON_INITIALIZE_RATIO, HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION, polkadot::{consensus::*, currency::*, fee::WeightToFee},
AccountId, Balance, BlockNumber, Hash, Header, Nonce, Signature, AVERAGE_ON_INITIALIZE_RATIO,
HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION,
}; };
// XCM Imports // XCM Imports
use xcm::latest::prelude::BodyId; use xcm::latest::prelude::BodyId;
@@ -15,12 +15,12 @@
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>. // along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
pub use bridge_hub_polkadot_runtime::{ pub use bridge_hub_polkadot_runtime::{
constants::fee::WeightToFee, xcm_config::XcmConfig, AllPalletsWithoutSystem, Balances, xcm_config::XcmConfig, AllPalletsWithoutSystem, Balances, ExistentialDeposit, ParachainSystem,
ExistentialDeposit, ParachainSystem, PolkadotXcm, Runtime, RuntimeEvent, SessionKeys, PolkadotXcm, Runtime, RuntimeEvent, SessionKeys,
}; };
use codec::Decode; use codec::Decode;
use frame_support::parameter_types; use frame_support::parameter_types;
use parachains_common::{AccountId, AuraId}; use parachains_common::{polkadot::fee::WeightToFee, AccountId, AuraId};
const ALICE: [u8; 32] = [1u8; 32]; const ALICE: [u8; 32] = [1u8; 32];
@@ -24,11 +24,9 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
pub mod bridge_hub_rococo_config; pub mod bridge_hub_rococo_config;
pub mod bridge_hub_wococo_config; pub mod bridge_hub_wococo_config;
pub mod constants;
mod weights; mod weights;
pub mod xcm_config; pub mod xcm_config;
use constants::{consensus::*, currency::*};
use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases; use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases;
use sp_api::impl_runtime_apis; use sp_api::impl_runtime_apis;
use sp_core::{crypto::KeyTypeId, OpaqueMetadata}; use sp_core::{crypto::KeyTypeId, OpaqueMetadata};
@@ -79,7 +77,6 @@ use crate::{
BridgeRefundBridgeHubRococoMessages, OnBridgeHubWococoBlobDispatcher, BridgeRefundBridgeHubRococoMessages, OnBridgeHubWococoBlobDispatcher,
WithBridgeHubRococoMessageBridge, WithBridgeHubRococoMessageBridge,
}, },
constants::fee::WeightToFee,
xcm_config::XcmRouter, xcm_config::XcmRouter,
}; };
use bridge_runtime_common::{ use bridge_runtime_common::{
@@ -87,8 +84,10 @@ use bridge_runtime_common::{
messages_xcm_extension::{XcmAsPlainPayload, XcmBlobMessageDispatch}, messages_xcm_extension::{XcmAsPlainPayload, XcmBlobMessageDispatch},
}; };
use parachains_common::{ use parachains_common::{
impls::DealWithFees, AccountId, Balance, BlockNumber, Hash, Header, Nonce, Signature, impls::DealWithFees,
AVERAGE_ON_INITIALIZE_RATIO, HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION, rococo::{consensus::*, currency::*, fee::WeightToFee},
AccountId, Balance, BlockNumber, Hash, Header, Nonce, Signature, AVERAGE_ON_INITIALIZE_RATIO,
HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION,
}; };
use xcm_executor::XcmExecutor; use xcm_executor::XcmExecutor;
@@ -19,7 +19,6 @@
use bp_polkadot_core::Signature; use bp_polkadot_core::Signature;
use bridge_hub_rococo_runtime::{ use bridge_hub_rococo_runtime::{
bridge_hub_rococo_config, bridge_hub_wococo_config, bridge_hub_rococo_config, bridge_hub_wococo_config,
constants::fee::WeightToFee,
xcm_config::{RelayNetwork, XcmConfig}, xcm_config::{RelayNetwork, XcmConfig},
AllPalletsWithoutSystem, BridgeRejectObsoleteHeadersAndMessages, DeliveryRewardInBalance, AllPalletsWithoutSystem, BridgeRejectObsoleteHeadersAndMessages, DeliveryRewardInBalance,
Executive, ExistentialDeposit, ParachainSystem, PolkadotXcm, RequiredStakeForStakeAndSlash, Executive, ExistentialDeposit, ParachainSystem, PolkadotXcm, RequiredStakeForStakeAndSlash,
@@ -28,7 +27,7 @@ use bridge_hub_rococo_runtime::{
use codec::{Decode, Encode}; use codec::{Decode, Encode};
use frame_support::parameter_types; use frame_support::parameter_types;
use frame_system::pallet_prelude::HeaderFor; use frame_system::pallet_prelude::HeaderFor;
use parachains_common::{AccountId, AuraId, Balance}; use parachains_common::{rococo::fee::WeightToFee, AccountId, AuraId, Balance};
use sp_keyring::AccountKeyring::Alice; use sp_keyring::AccountKeyring::Alice;
use sp_runtime::{ use sp_runtime::{
generic::{Era, SignedPayload}, generic::{Era, SignedPayload},
@@ -20,7 +20,7 @@ pub(crate) mod migration;
mod origins; mod origins;
mod tracks; mod tracks;
use crate::{ use crate::{
constants, impls::ToParentTreasury, weights, AccountId, Balance, Balances, FellowshipReferenda, impls::ToParentTreasury, weights, AccountId, Balance, Balances, FellowshipReferenda,
GovernanceLocation, PolkadotTreasuryAccount, Preimage, Runtime, RuntimeCall, RuntimeEvent, GovernanceLocation, PolkadotTreasuryAccount, Preimage, Runtime, RuntimeCall, RuntimeEvent,
RuntimeOrigin, Scheduler, DAYS, RuntimeOrigin, Scheduler, DAYS,
}; };
@@ -36,6 +36,7 @@ pub use origins::{
}; };
use pallet_ranked_collective::EnsureOfRank; use pallet_ranked_collective::EnsureOfRank;
use pallet_xcm::{EnsureXcm, IsVoiceOfBody}; use pallet_xcm::{EnsureXcm, IsVoiceOfBody};
use parachains_common::polkadot::account;
use polkadot_runtime_constants::{time::HOURS, xcm::body::FELLOWSHIP_ADMIN_INDEX}; use polkadot_runtime_constants::{time::HOURS, xcm::body::FELLOWSHIP_ADMIN_INDEX};
use sp_core::{ConstU128, ConstU32}; use sp_core::{ConstU128, ConstU32};
use sp_runtime::traits::{AccountIdConversion, ConstU16, ConvertToValue, Replace, TakeFirst}; use sp_runtime::traits::{AccountIdConversion, ConstU16, ConvertToValue, Replace, TakeFirst};
@@ -62,7 +63,7 @@ pub mod ranks {
parameter_types! { parameter_types! {
// Referenda pallet account, used to temporarily deposit slashed imbalance before teleporting. // Referenda pallet account, used to temporarily deposit slashed imbalance before teleporting.
pub ReferendaPalletAccount: AccountId = constants::account::REFERENDA_PALLET_ID.into_account_truncating(); pub ReferendaPalletAccount: AccountId = account::REFERENDA_PALLET_ID.into_account_truncating();
pub const FellowshipAdminBodyId: BodyId = BodyId::Index(FELLOWSHIP_ADMIN_INDEX); pub const FellowshipAdminBodyId: BodyId = BodyId::Index(FELLOWSHIP_ADMIN_INDEX);
} }
@@ -36,7 +36,6 @@
#[cfg(feature = "std")] #[cfg(feature = "std")]
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
pub mod constants;
pub mod impls; pub mod impls;
mod weights; mod weights;
pub mod xcm_config; pub mod xcm_config;
@@ -64,7 +63,6 @@ use sp_version::NativeVersion;
use sp_version::RuntimeVersion; use sp_version::RuntimeVersion;
use codec::{Decode, Encode, MaxEncodedLen}; use codec::{Decode, Encode, MaxEncodedLen};
use constants::{consensus::*, currency::*, fee::WeightToFee};
use frame_support::{ use frame_support::{
construct_runtime, construct_runtime,
dispatch::DispatchClass, dispatch::DispatchClass,
@@ -79,7 +77,9 @@ use frame_system::{
}; };
pub use parachains_common as common; pub use parachains_common as common;
use parachains_common::{ use parachains_common::{
impls::DealWithFees, AccountId, AuraId, Balance, BlockNumber, Hash, Header, Nonce, Signature, impls::DealWithFees,
polkadot::{account::*, consensus::*, currency::*, fee::WeightToFee},
AccountId, AuraId, Balance, BlockNumber, Hash, Header, Nonce, Signature,
AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT, MINUTES, NORMAL_DISPATCH_RATIO, AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT, MINUTES, NORMAL_DISPATCH_RATIO,
SLOT_DURATION, SLOT_DURATION,
}; };
@@ -484,8 +484,8 @@ parameter_types! {
pub const AllyDeposit: Balance = 1_000 * UNITS; // 1,000 DOT bond to join as an Ally pub const AllyDeposit: Balance = 1_000 * UNITS; // 1,000 DOT bond to join as an Ally
// The Alliance pallet account, used as a temporary place to deposit a slashed imbalance // The Alliance pallet account, used as a temporary place to deposit a slashed imbalance
// before the teleport to the Treasury. // before the teleport to the Treasury.
pub AlliancePalletAccount: AccountId = constants::account::ALLIANCE_PALLET_ID.into_account_truncating(); pub AlliancePalletAccount: AccountId = ALLIANCE_PALLET_ID.into_account_truncating();
pub PolkadotTreasuryAccount: AccountId = constants::account::POLKADOT_TREASURY_PALLET_ID.into_account_truncating(); pub PolkadotTreasuryAccount: AccountId = POLKADOT_TREASURY_PALLET_ID.into_account_truncating();
// The number of blocks a member must wait between giving a retirement notice and retiring. // The number of blocks a member must wait between giving a retirement notice and retiring.
// Supposed to be greater than time required to `kick_member` with alliance motion. // Supposed to be greater than time required to `kick_member` with alliance motion.
pub const AllianceRetirementPeriod: BlockNumber = (90 * DAYS) + ALLIANCE_MOTION_DURATION; pub const AllianceRetirementPeriod: BlockNumber = (90 * DAYS) + ALLIANCE_MOTION_DURATION;
@@ -14,8 +14,8 @@
// limitations under the License. // limitations under the License.
use crate::{ use crate::{
constants::currency::deposit, Balance, Balances, RandomnessCollectiveFlip, Runtime, Balance, Balances, RandomnessCollectiveFlip, Runtime, RuntimeCall, RuntimeEvent,
RuntimeCall, RuntimeEvent, RuntimeHoldReason, Timestamp, RuntimeHoldReason, Timestamp,
}; };
use frame_support::{ use frame_support::{
parameter_types, parameter_types,
@@ -28,7 +28,7 @@ use pallet_contracts::{
}; };
use sp_runtime::Perbill; use sp_runtime::Perbill;
pub use parachains_common::AVERAGE_ON_INITIALIZE_RATIO; pub use parachains_common::{rococo::currency::deposit, AVERAGE_ON_INITIALIZE_RATIO};
// Prints debug output of the `contracts` pallet to stdout if the node is // Prints debug output of the `contracts` pallet to stdout if the node is
// started with `-lruntime::contracts=debug`. // started with `-lruntime::contracts=debug`.
@@ -25,7 +25,6 @@
#[cfg(feature = "std")] #[cfg(feature = "std")]
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
pub mod constants;
mod contracts; mod contracts;
mod weights; mod weights;
mod xcm_config; mod xcm_config;
@@ -45,7 +44,6 @@ use sp_std::prelude::*;
use sp_version::NativeVersion; use sp_version::NativeVersion;
use sp_version::RuntimeVersion; use sp_version::RuntimeVersion;
use constants::{consensus::*, currency::*, fee::WeightToFee};
use frame_support::{ use frame_support::{
construct_runtime, construct_runtime,
dispatch::DispatchClass, dispatch::DispatchClass,
@@ -57,9 +55,10 @@ use frame_support::{
use frame_system::limits::{BlockLength, BlockWeights}; use frame_system::limits::{BlockLength, BlockWeights};
pub use parachains_common as common; pub use parachains_common as common;
use parachains_common::{ use parachains_common::{
impls::DealWithFees, AccountId, BlockNumber, Hash, Header, Nonce, Signature, impls::DealWithFees,
AVERAGE_ON_INITIALIZE_RATIO, MAXIMUM_BLOCK_WEIGHT, MINUTES, NORMAL_DISPATCH_RATIO, rococo::{consensus::*, currency::*, fee::WeightToFee},
SLOT_DURATION, AccountId, BlockNumber, Hash, Header, Nonce, Signature, AVERAGE_ON_INITIALIZE_RATIO,
MAXIMUM_BLOCK_WEIGHT, MINUTES, NORMAL_DISPATCH_RATIO, SLOT_DURATION,
}; };
pub use parachains_common::{AuraId, Balance}; pub use parachains_common::{AuraId, Balance};
use xcm_config::CollatorSelectionUpdateOrigin; use xcm_config::CollatorSelectionUpdateOrigin;
@@ -32,11 +32,11 @@ pub type AssetHubWestendChainSpec =
sc_service::GenericChainSpec<asset_hub_westend_runtime::RuntimeGenesisConfig, Extensions>; sc_service::GenericChainSpec<asset_hub_westend_runtime::RuntimeGenesisConfig, Extensions>;
const ASSET_HUB_POLKADOT_ED: AssetHubBalance = const ASSET_HUB_POLKADOT_ED: AssetHubBalance =
asset_hub_polkadot_runtime::constants::currency::EXISTENTIAL_DEPOSIT; parachains_common::polkadot::currency::EXISTENTIAL_DEPOSIT;
const ASSET_HUB_KUSAMA_ED: AssetHubBalance = const ASSET_HUB_KUSAMA_ED: AssetHubBalance =
asset_hub_kusama_runtime::constants::currency::EXISTENTIAL_DEPOSIT; parachains_common::kusama::currency::EXISTENTIAL_DEPOSIT;
const ASSET_HUB_WESTEND_ED: AssetHubBalance = const ASSET_HUB_WESTEND_ED: AssetHubBalance =
asset_hub_westend_runtime::constants::currency::EXISTENTIAL_DEPOSIT; parachains_common::westend::currency::EXISTENTIAL_DEPOSIT;
/// Generate the session keys from individual elements. /// Generate the session keys from individual elements.
/// ///
@@ -192,7 +192,7 @@ pub mod rococo {
pub(crate) const BRIDGE_HUB_ROCOCO_LOCAL: &str = "bridge-hub-rococo-local"; pub(crate) const BRIDGE_HUB_ROCOCO_LOCAL: &str = "bridge-hub-rococo-local";
pub(crate) const BRIDGE_HUB_ROCOCO_DEVELOPMENT: &str = "bridge-hub-rococo-dev"; pub(crate) const BRIDGE_HUB_ROCOCO_DEVELOPMENT: &str = "bridge-hub-rococo-dev";
const BRIDGE_HUB_ROCOCO_ED: BridgeHubBalance = const BRIDGE_HUB_ROCOCO_ED: BridgeHubBalance =
bridge_hub_rococo_runtime::constants::currency::EXISTENTIAL_DEPOSIT; parachains_common::rococo::currency::EXISTENTIAL_DEPOSIT;
/// Specialized `ChainSpec` for the normal parachain runtime. /// Specialized `ChainSpec` for the normal parachain runtime.
pub type BridgeHubChainSpec = pub type BridgeHubChainSpec =
@@ -372,7 +372,7 @@ pub mod kusama {
pub(crate) const BRIDGE_HUB_KUSAMA_LOCAL: &str = "bridge-hub-kusama-local"; pub(crate) const BRIDGE_HUB_KUSAMA_LOCAL: &str = "bridge-hub-kusama-local";
pub(crate) const BRIDGE_HUB_KUSAMA_DEVELOPMENT: &str = "bridge-hub-kusama-dev"; pub(crate) const BRIDGE_HUB_KUSAMA_DEVELOPMENT: &str = "bridge-hub-kusama-dev";
const BRIDGE_HUB_KUSAMA_ED: BridgeHubBalance = const BRIDGE_HUB_KUSAMA_ED: BridgeHubBalance =
bridge_hub_kusama_runtime::constants::currency::EXISTENTIAL_DEPOSIT; parachains_common::kusama::currency::EXISTENTIAL_DEPOSIT;
/// Specialized `ChainSpec` for the normal parachain runtime. /// Specialized `ChainSpec` for the normal parachain runtime.
pub type BridgeHubChainSpec = pub type BridgeHubChainSpec =
@@ -509,7 +509,7 @@ pub mod polkadot {
pub(crate) const BRIDGE_HUB_POLKADOT_LOCAL: &str = "bridge-hub-polkadot-local"; pub(crate) const BRIDGE_HUB_POLKADOT_LOCAL: &str = "bridge-hub-polkadot-local";
pub(crate) const BRIDGE_HUB_POLKADOT_DEVELOPMENT: &str = "bridge-hub-polkadot-dev"; pub(crate) const BRIDGE_HUB_POLKADOT_DEVELOPMENT: &str = "bridge-hub-polkadot-dev";
const BRIDGE_HUB_POLKADOT_ED: BridgeHubBalance = const BRIDGE_HUB_POLKADOT_ED: BridgeHubBalance =
bridge_hub_polkadot_runtime::constants::currency::EXISTENTIAL_DEPOSIT; parachains_common::polkadot::currency::EXISTENTIAL_DEPOSIT;
/// Specialized `ChainSpec` for the normal parachain runtime. /// Specialized `ChainSpec` for the normal parachain runtime.
pub type BridgeHubChainSpec = pub type BridgeHubChainSpec =
@@ -26,7 +26,7 @@ pub type CollectivesPolkadotChainSpec =
sc_service::GenericChainSpec<collectives_polkadot_runtime::RuntimeGenesisConfig, Extensions>; sc_service::GenericChainSpec<collectives_polkadot_runtime::RuntimeGenesisConfig, Extensions>;
const COLLECTIVES_POLKADOT_ED: CollectivesBalance = const COLLECTIVES_POLKADOT_ED: CollectivesBalance =
collectives_polkadot_runtime::constants::currency::EXISTENTIAL_DEPOSIT; parachains_common::polkadot::currency::EXISTENTIAL_DEPOSIT;
/// Generate the session keys from individual elements. /// Generate the session keys from individual elements.
/// ///
@@ -31,7 +31,7 @@ const CONTRACTS_PARACHAIN_ID: u32 = 1002;
/// The existential deposit is determined by the runtime "contracts-rococo". /// The existential deposit is determined by the runtime "contracts-rococo".
const CONTRACTS_ROCOCO_ED: contracts_rococo_runtime::Balance = const CONTRACTS_ROCOCO_ED: contracts_rococo_runtime::Balance =
contracts_rococo_runtime::constants::currency::EXISTENTIAL_DEPOSIT; parachains_common::rococo::currency::EXISTENTIAL_DEPOSIT;
pub fn contracts_rococo_development_config() -> ContractsRococoChainSpec { pub fn contracts_rococo_development_config() -> ContractsRococoChainSpec {
let mut properties = sc_chain_spec::Properties::new(); let mut properties = sc_chain_spec::Properties::new();