From bfcd7af559fdd5dd1e9d0c5fa2d8a4ed29fb0ee9 Mon Sep 17 00:00:00 2001 From: Uncle Stinky Date: Mon, 31 Aug 2026 15:03:33 +0300 Subject: [PATCH] we need to use 1/3 if the block time because each validator will re-execute all extrinsics Signed-off-by: Uncle Stinky --- runtime/common/src/benchmarking.rs | 2 +- runtime/common/src/lib.rs | 6 +++--- runtime/common/src/weights/block_weights.rs | 8 ++++---- runtime/common/src/weights/extrinsic.rs | 8 ++++---- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/runtime/common/src/benchmarking.rs b/runtime/common/src/benchmarking.rs index 68b8040..6f4fd3f 100644 --- a/runtime/common/src/benchmarking.rs +++ b/runtime/common/src/benchmarking.rs @@ -8,7 +8,7 @@ impl ArgumentsFactory<(), AccountId> for BenchmarkTreasuryHelper { fn create_asset_kind(_seed: u32) -> () { () } - fn create_beneficiary(mut seed: [u8; 32]) -> AccountId { + fn create_beneficiary(seed: [u8; 32]) -> AccountId { AccountId::from_entropy(&mut seed.as_slice()).unwrap() } } diff --git a/runtime/common/src/lib.rs b/runtime/common/src/lib.rs index 89d72d4..d24c55a 100644 --- a/runtime/common/src/lib.rs +++ b/runtime/common/src/lib.rs @@ -39,10 +39,10 @@ pub const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(30); /// be used by `Operational` extrinsics. pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(60); -/// We allow for 6 seconds of compute with a 12 seconds average block time. +/// We allow for 4 seconds of compute with a 12 seconds average block time. /// The storage proof size is not limited so far. pub const MAXIMUM_BLOCK_WEIGHT: Weight = - Weight::from_parts(WEIGHT_REF_TIME_PER_SECOND.saturating_mul(6), u64::MAX); + Weight::from_parts(WEIGHT_REF_TIME_PER_SECOND.saturating_mul(4), u64::MAX); const_assert!(NORMAL_DISPATCH_RATIO.deconstruct() >= AVERAGE_ON_INITIALIZE_RATIO.deconstruct()); @@ -173,7 +173,7 @@ macro_rules! prod_or_fast { } }; ($prod:expr, $test:expr, $env:expr) => { - if cfg!(feature == "fast-runtime") { + if cfg!(feature = "fast-runtime") { core::option_env!($env) .map(|s| s.parse().ok()) .flatten() diff --git a/runtime/common/src/weights/block_weights.rs b/runtime/common/src/weights/block_weights.rs index efbd024..8ebd38b 100644 --- a/runtime/common/src/weights/block_weights.rs +++ b/runtime/common/src/weights/block_weights.rs @@ -15,13 +15,13 @@ mod test_weights { let w = super::BlockExecutionWeight::get(); assert!( - w.ref_time() >= 100u64 * constants::WEIGHT_PER_TIME_PER_MICROS, - "Weight should be at least 100 µs." + w.ref_time() >= 5u64 * constants::WEIGHT_PER_TIME_PER_MICROS, + "Weight should be at least 5 µs." ); assert!( - w.ref_time() <= 50u64 * constants::WEIGHT_REF_TIME_PER_MILLIS, - "Weight should be at most 50 ms." + w.ref_time() <= 12u64 * constants::WEIGHT_REF_TIME_PER_MILLIS, + "Weight should be at most 12 ms." ); } } diff --git a/runtime/common/src/weights/extrinsic.rs b/runtime/common/src/weights/extrinsic.rs index 1ef3772..61bc9cc 100644 --- a/runtime/common/src/weights/extrinsic.rs +++ b/runtime/common/src/weights/extrinsic.rs @@ -16,13 +16,13 @@ mod test_weights { let w = super::ExtrinsicBaseWeight::get(); assert!( - w.ref_time() >= 10u64 * constants::WEIGHT_REF_TIME_PER_MICROS, - "Weight should be at least 10 µs." + w.ref_time() >= 70u64 * constants::WEIGHT_REF_TIME_PER_MICROS, + "Weight should be at least 70 µs." ); assert!( - w.ref_time() <= constants::WEIGHT_REF_TIME_PER_MILLIS, - "Weight should be at most 1 ms." + w.ref_time() <= 120u64 * constants::WEIGHT_REF_TIME_PER_MILLIS, + "Weight should be at most 120 ms." ); } }