mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 10:31:03 +00:00
Companion for paritytech/substrate#12868 (#6406)
* Replace WEIGHT_PER_* with WEIGHT_REF_TIME_PER_* * cargo fmt * Update substrate
This commit is contained in:
Generated
+182
-180
File diff suppressed because it is too large
Load Diff
@@ -40,7 +40,7 @@ mod mock;
|
|||||||
use frame_support::{
|
use frame_support::{
|
||||||
parameter_types,
|
parameter_types,
|
||||||
traits::{ConstU32, Currency, OneSessionHandler},
|
traits::{ConstU32, Currency, OneSessionHandler},
|
||||||
weights::{constants::WEIGHT_PER_SECOND, Weight},
|
weights::{constants::WEIGHT_REF_TIME_PER_SECOND, Weight},
|
||||||
};
|
};
|
||||||
use frame_system::limits;
|
use frame_system::limits;
|
||||||
use primitives::v2::{AssignmentId, Balance, BlockNumber, ValidatorId, MAX_POV_SIZE};
|
use primitives::v2::{AssignmentId, Balance, BlockNumber, ValidatorId, MAX_POV_SIZE};
|
||||||
@@ -71,7 +71,7 @@ pub const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(1);
|
|||||||
pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
|
pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
|
||||||
/// The storage proof size is not limited so far.
|
/// The storage proof size is not limited so far.
|
||||||
pub const MAXIMUM_BLOCK_WEIGHT: Weight =
|
pub const MAXIMUM_BLOCK_WEIGHT: Weight =
|
||||||
WEIGHT_PER_SECOND.saturating_mul(2).set_proof_size(MAX_POV_SIZE as u64);
|
Weight::from_parts(WEIGHT_REF_TIME_PER_SECOND.saturating_mul(2), MAX_POV_SIZE as u64);
|
||||||
|
|
||||||
const_assert!(NORMAL_DISPATCH_RATIO.deconstruct() >= AVERAGE_ON_INITIALIZE_RATIO.deconstruct());
|
const_assert!(NORMAL_DISPATCH_RATIO.deconstruct() >= AVERAGE_ON_INITIALIZE_RATIO.deconstruct());
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
// --header=./file_header.txt
|
// --header=./file_header.txt
|
||||||
|
|
||||||
use sp_core::parameter_types;
|
use sp_core::parameter_types;
|
||||||
use sp_weights::{constants::WEIGHT_PER_NANOS, Weight};
|
use sp_weights::{constants::WEIGHT_REF_TIME_PER_NANOS, Weight};
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
/// Time to execute an empty block.
|
/// Time to execute an empty block.
|
||||||
@@ -51,7 +51,8 @@ parameter_types! {
|
|||||||
/// 99th: 6_876_251
|
/// 99th: 6_876_251
|
||||||
/// 95th: 6_811_463
|
/// 95th: 6_811_463
|
||||||
/// 75th: 6_751_221
|
/// 75th: 6_751_221
|
||||||
pub const BlockExecutionWeight: Weight = WEIGHT_PER_NANOS.saturating_mul(6_731_894);
|
pub const BlockExecutionWeight: Weight =
|
||||||
|
Weight::from_ref_time(WEIGHT_REF_TIME_PER_NANOS.saturating_mul(6_731_894));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
@@ -67,12 +68,12 @@ mod test_weights {
|
|||||||
|
|
||||||
// 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."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
// --header=./file_header.txt
|
// --header=./file_header.txt
|
||||||
|
|
||||||
use sp_core::parameter_types;
|
use sp_core::parameter_types;
|
||||||
use sp_weights::{constants::WEIGHT_PER_NANOS, Weight};
|
use sp_weights::{constants::WEIGHT_REF_TIME_PER_NANOS, Weight};
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
/// Time to execute a NO-OP extrinsic, for example `System::remark`.
|
/// Time to execute a NO-OP extrinsic, for example `System::remark`.
|
||||||
@@ -51,7 +51,8 @@ parameter_types! {
|
|||||||
/// 99th: 96_279
|
/// 99th: 96_279
|
||||||
/// 95th: 95_584
|
/// 95th: 95_584
|
||||||
/// 75th: 95_005
|
/// 75th: 95_005
|
||||||
pub const ExtrinsicBaseWeight: Weight = WEIGHT_PER_NANOS.saturating_mul(94_889);
|
pub const ExtrinsicBaseWeight: Weight =
|
||||||
|
Weight::from_ref_time(WEIGHT_REF_TIME_PER_NANOS.saturating_mul(94_889));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
@@ -67,12 +68,12 @@ mod test_weights {
|
|||||||
|
|
||||||
// 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."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
//! Configuration can change only at session boundaries and is buffered until then.
|
//! Configuration can change only at session boundaries and is buffered until then.
|
||||||
|
|
||||||
use crate::shared;
|
use crate::shared;
|
||||||
use frame_support::{pallet_prelude::*, weights::constants::WEIGHT_PER_MILLIS};
|
use frame_support::{pallet_prelude::*, weights::constants::WEIGHT_REF_TIME_PER_MILLIS};
|
||||||
use frame_system::pallet_prelude::*;
|
use frame_system::pallet_prelude::*;
|
||||||
use parity_scale_codec::{Decode, Encode};
|
use parity_scale_codec::{Decode, Encode};
|
||||||
use primitives::v2::{Balance, SessionIndex, MAX_CODE_SIZE, MAX_HEAD_DATA_SIZE, MAX_POV_SIZE};
|
use primitives::v2::{Balance, SessionIndex, MAX_CODE_SIZE, MAX_HEAD_DATA_SIZE, MAX_POV_SIZE};
|
||||||
@@ -285,8 +285,10 @@ impl<BlockNumber: Default + From<u32>> Default for HostConfiguration<BlockNumber
|
|||||||
hrmp_max_parachain_outbound_channels: Default::default(),
|
hrmp_max_parachain_outbound_channels: Default::default(),
|
||||||
hrmp_max_parathread_outbound_channels: Default::default(),
|
hrmp_max_parathread_outbound_channels: Default::default(),
|
||||||
hrmp_max_message_num_per_candidate: Default::default(),
|
hrmp_max_message_num_per_candidate: Default::default(),
|
||||||
ump_max_individual_weight: (20u64 * WEIGHT_PER_MILLIS)
|
ump_max_individual_weight: Weight::from_parts(
|
||||||
.set_proof_size(MAX_POV_SIZE as u64),
|
20u64 * WEIGHT_REF_TIME_PER_MILLIS,
|
||||||
|
MAX_POV_SIZE as u64,
|
||||||
|
),
|
||||||
pvf_checking_enabled: false,
|
pvf_checking_enabled: false,
|
||||||
pvf_voting_ttl: 2u32.into(),
|
pvf_voting_ttl: 2u32.into(),
|
||||||
minimum_validation_upgrade_delay: 2.into(),
|
minimum_validation_upgrade_delay: 2.into(),
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ pub mod v3 {
|
|||||||
hrmp_max_parathread_outbound_channels: Default::default(),
|
hrmp_max_parathread_outbound_channels: Default::default(),
|
||||||
hrmp_max_message_num_per_candidate: Default::default(),
|
hrmp_max_message_num_per_candidate: Default::default(),
|
||||||
ump_max_individual_weight: OldWeight(
|
ump_max_individual_weight: OldWeight(
|
||||||
frame_support::weights::constants::WEIGHT_PER_MILLIS.ref_time() * 20,
|
frame_support::weights::constants::WEIGHT_REF_TIME_PER_MILLIS * 20,
|
||||||
),
|
),
|
||||||
pvf_checking_enabled: false,
|
pvf_checking_enabled: false,
|
||||||
pvf_voting_ttl: 2u32.into(),
|
pvf_voting_ttl: 2u32.into(),
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
// --header=./file_header.txt
|
// --header=./file_header.txt
|
||||||
|
|
||||||
use sp_core::parameter_types;
|
use sp_core::parameter_types;
|
||||||
use sp_weights::{constants::WEIGHT_PER_NANOS, Weight};
|
use sp_weights::{constants::WEIGHT_REF_TIME_PER_NANOS, Weight};
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
/// Time to execute an empty block.
|
/// Time to execute an empty block.
|
||||||
@@ -51,7 +51,8 @@ parameter_types! {
|
|||||||
/// 99th: 6_239_600
|
/// 99th: 6_239_600
|
||||||
/// 95th: 6_178_734
|
/// 95th: 6_178_734
|
||||||
/// 75th: 6_145_812
|
/// 75th: 6_145_812
|
||||||
pub const BlockExecutionWeight: Weight = WEIGHT_PER_NANOS.saturating_mul(6_103_588);
|
pub const BlockExecutionWeight: Weight =
|
||||||
|
Weight::from_ref_time(WEIGHT_REF_TIME_PER_NANOS.saturating_mul(6_103_588));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
@@ -67,12 +68,12 @@ mod test_weights {
|
|||||||
|
|
||||||
// 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."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
// --header=./file_header.txt
|
// --header=./file_header.txt
|
||||||
|
|
||||||
use sp_core::parameter_types;
|
use sp_core::parameter_types;
|
||||||
use sp_weights::{constants::WEIGHT_PER_NANOS, Weight};
|
use sp_weights::{constants::WEIGHT_REF_TIME_PER_NANOS, Weight};
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
/// Time to execute a NO-OP extrinsic, for example `System::remark`.
|
/// Time to execute a NO-OP extrinsic, for example `System::remark`.
|
||||||
@@ -51,7 +51,8 @@ parameter_types! {
|
|||||||
/// 99th: 96_351
|
/// 99th: 96_351
|
||||||
/// 95th: 96_116
|
/// 95th: 96_116
|
||||||
/// 75th: 95_639
|
/// 75th: 95_639
|
||||||
pub const ExtrinsicBaseWeight: Weight = WEIGHT_PER_NANOS.saturating_mul(95_479);
|
pub const ExtrinsicBaseWeight: Weight =
|
||||||
|
Weight::from_ref_time(WEIGHT_REF_TIME_PER_NANOS.saturating_mul(95_479));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
@@ -67,12 +68,12 @@ mod test_weights {
|
|||||||
|
|
||||||
// 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."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ pub mod constants {
|
|||||||
/// 99th: 14_451
|
/// 99th: 14_451
|
||||||
/// 95th: 12_588
|
/// 95th: 12_588
|
||||||
/// 75th: 11_200
|
/// 75th: 11_200
|
||||||
read: 11_826 * constants::WEIGHT_PER_NANOS.ref_time(),
|
read: 11_826 * constants::WEIGHT_REF_TIME_PER_NANOS,
|
||||||
|
|
||||||
/// Time to write one storage item.
|
/// Time to write one storage item.
|
||||||
/// Calculated by multiplying the *Average* of all values with `1.1` and adding `0`.
|
/// Calculated by multiplying the *Average* of all values with `1.1` and adding `0`.
|
||||||
@@ -72,7 +72,7 @@ pub mod constants {
|
|||||||
/// 99th: 69_379
|
/// 99th: 69_379
|
||||||
/// 95th: 47_168
|
/// 95th: 47_168
|
||||||
/// 75th: 35_252
|
/// 75th: 35_252
|
||||||
write: 38_052 * constants::WEIGHT_PER_NANOS.ref_time(),
|
write: 38_052 * constants::WEIGHT_REF_TIME_PER_NANOS,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,20 +88,20 @@ pub mod constants {
|
|||||||
fn bound() {
|
fn bound() {
|
||||||
// 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."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ pub mod constants {
|
|||||||
/// 99th: 32_074
|
/// 99th: 32_074
|
||||||
/// 95th: 26_658
|
/// 95th: 26_658
|
||||||
/// 75th: 19_363
|
/// 75th: 19_363
|
||||||
read: 20_499 * constants::WEIGHT_PER_NANOS.ref_time(),
|
read: 20_499 * constants::WEIGHT_REF_TIME_PER_NANOS,
|
||||||
|
|
||||||
/// Time to write one storage item.
|
/// Time to write one storage item.
|
||||||
/// Calculated by multiplying the *Average* of all values with `1.1` and adding `0`.
|
/// Calculated by multiplying the *Average* of all values with `1.1` and adding `0`.
|
||||||
@@ -71,7 +71,7 @@ pub mod constants {
|
|||||||
/// 99th: 111_151
|
/// 99th: 111_151
|
||||||
/// 95th: 92_666
|
/// 95th: 92_666
|
||||||
/// 75th: 80_297
|
/// 75th: 80_297
|
||||||
write: 83_471 * constants::WEIGHT_PER_NANOS.ref_time(),
|
write: 83_471 * constants::WEIGHT_REF_TIME_PER_NANOS,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,20 +87,20 @@ pub mod constants {
|
|||||||
fn bound() {
|
fn bound() {
|
||||||
// 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."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
// --header=./file_header.txt
|
// --header=./file_header.txt
|
||||||
|
|
||||||
use sp_core::parameter_types;
|
use sp_core::parameter_types;
|
||||||
use sp_weights::{constants::WEIGHT_PER_NANOS, Weight};
|
use sp_weights::{constants::WEIGHT_REF_TIME_PER_NANOS, Weight};
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
/// Time to execute an empty block.
|
/// Time to execute an empty block.
|
||||||
@@ -51,7 +51,8 @@ parameter_types! {
|
|||||||
/// 99th: 5_495_378
|
/// 99th: 5_495_378
|
||||||
/// 95th: 5_453_765
|
/// 95th: 5_453_765
|
||||||
/// 75th: 5_352_587
|
/// 75th: 5_352_587
|
||||||
pub const BlockExecutionWeight: Weight = WEIGHT_PER_NANOS.saturating_mul(5_334_883);
|
pub const BlockExecutionWeight: Weight =
|
||||||
|
Weight::from_ref_time(WEIGHT_REF_TIME_PER_NANOS.saturating_mul(5_334_883));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
@@ -67,12 +68,12 @@ mod test_weights {
|
|||||||
|
|
||||||
// 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."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
// --header=./file_header.txt
|
// --header=./file_header.txt
|
||||||
|
|
||||||
use sp_core::parameter_types;
|
use sp_core::parameter_types;
|
||||||
use sp_weights::{constants::WEIGHT_PER_NANOS, Weight};
|
use sp_weights::{constants::WEIGHT_REF_TIME_PER_NANOS, Weight};
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
/// Time to execute a NO-OP extrinsic, for example `System::remark`.
|
/// Time to execute a NO-OP extrinsic, for example `System::remark`.
|
||||||
@@ -51,7 +51,8 @@ parameter_types! {
|
|||||||
/// 99th: 87_916
|
/// 99th: 87_916
|
||||||
/// 95th: 87_727
|
/// 95th: 87_727
|
||||||
/// 75th: 87_112
|
/// 75th: 87_112
|
||||||
pub const ExtrinsicBaseWeight: Weight = WEIGHT_PER_NANOS.saturating_mul(87_092);
|
pub const ExtrinsicBaseWeight: Weight =
|
||||||
|
Weight::from_ref_time(WEIGHT_REF_TIME_PER_NANOS.saturating_mul(87_092));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
@@ -67,12 +68,12 @@ mod test_weights {
|
|||||||
|
|
||||||
// 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."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
// --header=./file_header.txt
|
// --header=./file_header.txt
|
||||||
|
|
||||||
use sp_core::parameter_types;
|
use sp_core::parameter_types;
|
||||||
use sp_weights::{constants::WEIGHT_PER_NANOS, Weight};
|
use sp_weights::{constants::WEIGHT_REF_TIME_PER_NANOS, Weight};
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
/// Time to execute an empty block.
|
/// Time to execute an empty block.
|
||||||
@@ -51,7 +51,8 @@ parameter_types! {
|
|||||||
/// 99th: 5_381_058
|
/// 99th: 5_381_058
|
||||||
/// 95th: 5_313_959
|
/// 95th: 5_313_959
|
||||||
/// 75th: 5_227_090
|
/// 75th: 5_227_090
|
||||||
pub const BlockExecutionWeight: Weight = WEIGHT_PER_NANOS.saturating_mul(5_208_926);
|
pub const BlockExecutionWeight: Weight =
|
||||||
|
Weight::from_ref_time(WEIGHT_REF_TIME_PER_NANOS.saturating_mul(5_208_926));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
@@ -67,12 +68,12 @@ mod test_weights {
|
|||||||
|
|
||||||
// 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."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
// --header=./file_header.txt
|
// --header=./file_header.txt
|
||||||
|
|
||||||
use sp_core::parameter_types;
|
use sp_core::parameter_types;
|
||||||
use sp_weights::{constants::WEIGHT_PER_NANOS, Weight};
|
use sp_weights::{constants::WEIGHT_REF_TIME_PER_NANOS, Weight};
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
/// Time to execute a NO-OP extrinsic, for example `System::remark`.
|
/// Time to execute a NO-OP extrinsic, for example `System::remark`.
|
||||||
@@ -51,7 +51,8 @@ parameter_types! {
|
|||||||
/// 99th: 87_990
|
/// 99th: 87_990
|
||||||
/// 95th: 87_768
|
/// 95th: 87_768
|
||||||
/// 75th: 87_312
|
/// 75th: 87_312
|
||||||
pub const ExtrinsicBaseWeight: Weight = WEIGHT_PER_NANOS.saturating_mul(87_248);
|
pub const ExtrinsicBaseWeight: Weight =
|
||||||
|
Weight::from_ref_time(WEIGHT_REF_TIME_PER_NANOS.saturating_mul(87_248));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
@@ -67,12 +68,12 @@ mod test_weights {
|
|||||||
|
|
||||||
// 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."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
|
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use super::{mock::*, test_utils::*, *};
|
use super::{mock::*, test_utils::*, *};
|
||||||
use frame_support::{assert_err, weights::constants::WEIGHT_PER_SECOND};
|
use frame_support::{assert_err, weights::constants::WEIGHT_REF_TIME_PER_SECOND};
|
||||||
use xcm::latest::prelude::*;
|
use xcm::latest::prelude::*;
|
||||||
use xcm_executor::{traits::*, Config, XcmExecutor};
|
use xcm_executor::{traits::*, Config, XcmExecutor};
|
||||||
|
|
||||||
@@ -676,8 +676,8 @@ fn weight_trader_tuple_should_work() {
|
|||||||
pub const PARA_2: MultiLocation = X1(Parachain(2)).into();
|
pub const PARA_2: MultiLocation = X1(Parachain(2)).into();
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub static HereWeightPrice: (AssetId, u128) = (Here.into().into(), WEIGHT_PER_SECOND.ref_time().into());
|
pub static HereWeightPrice: (AssetId, u128) = (Here.into().into(), WEIGHT_REF_TIME_PER_SECOND.into());
|
||||||
pub static PARA1WeightPrice: (AssetId, u128) = (PARA_1.into(), WEIGHT_PER_SECOND.ref_time().into());
|
pub static PARA1WeightPrice: (AssetId, u128) = (PARA_1.into(), WEIGHT_REF_TIME_PER_SECOND.into());
|
||||||
}
|
}
|
||||||
|
|
||||||
type Traders = (
|
type Traders = (
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
use frame_support::{
|
use frame_support::{
|
||||||
dispatch::GetDispatchInfo,
|
dispatch::GetDispatchInfo,
|
||||||
traits::{tokens::currency::Currency as CurrencyT, Get, OnUnbalanced as OnUnbalancedT},
|
traits::{tokens::currency::Currency as CurrencyT, Get, OnUnbalanced as OnUnbalancedT},
|
||||||
weights::{constants::WEIGHT_PER_SECOND, WeightToFee as WeightToFeeT},
|
weights::{constants::WEIGHT_REF_TIME_PER_SECOND, WeightToFee as WeightToFeeT},
|
||||||
};
|
};
|
||||||
use parity_scale_codec::Decode;
|
use parity_scale_codec::Decode;
|
||||||
use sp_runtime::traits::{SaturatedConversion, Saturating, Zero};
|
use sp_runtime::traits::{SaturatedConversion, Saturating, Zero};
|
||||||
@@ -153,7 +153,7 @@ impl<T: Get<(MultiLocation, u128)>, R: TakeRevenue> WeightTrader
|
|||||||
weight, payment,
|
weight, payment,
|
||||||
);
|
);
|
||||||
let (id, units_per_second) = T::get();
|
let (id, units_per_second) = T::get();
|
||||||
let amount = units_per_second * (weight as u128) / (WEIGHT_PER_SECOND.ref_time() as u128);
|
let amount = units_per_second * (weight as u128) / (WEIGHT_REF_TIME_PER_SECOND as u128);
|
||||||
let unused =
|
let unused =
|
||||||
payment.checked_sub((id, amount).into()).map_err(|_| XcmError::TooExpensive)?;
|
payment.checked_sub((id, amount).into()).map_err(|_| XcmError::TooExpensive)?;
|
||||||
self.0 = self.0.saturating_add(weight);
|
self.0 = self.0.saturating_add(weight);
|
||||||
@@ -165,7 +165,7 @@ impl<T: Get<(MultiLocation, u128)>, R: TakeRevenue> WeightTrader
|
|||||||
log::trace!(target: "xcm::weight", "FixedRateOfConcreteFungible::refund_weight weight: {:?}", weight);
|
log::trace!(target: "xcm::weight", "FixedRateOfConcreteFungible::refund_weight weight: {:?}", weight);
|
||||||
let (id, units_per_second) = T::get();
|
let (id, units_per_second) = T::get();
|
||||||
let weight = weight.min(self.0);
|
let weight = weight.min(self.0);
|
||||||
let amount = units_per_second * (weight as u128) / (WEIGHT_PER_SECOND.ref_time() as u128);
|
let amount = units_per_second * (weight as u128) / (WEIGHT_REF_TIME_PER_SECOND as u128);
|
||||||
self.0 -= weight;
|
self.0 -= weight;
|
||||||
self.1 = self.1.saturating_sub(amount);
|
self.1 = self.1.saturating_sub(amount);
|
||||||
if amount > 0 {
|
if amount > 0 {
|
||||||
@@ -205,7 +205,7 @@ impl<T: Get<(AssetId, u128)>, R: TakeRevenue> WeightTrader for FixedRateOfFungib
|
|||||||
weight, payment,
|
weight, payment,
|
||||||
);
|
);
|
||||||
let (id, units_per_second) = T::get();
|
let (id, units_per_second) = T::get();
|
||||||
let amount = units_per_second * (weight as u128) / (WEIGHT_PER_SECOND.ref_time() as u128);
|
let amount = units_per_second * (weight as u128) / (WEIGHT_REF_TIME_PER_SECOND as u128);
|
||||||
if amount == 0 {
|
if amount == 0 {
|
||||||
return Ok(payment)
|
return Ok(payment)
|
||||||
}
|
}
|
||||||
@@ -220,7 +220,7 @@ impl<T: Get<(AssetId, u128)>, R: TakeRevenue> WeightTrader for FixedRateOfFungib
|
|||||||
log::trace!(target: "xcm::weight", "FixedRateOfFungible::refund_weight weight: {:?}", weight);
|
log::trace!(target: "xcm::weight", "FixedRateOfFungible::refund_weight weight: {:?}", weight);
|
||||||
let (id, units_per_second) = T::get();
|
let (id, units_per_second) = T::get();
|
||||||
let weight = weight.min(self.0);
|
let weight = weight.min(self.0);
|
||||||
let amount = units_per_second * (weight as u128) / (WEIGHT_PER_SECOND.ref_time() as u128);
|
let amount = units_per_second * (weight as u128) / (WEIGHT_REF_TIME_PER_SECOND as u128);
|
||||||
self.0 -= weight;
|
self.0 -= weight;
|
||||||
self.1 = self.1.saturating_sub(amount);
|
self.1 = self.1.saturating_sub(amount);
|
||||||
if amount > 0 {
|
if amount > 0 {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ use codec::{Decode, Encode};
|
|||||||
use frame_support::{
|
use frame_support::{
|
||||||
construct_runtime, parameter_types,
|
construct_runtime, parameter_types,
|
||||||
traits::{Everything, Nothing},
|
traits::{Everything, Nothing},
|
||||||
weights::{constants::WEIGHT_PER_SECOND, Weight},
|
weights::{constants::WEIGHT_REF_TIME_PER_SECOND, Weight},
|
||||||
};
|
};
|
||||||
use sp_core::H256;
|
use sp_core::H256;
|
||||||
use sp_runtime::{
|
use sp_runtime::{
|
||||||
@@ -97,8 +97,8 @@ impl pallet_balances::Config for Runtime {
|
|||||||
}
|
}
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const ReservedXcmpWeight: Weight = WEIGHT_PER_SECOND.saturating_div(4);
|
pub const ReservedXcmpWeight: Weight = Weight::from_ref_time(WEIGHT_REF_TIME_PER_SECOND.saturating_div(4));
|
||||||
pub const ReservedDmpWeight: Weight = WEIGHT_PER_SECOND.saturating_div(4);
|
pub const ReservedDmpWeight: Weight = Weight::from_ref_time(WEIGHT_REF_TIME_PER_SECOND.saturating_div(4));
|
||||||
}
|
}
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ use codec::{Decode, Encode};
|
|||||||
use frame_support::{
|
use frame_support::{
|
||||||
construct_runtime, parameter_types,
|
construct_runtime, parameter_types,
|
||||||
traits::{Everything, Nothing},
|
traits::{Everything, Nothing},
|
||||||
weights::{constants::WEIGHT_PER_SECOND, Weight},
|
weights::{constants::WEIGHT_REF_TIME_PER_SECOND, Weight},
|
||||||
};
|
};
|
||||||
use sp_core::H256;
|
use sp_core::H256;
|
||||||
use sp_runtime::{
|
use sp_runtime::{
|
||||||
@@ -97,8 +97,8 @@ impl pallet_balances::Config for Runtime {
|
|||||||
}
|
}
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const ReservedXcmpWeight: Weight = WEIGHT_PER_SECOND.saturating_div(4);
|
pub const ReservedXcmpWeight: Weight = Weight::from_ref_time(WEIGHT_REF_TIME_PER_SECOND.saturating_div(4));
|
||||||
pub const ReservedDmpWeight: Weight = WEIGHT_PER_SECOND.saturating_div(4);
|
pub const ReservedDmpWeight: Weight = Weight::from_ref_time(WEIGHT_REF_TIME_PER_SECOND.saturating_div(4));
|
||||||
}
|
}
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
|
|||||||
Reference in New Issue
Block a user