remove unnecessary files and sligtly tweak the ratios
Signed-off-by: Uncle Stinky <uncle.stinky@ghostchain.io>
This commit is contained in:
parent
afea8046f9
commit
882ec7ec0d
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "runtime-common"
|
||||
version = "0.4.6"
|
||||
version = "0.4.7"
|
||||
authors.workspace = true
|
||||
edition.workspace = true
|
||||
homepage.workspace = true
|
||||
|
||||
@ -30,14 +30,14 @@ pub use sp_runtime::BuildStorage;
|
||||
|
||||
pub use impls::ToAuthor;
|
||||
|
||||
/// We assume that an on-initialize consumes 30% of the weight on average, hence
|
||||
/// We assume that an on-initialize consumes 10% of the weight on average, hence
|
||||
/// a single extrinsic will not be allowed to consume more than
|
||||
/// `AvailableBlockRatio - 30%`.
|
||||
pub const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(30);
|
||||
/// `AvailableBlockRatio - 10%`.
|
||||
pub const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(10);
|
||||
|
||||
/// We allow `Normal` extrinsics to fill up the block up to 60%, the rest can
|
||||
/// We allow `Normal` extrinsics to fill up the block up to 75%, the rest can
|
||||
/// be used by `Operational` extrinsics.
|
||||
pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(60);
|
||||
pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
|
||||
|
||||
/// We allow for 4 seconds of compute with a 12 seconds average block time.
|
||||
/// The storage proof size is not limited so far.
|
||||
@ -112,19 +112,19 @@ macro_rules! impl_runtime_weights {
|
||||
.for_class(DispatchClass::all(), |weights| {
|
||||
weights.base_extrinsic = $runtime::weights::ExtrinsicBaseWeight::get();
|
||||
})
|
||||
.for_class(DispatchClass::Normal, |weights| {
|
||||
weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT);
|
||||
})
|
||||
.for_class(DispatchClass::Operational, |weights| {
|
||||
weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT);
|
||||
// Operational transactions have an extra reserved space, so that they
|
||||
// are included even if block reached `MAXIMUM_BLOCK_WEIGHT`.
|
||||
weights.reserved = Some(
|
||||
MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT,
|
||||
);
|
||||
})
|
||||
.avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)
|
||||
.build_or_panic();
|
||||
.for_class(DispatchClass::Normal, |weights| {
|
||||
weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT);
|
||||
})
|
||||
.for_class(DispatchClass::Operational, |weights| {
|
||||
weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT);
|
||||
// Operational transactions have an extra reserved space, so that they
|
||||
// are included even if block reached `MAXIMUM_BLOCK_WEIGHT`.
|
||||
weights.reserved = Some(
|
||||
MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT,
|
||||
);
|
||||
})
|
||||
.avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)
|
||||
.build_or_panic();
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -138,8 +138,8 @@ static_assertions::assert_eq_size!(primitives::Balance, u128);
|
||||
/// A reasonable benchmarking config for staking pallet.
|
||||
pub struct StakingBenchmarkingConfig;
|
||||
impl pallet_staking::BenchmarkingConfig for StakingBenchmarkingConfig {
|
||||
type MaxValidators = ConstU32<500>;
|
||||
type MaxNominators = ConstU32<10_000>;
|
||||
type MaxValidators = ConstU32<299>; // MaxActiveValidators: u32 = 300
|
||||
type MaxNominators = ConstU32<3_000>;
|
||||
}
|
||||
|
||||
/// Convert a balance to an unsigned 256-bit number, use in nomination pools.
|
||||
|
||||
@ -1,27 +0,0 @@
|
||||
use sp_core::parameter_types;
|
||||
use sp_weights::{constants::WEIGHT_PER_TIME_PER_NANOS, Weight};
|
||||
|
||||
parameter_types! {
|
||||
pub const BlockExecutionWeight: Weight =
|
||||
Weight::from_ref_time(WEIGHT_PER_TIME_PER_NANOS.saturating_mul(7_955_558));
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test_weights {
|
||||
use sp_weights::constants;
|
||||
|
||||
#[test]
|
||||
fn sane() {
|
||||
let w = super::BlockExecutionWeight::get();
|
||||
|
||||
assert!(
|
||||
w.ref_time() >= 5u64 * constants::WEIGHT_PER_TIME_PER_MICROS,
|
||||
"Weight should be at least 5 µs."
|
||||
);
|
||||
|
||||
assert!(
|
||||
w.ref_time() <= 12u64 * constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||
"Weight should be at most 12 ms."
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1,28 +0,0 @@
|
||||
use sp_core::parameter_types;
|
||||
use sp_weights::{constants::WEIGHT_REF_TIME_PER_NANOS, Weight};
|
||||
|
||||
parameter_types! {
|
||||
pub const ExtrinsicBaseWeight: Weight =
|
||||
Weight::from_ref_time(WEIGHT_REF_TIME_PER_NANOS.saturating_mul(94_914));
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test_weights {
|
||||
use frame_support::traits::Get;
|
||||
use sp_weights::constants;
|
||||
|
||||
#[test]
|
||||
fn sane() {
|
||||
let w = super::ExtrinsicBaseWeight::get();
|
||||
|
||||
assert!(
|
||||
w.ref_time() >= 70u64 * constants::WEIGHT_REF_TIME_PER_MICROS,
|
||||
"Weight should be at least 70 µs."
|
||||
);
|
||||
|
||||
assert!(
|
||||
w.ref_time() <= 120u64 * constants::WEIGHT_REF_TIME_PER_MILLIS,
|
||||
"Weight should be at most 120 ms."
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1,5 +0,0 @@
|
||||
pub mod block_weights;
|
||||
pub mod extrinsic_weight;
|
||||
|
||||
pub use block_weights::BlockExecutionWeight;
|
||||
pub use extrinsic_weights::ExtrinsicBaseWeight;
|
||||
Loading…
Reference in New Issue
Block a user