diff --git a/runtime/shibuya/src/lib.rs b/runtime/shibuya/src/lib.rs index 22aa68f38..3adc25697 100644 --- a/runtime/shibuya/src/lib.rs +++ b/runtime/shibuya/src/lib.rs @@ -230,6 +230,19 @@ impl_opaque_keys! { } } +// Adjusting the base extrinsic weight to account for the additional database +// read introduced by the `tx-pause` pallet during extrinsic filtering. +// +// TODO: This hardcoded addition is a temporary fix. Replace it with a proper +// benchmark in the future. +pub struct RuntimeAdjustedWeights; +impl RuntimeAdjustedWeights { + pub fn extrinsic_base_weight() -> Weight { + ExtrinsicBaseWeight::get() + .saturating_add(::DbWeight::get().reads(1)) + } +} + /// We assume that ~10% of the block weight is consumed by `on_initalize` handlers. /// This is used to limit the maximal weight of a single extrinsic. const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(10); @@ -249,12 +262,7 @@ parameter_types! { pub RuntimeBlockWeights: BlockWeights = BlockWeights::builder() .base_block(BlockExecutionWeight::get()) .for_class(DispatchClass::all(), |weights| { - // Adjusting the base extrinsic weight to account for the additional database - // read introduced by the `tx-pause` pallet during extrinsic filtering. - // - // TODO: This hardcoded addition is a temporary fix. Replace it with a proper - // benchmark in the future. - weights.base_extrinsic = ExtrinsicBaseWeight::get().saturating_add(::DbWeight::get().reads(1)); + weights.base_extrinsic = RuntimeAdjustedWeights::extrinsic_base_weight(); }) .for_class(DispatchClass::Normal, |weights| { weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT); @@ -807,7 +815,7 @@ impl WeightToFeePolynomial for WeightToFee { type Balance = Balance; fn polynomial() -> WeightToFeeCoefficients { let p = WeightFeeFactor::get(); - let q = Balance::from(ExtrinsicBaseWeight::get().ref_time()); + let q = Balance::from(RuntimeAdjustedWeights::extrinsic_base_weight().ref_time()); smallvec::smallvec![WeightToFeeCoefficient { degree: 1, negative: false,