Skip to content

Commit

Permalink
Revert "RuntimeAdjustedWeights type to handle weights override"
Browse files Browse the repository at this point in the history
This reverts commit 1f400a4.
  • Loading branch information
ipapandinas committed Dec 4, 2024
1 parent 633982f commit ce4612c
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions runtime/shibuya/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,19 +230,6 @@ 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(<Runtime as frame_system::Config>::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);
Expand All @@ -262,7 +249,12 @@ parameter_types! {
pub RuntimeBlockWeights: BlockWeights = BlockWeights::builder()
.base_block(BlockExecutionWeight::get())
.for_class(DispatchClass::all(), |weights| {
weights.base_extrinsic = RuntimeAdjustedWeights::extrinsic_base_weight();
// 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(<Runtime as frame_system::Config>::DbWeight::get().reads(1));
})
.for_class(DispatchClass::Normal, |weights| {
weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT);
Expand Down Expand Up @@ -815,7 +807,7 @@ impl WeightToFeePolynomial for WeightToFee {
type Balance = Balance;
fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {
let p = WeightFeeFactor::get();
let q = Balance::from(RuntimeAdjustedWeights::extrinsic_base_weight().ref_time());
let q = Balance::from(ExtrinsicBaseWeight::get().ref_time());
smallvec::smallvec![WeightToFeeCoefficient {
degree: 1,
negative: false,
Expand Down

0 comments on commit ce4612c

Please sign in to comment.