mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 20:27:58 +00:00
Split Operational and Normal weight (#5954)
* Split operational and normal weight * Update other parts of the code * relatively minor changes to add/fix behavior * Limit reported block weight for fee adjustment * fix test * explicit match * Move common logic out * Update frame/system/src/lib.rs Co-authored-by: Gavin Wood <gavin@parity.io> * API improvement @bkchr Co-authored-by: Gavin Wood <gavin@parity.io>
This commit is contained in:
@@ -70,8 +70,8 @@ pub struct TargetedFeeAdjustment<T>(sp_std::marker::PhantomData<T>);
|
||||
|
||||
impl<T: Get<Perquintill>> Convert<Fixed128, Fixed128> for TargetedFeeAdjustment<T> {
|
||||
fn convert(multiplier: Fixed128) -> Fixed128 {
|
||||
let block_weight = System::all_extrinsics_weight();
|
||||
let max_weight = MaximumBlockWeight::get();
|
||||
let block_weight = System::all_extrinsics_weight().total().min(max_weight);
|
||||
let target_weight = (T::get() * max_weight) as u128;
|
||||
let block_weight = block_weight as u128;
|
||||
|
||||
@@ -132,11 +132,12 @@ mod tests {
|
||||
|
||||
// poc reference implementation.
|
||||
fn fee_multiplier_update(block_weight: Weight, previous: Fixed128) -> Fixed128 {
|
||||
let block_weight = block_weight as f64;
|
||||
let v: f64 = 0.00004;
|
||||
|
||||
// maximum tx weight
|
||||
let m = max() as f64;
|
||||
// block weight always truncated to max weight
|
||||
let block_weight = (block_weight as f64).min(m);
|
||||
let v: f64 = 0.00004;
|
||||
|
||||
// Ideal saturation in terms of weight
|
||||
let ss = target() as f64;
|
||||
// Current saturation in terms of weight
|
||||
|
||||
Reference in New Issue
Block a user