mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 02:21:04 +00:00
Companion for paritytech/substrate#12868 (#1970)
* Replace WEIGHT_PER_* with WEIGHT_REF_TIME_PER_*
* Fixes
* Fixes
* update lockfile for {"substrate", "polkadot"}
Co-authored-by: parity-processbot <>
This commit is contained in:
Generated
+266
-277
File diff suppressed because it is too large
Load Diff
@@ -27,7 +27,7 @@ use codec::{Decode, DecodeLimit, Encode};
|
|||||||
use cumulus_primitives_core::{relay_chain::BlockNumber as RelayBlockNumber, DmpMessageHandler};
|
use cumulus_primitives_core::{relay_chain::BlockNumber as RelayBlockNumber, DmpMessageHandler};
|
||||||
use frame_support::{
|
use frame_support::{
|
||||||
traits::EnsureOrigin,
|
traits::EnsureOrigin,
|
||||||
weights::{constants::WEIGHT_PER_MILLIS, Weight},
|
weights::{constants::WEIGHT_REF_TIME_PER_MILLIS, Weight},
|
||||||
};
|
};
|
||||||
pub use pallet::*;
|
pub use pallet::*;
|
||||||
use scale_info::TypeInfo;
|
use scale_info::TypeInfo;
|
||||||
@@ -52,8 +52,8 @@ impl Default for ConfigData {
|
|||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
max_individual: Weight::from_parts(
|
max_individual: Weight::from_parts(
|
||||||
10u64 * WEIGHT_PER_MILLIS.ref_time(), // 10 ms of execution time maximum by default
|
10u64 * WEIGHT_REF_TIME_PER_MILLIS, // 10 ms of execution time maximum by default
|
||||||
DEFAULT_POV_SIZE, // 64 KB of proof size by default
|
DEFAULT_POV_SIZE, // 64 KB of proof size by default
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ use crate::{Config, Pallet, Store, DEFAULT_POV_SIZE};
|
|||||||
use frame_support::{
|
use frame_support::{
|
||||||
pallet_prelude::*,
|
pallet_prelude::*,
|
||||||
traits::StorageVersion,
|
traits::StorageVersion,
|
||||||
weights::{constants::WEIGHT_PER_MILLIS, Weight},
|
weights::{constants::WEIGHT_REF_TIME_PER_MILLIS, Weight},
|
||||||
};
|
};
|
||||||
use xcm::latest::Weight as XcmWeight;
|
use xcm::latest::Weight as XcmWeight;
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ mod v0 {
|
|||||||
|
|
||||||
impl Default for ConfigData {
|
impl Default for ConfigData {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
ConfigData { max_individual: 10u64 * WEIGHT_PER_MILLIS.ref_time() }
|
ConfigData { max_individual: 10u64 * WEIGHT_REF_TIME_PER_MILLIS }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ use cumulus_primitives_core::{
|
|||||||
};
|
};
|
||||||
use frame_support::{
|
use frame_support::{
|
||||||
traits::EnsureOrigin,
|
traits::EnsureOrigin,
|
||||||
weights::{constants::WEIGHT_PER_MILLIS, Weight},
|
weights::{constants::WEIGHT_REF_TIME_PER_MILLIS, Weight},
|
||||||
};
|
};
|
||||||
use rand_chacha::{
|
use rand_chacha::{
|
||||||
rand_core::{RngCore, SeedableRng},
|
rand_core::{RngCore, SeedableRng},
|
||||||
@@ -464,7 +464,7 @@ impl Default for QueueConfigData {
|
|||||||
threshold_weight: Weight::from_ref_time(100_000),
|
threshold_weight: Weight::from_ref_time(100_000),
|
||||||
weight_restrict_decay: Weight::from_ref_time(2),
|
weight_restrict_decay: Weight::from_ref_time(2),
|
||||||
xcmp_max_individual_weight: Weight::from_parts(
|
xcmp_max_individual_weight: Weight::from_parts(
|
||||||
20u64 * WEIGHT_PER_MILLIS.ref_time(),
|
20u64 * WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
DEFAULT_POV_SIZE,
|
DEFAULT_POV_SIZE,
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ use crate::{Config, Pallet, Store, DEFAULT_POV_SIZE};
|
|||||||
use frame_support::{
|
use frame_support::{
|
||||||
pallet_prelude::*,
|
pallet_prelude::*,
|
||||||
traits::StorageVersion,
|
traits::StorageVersion,
|
||||||
weights::{constants::WEIGHT_PER_MILLIS, Weight},
|
weights::{constants::WEIGHT_REF_TIME_PER_MILLIS, Weight},
|
||||||
};
|
};
|
||||||
use xcm::latest::Weight as XcmWeight;
|
use xcm::latest::Weight as XcmWeight;
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ mod v1 {
|
|||||||
resume_threshold: 1,
|
resume_threshold: 1,
|
||||||
threshold_weight: 100_000,
|
threshold_weight: 100_000,
|
||||||
weight_restrict_decay: 2,
|
weight_restrict_decay: 2,
|
||||||
xcmp_max_individual_weight: 20u64 * WEIGHT_PER_MILLIS.ref_time(),
|
xcmp_max_individual_weight: 20u64 * WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -220,21 +220,24 @@ fn update_xcmp_max_individual_weight() {
|
|||||||
let data: QueueConfigData = <QueueConfig<Test>>::get();
|
let data: QueueConfigData = <QueueConfig<Test>>::get();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
data.xcmp_max_individual_weight,
|
data.xcmp_max_individual_weight,
|
||||||
Weight::from_parts(20u64 * WEIGHT_PER_MILLIS.ref_time(), DEFAULT_POV_SIZE),
|
Weight::from_parts(20u64 * WEIGHT_REF_TIME_PER_MILLIS, DEFAULT_POV_SIZE),
|
||||||
);
|
);
|
||||||
assert_ok!(XcmpQueue::update_xcmp_max_individual_weight(
|
assert_ok!(XcmpQueue::update_xcmp_max_individual_weight(
|
||||||
RuntimeOrigin::root(),
|
RuntimeOrigin::root(),
|
||||||
30u64 * WEIGHT_PER_MILLIS.ref_time()
|
30u64 * WEIGHT_REF_TIME_PER_MILLIS
|
||||||
));
|
));
|
||||||
assert_noop!(
|
assert_noop!(
|
||||||
XcmpQueue::update_xcmp_max_individual_weight(
|
XcmpQueue::update_xcmp_max_individual_weight(
|
||||||
RuntimeOrigin::signed(3),
|
RuntimeOrigin::signed(3),
|
||||||
10u64 * WEIGHT_PER_MILLIS.ref_time()
|
10u64 * WEIGHT_REF_TIME_PER_MILLIS
|
||||||
),
|
),
|
||||||
BadOrigin
|
BadOrigin
|
||||||
);
|
);
|
||||||
let data: QueueConfigData = <QueueConfig<Test>>::get();
|
let data: QueueConfigData = <QueueConfig<Test>>::get();
|
||||||
|
|
||||||
assert_eq!(data.xcmp_max_individual_weight, 30u64 * WEIGHT_PER_MILLIS);
|
assert_eq!(
|
||||||
|
data.xcmp_max_individual_weight,
|
||||||
|
Weight::from_ref_time(30u64 * WEIGHT_REF_TIME_PER_MILLIS)
|
||||||
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ use frame_support::{
|
|||||||
parameter_types,
|
parameter_types,
|
||||||
traits::{ConstU32, ConstU64, ConstU8, Everything},
|
traits::{ConstU32, ConstU64, ConstU8, Everything},
|
||||||
weights::{
|
weights::{
|
||||||
constants::WEIGHT_PER_SECOND, ConstantMultiplier, Weight, WeightToFeeCoefficient,
|
constants::WEIGHT_REF_TIME_PER_SECOND, ConstantMultiplier, Weight, WeightToFeeCoefficient,
|
||||||
WeightToFeeCoefficients, WeightToFeePolynomial,
|
WeightToFeeCoefficients, WeightToFeePolynomial,
|
||||||
},
|
},
|
||||||
PalletId,
|
PalletId,
|
||||||
@@ -217,9 +217,10 @@ const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(5);
|
|||||||
const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
|
const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
|
||||||
|
|
||||||
/// We allow for 0.5 of a second of compute with a 12 second average block time.
|
/// We allow for 0.5 of a second of compute with a 12 second average block time.
|
||||||
const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND
|
const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts(
|
||||||
.saturating_div(2)
|
WEIGHT_REF_TIME_PER_SECOND.saturating_div(2),
|
||||||
.set_proof_size(cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64);
|
cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64,
|
||||||
|
);
|
||||||
|
|
||||||
/// The version information used to identify this runtime when compiled natively.
|
/// The version information used to identify this runtime when compiled natively.
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
|
|||||||
@@ -23,7 +23,8 @@ pub mod constants {
|
|||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
/// Importing a block with 0 Extrinsics.
|
/// Importing a block with 0 Extrinsics.
|
||||||
pub const BlockExecutionWeight: Weight = constants::WEIGHT_PER_NANOS.saturating_mul(5_000_000);
|
pub const BlockExecutionWeight: Weight =
|
||||||
|
Weight::from_ref_time(constants::WEIGHT_REF_TIME_PER_NANOS.saturating_mul(5_000_000));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
@@ -39,12 +40,12 @@ pub mod constants {
|
|||||||
|
|
||||||
// At least 100 µs.
|
// At least 100 µs.
|
||||||
assert!(
|
assert!(
|
||||||
w.ref_time() >= 100u64 * constants::WEIGHT_PER_MICROS.ref_time(),
|
w.ref_time() >= 100u64 * constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Weight should be at least 100 µs."
|
"Weight should be at least 100 µs."
|
||||||
);
|
);
|
||||||
// At most 50 ms.
|
// At most 50 ms.
|
||||||
assert!(
|
assert!(
|
||||||
w.ref_time() <= 50u64 * constants::WEIGHT_PER_MILLIS.ref_time(),
|
w.ref_time() <= 50u64 * constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Weight should be at most 50 ms."
|
"Weight should be at most 50 ms."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,8 @@ pub mod constants {
|
|||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
/// Executing a NO-OP `System::remarks` Extrinsic.
|
/// Executing a NO-OP `System::remarks` Extrinsic.
|
||||||
pub const ExtrinsicBaseWeight: Weight = constants::WEIGHT_PER_NANOS.saturating_mul(125_000);
|
pub const ExtrinsicBaseWeight: Weight =
|
||||||
|
Weight::from_ref_time(constants::WEIGHT_REF_TIME_PER_NANOS.saturating_mul(125_000));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
@@ -39,12 +40,12 @@ pub mod constants {
|
|||||||
|
|
||||||
// At least 10 µs.
|
// At least 10 µs.
|
||||||
assert!(
|
assert!(
|
||||||
w.ref_time() >= 10u64 * constants::WEIGHT_PER_MICROS.ref_time(),
|
w.ref_time() >= 10u64 * constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Weight should be at least 10 µs."
|
"Weight should be at least 10 µs."
|
||||||
);
|
);
|
||||||
// At most 1 ms.
|
// At most 1 ms.
|
||||||
assert!(
|
assert!(
|
||||||
w.ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(),
|
w.ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Weight should be at most 1 ms."
|
"Weight should be at most 1 ms."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ pub mod constants {
|
|||||||
/// `ParityDB` can be enabled with a feature flag, but is still experimental. These weights
|
/// `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.
|
/// are available for brave runtime engineers who may want to try this out as default.
|
||||||
pub const ParityDbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
pub const ParityDbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
||||||
read: 8_000 * constants::WEIGHT_PER_NANOS.ref_time(),
|
read: 8_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
|
||||||
write: 50_000 * constants::WEIGHT_PER_NANOS.ref_time(),
|
write: 50_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,20 +42,20 @@ pub mod constants {
|
|||||||
fn sane() {
|
fn sane() {
|
||||||
// At least 1 µs.
|
// At least 1 µs.
|
||||||
assert!(
|
assert!(
|
||||||
W::get().reads(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(),
|
W::get().reads(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Read weight should be at least 1 µs."
|
"Read weight should be at least 1 µs."
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
W::get().writes(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(),
|
W::get().writes(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Write weight should be at least 1 µs."
|
"Write weight should be at least 1 µs."
|
||||||
);
|
);
|
||||||
// At most 1 ms.
|
// At most 1 ms.
|
||||||
assert!(
|
assert!(
|
||||||
W::get().reads(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(),
|
W::get().reads(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Read weight should be at most 1 ms."
|
"Read weight should be at most 1 ms."
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
W::get().writes(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(),
|
W::get().writes(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Write weight should be at most 1 ms."
|
"Write weight should be at most 1 ms."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ pub mod constants {
|
|||||||
/// By default, Substrate uses `RocksDB`, so this will be the weight used throughout
|
/// By default, Substrate uses `RocksDB`, so this will be the weight used throughout
|
||||||
/// the runtime.
|
/// the runtime.
|
||||||
pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
||||||
read: 25_000 * constants::WEIGHT_PER_NANOS.ref_time(),
|
read: 25_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
|
||||||
write: 100_000 * constants::WEIGHT_PER_NANOS.ref_time(),
|
write: 100_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,20 +42,20 @@ pub mod constants {
|
|||||||
fn sane() {
|
fn sane() {
|
||||||
// At least 1 µs.
|
// At least 1 µs.
|
||||||
assert!(
|
assert!(
|
||||||
W::get().reads(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(),
|
W::get().reads(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Read weight should be at least 1 µs."
|
"Read weight should be at least 1 µs."
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
W::get().writes(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(),
|
W::get().writes(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Write weight should be at least 1 µs."
|
"Write weight should be at least 1 µs."
|
||||||
);
|
);
|
||||||
// At most 1 ms.
|
// At most 1 ms.
|
||||||
assert!(
|
assert!(
|
||||||
W::get().reads(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(),
|
W::get().reads(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Read weight should be at most 1 ms."
|
"Read weight should be at most 1 ms."
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
W::get().writes(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(),
|
W::get().writes(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Write weight should be at most 1 ms."
|
"Write weight should be at most 1 ms."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ mod types {
|
|||||||
/// Common constants of parachains.
|
/// Common constants of parachains.
|
||||||
mod constants {
|
mod constants {
|
||||||
use super::types::BlockNumber;
|
use super::types::BlockNumber;
|
||||||
use frame_support::weights::{constants::WEIGHT_PER_SECOND, Weight};
|
use frame_support::weights::{constants::WEIGHT_REF_TIME_PER_SECOND, Weight};
|
||||||
use sp_runtime::Perbill;
|
use sp_runtime::Perbill;
|
||||||
/// This determines the average expected block time that we are targeting. Blocks will be
|
/// This determines the average expected block time that we are targeting. Blocks will be
|
||||||
/// produced at a minimum duration defined by `SLOT_DURATION`. `SLOT_DURATION` is picked up by
|
/// produced at a minimum duration defined by `SLOT_DURATION`. `SLOT_DURATION` is picked up by
|
||||||
@@ -92,9 +92,10 @@ mod constants {
|
|||||||
pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
|
pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
|
||||||
|
|
||||||
/// We allow for 0.5 seconds of compute with a 6 second average block time.
|
/// We allow for 0.5 seconds of compute with a 6 second average block time.
|
||||||
pub const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND
|
pub const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts(
|
||||||
.saturating_div(2)
|
WEIGHT_REF_TIME_PER_SECOND.saturating_div(2),
|
||||||
.set_proof_size(polkadot_primitives::v2::MAX_POV_SIZE as u64);
|
polkadot_primitives::v2::MAX_POV_SIZE as u64,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know
|
/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know
|
||||||
|
|||||||
@@ -23,7 +23,8 @@ pub mod constants {
|
|||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
/// Importing a block with 0 Extrinsics.
|
/// Importing a block with 0 Extrinsics.
|
||||||
pub const BlockExecutionWeight: Weight = constants::WEIGHT_PER_NANOS.saturating_mul(5_000_000);
|
pub const BlockExecutionWeight: Weight =
|
||||||
|
Weight::from_ref_time(constants::WEIGHT_REF_TIME_PER_NANOS.saturating_mul(5_000_000));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
@@ -39,12 +40,12 @@ pub mod constants {
|
|||||||
|
|
||||||
// At least 100 µs.
|
// At least 100 µs.
|
||||||
assert!(
|
assert!(
|
||||||
w.ref_time() >= 100u64 * constants::WEIGHT_PER_MICROS.ref_time(),
|
w.ref_time() >= 100u64 * constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Weight should be at least 100 µs."
|
"Weight should be at least 100 µs."
|
||||||
);
|
);
|
||||||
// At most 50 ms.
|
// At most 50 ms.
|
||||||
assert!(
|
assert!(
|
||||||
w.ref_time() <= 50u64 * constants::WEIGHT_PER_MILLIS.ref_time(),
|
w.ref_time() <= 50u64 * constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Weight should be at most 50 ms."
|
"Weight should be at most 50 ms."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,8 @@ pub mod constants {
|
|||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
/// Executing a NO-OP `System::remarks` Extrinsic.
|
/// Executing a NO-OP `System::remarks` Extrinsic.
|
||||||
pub const ExtrinsicBaseWeight: Weight = constants::WEIGHT_PER_NANOS.saturating_mul(125_000);
|
pub const ExtrinsicBaseWeight: Weight =
|
||||||
|
Weight::from_ref_time(constants::WEIGHT_REF_TIME_PER_NANOS.saturating_mul(125_000));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
@@ -39,12 +40,12 @@ pub mod constants {
|
|||||||
|
|
||||||
// At least 10 µs.
|
// At least 10 µs.
|
||||||
assert!(
|
assert!(
|
||||||
w.ref_time() >= 10u64 * constants::WEIGHT_PER_MICROS.ref_time(),
|
w.ref_time() >= 10u64 * constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Weight should be at least 10 µs."
|
"Weight should be at least 10 µs."
|
||||||
);
|
);
|
||||||
// At most 1 ms.
|
// At most 1 ms.
|
||||||
assert!(
|
assert!(
|
||||||
w.ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(),
|
w.ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Weight should be at most 1 ms."
|
"Weight should be at most 1 ms."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ pub mod constants {
|
|||||||
/// `ParityDB` can be enabled with a feature flag, but is still experimental. These weights
|
/// `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.
|
/// are available for brave runtime engineers who may want to try this out as default.
|
||||||
pub const ParityDbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
pub const ParityDbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
||||||
read: 8_000 * constants::WEIGHT_PER_NANOS.ref_time(),
|
read: 8_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
|
||||||
write: 50_000 * constants::WEIGHT_PER_NANOS.ref_time(),
|
write: 50_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,20 +42,20 @@ pub mod constants {
|
|||||||
fn sane() {
|
fn sane() {
|
||||||
// At least 1 µs.
|
// At least 1 µs.
|
||||||
assert!(
|
assert!(
|
||||||
W::get().reads(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(),
|
W::get().reads(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Read weight should be at least 1 µs."
|
"Read weight should be at least 1 µs."
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
W::get().writes(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(),
|
W::get().writes(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Write weight should be at least 1 µs."
|
"Write weight should be at least 1 µs."
|
||||||
);
|
);
|
||||||
// At most 1 ms.
|
// At most 1 ms.
|
||||||
assert!(
|
assert!(
|
||||||
W::get().reads(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(),
|
W::get().reads(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Read weight should be at most 1 ms."
|
"Read weight should be at most 1 ms."
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
W::get().writes(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(),
|
W::get().writes(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Write weight should be at most 1 ms."
|
"Write weight should be at most 1 ms."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ pub mod constants {
|
|||||||
/// By default, Substrate uses `RocksDB`, so this will be the weight used throughout
|
/// By default, Substrate uses `RocksDB`, so this will be the weight used throughout
|
||||||
/// the runtime.
|
/// the runtime.
|
||||||
pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
||||||
read: 25_000 * constants::WEIGHT_PER_NANOS.ref_time(),
|
read: 25_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
|
||||||
write: 100_000 * constants::WEIGHT_PER_NANOS.ref_time(),
|
write: 100_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,20 +42,20 @@ pub mod constants {
|
|||||||
fn sane() {
|
fn sane() {
|
||||||
// At least 1 µs.
|
// At least 1 µs.
|
||||||
assert!(
|
assert!(
|
||||||
W::get().reads(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(),
|
W::get().reads(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Read weight should be at least 1 µs."
|
"Read weight should be at least 1 µs."
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
W::get().writes(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(),
|
W::get().writes(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Write weight should be at least 1 µs."
|
"Write weight should be at least 1 µs."
|
||||||
);
|
);
|
||||||
// At most 1 ms.
|
// At most 1 ms.
|
||||||
assert!(
|
assert!(
|
||||||
W::get().reads(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(),
|
W::get().reads(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Read weight should be at most 1 ms."
|
"Read weight should be at most 1 ms."
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
W::get().writes(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(),
|
W::get().writes(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Write weight should be at most 1 ms."
|
"Write weight should be at most 1 ms."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,8 @@ pub mod constants {
|
|||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
/// Importing a block with 0 Extrinsics.
|
/// Importing a block with 0 Extrinsics.
|
||||||
pub const BlockExecutionWeight: Weight = constants::WEIGHT_PER_NANOS.saturating_mul(5_000_000);
|
pub const BlockExecutionWeight: Weight =
|
||||||
|
Weight::from_ref_time(constants::WEIGHT_REF_TIME_PER_NANOS.saturating_mul(5_000_000));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
@@ -39,12 +40,12 @@ pub mod constants {
|
|||||||
|
|
||||||
// At least 100 µs.
|
// At least 100 µs.
|
||||||
assert!(
|
assert!(
|
||||||
w.ref_time() >= 100u64 * constants::WEIGHT_PER_MICROS.ref_time(),
|
w.ref_time() >= 100u64 * constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Weight should be at least 100 µs."
|
"Weight should be at least 100 µs."
|
||||||
);
|
);
|
||||||
// At most 50 ms.
|
// At most 50 ms.
|
||||||
assert!(
|
assert!(
|
||||||
w.ref_time() <= 50u64 * constants::WEIGHT_PER_MILLIS.ref_time(),
|
w.ref_time() <= 50u64 * constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Weight should be at most 50 ms."
|
"Weight should be at most 50 ms."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,8 @@ pub mod constants {
|
|||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
/// Executing a NO-OP `System::remarks` Extrinsic.
|
/// Executing a NO-OP `System::remarks` Extrinsic.
|
||||||
pub const ExtrinsicBaseWeight: Weight = constants::WEIGHT_PER_NANOS.saturating_mul(125_000);
|
pub const ExtrinsicBaseWeight: Weight =
|
||||||
|
Weight::from_ref_time(constants::WEIGHT_REF_TIME_PER_NANOS.saturating_mul(125_000));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
@@ -39,12 +40,12 @@ pub mod constants {
|
|||||||
|
|
||||||
// At least 10 µs.
|
// At least 10 µs.
|
||||||
assert!(
|
assert!(
|
||||||
w.ref_time() >= 10u64 * constants::WEIGHT_PER_MICROS.ref_time(),
|
w.ref_time() >= 10u64 * constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Weight should be at least 10 µs."
|
"Weight should be at least 10 µs."
|
||||||
);
|
);
|
||||||
// At most 1 ms.
|
// At most 1 ms.
|
||||||
assert!(
|
assert!(
|
||||||
w.ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(),
|
w.ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Weight should be at most 1 ms."
|
"Weight should be at most 1 ms."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ pub mod constants {
|
|||||||
/// `ParityDB` can be enabled with a feature flag, but is still experimental. These weights
|
/// `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.
|
/// are available for brave runtime engineers who may want to try this out as default.
|
||||||
pub const ParityDbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
pub const ParityDbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
||||||
read: 8_000 * constants::WEIGHT_PER_NANOS.ref_time(),
|
read: 8_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
|
||||||
write: 50_000 * constants::WEIGHT_PER_NANOS.ref_time(),
|
write: 50_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,20 +42,20 @@ pub mod constants {
|
|||||||
fn sane() {
|
fn sane() {
|
||||||
// At least 1 µs.
|
// At least 1 µs.
|
||||||
assert!(
|
assert!(
|
||||||
W::get().reads(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(),
|
W::get().reads(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Read weight should be at least 1 µs."
|
"Read weight should be at least 1 µs."
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
W::get().writes(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(),
|
W::get().writes(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Write weight should be at least 1 µs."
|
"Write weight should be at least 1 µs."
|
||||||
);
|
);
|
||||||
// At most 1 ms.
|
// At most 1 ms.
|
||||||
assert!(
|
assert!(
|
||||||
W::get().reads(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(),
|
W::get().reads(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Read weight should be at most 1 ms."
|
"Read weight should be at most 1 ms."
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
W::get().writes(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(),
|
W::get().writes(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Write weight should be at most 1 ms."
|
"Write weight should be at most 1 ms."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ pub mod constants {
|
|||||||
/// By default, Substrate uses `RocksDB`, so this will be the weight used throughout
|
/// By default, Substrate uses `RocksDB`, so this will be the weight used throughout
|
||||||
/// the runtime.
|
/// the runtime.
|
||||||
pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
||||||
read: 25_000 * constants::WEIGHT_PER_NANOS.ref_time(),
|
read: 25_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
|
||||||
write: 100_000 * constants::WEIGHT_PER_NANOS.ref_time(),
|
write: 100_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,20 +42,20 @@ pub mod constants {
|
|||||||
fn sane() {
|
fn sane() {
|
||||||
// At least 1 µs.
|
// At least 1 µs.
|
||||||
assert!(
|
assert!(
|
||||||
W::get().reads(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(),
|
W::get().reads(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Read weight should be at least 1 µs."
|
"Read weight should be at least 1 µs."
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
W::get().writes(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(),
|
W::get().writes(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Write weight should be at least 1 µs."
|
"Write weight should be at least 1 µs."
|
||||||
);
|
);
|
||||||
// At most 1 ms.
|
// At most 1 ms.
|
||||||
assert!(
|
assert!(
|
||||||
W::get().reads(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(),
|
W::get().reads(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Read weight should be at most 1 ms."
|
"Read weight should be at most 1 ms."
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
W::get().writes(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(),
|
W::get().writes(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Write weight should be at most 1 ms."
|
"Write weight should be at most 1 ms."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,8 @@ pub mod constants {
|
|||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
/// Importing a block with 0 Extrinsics.
|
/// Importing a block with 0 Extrinsics.
|
||||||
pub const BlockExecutionWeight: Weight = constants::WEIGHT_PER_NANOS.saturating_mul(5_000_000);
|
pub const BlockExecutionWeight: Weight =
|
||||||
|
Weight::from_ref_time(constants::WEIGHT_REF_TIME_PER_NANOS.saturating_mul(5_000_000));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
@@ -39,12 +40,12 @@ pub mod constants {
|
|||||||
|
|
||||||
// At least 100 µs.
|
// At least 100 µs.
|
||||||
assert!(
|
assert!(
|
||||||
w.ref_time() >= 100u64 * constants::WEIGHT_PER_MICROS.ref_time(),
|
w.ref_time() >= 100u64 * constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Weight should be at least 100 µs."
|
"Weight should be at least 100 µs."
|
||||||
);
|
);
|
||||||
// At most 50 ms.
|
// At most 50 ms.
|
||||||
assert!(
|
assert!(
|
||||||
w.ref_time() <= 50u64 * constants::WEIGHT_PER_MILLIS.ref_time(),
|
w.ref_time() <= 50u64 * constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Weight should be at most 50 ms."
|
"Weight should be at most 50 ms."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,8 @@ pub mod constants {
|
|||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
/// Executing a NO-OP `System::remarks` Extrinsic.
|
/// Executing a NO-OP `System::remarks` Extrinsic.
|
||||||
pub const ExtrinsicBaseWeight: Weight = constants::WEIGHT_PER_NANOS.saturating_mul(125_000);
|
pub const ExtrinsicBaseWeight: Weight =
|
||||||
|
Weight::from_ref_time(constants::WEIGHT_REF_TIME_PER_NANOS.saturating_mul(125_000));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
@@ -39,12 +40,12 @@ pub mod constants {
|
|||||||
|
|
||||||
// At least 10 µs.
|
// At least 10 µs.
|
||||||
assert!(
|
assert!(
|
||||||
w.ref_time() >= 10u64 * constants::WEIGHT_PER_MICROS.ref_time(),
|
w.ref_time() >= 10u64 * constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Weight should be at least 10 µs."
|
"Weight should be at least 10 µs."
|
||||||
);
|
);
|
||||||
// At most 1 ms.
|
// At most 1 ms.
|
||||||
assert!(
|
assert!(
|
||||||
w.ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(),
|
w.ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Weight should be at most 1 ms."
|
"Weight should be at most 1 ms."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ pub mod constants {
|
|||||||
/// `ParityDB` can be enabled with a feature flag, but is still experimental. These weights
|
/// `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.
|
/// are available for brave runtime engineers who may want to try this out as default.
|
||||||
pub const ParityDbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
pub const ParityDbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
||||||
read: 8_000 * constants::WEIGHT_PER_NANOS.ref_time(),
|
read: 8_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
|
||||||
write: 50_000 * constants::WEIGHT_PER_NANOS.ref_time(),
|
write: 50_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,20 +42,20 @@ pub mod constants {
|
|||||||
fn sane() {
|
fn sane() {
|
||||||
// At least 1 µs.
|
// At least 1 µs.
|
||||||
assert!(
|
assert!(
|
||||||
W::get().reads(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(),
|
W::get().reads(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Read weight should be at least 1 µs."
|
"Read weight should be at least 1 µs."
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
W::get().writes(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(),
|
W::get().writes(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Write weight should be at least 1 µs."
|
"Write weight should be at least 1 µs."
|
||||||
);
|
);
|
||||||
// At most 1 ms.
|
// At most 1 ms.
|
||||||
assert!(
|
assert!(
|
||||||
W::get().reads(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(),
|
W::get().reads(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Read weight should be at most 1 ms."
|
"Read weight should be at most 1 ms."
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
W::get().writes(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(),
|
W::get().writes(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Write weight should be at most 1 ms."
|
"Write weight should be at most 1 ms."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ pub mod constants {
|
|||||||
/// By default, Substrate uses `RocksDB`, so this will be the weight used throughout
|
/// By default, Substrate uses `RocksDB`, so this will be the weight used throughout
|
||||||
/// the runtime.
|
/// the runtime.
|
||||||
pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
||||||
read: 25_000 * constants::WEIGHT_PER_NANOS.ref_time(),
|
read: 25_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
|
||||||
write: 100_000 * constants::WEIGHT_PER_NANOS.ref_time(),
|
write: 100_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,20 +42,20 @@ pub mod constants {
|
|||||||
fn sane() {
|
fn sane() {
|
||||||
// At least 1 µs.
|
// At least 1 µs.
|
||||||
assert!(
|
assert!(
|
||||||
W::get().reads(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(),
|
W::get().reads(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Read weight should be at least 1 µs."
|
"Read weight should be at least 1 µs."
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
W::get().writes(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(),
|
W::get().writes(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Write weight should be at least 1 µs."
|
"Write weight should be at least 1 µs."
|
||||||
);
|
);
|
||||||
// At most 1 ms.
|
// At most 1 ms.
|
||||||
assert!(
|
assert!(
|
||||||
W::get().reads(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(),
|
W::get().reads(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Read weight should be at most 1 ms."
|
"Read weight should be at most 1 ms."
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
W::get().writes(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(),
|
W::get().writes(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Write weight should be at most 1 ms."
|
"Write weight should be at most 1 ms."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-3
@@ -23,7 +23,8 @@ pub mod constants {
|
|||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
/// Importing a block with 0 Extrinsics.
|
/// Importing a block with 0 Extrinsics.
|
||||||
pub const BlockExecutionWeight: Weight = constants::WEIGHT_PER_NANOS.saturating_mul(5_000_000);
|
pub const BlockExecutionWeight: Weight =
|
||||||
|
Weight::from_ref_time(constants::WEIGHT_REF_TIME_PER_NANOS.saturating_mul(5_000_000));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
@@ -39,12 +40,12 @@ pub mod constants {
|
|||||||
|
|
||||||
// At least 100 µs.
|
// At least 100 µs.
|
||||||
assert!(
|
assert!(
|
||||||
w.ref_time() >= 100u64 * constants::WEIGHT_PER_MICROS.ref_time(),
|
w.ref_time() >= 100u64 * constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Weight should be at least 100 µs."
|
"Weight should be at least 100 µs."
|
||||||
);
|
);
|
||||||
// At most 50 ms.
|
// At most 50 ms.
|
||||||
assert!(
|
assert!(
|
||||||
w.ref_time() <= 50u64 * constants::WEIGHT_PER_MILLIS.ref_time(),
|
w.ref_time() <= 50u64 * constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Weight should be at most 50 ms."
|
"Weight should be at most 50 ms."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-3
@@ -23,7 +23,8 @@ pub mod constants {
|
|||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
/// Executing a NO-OP `System::remarks` Extrinsic.
|
/// Executing a NO-OP `System::remarks` Extrinsic.
|
||||||
pub const ExtrinsicBaseWeight: Weight = constants::WEIGHT_PER_NANOS.saturating_mul(125_000);
|
pub const ExtrinsicBaseWeight: Weight =
|
||||||
|
Weight::from_ref_time(constants::WEIGHT_REF_TIME_PER_NANOS.saturating_mul(125_000));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
@@ -39,12 +40,12 @@ pub mod constants {
|
|||||||
|
|
||||||
// At least 10 µs.
|
// At least 10 µs.
|
||||||
assert!(
|
assert!(
|
||||||
w.ref_time() >= 10u64 * constants::WEIGHT_PER_MICROS.ref_time(),
|
w.ref_time() >= 10u64 * constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Weight should be at least 10 µs."
|
"Weight should be at least 10 µs."
|
||||||
);
|
);
|
||||||
// At most 1 ms.
|
// At most 1 ms.
|
||||||
assert!(
|
assert!(
|
||||||
w.ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(),
|
w.ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Weight should be at most 1 ms."
|
"Weight should be at most 1 ms."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-6
@@ -25,8 +25,8 @@ pub mod constants {
|
|||||||
/// `ParityDB` can be enabled with a feature flag, but is still experimental. These weights
|
/// `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.
|
/// are available for brave runtime engineers who may want to try this out as default.
|
||||||
pub const ParityDbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
pub const ParityDbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
||||||
read: 8_000 * constants::WEIGHT_PER_NANOS.ref_time(),
|
read: 8_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
|
||||||
write: 50_000 * constants::WEIGHT_PER_NANOS.ref_time(),
|
write: 50_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,20 +42,20 @@ pub mod constants {
|
|||||||
fn sane() {
|
fn sane() {
|
||||||
// At least 1 µs.
|
// At least 1 µs.
|
||||||
assert!(
|
assert!(
|
||||||
W::get().reads(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(),
|
W::get().reads(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Read weight should be at least 1 µs."
|
"Read weight should be at least 1 µs."
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
W::get().writes(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(),
|
W::get().writes(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Write weight should be at least 1 µs."
|
"Write weight should be at least 1 µs."
|
||||||
);
|
);
|
||||||
// At most 1 ms.
|
// At most 1 ms.
|
||||||
assert!(
|
assert!(
|
||||||
W::get().reads(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(),
|
W::get().reads(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Read weight should be at most 1 ms."
|
"Read weight should be at most 1 ms."
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
W::get().writes(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(),
|
W::get().writes(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Write weight should be at most 1 ms."
|
"Write weight should be at most 1 ms."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-6
@@ -25,8 +25,8 @@ pub mod constants {
|
|||||||
/// By default, Substrate uses `RocksDB`, so this will be the weight used throughout
|
/// By default, Substrate uses `RocksDB`, so this will be the weight used throughout
|
||||||
/// the runtime.
|
/// the runtime.
|
||||||
pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
||||||
read: 25_000 * constants::WEIGHT_PER_NANOS.ref_time(),
|
read: 25_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
|
||||||
write: 100_000 * constants::WEIGHT_PER_NANOS.ref_time(),
|
write: 100_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,20 +42,20 @@ pub mod constants {
|
|||||||
fn sane() {
|
fn sane() {
|
||||||
// At least 1 µs.
|
// At least 1 µs.
|
||||||
assert!(
|
assert!(
|
||||||
W::get().reads(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(),
|
W::get().reads(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Read weight should be at least 1 µs."
|
"Read weight should be at least 1 µs."
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
W::get().writes(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(),
|
W::get().writes(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Write weight should be at least 1 µs."
|
"Write weight should be at least 1 µs."
|
||||||
);
|
);
|
||||||
// At most 1 ms.
|
// At most 1 ms.
|
||||||
assert!(
|
assert!(
|
||||||
W::get().reads(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(),
|
W::get().reads(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Read weight should be at most 1 ms."
|
"Read weight should be at most 1 ms."
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
W::get().writes(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(),
|
W::get().writes(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Write weight should be at most 1 ms."
|
"Write weight should be at most 1 ms."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-3
@@ -23,7 +23,8 @@ pub mod constants {
|
|||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
/// Importing a block with 0 Extrinsics.
|
/// Importing a block with 0 Extrinsics.
|
||||||
pub const BlockExecutionWeight: Weight = constants::WEIGHT_PER_NANOS.saturating_mul(5_000_000);
|
pub const BlockExecutionWeight: Weight =
|
||||||
|
Weight::from_ref_time(constants::WEIGHT_REF_TIME_PER_NANOS.saturating_mul(5_000_000));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
@@ -39,12 +40,12 @@ pub mod constants {
|
|||||||
|
|
||||||
// At least 100 µs.
|
// At least 100 µs.
|
||||||
assert!(
|
assert!(
|
||||||
w.ref_time() >= 100u64 * constants::WEIGHT_PER_MICROS.ref_time(),
|
w.ref_time() >= 100u64 * constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Weight should be at least 100 µs."
|
"Weight should be at least 100 µs."
|
||||||
);
|
);
|
||||||
// At most 50 ms.
|
// At most 50 ms.
|
||||||
assert!(
|
assert!(
|
||||||
w.ref_time() <= 50u64 * constants::WEIGHT_PER_MILLIS.ref_time(),
|
w.ref_time() <= 50u64 * constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Weight should be at most 50 ms."
|
"Weight should be at most 50 ms."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-3
@@ -23,7 +23,8 @@ pub mod constants {
|
|||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
/// Executing a NO-OP `System::remarks` Extrinsic.
|
/// Executing a NO-OP `System::remarks` Extrinsic.
|
||||||
pub const ExtrinsicBaseWeight: Weight = constants::WEIGHT_PER_NANOS.saturating_mul(125_000);
|
pub const ExtrinsicBaseWeight: Weight =
|
||||||
|
Weight::from_ref_time(constants::WEIGHT_REF_TIME_PER_NANOS.saturating_mul(125_000));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
@@ -39,12 +40,12 @@ pub mod constants {
|
|||||||
|
|
||||||
// At least 10 µs.
|
// At least 10 µs.
|
||||||
assert!(
|
assert!(
|
||||||
w.ref_time() >= 10u64 * constants::WEIGHT_PER_MICROS.ref_time(),
|
w.ref_time() >= 10u64 * constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Weight should be at least 10 µs."
|
"Weight should be at least 10 µs."
|
||||||
);
|
);
|
||||||
// At most 1 ms.
|
// At most 1 ms.
|
||||||
assert!(
|
assert!(
|
||||||
w.ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(),
|
w.ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Weight should be at most 1 ms."
|
"Weight should be at most 1 ms."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-6
@@ -25,8 +25,8 @@ pub mod constants {
|
|||||||
/// `ParityDB` can be enabled with a feature flag, but is still experimental. These weights
|
/// `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.
|
/// are available for brave runtime engineers who may want to try this out as default.
|
||||||
pub const ParityDbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
pub const ParityDbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
||||||
read: 8_000 * constants::WEIGHT_PER_NANOS.ref_time(),
|
read: 8_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
|
||||||
write: 50_000 * constants::WEIGHT_PER_NANOS.ref_time(),
|
write: 50_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,20 +42,20 @@ pub mod constants {
|
|||||||
fn sane() {
|
fn sane() {
|
||||||
// At least 1 µs.
|
// At least 1 µs.
|
||||||
assert!(
|
assert!(
|
||||||
W::get().reads(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(),
|
W::get().reads(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Read weight should be at least 1 µs."
|
"Read weight should be at least 1 µs."
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
W::get().writes(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(),
|
W::get().writes(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Write weight should be at least 1 µs."
|
"Write weight should be at least 1 µs."
|
||||||
);
|
);
|
||||||
// At most 1 ms.
|
// At most 1 ms.
|
||||||
assert!(
|
assert!(
|
||||||
W::get().reads(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(),
|
W::get().reads(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Read weight should be at most 1 ms."
|
"Read weight should be at most 1 ms."
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
W::get().writes(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(),
|
W::get().writes(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Write weight should be at most 1 ms."
|
"Write weight should be at most 1 ms."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-6
@@ -25,8 +25,8 @@ pub mod constants {
|
|||||||
/// By default, Substrate uses `RocksDB`, so this will be the weight used throughout
|
/// By default, Substrate uses `RocksDB`, so this will be the weight used throughout
|
||||||
/// the runtime.
|
/// the runtime.
|
||||||
pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
||||||
read: 25_000 * constants::WEIGHT_PER_NANOS.ref_time(),
|
read: 25_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
|
||||||
write: 100_000 * constants::WEIGHT_PER_NANOS.ref_time(),
|
write: 100_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,20 +42,20 @@ pub mod constants {
|
|||||||
fn sane() {
|
fn sane() {
|
||||||
// At least 1 µs.
|
// At least 1 µs.
|
||||||
assert!(
|
assert!(
|
||||||
W::get().reads(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(),
|
W::get().reads(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Read weight should be at least 1 µs."
|
"Read weight should be at least 1 µs."
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
W::get().writes(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(),
|
W::get().writes(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Write weight should be at least 1 µs."
|
"Write weight should be at least 1 µs."
|
||||||
);
|
);
|
||||||
// At most 1 ms.
|
// At most 1 ms.
|
||||||
assert!(
|
assert!(
|
||||||
W::get().reads(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(),
|
W::get().reads(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Read weight should be at most 1 ms."
|
"Read weight should be at most 1 ms."
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
W::get().writes(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(),
|
W::get().writes(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Write weight should be at most 1 ms."
|
"Write weight should be at most 1 ms."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-3
@@ -23,7 +23,8 @@ pub mod constants {
|
|||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
/// Importing a block with 0 Extrinsics.
|
/// Importing a block with 0 Extrinsics.
|
||||||
pub const BlockExecutionWeight: Weight = constants::WEIGHT_PER_NANOS.saturating_mul(5_000_000);
|
pub const BlockExecutionWeight: Weight =
|
||||||
|
Weight::from_ref_time(constants::WEIGHT_REF_TIME_PER_NANOS.saturating_mul(5_000_000));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
@@ -39,12 +40,12 @@ pub mod constants {
|
|||||||
|
|
||||||
// At least 100 µs.
|
// At least 100 µs.
|
||||||
assert!(
|
assert!(
|
||||||
w.ref_time() >= 100u64 * constants::WEIGHT_PER_MICROS.ref_time(),
|
w.ref_time() >= 100u64 * constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Weight should be at least 100 µs."
|
"Weight should be at least 100 µs."
|
||||||
);
|
);
|
||||||
// At most 50 ms.
|
// At most 50 ms.
|
||||||
assert!(
|
assert!(
|
||||||
w.ref_time() <= 50u64 * constants::WEIGHT_PER_MILLIS.ref_time(),
|
w.ref_time() <= 50u64 * constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Weight should be at most 50 ms."
|
"Weight should be at most 50 ms."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-3
@@ -23,7 +23,8 @@ pub mod constants {
|
|||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
/// Executing a NO-OP `System::remarks` Extrinsic.
|
/// Executing a NO-OP `System::remarks` Extrinsic.
|
||||||
pub const ExtrinsicBaseWeight: Weight = constants::WEIGHT_PER_NANOS.saturating_mul(125_000);
|
pub const ExtrinsicBaseWeight: Weight =
|
||||||
|
Weight::from_ref_time(constants::WEIGHT_REF_TIME_PER_NANOS.saturating_mul(125_000));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
@@ -39,12 +40,12 @@ pub mod constants {
|
|||||||
|
|
||||||
// At least 10 µs.
|
// At least 10 µs.
|
||||||
assert!(
|
assert!(
|
||||||
w.ref_time() >= 10u64 * constants::WEIGHT_PER_MICROS.ref_time(),
|
w.ref_time() >= 10u64 * constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Weight should be at least 10 µs."
|
"Weight should be at least 10 µs."
|
||||||
);
|
);
|
||||||
// At most 1 ms.
|
// At most 1 ms.
|
||||||
assert!(
|
assert!(
|
||||||
w.ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(),
|
w.ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Weight should be at most 1 ms."
|
"Weight should be at most 1 ms."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-6
@@ -25,8 +25,8 @@ pub mod constants {
|
|||||||
/// `ParityDB` can be enabled with a feature flag, but is still experimental. These weights
|
/// `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.
|
/// are available for brave runtime engineers who may want to try this out as default.
|
||||||
pub const ParityDbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
pub const ParityDbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
||||||
read: 8_000 * constants::WEIGHT_PER_NANOS.ref_time(),
|
read: 8_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
|
||||||
write: 50_000 * constants::WEIGHT_PER_NANOS.ref_time(),
|
write: 50_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,20 +42,20 @@ pub mod constants {
|
|||||||
fn sane() {
|
fn sane() {
|
||||||
// At least 1 µs.
|
// At least 1 µs.
|
||||||
assert!(
|
assert!(
|
||||||
W::get().reads(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(),
|
W::get().reads(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Read weight should be at least 1 µs."
|
"Read weight should be at least 1 µs."
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
W::get().writes(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(),
|
W::get().writes(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Write weight should be at least 1 µs."
|
"Write weight should be at least 1 µs."
|
||||||
);
|
);
|
||||||
// At most 1 ms.
|
// At most 1 ms.
|
||||||
assert!(
|
assert!(
|
||||||
W::get().reads(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(),
|
W::get().reads(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Read weight should be at most 1 ms."
|
"Read weight should be at most 1 ms."
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
W::get().writes(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(),
|
W::get().writes(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Write weight should be at most 1 ms."
|
"Write weight should be at most 1 ms."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-6
@@ -25,8 +25,8 @@ pub mod constants {
|
|||||||
/// By default, Substrate uses `RocksDB`, so this will be the weight used throughout
|
/// By default, Substrate uses `RocksDB`, so this will be the weight used throughout
|
||||||
/// the runtime.
|
/// the runtime.
|
||||||
pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
||||||
read: 25_000 * constants::WEIGHT_PER_NANOS.ref_time(),
|
read: 25_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
|
||||||
write: 100_000 * constants::WEIGHT_PER_NANOS.ref_time(),
|
write: 100_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,20 +42,20 @@ pub mod constants {
|
|||||||
fn sane() {
|
fn sane() {
|
||||||
// At least 1 µs.
|
// At least 1 µs.
|
||||||
assert!(
|
assert!(
|
||||||
W::get().reads(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(),
|
W::get().reads(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Read weight should be at least 1 µs."
|
"Read weight should be at least 1 µs."
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
W::get().writes(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(),
|
W::get().writes(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Write weight should be at least 1 µs."
|
"Write weight should be at least 1 µs."
|
||||||
);
|
);
|
||||||
// At most 1 ms.
|
// At most 1 ms.
|
||||||
assert!(
|
assert!(
|
||||||
W::get().reads(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(),
|
W::get().reads(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Read weight should be at most 1 ms."
|
"Read weight should be at most 1 ms."
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
W::get().writes(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(),
|
W::get().writes(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Write weight should be at most 1 ms."
|
"Write weight should be at most 1 ms."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,8 @@ pub mod constants {
|
|||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
/// Importing a block with 0 Extrinsics.
|
/// Importing a block with 0 Extrinsics.
|
||||||
pub const BlockExecutionWeight: Weight = constants::WEIGHT_PER_NANOS.saturating_mul(5_000_000);
|
pub const BlockExecutionWeight: Weight =
|
||||||
|
Weight::from_ref_time(constants::WEIGHT_REF_TIME_PER_NANOS.saturating_mul(5_000_000));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
@@ -39,12 +40,12 @@ pub mod constants {
|
|||||||
|
|
||||||
// At least 100 µs.
|
// At least 100 µs.
|
||||||
assert!(
|
assert!(
|
||||||
w.ref_time() >= 100u64 * constants::WEIGHT_PER_MICROS.ref_time(),
|
w.ref_time() >= 100u64 * constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Weight should be at least 100 µs."
|
"Weight should be at least 100 µs."
|
||||||
);
|
);
|
||||||
// At most 50 ms.
|
// At most 50 ms.
|
||||||
assert!(
|
assert!(
|
||||||
w.ref_time() <= 50u64 * constants::WEIGHT_PER_MILLIS.ref_time(),
|
w.ref_time() <= 50u64 * constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Weight should be at most 50 ms."
|
"Weight should be at most 50 ms."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-3
@@ -23,7 +23,8 @@ pub mod constants {
|
|||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
/// Executing a NO-OP `System::remarks` Extrinsic.
|
/// Executing a NO-OP `System::remarks` Extrinsic.
|
||||||
pub const ExtrinsicBaseWeight: Weight = constants::WEIGHT_PER_NANOS.saturating_mul(125_000);
|
pub const ExtrinsicBaseWeight: Weight =
|
||||||
|
Weight::from_ref_time(constants::WEIGHT_REF_TIME_PER_NANOS.saturating_mul(125_000));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
@@ -39,12 +40,12 @@ pub mod constants {
|
|||||||
|
|
||||||
// At least 10 µs.
|
// At least 10 µs.
|
||||||
assert!(
|
assert!(
|
||||||
w.ref_time() >= 10u64 * constants::WEIGHT_PER_MICROS.ref_time(),
|
w.ref_time() >= 10u64 * constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Weight should be at least 10 µs."
|
"Weight should be at least 10 µs."
|
||||||
);
|
);
|
||||||
// At most 1 ms.
|
// At most 1 ms.
|
||||||
assert!(
|
assert!(
|
||||||
w.ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(),
|
w.ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Weight should be at most 1 ms."
|
"Weight should be at most 1 ms."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-6
@@ -25,8 +25,8 @@ pub mod constants {
|
|||||||
/// `ParityDB` can be enabled with a feature flag, but is still experimental. These weights
|
/// `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.
|
/// are available for brave runtime engineers who may want to try this out as default.
|
||||||
pub const ParityDbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
pub const ParityDbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
||||||
read: 8_000 * constants::WEIGHT_PER_NANOS.ref_time(),
|
read: 8_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
|
||||||
write: 50_000 * constants::WEIGHT_PER_NANOS.ref_time(),
|
write: 50_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,20 +42,20 @@ pub mod constants {
|
|||||||
fn sane() {
|
fn sane() {
|
||||||
// At least 1 µs.
|
// At least 1 µs.
|
||||||
assert!(
|
assert!(
|
||||||
W::get().reads(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(),
|
W::get().reads(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Read weight should be at least 1 µs."
|
"Read weight should be at least 1 µs."
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
W::get().writes(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(),
|
W::get().writes(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Write weight should be at least 1 µs."
|
"Write weight should be at least 1 µs."
|
||||||
);
|
);
|
||||||
// At most 1 ms.
|
// At most 1 ms.
|
||||||
assert!(
|
assert!(
|
||||||
W::get().reads(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(),
|
W::get().reads(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Read weight should be at most 1 ms."
|
"Read weight should be at most 1 ms."
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
W::get().writes(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(),
|
W::get().writes(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Write weight should be at most 1 ms."
|
"Write weight should be at most 1 ms."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-6
@@ -25,8 +25,8 @@ pub mod constants {
|
|||||||
/// By default, Substrate uses `RocksDB`, so this will be the weight used throughout
|
/// By default, Substrate uses `RocksDB`, so this will be the weight used throughout
|
||||||
/// the runtime.
|
/// the runtime.
|
||||||
pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
||||||
read: 25_000 * constants::WEIGHT_PER_NANOS.ref_time(),
|
read: 25_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
|
||||||
write: 100_000 * constants::WEIGHT_PER_NANOS.ref_time(),
|
write: 100_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,20 +42,20 @@ pub mod constants {
|
|||||||
fn sane() {
|
fn sane() {
|
||||||
// At least 1 µs.
|
// At least 1 µs.
|
||||||
assert!(
|
assert!(
|
||||||
W::get().reads(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(),
|
W::get().reads(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Read weight should be at least 1 µs."
|
"Read weight should be at least 1 µs."
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
W::get().writes(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(),
|
W::get().writes(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Write weight should be at least 1 µs."
|
"Write weight should be at least 1 µs."
|
||||||
);
|
);
|
||||||
// At most 1 ms.
|
// At most 1 ms.
|
||||||
assert!(
|
assert!(
|
||||||
W::get().reads(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(),
|
W::get().reads(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Read weight should be at most 1 ms."
|
"Read weight should be at most 1 ms."
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
W::get().writes(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(),
|
W::get().writes(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Write weight should be at most 1 ms."
|
"Write weight should be at most 1 ms."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,9 @@ pub use frame_support::{
|
|||||||
parameter_types,
|
parameter_types,
|
||||||
traits::{IsInVec, Randomness},
|
traits::{IsInVec, Randomness},
|
||||||
weights::{
|
weights::{
|
||||||
constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},
|
constants::{
|
||||||
|
BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_REF_TIME_PER_SECOND,
|
||||||
|
},
|
||||||
IdentityFee, Weight,
|
IdentityFee, Weight,
|
||||||
},
|
},
|
||||||
StorageValue,
|
StorageValue,
|
||||||
@@ -85,9 +87,10 @@ const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(10);
|
|||||||
/// by Operational extrinsics.
|
/// by Operational extrinsics.
|
||||||
const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
|
const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
|
||||||
/// We allow for .5 seconds of compute with a 12 second average block time.
|
/// We allow for .5 seconds of compute with a 12 second average block time.
|
||||||
const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND
|
const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts(
|
||||||
.saturating_div(2)
|
WEIGHT_REF_TIME_PER_SECOND.saturating_div(2),
|
||||||
.set_proof_size(cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64);
|
cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64,
|
||||||
|
);
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const BlockHashCount: BlockNumber = 250;
|
pub const BlockHashCount: BlockNumber = 250;
|
||||||
|
|||||||
@@ -55,7 +55,9 @@ pub use frame_support::{
|
|||||||
parameter_types,
|
parameter_types,
|
||||||
traits::{Everything, IsInVec, Randomness},
|
traits::{Everything, IsInVec, Randomness},
|
||||||
weights::{
|
weights::{
|
||||||
constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},
|
constants::{
|
||||||
|
BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_REF_TIME_PER_SECOND,
|
||||||
|
},
|
||||||
IdentityFee, Weight,
|
IdentityFee, Weight,
|
||||||
},
|
},
|
||||||
StorageValue,
|
StorageValue,
|
||||||
@@ -92,9 +94,10 @@ const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(10);
|
|||||||
/// by Operational extrinsics.
|
/// by Operational extrinsics.
|
||||||
const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
|
const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
|
||||||
/// We allow for .5 seconds of compute with a 12 second average block time.
|
/// We allow for .5 seconds of compute with a 12 second average block time.
|
||||||
const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND
|
const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts(
|
||||||
.saturating_div(2)
|
WEIGHT_REF_TIME_PER_SECOND.saturating_div(2),
|
||||||
.set_proof_size(cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64);
|
cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64,
|
||||||
|
);
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const BlockHashCount: BlockNumber = 250;
|
pub const BlockHashCount: BlockNumber = 250;
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ use frame_support::{
|
|||||||
parameter_types,
|
parameter_types,
|
||||||
traits::{AsEnsureOriginWithArg, ConstU32, ConstU64, ConstU8, Everything},
|
traits::{AsEnsureOriginWithArg, ConstU32, ConstU64, ConstU8, Everything},
|
||||||
weights::{
|
weights::{
|
||||||
constants::WEIGHT_PER_SECOND, ConstantMultiplier, Weight, WeightToFeeCoefficient,
|
constants::WEIGHT_REF_TIME_PER_SECOND, ConstantMultiplier, Weight, WeightToFeeCoefficient,
|
||||||
WeightToFeeCoefficients, WeightToFeePolynomial,
|
WeightToFeeCoefficients, WeightToFeePolynomial,
|
||||||
},
|
},
|
||||||
PalletId,
|
PalletId,
|
||||||
@@ -230,9 +230,10 @@ const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(5);
|
|||||||
const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
|
const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
|
||||||
|
|
||||||
/// We allow for 0.5 of a second of compute with a 12 second average block time.
|
/// We allow for 0.5 of a second of compute with a 12 second average block time.
|
||||||
const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND
|
const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts(
|
||||||
.saturating_div(2)
|
WEIGHT_REF_TIME_PER_SECOND.saturating_div(2),
|
||||||
.set_proof_size(cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64);
|
cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64,
|
||||||
|
);
|
||||||
|
|
||||||
/// The version information used to identify this runtime when compiled natively.
|
/// The version information used to identify this runtime when compiled natively.
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
|
|||||||
@@ -23,7 +23,8 @@ pub mod constants {
|
|||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
/// Importing a block with 0 Extrinsics.
|
/// Importing a block with 0 Extrinsics.
|
||||||
pub const BlockExecutionWeight: Weight = constants::WEIGHT_PER_NANOS.saturating_mul(5_000_000);
|
pub const BlockExecutionWeight: Weight =
|
||||||
|
Weight::from_ref_time(constants::WEIGHT_REF_TIME_PER_NANOS.saturating_mul(5_000_000));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
@@ -39,12 +40,12 @@ pub mod constants {
|
|||||||
|
|
||||||
// At least 100 µs.
|
// At least 100 µs.
|
||||||
assert!(
|
assert!(
|
||||||
w.ref_time() >= 100u64 * constants::WEIGHT_PER_MICROS.ref_time(),
|
w.ref_time() >= 100u64 * constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Weight should be at least 100 µs."
|
"Weight should be at least 100 µs."
|
||||||
);
|
);
|
||||||
// At most 50 ms.
|
// At most 50 ms.
|
||||||
assert!(
|
assert!(
|
||||||
w.ref_time() <= 50u64 * constants::WEIGHT_PER_MILLIS.ref_time(),
|
w.ref_time() <= 50u64 * constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Weight should be at most 50 ms."
|
"Weight should be at most 50 ms."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,8 @@ pub mod constants {
|
|||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
/// Executing a NO-OP `System::remarks` Extrinsic.
|
/// Executing a NO-OP `System::remarks` Extrinsic.
|
||||||
pub const ExtrinsicBaseWeight: Weight = constants::WEIGHT_PER_NANOS.saturating_mul(125_000);
|
pub const ExtrinsicBaseWeight: Weight =
|
||||||
|
Weight::from_ref_time(constants::WEIGHT_REF_TIME_PER_NANOS.saturating_mul(125_000));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
@@ -39,12 +40,12 @@ pub mod constants {
|
|||||||
|
|
||||||
// At least 10 µs.
|
// At least 10 µs.
|
||||||
assert!(
|
assert!(
|
||||||
w.ref_time() >= 10u64 * constants::WEIGHT_PER_MICROS.ref_time(),
|
w.ref_time() >= 10u64 * constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Weight should be at least 10 µs."
|
"Weight should be at least 10 µs."
|
||||||
);
|
);
|
||||||
// At most 1 ms.
|
// At most 1 ms.
|
||||||
assert!(
|
assert!(
|
||||||
w.ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(),
|
w.ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Weight should be at most 1 ms."
|
"Weight should be at most 1 ms."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ pub mod constants {
|
|||||||
/// `ParityDB` can be enabled with a feature flag, but is still experimental. These weights
|
/// `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.
|
/// are available for brave runtime engineers who may want to try this out as default.
|
||||||
pub const ParityDbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
pub const ParityDbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
||||||
read: 8_000 * constants::WEIGHT_PER_NANOS.ref_time(),
|
read: 8_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
|
||||||
write: 50_000 * constants::WEIGHT_PER_NANOS.ref_time(),
|
write: 50_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,20 +42,20 @@ pub mod constants {
|
|||||||
fn sane() {
|
fn sane() {
|
||||||
// At least 1 µs.
|
// At least 1 µs.
|
||||||
assert!(
|
assert!(
|
||||||
W::get().reads(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(),
|
W::get().reads(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Read weight should be at least 1 µs."
|
"Read weight should be at least 1 µs."
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
W::get().writes(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(),
|
W::get().writes(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Write weight should be at least 1 µs."
|
"Write weight should be at least 1 µs."
|
||||||
);
|
);
|
||||||
// At most 1 ms.
|
// At most 1 ms.
|
||||||
assert!(
|
assert!(
|
||||||
W::get().reads(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(),
|
W::get().reads(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Read weight should be at most 1 ms."
|
"Read weight should be at most 1 ms."
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
W::get().writes(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(),
|
W::get().writes(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Write weight should be at most 1 ms."
|
"Write weight should be at most 1 ms."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ pub mod constants {
|
|||||||
/// By default, Substrate uses `RocksDB`, so this will be the weight used throughout
|
/// By default, Substrate uses `RocksDB`, so this will be the weight used throughout
|
||||||
/// the runtime.
|
/// the runtime.
|
||||||
pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
||||||
read: 25_000 * constants::WEIGHT_PER_NANOS.ref_time(),
|
read: 25_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
|
||||||
write: 100_000 * constants::WEIGHT_PER_NANOS.ref_time(),
|
write: 100_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,20 +42,20 @@ pub mod constants {
|
|||||||
fn sane() {
|
fn sane() {
|
||||||
// At least 1 µs.
|
// At least 1 µs.
|
||||||
assert!(
|
assert!(
|
||||||
W::get().reads(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(),
|
W::get().reads(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Read weight should be at least 1 µs."
|
"Read weight should be at least 1 µs."
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
W::get().writes(1).ref_time() >= constants::WEIGHT_PER_MICROS.ref_time(),
|
W::get().writes(1).ref_time() >= constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||||
"Write weight should be at least 1 µs."
|
"Write weight should be at least 1 µs."
|
||||||
);
|
);
|
||||||
// At most 1 ms.
|
// At most 1 ms.
|
||||||
assert!(
|
assert!(
|
||||||
W::get().reads(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(),
|
W::get().reads(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Read weight should be at most 1 ms."
|
"Read weight should be at most 1 ms."
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
W::get().writes(1).ref_time() <= constants::WEIGHT_PER_MILLIS.ref_time(),
|
W::get().writes(1).ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
"Write weight should be at most 1 ms."
|
"Write weight should be at most 1 ms."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,9 @@ pub use frame_support::{
|
|||||||
Randomness,
|
Randomness,
|
||||||
},
|
},
|
||||||
weights::{
|
weights::{
|
||||||
constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},
|
constants::{
|
||||||
|
BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_REF_TIME_PER_SECOND,
|
||||||
|
},
|
||||||
ConstantMultiplier, IdentityFee, Weight,
|
ConstantMultiplier, IdentityFee, Weight,
|
||||||
},
|
},
|
||||||
StorageValue,
|
StorageValue,
|
||||||
@@ -137,9 +139,10 @@ const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(10);
|
|||||||
/// by Operational extrinsics.
|
/// by Operational extrinsics.
|
||||||
const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
|
const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
|
||||||
/// We allow for .5 seconds of compute with a 12 second average block time.
|
/// We allow for .5 seconds of compute with a 12 second average block time.
|
||||||
const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND
|
const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts(
|
||||||
.saturating_div(2)
|
WEIGHT_REF_TIME_PER_SECOND.saturating_div(2),
|
||||||
.set_proof_size(cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64);
|
cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64,
|
||||||
|
);
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const BlockHashCount: BlockNumber = 250;
|
pub const BlockHashCount: BlockNumber = 250;
|
||||||
|
|||||||
@@ -50,7 +50,9 @@ pub use frame_support::{
|
|||||||
parameter_types,
|
parameter_types,
|
||||||
traits::{ConstU8, Randomness},
|
traits::{ConstU8, Randomness},
|
||||||
weights::{
|
weights::{
|
||||||
constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},
|
constants::{
|
||||||
|
BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_REF_TIME_PER_SECOND,
|
||||||
|
},
|
||||||
ConstantMultiplier, IdentityFee, Weight,
|
ConstantMultiplier, IdentityFee, Weight,
|
||||||
},
|
},
|
||||||
StorageValue,
|
StorageValue,
|
||||||
@@ -140,9 +142,10 @@ const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(10);
|
|||||||
/// by Operational extrinsics.
|
/// by Operational extrinsics.
|
||||||
const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
|
const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
|
||||||
/// We allow for .5 seconds of compute with a 12 second average block time.
|
/// We allow for .5 seconds of compute with a 12 second average block time.
|
||||||
const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND
|
const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts(
|
||||||
.saturating_div(2)
|
WEIGHT_REF_TIME_PER_SECOND.saturating_div(2),
|
||||||
.set_proof_size(cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64);
|
cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64,
|
||||||
|
);
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const BlockHashCount: BlockNumber = 250;
|
pub const BlockHashCount: BlockNumber = 250;
|
||||||
|
|||||||
Reference in New Issue
Block a user