mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 12:51:02 +00:00
* Use runtime dependent weights in parachains Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Lockfile Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * update lockfile for {"polkadot"} Co-authored-by: parity-processbot <>
This commit is contained in:
committed by
GitHub
parent
c744374f5f
commit
93934c7488
Generated
+239
-239
File diff suppressed because it is too large
Load Diff
@@ -57,7 +57,6 @@ sp-version = { git = "https://github.com/paritytech/substrate", default-features
|
|||||||
# Polkadot
|
# Polkadot
|
||||||
pallet-xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
pallet-xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
polkadot-runtime = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
|
||||||
polkadot-runtime-common = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
polkadot-runtime-common = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
xcm-builder = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
xcm-builder = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
@@ -110,7 +109,6 @@ std = [
|
|||||||
"pallet-xcm/std",
|
"pallet-xcm/std",
|
||||||
"parachain-info/std",
|
"parachain-info/std",
|
||||||
"polkadot-parachain/std",
|
"polkadot-parachain/std",
|
||||||
"polkadot-runtime/std",
|
|
||||||
"polkadot-runtime-common/std",
|
"polkadot-runtime-common/std",
|
||||||
"sp-api/std",
|
"sp-api/std",
|
||||||
"sp-block-builder/std",
|
"sp-block-builder/std",
|
||||||
@@ -140,7 +138,6 @@ runtime-benchmarks = [
|
|||||||
"pallet-template/runtime-benchmarks",
|
"pallet-template/runtime-benchmarks",
|
||||||
"pallet-timestamp/runtime-benchmarks",
|
"pallet-timestamp/runtime-benchmarks",
|
||||||
"pallet-xcm/runtime-benchmarks",
|
"pallet-xcm/runtime-benchmarks",
|
||||||
"polkadot-runtime/runtime-benchmarks",
|
|
||||||
"sp-runtime/runtime-benchmarks",
|
"sp-runtime/runtime-benchmarks",
|
||||||
"xcm-builder/runtime-benchmarks",
|
"xcm-builder/runtime-benchmarks",
|
||||||
"cumulus-pallet-session-benchmarking/runtime-benchmarks",
|
"cumulus-pallet-session-benchmarking/runtime-benchmarks",
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
|
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
|
||||||
|
|
||||||
|
mod weights;
|
||||||
pub mod xcm_config;
|
pub mod xcm_config;
|
||||||
|
|
||||||
use smallvec::smallvec;
|
use smallvec::smallvec;
|
||||||
@@ -27,9 +28,8 @@ use frame_support::{
|
|||||||
construct_runtime, parameter_types,
|
construct_runtime, parameter_types,
|
||||||
traits::Everything,
|
traits::Everything,
|
||||||
weights::{
|
weights::{
|
||||||
constants::{BlockExecutionWeight, ExtrinsicBaseWeight, WEIGHT_PER_SECOND},
|
constants::WEIGHT_PER_SECOND, DispatchClass, Weight, WeightToFeeCoefficient,
|
||||||
DispatchClass, Weight, WeightToFeeCoefficient, WeightToFeeCoefficients,
|
WeightToFeeCoefficients, WeightToFeePolynomial,
|
||||||
WeightToFeePolynomial,
|
|
||||||
},
|
},
|
||||||
PalletId,
|
PalletId,
|
||||||
};
|
};
|
||||||
@@ -44,8 +44,10 @@ use xcm_config::{XcmConfig, XcmOriginToTransactDispatchOrigin};
|
|||||||
#[cfg(any(feature = "std", test))]
|
#[cfg(any(feature = "std", test))]
|
||||||
pub use sp_runtime::BuildStorage;
|
pub use sp_runtime::BuildStorage;
|
||||||
|
|
||||||
// Polkadot Imports
|
// Polkadot imports
|
||||||
use polkadot_runtime::{BlockHashCount, RocksDbWeight, SlowAdjustingFeeUpdate};
|
use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate};
|
||||||
|
|
||||||
|
use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight};
|
||||||
|
|
||||||
// XCM Imports
|
// XCM Imports
|
||||||
use xcm::latest::prelude::BodyId;
|
use xcm::latest::prelude::BodyId;
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
// This file is part of Substrate.
|
||||||
|
|
||||||
|
// Copyright (C) 2022 Parity Technologies (UK) Ltd.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
pub mod constants {
|
||||||
|
use frame_support::{
|
||||||
|
parameter_types,
|
||||||
|
weights::{constants, Weight},
|
||||||
|
};
|
||||||
|
|
||||||
|
parameter_types! {
|
||||||
|
/// Importing a block with 0 Extrinsics.
|
||||||
|
pub const BlockExecutionWeight: Weight = 5_000_000 * constants::WEIGHT_PER_NANOS;
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test_weights {
|
||||||
|
use frame_support::weights::constants;
|
||||||
|
|
||||||
|
/// Checks that the weight exists and is sane.
|
||||||
|
// NOTE: If this test fails but you are sure that the generated values are fine,
|
||||||
|
// you can delete it.
|
||||||
|
#[test]
|
||||||
|
fn sane() {
|
||||||
|
let w = super::constants::BlockExecutionWeight::get();
|
||||||
|
|
||||||
|
// At least 100 µs.
|
||||||
|
assert!(w >= 100 * constants::WEIGHT_PER_MICROS, "Weight should be at least 100 µs.");
|
||||||
|
// At most 50 ms.
|
||||||
|
assert!(w <= 50 * constants::WEIGHT_PER_MILLIS, "Weight should be at most 50 ms.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
// This file is part of Substrate.
|
||||||
|
|
||||||
|
// Copyright (C) 2022 Parity Technologies (UK) Ltd.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
pub mod constants {
|
||||||
|
use frame_support::{
|
||||||
|
parameter_types,
|
||||||
|
weights::{constants, Weight},
|
||||||
|
};
|
||||||
|
|
||||||
|
parameter_types! {
|
||||||
|
/// Executing a NO-OP `System::remarks` Extrinsic.
|
||||||
|
pub const ExtrinsicBaseWeight: Weight = 125_000 * constants::WEIGHT_PER_NANOS;
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test_weights {
|
||||||
|
use frame_support::weights::constants;
|
||||||
|
|
||||||
|
/// Checks that the weight exists and is sane.
|
||||||
|
// NOTE: If this test fails but you are sure that the generated values are fine,
|
||||||
|
// you can delete it.
|
||||||
|
#[test]
|
||||||
|
fn sane() {
|
||||||
|
let w = super::constants::ExtrinsicBaseWeight::get();
|
||||||
|
|
||||||
|
// At least 10 µs.
|
||||||
|
assert!(w >= 10 * constants::WEIGHT_PER_MICROS, "Weight should be at least 10 µs.");
|
||||||
|
// At most 1 ms.
|
||||||
|
assert!(w <= constants::WEIGHT_PER_MILLIS, "Weight should be at most 1 ms.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
// This file is part of Substrate.
|
||||||
|
|
||||||
|
// Copyright (C) 2022 Parity Technologies (UK) Ltd.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
//! Expose the auto generated weight files.
|
||||||
|
|
||||||
|
pub mod block_weights;
|
||||||
|
pub mod extrinsic_weights;
|
||||||
|
pub mod paritydb_weights;
|
||||||
|
pub mod rocksdb_weights;
|
||||||
|
|
||||||
|
pub use block_weights::constants::BlockExecutionWeight;
|
||||||
|
pub use extrinsic_weights::constants::ExtrinsicBaseWeight;
|
||||||
|
pub use paritydb_weights::constants::ParityDbWeight;
|
||||||
|
pub use rocksdb_weights::constants::RocksDbWeight;
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
// This file is part of Substrate.
|
||||||
|
|
||||||
|
// Copyright (C) 2022 Parity Technologies (UK) Ltd.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
pub mod constants {
|
||||||
|
use frame_support::{
|
||||||
|
parameter_types,
|
||||||
|
weights::{constants, RuntimeDbWeight},
|
||||||
|
};
|
||||||
|
|
||||||
|
parameter_types! {
|
||||||
|
/// `ParityDB` can be enabled with a feature flag, but is still experimental. These weights
|
||||||
|
/// are available for brave runtime engineers who may want to try this out as default.
|
||||||
|
pub const ParityDbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
||||||
|
read: 8_000 * constants::WEIGHT_PER_NANOS,
|
||||||
|
write: 50_000 * constants::WEIGHT_PER_NANOS,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test_db_weights {
|
||||||
|
use super::constants::ParityDbWeight as W;
|
||||||
|
use frame_support::weights::constants;
|
||||||
|
|
||||||
|
/// Checks that all weights exist and have sane values.
|
||||||
|
// NOTE: If this test fails but you are sure that the generated values are fine,
|
||||||
|
// you can delete it.
|
||||||
|
#[test]
|
||||||
|
fn sane() {
|
||||||
|
// At least 1 µs.
|
||||||
|
assert!(
|
||||||
|
W::get().reads(1) >= constants::WEIGHT_PER_MICROS,
|
||||||
|
"Read weight should be at least 1 µs."
|
||||||
|
);
|
||||||
|
assert!(
|
||||||
|
W::get().writes(1) >= constants::WEIGHT_PER_MICROS,
|
||||||
|
"Write weight should be at least 1 µs."
|
||||||
|
);
|
||||||
|
// At most 1 ms.
|
||||||
|
assert!(
|
||||||
|
W::get().reads(1) <= constants::WEIGHT_PER_MILLIS,
|
||||||
|
"Read weight should be at most 1 ms."
|
||||||
|
);
|
||||||
|
assert!(
|
||||||
|
W::get().writes(1) <= constants::WEIGHT_PER_MILLIS,
|
||||||
|
"Write weight should be at most 1 ms."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
// This file is part of Substrate.
|
||||||
|
|
||||||
|
// Copyright (C) 2022 Parity Technologies (UK) Ltd.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
pub mod constants {
|
||||||
|
use frame_support::{
|
||||||
|
parameter_types,
|
||||||
|
weights::{constants, RuntimeDbWeight},
|
||||||
|
};
|
||||||
|
|
||||||
|
parameter_types! {
|
||||||
|
/// By default, Substrate uses `RocksDB`, so this will be the weight used throughout
|
||||||
|
/// the runtime.
|
||||||
|
pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
||||||
|
read: 25_000 * constants::WEIGHT_PER_NANOS,
|
||||||
|
write: 100_000 * constants::WEIGHT_PER_NANOS,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test_db_weights {
|
||||||
|
use super::constants::RocksDbWeight as W;
|
||||||
|
use frame_support::weights::constants;
|
||||||
|
|
||||||
|
/// Checks that all weights exist and have sane values.
|
||||||
|
// NOTE: If this test fails but you are sure that the generated values are fine,
|
||||||
|
// you can delete it.
|
||||||
|
#[test]
|
||||||
|
fn sane() {
|
||||||
|
// At least 1 µs.
|
||||||
|
assert!(
|
||||||
|
W::get().reads(1) >= constants::WEIGHT_PER_MICROS,
|
||||||
|
"Read weight should be at least 1 µs."
|
||||||
|
);
|
||||||
|
assert!(
|
||||||
|
W::get().writes(1) >= constants::WEIGHT_PER_MICROS,
|
||||||
|
"Write weight should be at least 1 µs."
|
||||||
|
);
|
||||||
|
// At most 1 ms.
|
||||||
|
assert!(
|
||||||
|
W::get().reads(1) <= constants::WEIGHT_PER_MILLIS,
|
||||||
|
"Read weight should be at most 1 ms."
|
||||||
|
);
|
||||||
|
assert!(
|
||||||
|
W::get().writes(1) <= constants::WEIGHT_PER_MILLIS,
|
||||||
|
"Write weight should be at most 1 ms."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -58,7 +58,7 @@ kusama-runtime-constants = { git = "https://github.com/paritytech/polkadot", def
|
|||||||
pallet-xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
pallet-xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
polkadot-core-primitives = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
polkadot-core-primitives = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
polkadot-runtime = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
polkadot-runtime-common = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
xcm-builder = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
xcm-builder = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
@@ -111,7 +111,7 @@ std = [
|
|||||||
"parachains-common/std",
|
"parachains-common/std",
|
||||||
"polkadot-core-primitives/std",
|
"polkadot-core-primitives/std",
|
||||||
"polkadot-parachain/std",
|
"polkadot-parachain/std",
|
||||||
"polkadot-runtime/std",
|
"polkadot-runtime-common/std",
|
||||||
"sp-api/std",
|
"sp-api/std",
|
||||||
"sp-block-builder/std",
|
"sp-block-builder/std",
|
||||||
"sp-consensus-aura/std",
|
"sp-consensus-aura/std",
|
||||||
@@ -156,7 +156,6 @@ runtime-benchmarks = [
|
|||||||
"pallet-timestamp/runtime-benchmarks",
|
"pallet-timestamp/runtime-benchmarks",
|
||||||
"pallet-utility/runtime-benchmarks",
|
"pallet-utility/runtime-benchmarks",
|
||||||
"pallet-xcm/runtime-benchmarks",
|
"pallet-xcm/runtime-benchmarks",
|
||||||
"polkadot-runtime/runtime-benchmarks",
|
|
||||||
"sp-runtime/runtime-benchmarks",
|
"sp-runtime/runtime-benchmarks",
|
||||||
"xcm-builder/runtime-benchmarks",
|
"xcm-builder/runtime-benchmarks",
|
||||||
"cumulus-pallet-session-benchmarking/runtime-benchmarks",
|
"cumulus-pallet-session-benchmarking/runtime-benchmarks",
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
|
|||||||
|
|
||||||
pub mod constants;
|
pub mod constants;
|
||||||
mod contracts;
|
mod contracts;
|
||||||
|
mod weights;
|
||||||
mod xcm_config;
|
mod xcm_config;
|
||||||
|
|
||||||
use sp_api::impl_runtime_apis;
|
use sp_api::impl_runtime_apis;
|
||||||
@@ -43,10 +44,7 @@ use constants::{currency::*, fee::WeightToFee};
|
|||||||
use frame_support::{
|
use frame_support::{
|
||||||
construct_runtime, parameter_types,
|
construct_runtime, parameter_types,
|
||||||
traits::{ConstU128, ConstU16, ConstU32, ConstU64, ConstU8, Everything},
|
traits::{ConstU128, ConstU16, ConstU32, ConstU64, ConstU8, Everything},
|
||||||
weights::{
|
weights::DispatchClass,
|
||||||
constants::{BlockExecutionWeight, ExtrinsicBaseWeight},
|
|
||||||
DispatchClass,
|
|
||||||
},
|
|
||||||
PalletId,
|
PalletId,
|
||||||
};
|
};
|
||||||
use frame_system::limits::{BlockLength, BlockWeights};
|
use frame_system::limits::{BlockLength, BlockWeights};
|
||||||
@@ -65,7 +63,9 @@ pub use sp_runtime::BuildStorage;
|
|||||||
use frame_support::weights::Weight;
|
use frame_support::weights::Weight;
|
||||||
|
|
||||||
// Polkadot imports
|
// Polkadot imports
|
||||||
use polkadot_runtime::{BlockHashCount, RocksDbWeight, SlowAdjustingFeeUpdate};
|
use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate};
|
||||||
|
|
||||||
|
use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight};
|
||||||
|
|
||||||
/// The address format for describing accounts.
|
/// The address format for describing accounts.
|
||||||
pub type Address = sp_runtime::MultiAddress<AccountId, ()>;
|
pub type Address = sp_runtime::MultiAddress<AccountId, ()>;
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
// This file is part of Substrate.
|
||||||
|
|
||||||
|
// Copyright (C) 2022 Parity Technologies (UK) Ltd.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
pub mod constants {
|
||||||
|
use frame_support::{
|
||||||
|
parameter_types,
|
||||||
|
weights::{constants, Weight},
|
||||||
|
};
|
||||||
|
|
||||||
|
parameter_types! {
|
||||||
|
/// Importing a block with 0 Extrinsics.
|
||||||
|
pub const BlockExecutionWeight: Weight = 5_000_000 * constants::WEIGHT_PER_NANOS;
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test_weights {
|
||||||
|
use frame_support::weights::constants;
|
||||||
|
|
||||||
|
/// Checks that the weight exists and is sane.
|
||||||
|
// NOTE: If this test fails but you are sure that the generated values are fine,
|
||||||
|
// you can delete it.
|
||||||
|
#[test]
|
||||||
|
fn sane() {
|
||||||
|
let w = super::constants::BlockExecutionWeight::get();
|
||||||
|
|
||||||
|
// At least 100 µs.
|
||||||
|
assert!(w >= 100 * constants::WEIGHT_PER_MICROS, "Weight should be at least 100 µs.");
|
||||||
|
// At most 50 ms.
|
||||||
|
assert!(w <= 50 * constants::WEIGHT_PER_MILLIS, "Weight should be at most 50 ms.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
// This file is part of Substrate.
|
||||||
|
|
||||||
|
// Copyright (C) 2022 Parity Technologies (UK) Ltd.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
pub mod constants {
|
||||||
|
use frame_support::{
|
||||||
|
parameter_types,
|
||||||
|
weights::{constants, Weight},
|
||||||
|
};
|
||||||
|
|
||||||
|
parameter_types! {
|
||||||
|
/// Executing a NO-OP `System::remarks` Extrinsic.
|
||||||
|
pub const ExtrinsicBaseWeight: Weight = 125_000 * constants::WEIGHT_PER_NANOS;
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test_weights {
|
||||||
|
use frame_support::weights::constants;
|
||||||
|
|
||||||
|
/// Checks that the weight exists and is sane.
|
||||||
|
// NOTE: If this test fails but you are sure that the generated values are fine,
|
||||||
|
// you can delete it.
|
||||||
|
#[test]
|
||||||
|
fn sane() {
|
||||||
|
let w = super::constants::ExtrinsicBaseWeight::get();
|
||||||
|
|
||||||
|
// At least 10 µs.
|
||||||
|
assert!(w >= 10 * constants::WEIGHT_PER_MICROS, "Weight should be at least 10 µs.");
|
||||||
|
// At most 1 ms.
|
||||||
|
assert!(w <= constants::WEIGHT_PER_MILLIS, "Weight should be at most 1 ms.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
// This file is part of Substrate.
|
||||||
|
|
||||||
|
// Copyright (C) 2022 Parity Technologies (UK) Ltd.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
//! Expose the auto generated weight files.
|
||||||
|
|
||||||
|
pub mod block_weights;
|
||||||
|
pub mod extrinsic_weights;
|
||||||
|
pub mod paritydb_weights;
|
||||||
|
pub mod rocksdb_weights;
|
||||||
|
|
||||||
|
pub use block_weights::constants::BlockExecutionWeight;
|
||||||
|
pub use extrinsic_weights::constants::ExtrinsicBaseWeight;
|
||||||
|
pub use paritydb_weights::constants::ParityDbWeight;
|
||||||
|
pub use rocksdb_weights::constants::RocksDbWeight;
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
// This file is part of Substrate.
|
||||||
|
|
||||||
|
// Copyright (C) 2022 Parity Technologies (UK) Ltd.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
pub mod constants {
|
||||||
|
use frame_support::{
|
||||||
|
parameter_types,
|
||||||
|
weights::{constants, RuntimeDbWeight},
|
||||||
|
};
|
||||||
|
|
||||||
|
parameter_types! {
|
||||||
|
/// `ParityDB` can be enabled with a feature flag, but is still experimental. These weights
|
||||||
|
/// are available for brave runtime engineers who may want to try this out as default.
|
||||||
|
pub const ParityDbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
||||||
|
read: 8_000 * constants::WEIGHT_PER_NANOS,
|
||||||
|
write: 50_000 * constants::WEIGHT_PER_NANOS,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test_db_weights {
|
||||||
|
use super::constants::ParityDbWeight as W;
|
||||||
|
use frame_support::weights::constants;
|
||||||
|
|
||||||
|
/// Checks that all weights exist and have sane values.
|
||||||
|
// NOTE: If this test fails but you are sure that the generated values are fine,
|
||||||
|
// you can delete it.
|
||||||
|
#[test]
|
||||||
|
fn sane() {
|
||||||
|
// At least 1 µs.
|
||||||
|
assert!(
|
||||||
|
W::get().reads(1) >= constants::WEIGHT_PER_MICROS,
|
||||||
|
"Read weight should be at least 1 µs."
|
||||||
|
);
|
||||||
|
assert!(
|
||||||
|
W::get().writes(1) >= constants::WEIGHT_PER_MICROS,
|
||||||
|
"Write weight should be at least 1 µs."
|
||||||
|
);
|
||||||
|
// At most 1 ms.
|
||||||
|
assert!(
|
||||||
|
W::get().reads(1) <= constants::WEIGHT_PER_MILLIS,
|
||||||
|
"Read weight should be at most 1 ms."
|
||||||
|
);
|
||||||
|
assert!(
|
||||||
|
W::get().writes(1) <= constants::WEIGHT_PER_MILLIS,
|
||||||
|
"Write weight should be at most 1 ms."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
// This file is part of Substrate.
|
||||||
|
|
||||||
|
// Copyright (C) 2022 Parity Technologies (UK) Ltd.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
pub mod constants {
|
||||||
|
use frame_support::{
|
||||||
|
parameter_types,
|
||||||
|
weights::{constants, RuntimeDbWeight},
|
||||||
|
};
|
||||||
|
|
||||||
|
parameter_types! {
|
||||||
|
/// By default, Substrate uses `RocksDB`, so this will be the weight used throughout
|
||||||
|
/// the runtime.
|
||||||
|
pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
||||||
|
read: 25_000 * constants::WEIGHT_PER_NANOS,
|
||||||
|
write: 100_000 * constants::WEIGHT_PER_NANOS,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test_db_weights {
|
||||||
|
use super::constants::RocksDbWeight as W;
|
||||||
|
use frame_support::weights::constants;
|
||||||
|
|
||||||
|
/// Checks that all weights exist and have sane values.
|
||||||
|
// NOTE: If this test fails but you are sure that the generated values are fine,
|
||||||
|
// you can delete it.
|
||||||
|
#[test]
|
||||||
|
fn sane() {
|
||||||
|
// At least 1 µs.
|
||||||
|
assert!(
|
||||||
|
W::get().reads(1) >= constants::WEIGHT_PER_MICROS,
|
||||||
|
"Read weight should be at least 1 µs."
|
||||||
|
);
|
||||||
|
assert!(
|
||||||
|
W::get().writes(1) >= constants::WEIGHT_PER_MICROS,
|
||||||
|
"Write weight should be at least 1 µs."
|
||||||
|
);
|
||||||
|
// At most 1 ms.
|
||||||
|
assert!(
|
||||||
|
W::get().reads(1) <= constants::WEIGHT_PER_MILLIS,
|
||||||
|
"Read weight should be at most 1 ms."
|
||||||
|
);
|
||||||
|
assert!(
|
||||||
|
W::get().writes(1) <= constants::WEIGHT_PER_MILLIS,
|
||||||
|
"Write weight should be at most 1 ms."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -53,7 +53,7 @@ kusama-runtime-constants = { git = "https://github.com/paritytech/polkadot", def
|
|||||||
pallet-xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
pallet-xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
polkadot-core-primitives = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
polkadot-core-primitives = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
polkadot-runtime = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
polkadot-runtime-common = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
xcm-builder = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
xcm-builder = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
@@ -96,7 +96,6 @@ runtime-benchmarks = [
|
|||||||
"pallet-uniques/runtime-benchmarks",
|
"pallet-uniques/runtime-benchmarks",
|
||||||
"pallet-utility/runtime-benchmarks",
|
"pallet-utility/runtime-benchmarks",
|
||||||
"pallet-xcm/runtime-benchmarks",
|
"pallet-xcm/runtime-benchmarks",
|
||||||
"polkadot-runtime/runtime-benchmarks",
|
|
||||||
"sp-runtime/runtime-benchmarks",
|
"sp-runtime/runtime-benchmarks",
|
||||||
"xcm-builder/runtime-benchmarks",
|
"xcm-builder/runtime-benchmarks",
|
||||||
"cumulus-pallet-session-benchmarking/runtime-benchmarks",
|
"cumulus-pallet-session-benchmarking/runtime-benchmarks",
|
||||||
@@ -134,7 +133,7 @@ std = [
|
|||||||
"pallet-xcm/std",
|
"pallet-xcm/std",
|
||||||
"polkadot-core-primitives/std",
|
"polkadot-core-primitives/std",
|
||||||
"polkadot-parachain/std",
|
"polkadot-parachain/std",
|
||||||
"polkadot-runtime/std",
|
"polkadot-runtime-common/std",
|
||||||
"sp-api/std",
|
"sp-api/std",
|
||||||
"sp-block-builder/std",
|
"sp-block-builder/std",
|
||||||
"sp-consensus-aura/std",
|
"sp-consensus-aura/std",
|
||||||
|
|||||||
@@ -45,10 +45,7 @@ use constants::{currency::*, fee::WeightToFee};
|
|||||||
use frame_support::{
|
use frame_support::{
|
||||||
construct_runtime, parameter_types,
|
construct_runtime, parameter_types,
|
||||||
traits::{AsEnsureOriginWithArg, EnsureOneOf, InstanceFilter},
|
traits::{AsEnsureOriginWithArg, EnsureOneOf, InstanceFilter},
|
||||||
weights::{
|
weights::{DispatchClass, Weight},
|
||||||
constants::{BlockExecutionWeight, ExtrinsicBaseWeight},
|
|
||||||
DispatchClass, Weight,
|
|
||||||
},
|
|
||||||
PalletId, RuntimeDebug,
|
PalletId, RuntimeDebug,
|
||||||
};
|
};
|
||||||
use frame_system::{
|
use frame_system::{
|
||||||
@@ -68,10 +65,12 @@ pub use sp_runtime::BuildStorage;
|
|||||||
|
|
||||||
// Polkadot imports
|
// Polkadot imports
|
||||||
use pallet_xcm::{EnsureXcm, IsMajorityOfBody};
|
use pallet_xcm::{EnsureXcm, IsMajorityOfBody};
|
||||||
use polkadot_runtime::{BlockHashCount, RocksDbWeight, SlowAdjustingFeeUpdate};
|
use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate};
|
||||||
use xcm::latest::BodyId;
|
use xcm::latest::BodyId;
|
||||||
use xcm_executor::XcmExecutor;
|
use xcm_executor::XcmExecutor;
|
||||||
|
|
||||||
|
use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight};
|
||||||
|
|
||||||
impl_opaque_keys! {
|
impl_opaque_keys! {
|
||||||
pub struct SessionKeys {
|
pub struct SessionKeys {
|
||||||
pub aura: Aura,
|
pub aura: Aura,
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
// This file is part of Substrate.
|
||||||
|
|
||||||
|
// Copyright (C) 2022 Parity Technologies (UK) Ltd.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
pub mod constants {
|
||||||
|
use frame_support::{
|
||||||
|
parameter_types,
|
||||||
|
weights::{constants, Weight},
|
||||||
|
};
|
||||||
|
|
||||||
|
parameter_types! {
|
||||||
|
/// Importing a block with 0 Extrinsics.
|
||||||
|
pub const BlockExecutionWeight: Weight = 5_000_000 * constants::WEIGHT_PER_NANOS;
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test_weights {
|
||||||
|
use frame_support::weights::constants;
|
||||||
|
|
||||||
|
/// Checks that the weight exists and is sane.
|
||||||
|
// NOTE: If this test fails but you are sure that the generated values are fine,
|
||||||
|
// you can delete it.
|
||||||
|
#[test]
|
||||||
|
fn sane() {
|
||||||
|
let w = super::constants::BlockExecutionWeight::get();
|
||||||
|
|
||||||
|
// At least 100 µs.
|
||||||
|
assert!(w >= 100 * constants::WEIGHT_PER_MICROS, "Weight should be at least 100 µs.");
|
||||||
|
// At most 50 ms.
|
||||||
|
assert!(w <= 50 * constants::WEIGHT_PER_MILLIS, "Weight should be at most 50 ms.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
// This file is part of Substrate.
|
||||||
|
|
||||||
|
// Copyright (C) 2022 Parity Technologies (UK) Ltd.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
pub mod constants {
|
||||||
|
use frame_support::{
|
||||||
|
parameter_types,
|
||||||
|
weights::{constants, Weight},
|
||||||
|
};
|
||||||
|
|
||||||
|
parameter_types! {
|
||||||
|
/// Executing a NO-OP `System::remarks` Extrinsic.
|
||||||
|
pub const ExtrinsicBaseWeight: Weight = 125_000 * constants::WEIGHT_PER_NANOS;
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test_weights {
|
||||||
|
use frame_support::weights::constants;
|
||||||
|
|
||||||
|
/// Checks that the weight exists and is sane.
|
||||||
|
// NOTE: If this test fails but you are sure that the generated values are fine,
|
||||||
|
// you can delete it.
|
||||||
|
#[test]
|
||||||
|
fn sane() {
|
||||||
|
let w = super::constants::ExtrinsicBaseWeight::get();
|
||||||
|
|
||||||
|
// At least 10 µs.
|
||||||
|
assert!(w >= 10 * constants::WEIGHT_PER_MICROS, "Weight should be at least 10 µs.");
|
||||||
|
// At most 1 ms.
|
||||||
|
assert!(w <= constants::WEIGHT_PER_MILLIS, "Weight should be at most 1 ms.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
|
pub mod block_weights;
|
||||||
pub mod cumulus_pallet_xcmp_queue;
|
pub mod cumulus_pallet_xcmp_queue;
|
||||||
|
pub mod extrinsic_weights;
|
||||||
pub mod frame_system;
|
pub mod frame_system;
|
||||||
pub mod pallet_assets;
|
pub mod pallet_assets;
|
||||||
pub mod pallet_balances;
|
pub mod pallet_balances;
|
||||||
@@ -9,3 +11,10 @@ pub mod pallet_session;
|
|||||||
pub mod pallet_timestamp;
|
pub mod pallet_timestamp;
|
||||||
pub mod pallet_uniques;
|
pub mod pallet_uniques;
|
||||||
pub mod pallet_utility;
|
pub mod pallet_utility;
|
||||||
|
pub mod paritydb_weights;
|
||||||
|
pub mod rocksdb_weights;
|
||||||
|
|
||||||
|
pub use block_weights::constants::BlockExecutionWeight;
|
||||||
|
pub use extrinsic_weights::constants::ExtrinsicBaseWeight;
|
||||||
|
pub use paritydb_weights::constants::ParityDbWeight;
|
||||||
|
pub use rocksdb_weights::constants::RocksDbWeight;
|
||||||
|
|||||||
@@ -0,0 +1,63 @@
|
|||||||
|
// This file is part of Substrate.
|
||||||
|
|
||||||
|
// Copyright (C) 2022 Parity Technologies (UK) Ltd.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
pub mod constants {
|
||||||
|
use frame_support::{
|
||||||
|
parameter_types,
|
||||||
|
weights::{constants, RuntimeDbWeight},
|
||||||
|
};
|
||||||
|
|
||||||
|
parameter_types! {
|
||||||
|
/// `ParityDB` can be enabled with a feature flag, but is still experimental. These weights
|
||||||
|
/// are available for brave runtime engineers who may want to try this out as default.
|
||||||
|
pub const ParityDbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
||||||
|
read: 8_000 * constants::WEIGHT_PER_NANOS,
|
||||||
|
write: 50_000 * constants::WEIGHT_PER_NANOS,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test_db_weights {
|
||||||
|
use super::constants::ParityDbWeight as W;
|
||||||
|
use frame_support::weights::constants;
|
||||||
|
|
||||||
|
/// Checks that all weights exist and have sane values.
|
||||||
|
// NOTE: If this test fails but you are sure that the generated values are fine,
|
||||||
|
// you can delete it.
|
||||||
|
#[test]
|
||||||
|
fn sane() {
|
||||||
|
// At least 1 µs.
|
||||||
|
assert!(
|
||||||
|
W::get().reads(1) >= constants::WEIGHT_PER_MICROS,
|
||||||
|
"Read weight should be at least 1 µs."
|
||||||
|
);
|
||||||
|
assert!(
|
||||||
|
W::get().writes(1) >= constants::WEIGHT_PER_MICROS,
|
||||||
|
"Write weight should be at least 1 µs."
|
||||||
|
);
|
||||||
|
// At most 1 ms.
|
||||||
|
assert!(
|
||||||
|
W::get().reads(1) <= constants::WEIGHT_PER_MILLIS,
|
||||||
|
"Read weight should be at most 1 ms."
|
||||||
|
);
|
||||||
|
assert!(
|
||||||
|
W::get().writes(1) <= constants::WEIGHT_PER_MILLIS,
|
||||||
|
"Write weight should be at most 1 ms."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
// This file is part of Substrate.
|
||||||
|
|
||||||
|
// Copyright (C) 2022 Parity Technologies (UK) Ltd.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
pub mod constants {
|
||||||
|
use frame_support::{
|
||||||
|
parameter_types,
|
||||||
|
weights::{constants, RuntimeDbWeight},
|
||||||
|
};
|
||||||
|
|
||||||
|
parameter_types! {
|
||||||
|
/// By default, Substrate uses `RocksDB`, so this will be the weight used throughout
|
||||||
|
/// the runtime.
|
||||||
|
pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
||||||
|
read: 25_000 * constants::WEIGHT_PER_NANOS,
|
||||||
|
write: 100_000 * constants::WEIGHT_PER_NANOS,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test_db_weights {
|
||||||
|
use super::constants::RocksDbWeight as W;
|
||||||
|
use frame_support::weights::constants;
|
||||||
|
|
||||||
|
/// Checks that all weights exist and have sane values.
|
||||||
|
// NOTE: If this test fails but you are sure that the generated values are fine,
|
||||||
|
// you can delete it.
|
||||||
|
#[test]
|
||||||
|
fn sane() {
|
||||||
|
// At least 1 µs.
|
||||||
|
assert!(
|
||||||
|
W::get().reads(1) >= constants::WEIGHT_PER_MICROS,
|
||||||
|
"Read weight should be at least 1 µs."
|
||||||
|
);
|
||||||
|
assert!(
|
||||||
|
W::get().writes(1) >= constants::WEIGHT_PER_MICROS,
|
||||||
|
"Write weight should be at least 1 µs."
|
||||||
|
);
|
||||||
|
// At most 1 ms.
|
||||||
|
assert!(
|
||||||
|
W::get().reads(1) <= constants::WEIGHT_PER_MILLIS,
|
||||||
|
"Read weight should be at most 1 ms."
|
||||||
|
);
|
||||||
|
assert!(
|
||||||
|
W::get().writes(1) <= constants::WEIGHT_PER_MILLIS,
|
||||||
|
"Write weight should be at most 1 ms."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -52,7 +52,7 @@ sp-version = { git = "https://github.com/paritytech/substrate", default-features
|
|||||||
pallet-xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
pallet-xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
polkadot-core-primitives = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
polkadot-core-primitives = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
polkadot-runtime = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
polkadot-runtime-common = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
polkadot-runtime-constants = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
polkadot-runtime-constants = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
xcm-builder = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
xcm-builder = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
@@ -95,7 +95,6 @@ runtime-benchmarks = [
|
|||||||
"pallet-uniques/runtime-benchmarks",
|
"pallet-uniques/runtime-benchmarks",
|
||||||
"pallet-utility/runtime-benchmarks",
|
"pallet-utility/runtime-benchmarks",
|
||||||
"pallet-xcm/runtime-benchmarks",
|
"pallet-xcm/runtime-benchmarks",
|
||||||
"polkadot-runtime/runtime-benchmarks",
|
|
||||||
"sp-runtime/runtime-benchmarks",
|
"sp-runtime/runtime-benchmarks",
|
||||||
"xcm-builder/runtime-benchmarks",
|
"xcm-builder/runtime-benchmarks",
|
||||||
"cumulus-pallet-session-benchmarking/runtime-benchmarks",
|
"cumulus-pallet-session-benchmarking/runtime-benchmarks",
|
||||||
@@ -132,7 +131,7 @@ std = [
|
|||||||
"pallet-xcm/std",
|
"pallet-xcm/std",
|
||||||
"polkadot-core-primitives/std",
|
"polkadot-core-primitives/std",
|
||||||
"polkadot-parachain/std",
|
"polkadot-parachain/std",
|
||||||
"polkadot-runtime/std",
|
"polkadot-runtime-common/std",
|
||||||
"polkadot-runtime-constants/std",
|
"polkadot-runtime-constants/std",
|
||||||
"sp-api/std",
|
"sp-api/std",
|
||||||
"sp-block-builder/std",
|
"sp-block-builder/std",
|
||||||
|
|||||||
@@ -45,10 +45,7 @@ use constants::{currency::*, fee::WeightToFee};
|
|||||||
use frame_support::{
|
use frame_support::{
|
||||||
construct_runtime, parameter_types,
|
construct_runtime, parameter_types,
|
||||||
traits::{AsEnsureOriginWithArg, Contains, EnsureOneOf, InstanceFilter},
|
traits::{AsEnsureOriginWithArg, Contains, EnsureOneOf, InstanceFilter},
|
||||||
weights::{
|
weights::{DispatchClass, Weight},
|
||||||
constants::{BlockExecutionWeight, ExtrinsicBaseWeight},
|
|
||||||
DispatchClass, Weight,
|
|
||||||
},
|
|
||||||
PalletId, RuntimeDebug,
|
PalletId, RuntimeDebug,
|
||||||
};
|
};
|
||||||
use frame_system::{
|
use frame_system::{
|
||||||
@@ -69,10 +66,12 @@ pub use sp_runtime::BuildStorage;
|
|||||||
|
|
||||||
// Polkadot imports
|
// Polkadot imports
|
||||||
use pallet_xcm::{EnsureXcm, IsMajorityOfBody};
|
use pallet_xcm::{EnsureXcm, IsMajorityOfBody};
|
||||||
use polkadot_runtime::{BlockHashCount, RocksDbWeight, SlowAdjustingFeeUpdate};
|
use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate};
|
||||||
use xcm::latest::BodyId;
|
use xcm::latest::BodyId;
|
||||||
use xcm_executor::XcmExecutor;
|
use xcm_executor::XcmExecutor;
|
||||||
|
|
||||||
|
use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight};
|
||||||
|
|
||||||
impl_opaque_keys! {
|
impl_opaque_keys! {
|
||||||
pub struct SessionKeys {
|
pub struct SessionKeys {
|
||||||
pub aura: Aura,
|
pub aura: Aura,
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
// This file is part of Substrate.
|
||||||
|
|
||||||
|
// Copyright (C) 2022 Parity Technologies (UK) Ltd.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
pub mod constants {
|
||||||
|
use frame_support::{
|
||||||
|
parameter_types,
|
||||||
|
weights::{constants, Weight},
|
||||||
|
};
|
||||||
|
|
||||||
|
parameter_types! {
|
||||||
|
/// Importing a block with 0 Extrinsics.
|
||||||
|
pub const BlockExecutionWeight: Weight = 5_000_000 * constants::WEIGHT_PER_NANOS;
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test_weights {
|
||||||
|
use frame_support::weights::constants;
|
||||||
|
|
||||||
|
/// Checks that the weight exists and is sane.
|
||||||
|
// NOTE: If this test fails but you are sure that the generated values are fine,
|
||||||
|
// you can delete it.
|
||||||
|
#[test]
|
||||||
|
fn sane() {
|
||||||
|
let w = super::constants::BlockExecutionWeight::get();
|
||||||
|
|
||||||
|
// At least 100 µs.
|
||||||
|
assert!(w >= 100 * constants::WEIGHT_PER_MICROS, "Weight should be at least 100 µs.");
|
||||||
|
// At most 50 ms.
|
||||||
|
assert!(w <= 50 * constants::WEIGHT_PER_MILLIS, "Weight should be at most 50 ms.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
// This file is part of Substrate.
|
||||||
|
|
||||||
|
// Copyright (C) 2022 Parity Technologies (UK) Ltd.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
pub mod constants {
|
||||||
|
use frame_support::{
|
||||||
|
parameter_types,
|
||||||
|
weights::{constants, Weight},
|
||||||
|
};
|
||||||
|
|
||||||
|
parameter_types! {
|
||||||
|
/// Executing a NO-OP `System::remarks` Extrinsic.
|
||||||
|
pub const ExtrinsicBaseWeight: Weight = 125_000 * constants::WEIGHT_PER_NANOS;
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test_weights {
|
||||||
|
use frame_support::weights::constants;
|
||||||
|
|
||||||
|
/// Checks that the weight exists and is sane.
|
||||||
|
// NOTE: If this test fails but you are sure that the generated values are fine,
|
||||||
|
// you can delete it.
|
||||||
|
#[test]
|
||||||
|
fn sane() {
|
||||||
|
let w = super::constants::ExtrinsicBaseWeight::get();
|
||||||
|
|
||||||
|
// At least 10 µs.
|
||||||
|
assert!(w >= 10 * constants::WEIGHT_PER_MICROS, "Weight should be at least 10 µs.");
|
||||||
|
// At most 1 ms.
|
||||||
|
assert!(w <= constants::WEIGHT_PER_MILLIS, "Weight should be at most 1 ms.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
|
pub mod block_weights;
|
||||||
pub mod cumulus_pallet_xcmp_queue;
|
pub mod cumulus_pallet_xcmp_queue;
|
||||||
|
pub mod extrinsic_weights;
|
||||||
pub mod frame_system;
|
pub mod frame_system;
|
||||||
pub mod pallet_assets;
|
pub mod pallet_assets;
|
||||||
pub mod pallet_balances;
|
pub mod pallet_balances;
|
||||||
@@ -9,3 +11,10 @@ pub mod pallet_session;
|
|||||||
pub mod pallet_timestamp;
|
pub mod pallet_timestamp;
|
||||||
pub mod pallet_uniques;
|
pub mod pallet_uniques;
|
||||||
pub mod pallet_utility;
|
pub mod pallet_utility;
|
||||||
|
pub mod paritydb_weights;
|
||||||
|
pub mod rocksdb_weights;
|
||||||
|
|
||||||
|
pub use block_weights::constants::BlockExecutionWeight;
|
||||||
|
pub use extrinsic_weights::constants::ExtrinsicBaseWeight;
|
||||||
|
pub use paritydb_weights::constants::ParityDbWeight;
|
||||||
|
pub use rocksdb_weights::constants::RocksDbWeight;
|
||||||
|
|||||||
@@ -0,0 +1,63 @@
|
|||||||
|
// This file is part of Substrate.
|
||||||
|
|
||||||
|
// Copyright (C) 2022 Parity Technologies (UK) Ltd.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
pub mod constants {
|
||||||
|
use frame_support::{
|
||||||
|
parameter_types,
|
||||||
|
weights::{constants, RuntimeDbWeight},
|
||||||
|
};
|
||||||
|
|
||||||
|
parameter_types! {
|
||||||
|
/// `ParityDB` can be enabled with a feature flag, but is still experimental. These weights
|
||||||
|
/// are available for brave runtime engineers who may want to try this out as default.
|
||||||
|
pub const ParityDbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
||||||
|
read: 8_000 * constants::WEIGHT_PER_NANOS,
|
||||||
|
write: 50_000 * constants::WEIGHT_PER_NANOS,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test_db_weights {
|
||||||
|
use super::constants::ParityDbWeight as W;
|
||||||
|
use frame_support::weights::constants;
|
||||||
|
|
||||||
|
/// Checks that all weights exist and have sane values.
|
||||||
|
// NOTE: If this test fails but you are sure that the generated values are fine,
|
||||||
|
// you can delete it.
|
||||||
|
#[test]
|
||||||
|
fn sane() {
|
||||||
|
// At least 1 µs.
|
||||||
|
assert!(
|
||||||
|
W::get().reads(1) >= constants::WEIGHT_PER_MICROS,
|
||||||
|
"Read weight should be at least 1 µs."
|
||||||
|
);
|
||||||
|
assert!(
|
||||||
|
W::get().writes(1) >= constants::WEIGHT_PER_MICROS,
|
||||||
|
"Write weight should be at least 1 µs."
|
||||||
|
);
|
||||||
|
// At most 1 ms.
|
||||||
|
assert!(
|
||||||
|
W::get().reads(1) <= constants::WEIGHT_PER_MILLIS,
|
||||||
|
"Read weight should be at most 1 ms."
|
||||||
|
);
|
||||||
|
assert!(
|
||||||
|
W::get().writes(1) <= constants::WEIGHT_PER_MILLIS,
|
||||||
|
"Write weight should be at most 1 ms."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
// This file is part of Substrate.
|
||||||
|
|
||||||
|
// Copyright (C) 2022 Parity Technologies (UK) Ltd.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
pub mod constants {
|
||||||
|
use frame_support::{
|
||||||
|
parameter_types,
|
||||||
|
weights::{constants, RuntimeDbWeight},
|
||||||
|
};
|
||||||
|
|
||||||
|
parameter_types! {
|
||||||
|
/// By default, Substrate uses `RocksDB`, so this will be the weight used throughout
|
||||||
|
/// the runtime.
|
||||||
|
pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
||||||
|
read: 25_000 * constants::WEIGHT_PER_NANOS,
|
||||||
|
write: 100_000 * constants::WEIGHT_PER_NANOS,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test_db_weights {
|
||||||
|
use super::constants::RocksDbWeight as W;
|
||||||
|
use frame_support::weights::constants;
|
||||||
|
|
||||||
|
/// Checks that all weights exist and have sane values.
|
||||||
|
// NOTE: If this test fails but you are sure that the generated values are fine,
|
||||||
|
// you can delete it.
|
||||||
|
#[test]
|
||||||
|
fn sane() {
|
||||||
|
// At least 1 µs.
|
||||||
|
assert!(
|
||||||
|
W::get().reads(1) >= constants::WEIGHT_PER_MICROS,
|
||||||
|
"Read weight should be at least 1 µs."
|
||||||
|
);
|
||||||
|
assert!(
|
||||||
|
W::get().writes(1) >= constants::WEIGHT_PER_MICROS,
|
||||||
|
"Write weight should be at least 1 µs."
|
||||||
|
);
|
||||||
|
// At most 1 ms.
|
||||||
|
assert!(
|
||||||
|
W::get().reads(1) <= constants::WEIGHT_PER_MILLIS,
|
||||||
|
"Read weight should be at most 1 ms."
|
||||||
|
);
|
||||||
|
assert!(
|
||||||
|
W::get().writes(1) <= constants::WEIGHT_PER_MILLIS,
|
||||||
|
"Write weight should be at most 1 ms."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -51,7 +51,7 @@ sp-version = { git = "https://github.com/paritytech/substrate", default-features
|
|||||||
pallet-xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
pallet-xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
polkadot-core-primitives = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
polkadot-core-primitives = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
polkadot-runtime = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
polkadot-runtime-common = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
westend-runtime-constants = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
westend-runtime-constants = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
xcm-builder = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
xcm-builder = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
@@ -94,7 +94,6 @@ runtime-benchmarks = [
|
|||||||
"pallet-uniques/runtime-benchmarks",
|
"pallet-uniques/runtime-benchmarks",
|
||||||
"pallet-utility/runtime-benchmarks",
|
"pallet-utility/runtime-benchmarks",
|
||||||
"pallet-xcm/runtime-benchmarks",
|
"pallet-xcm/runtime-benchmarks",
|
||||||
"polkadot-runtime/runtime-benchmarks",
|
|
||||||
"sp-runtime/runtime-benchmarks",
|
"sp-runtime/runtime-benchmarks",
|
||||||
"xcm-builder/runtime-benchmarks",
|
"xcm-builder/runtime-benchmarks",
|
||||||
"cumulus-pallet-session-benchmarking/runtime-benchmarks",
|
"cumulus-pallet-session-benchmarking/runtime-benchmarks",
|
||||||
@@ -130,7 +129,7 @@ std = [
|
|||||||
"pallet-xcm/std",
|
"pallet-xcm/std",
|
||||||
"polkadot-core-primitives/std",
|
"polkadot-core-primitives/std",
|
||||||
"polkadot-parachain/std",
|
"polkadot-parachain/std",
|
||||||
"polkadot-runtime/std",
|
"polkadot-runtime-common/std",
|
||||||
"sp-api/std",
|
"sp-api/std",
|
||||||
"sp-block-builder/std",
|
"sp-block-builder/std",
|
||||||
"sp-consensus-aura/std",
|
"sp-consensus-aura/std",
|
||||||
|
|||||||
@@ -45,10 +45,7 @@ use constants::{currency::*, fee::WeightToFee};
|
|||||||
use frame_support::{
|
use frame_support::{
|
||||||
construct_runtime, parameter_types,
|
construct_runtime, parameter_types,
|
||||||
traits::{AsEnsureOriginWithArg, InstanceFilter},
|
traits::{AsEnsureOriginWithArg, InstanceFilter},
|
||||||
weights::{
|
weights::{DispatchClass, Weight},
|
||||||
constants::{BlockExecutionWeight, ExtrinsicBaseWeight},
|
|
||||||
DispatchClass, Weight,
|
|
||||||
},
|
|
||||||
PalletId, RuntimeDebug,
|
PalletId, RuntimeDebug,
|
||||||
};
|
};
|
||||||
use frame_system::{
|
use frame_system::{
|
||||||
@@ -67,9 +64,11 @@ use xcm_config::{XcmConfig, XcmOriginToTransactDispatchOrigin};
|
|||||||
pub use sp_runtime::BuildStorage;
|
pub use sp_runtime::BuildStorage;
|
||||||
|
|
||||||
// Polkadot imports
|
// Polkadot imports
|
||||||
use polkadot_runtime::{BlockHashCount, RocksDbWeight, SlowAdjustingFeeUpdate};
|
use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate};
|
||||||
use xcm_executor::XcmExecutor;
|
use xcm_executor::XcmExecutor;
|
||||||
|
|
||||||
|
use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight};
|
||||||
|
|
||||||
impl_opaque_keys! {
|
impl_opaque_keys! {
|
||||||
pub struct SessionKeys {
|
pub struct SessionKeys {
|
||||||
pub aura: Aura,
|
pub aura: Aura,
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
// This file is part of Substrate.
|
||||||
|
|
||||||
|
// Copyright (C) 2022 Parity Technologies (UK) Ltd.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
pub mod constants {
|
||||||
|
use frame_support::{
|
||||||
|
parameter_types,
|
||||||
|
weights::{constants, Weight},
|
||||||
|
};
|
||||||
|
|
||||||
|
parameter_types! {
|
||||||
|
/// Importing a block with 0 Extrinsics.
|
||||||
|
pub const BlockExecutionWeight: Weight = 5_000_000 * constants::WEIGHT_PER_NANOS;
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test_weights {
|
||||||
|
use frame_support::weights::constants;
|
||||||
|
|
||||||
|
/// Checks that the weight exists and is sane.
|
||||||
|
// NOTE: If this test fails but you are sure that the generated values are fine,
|
||||||
|
// you can delete it.
|
||||||
|
#[test]
|
||||||
|
fn sane() {
|
||||||
|
let w = super::constants::BlockExecutionWeight::get();
|
||||||
|
|
||||||
|
// At least 100 µs.
|
||||||
|
assert!(w >= 100 * constants::WEIGHT_PER_MICROS, "Weight should be at least 100 µs.");
|
||||||
|
// At most 50 ms.
|
||||||
|
assert!(w <= 50 * constants::WEIGHT_PER_MILLIS, "Weight should be at most 50 ms.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
// This file is part of Substrate.
|
||||||
|
|
||||||
|
// Copyright (C) 2022 Parity Technologies (UK) Ltd.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
pub mod constants {
|
||||||
|
use frame_support::{
|
||||||
|
parameter_types,
|
||||||
|
weights::{constants, Weight},
|
||||||
|
};
|
||||||
|
|
||||||
|
parameter_types! {
|
||||||
|
/// Executing a NO-OP `System::remarks` Extrinsic.
|
||||||
|
pub const ExtrinsicBaseWeight: Weight = 125_000 * constants::WEIGHT_PER_NANOS;
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test_weights {
|
||||||
|
use frame_support::weights::constants;
|
||||||
|
|
||||||
|
/// Checks that the weight exists and is sane.
|
||||||
|
// NOTE: If this test fails but you are sure that the generated values are fine,
|
||||||
|
// you can delete it.
|
||||||
|
#[test]
|
||||||
|
fn sane() {
|
||||||
|
let w = super::constants::ExtrinsicBaseWeight::get();
|
||||||
|
|
||||||
|
// At least 10 µs.
|
||||||
|
assert!(w >= 10 * constants::WEIGHT_PER_MICROS, "Weight should be at least 10 µs.");
|
||||||
|
// At most 1 ms.
|
||||||
|
assert!(w <= constants::WEIGHT_PER_MILLIS, "Weight should be at most 1 ms.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
|
pub mod block_weights;
|
||||||
pub mod cumulus_pallet_xcmp_queue;
|
pub mod cumulus_pallet_xcmp_queue;
|
||||||
|
pub mod extrinsic_weights;
|
||||||
pub mod frame_system;
|
pub mod frame_system;
|
||||||
pub mod pallet_assets;
|
pub mod pallet_assets;
|
||||||
pub mod pallet_balances;
|
pub mod pallet_balances;
|
||||||
@@ -9,3 +11,10 @@ pub mod pallet_session;
|
|||||||
pub mod pallet_timestamp;
|
pub mod pallet_timestamp;
|
||||||
pub mod pallet_uniques;
|
pub mod pallet_uniques;
|
||||||
pub mod pallet_utility;
|
pub mod pallet_utility;
|
||||||
|
pub mod paritydb_weights;
|
||||||
|
pub mod rocksdb_weights;
|
||||||
|
|
||||||
|
pub use block_weights::constants::BlockExecutionWeight;
|
||||||
|
pub use extrinsic_weights::constants::ExtrinsicBaseWeight;
|
||||||
|
pub use paritydb_weights::constants::ParityDbWeight;
|
||||||
|
pub use rocksdb_weights::constants::RocksDbWeight;
|
||||||
|
|||||||
@@ -0,0 +1,63 @@
|
|||||||
|
// This file is part of Substrate.
|
||||||
|
|
||||||
|
// Copyright (C) 2022 Parity Technologies (UK) Ltd.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
pub mod constants {
|
||||||
|
use frame_support::{
|
||||||
|
parameter_types,
|
||||||
|
weights::{constants, RuntimeDbWeight},
|
||||||
|
};
|
||||||
|
|
||||||
|
parameter_types! {
|
||||||
|
/// `ParityDB` can be enabled with a feature flag, but is still experimental. These weights
|
||||||
|
/// are available for brave runtime engineers who may want to try this out as default.
|
||||||
|
pub const ParityDbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
||||||
|
read: 8_000 * constants::WEIGHT_PER_NANOS,
|
||||||
|
write: 50_000 * constants::WEIGHT_PER_NANOS,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test_db_weights {
|
||||||
|
use super::constants::ParityDbWeight as W;
|
||||||
|
use frame_support::weights::constants;
|
||||||
|
|
||||||
|
/// Checks that all weights exist and have sane values.
|
||||||
|
// NOTE: If this test fails but you are sure that the generated values are fine,
|
||||||
|
// you can delete it.
|
||||||
|
#[test]
|
||||||
|
fn sane() {
|
||||||
|
// At least 1 µs.
|
||||||
|
assert!(
|
||||||
|
W::get().reads(1) >= constants::WEIGHT_PER_MICROS,
|
||||||
|
"Read weight should be at least 1 µs."
|
||||||
|
);
|
||||||
|
assert!(
|
||||||
|
W::get().writes(1) >= constants::WEIGHT_PER_MICROS,
|
||||||
|
"Write weight should be at least 1 µs."
|
||||||
|
);
|
||||||
|
// At most 1 ms.
|
||||||
|
assert!(
|
||||||
|
W::get().reads(1) <= constants::WEIGHT_PER_MILLIS,
|
||||||
|
"Read weight should be at most 1 ms."
|
||||||
|
);
|
||||||
|
assert!(
|
||||||
|
W::get().writes(1) <= constants::WEIGHT_PER_MILLIS,
|
||||||
|
"Write weight should be at most 1 ms."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
// This file is part of Substrate.
|
||||||
|
|
||||||
|
// Copyright (C) 2022 Parity Technologies (UK) Ltd.
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
pub mod constants {
|
||||||
|
use frame_support::{
|
||||||
|
parameter_types,
|
||||||
|
weights::{constants, RuntimeDbWeight},
|
||||||
|
};
|
||||||
|
|
||||||
|
parameter_types! {
|
||||||
|
/// By default, Substrate uses `RocksDB`, so this will be the weight used throughout
|
||||||
|
/// the runtime.
|
||||||
|
pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
||||||
|
read: 25_000 * constants::WEIGHT_PER_NANOS,
|
||||||
|
write: 100_000 * constants::WEIGHT_PER_NANOS,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test_db_weights {
|
||||||
|
use super::constants::RocksDbWeight as W;
|
||||||
|
use frame_support::weights::constants;
|
||||||
|
|
||||||
|
/// Checks that all weights exist and have sane values.
|
||||||
|
// NOTE: If this test fails but you are sure that the generated values are fine,
|
||||||
|
// you can delete it.
|
||||||
|
#[test]
|
||||||
|
fn sane() {
|
||||||
|
// At least 1 µs.
|
||||||
|
assert!(
|
||||||
|
W::get().reads(1) >= constants::WEIGHT_PER_MICROS,
|
||||||
|
"Read weight should be at least 1 µs."
|
||||||
|
);
|
||||||
|
assert!(
|
||||||
|
W::get().writes(1) >= constants::WEIGHT_PER_MICROS,
|
||||||
|
"Write weight should be at least 1 µs."
|
||||||
|
);
|
||||||
|
// At most 1 ms.
|
||||||
|
assert!(
|
||||||
|
W::get().reads(1) <= constants::WEIGHT_PER_MILLIS,
|
||||||
|
"Read weight should be at most 1 ms."
|
||||||
|
);
|
||||||
|
assert!(
|
||||||
|
W::get().writes(1) <= constants::WEIGHT_PER_MILLIS,
|
||||||
|
"Write weight should be at most 1 ms."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user