mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 11:38:01 +00:00
Introduce sensible weight constants (#12868)
* Introduce sensible weight constants * cargo fmt * Remove unused import * Add missing import * ".git/.scripts/bench-bot.sh" pallet dev pallet_lottery Co-authored-by: command-bot <>
This commit is contained in:
@@ -37,7 +37,7 @@
|
||||
// --repeat=100
|
||||
|
||||
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! {
|
||||
/// Time to execute an empty block.
|
||||
@@ -53,7 +53,8 @@ parameter_types! {
|
||||
/// 99th: 390_723
|
||||
/// 95th: 365_799
|
||||
/// 75th: 361_582
|
||||
pub const BlockExecutionWeight: Weight = WEIGHT_PER_NANOS.saturating_mul(358_523);
|
||||
pub const BlockExecutionWeight: Weight =
|
||||
Weight::from_ref_time(WEIGHT_REF_TIME_PER_NANOS.saturating_mul(358_523));
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
@@ -69,12 +70,12 @@ mod test_weights {
|
||||
|
||||
// At least 100 µs.
|
||||
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."
|
||||
);
|
||||
// At most 50 ms.
|
||||
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."
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user