Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Prev Previous commit
Next Next commit
Update other parts of the code
  • Loading branch information
shawntabrizi committed May 8, 2020
commit cfc554bbc5aa6af2098f13de2d19c22d10427634
2 changes: 1 addition & 1 deletion bin/node/runtime/src/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ 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 block_weight = System::all_extrinsics_weight().total();
let max_weight = MaximumBlockWeight::get();
let target_weight = (T::get() * max_weight) as u128;
let block_weight = block_weight as u128;
Expand Down
12 changes: 6 additions & 6 deletions frame/executive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ mod tests {
Digest::default(),
));
// Base block execution weight + `on_initialize` weight from the custom module.
assert_eq!(<frame_system::Module<Runtime>>::all_extrinsics_weight(), base_block_weight);
assert_eq!(<frame_system::Module<Runtime>>::all_extrinsics_weight().total(), base_block_weight);

for nonce in 0..=num_to_exhaust_block {
let xt = TestXt::new(
Expand All @@ -795,7 +795,7 @@ mod tests {
if nonce != num_to_exhaust_block {
assert!(res.is_ok());
assert_eq!(
<frame_system::Module<Runtime>>::all_extrinsics_weight(),
<frame_system::Module<Runtime>>::all_extrinsics_weight().total(),
//--------------------- on_initialize + block_execution + extrinsic_base weight
(encoded_len + 5) * (nonce + 1) + base_block_weight,
);
Expand All @@ -815,7 +815,7 @@ mod tests {
let len = xt.clone().encode().len() as u32;
let mut t = new_test_ext(1);
t.execute_with(|| {
assert_eq!(<frame_system::Module<Runtime>>::all_extrinsics_weight(), 0);
assert_eq!(<frame_system::Module<Runtime>>::all_extrinsics_weight().total(), 0);
assert_eq!(<frame_system::Module<Runtime>>::all_extrinsics_len(), 0);

assert!(Executive::apply_extrinsic(xt.clone()).unwrap().is_ok());
Expand All @@ -824,14 +824,14 @@ mod tests {

// default weight for `TestXt` == encoded length.
assert_eq!(
<frame_system::Module<Runtime>>::all_extrinsics_weight(),
<frame_system::Module<Runtime>>::all_extrinsics_weight().total(),
3 * (len as Weight + <Runtime as frame_system::Trait>::ExtrinsicBaseWeight::get()),
);
assert_eq!(<frame_system::Module<Runtime>>::all_extrinsics_len(), 3 * len);

let _ = <frame_system::Module<Runtime>>::finalize();

assert_eq!(<frame_system::Module<Runtime>>::all_extrinsics_weight(), 0);
assert_eq!(<frame_system::Module<Runtime>>::all_extrinsics_weight().total(), 0);
assert_eq!(<frame_system::Module<Runtime>>::all_extrinsics_len(), 0);
});
}
Expand Down Expand Up @@ -903,7 +903,7 @@ mod tests {
// NOTE: might need updates over time if new weights are introduced.
// For now it only accounts for the base block execution weight and
// the `on_initialize` weight defined in the custom test module.
assert_eq!(<frame_system::Module<Runtime>>::all_extrinsics_weight(), 175 + 10);
assert_eq!(<frame_system::Module<Runtime>>::all_extrinsics_weight().total(), 175 + 10);
})
}

Expand Down