From 83f82c57f66947b239f3f9a0d13fd6be7412cf4d Mon Sep 17 00:00:00 2001 From: Szegoo Date: Thu, 27 Oct 2022 21:22:05 +0200 Subject: [PATCH] remove fill_block --- runtime/kusama/src/lib.rs | 17 ++++------------- runtime/polkadot/src/lib.rs | 17 ++++------------- 2 files changed, 8 insertions(+), 26 deletions(-) diff --git a/runtime/kusama/src/lib.rs b/runtime/kusama/src/lib.rs index e05b8ba8eb88..9d1d56f9681b 100644 --- a/runtime/kusama/src/lib.rs +++ b/runtime/kusama/src/lib.rs @@ -2088,7 +2088,7 @@ mod tests_fess { #[cfg(test)] mod multiplier_tests { use super::*; - use frame_support::{dispatch::GetDispatchInfo, traits::OnFinalize}; + use frame_support::{dispatch::DispatchInfo, traits::OnFinalize}; use runtime_common::{MinimumMultiplier, TargetBlockFullness}; use separator::Separatable; use sp_runtime::traits::Convert; @@ -2130,17 +2130,8 @@ mod multiplier_tests { let mut blocks = 0; let mut fees_paid = 0; - let call = frame_system::Call::::fill_block { - ratio: Perbill::from_rational( - block_weight.ref_time(), - BlockWeights::get().get(DispatchClass::Normal).max_total.unwrap().ref_time(), - ), - }; - println!("calling {:?}", call); - let info = call.get_dispatch_info(); - // convert to outer call. - let call = RuntimeCall::System(call); - let len = call.using_encoded(|e| e.len()) as u32; + frame_system::Pallet::::set_block_consumed_resources(Weight::MAX, 0); + let info = DispatchInfo { weight: Weight::MAX, ..Default::default() }; let mut t: sp_io::TestExternalities = frame_system::GenesisConfig::default() .build_storage::() @@ -2154,7 +2145,7 @@ mod multiplier_tests { while multiplier <= Multiplier::from_u32(1) { t.execute_with(|| { // imagine this tx was called. - let fee = TransactionPayment::compute_fee(len, &info, 0); + let fee = TransactionPayment::compute_fee(0, &info, 0); fees_paid += fee; // this will update the multiplier. diff --git a/runtime/polkadot/src/lib.rs b/runtime/polkadot/src/lib.rs index 6b898230c209..82e66f23b144 100644 --- a/runtime/polkadot/src/lib.rs +++ b/runtime/polkadot/src/lib.rs @@ -2278,7 +2278,7 @@ mod test { #[cfg(test)] mod multiplier_tests { use super::*; - use frame_support::{dispatch::GetDispatchInfo, traits::OnFinalize}; + use frame_support::{dispatch::DispatchInfo, traits::OnFinalize}; use runtime_common::{MinimumMultiplier, TargetBlockFullness}; use separator::Separatable; use sp_runtime::traits::Convert; @@ -2320,17 +2320,8 @@ mod multiplier_tests { let mut blocks = 0; let mut fees_paid = 0; - let call = frame_system::Call::::fill_block { - ratio: Perbill::from_rational( - block_weight.ref_time(), - BlockWeights::get().get(DispatchClass::Normal).max_total.unwrap().ref_time(), - ), - }; - println!("calling {:?}", call); - let info = call.get_dispatch_info(); - // convert to outer call. - let call = RuntimeCall::System(call); - let len = call.using_encoded(|e| e.len()) as u32; + frame_system::Pallet::::set_block_consumed_resources(Weight::MAX, 0); + let info = DispatchInfo { weight: Weight::MAX, ..Default::default() }; let mut t: sp_io::TestExternalities = frame_system::GenesisConfig::default() .build_storage::() @@ -2344,7 +2335,7 @@ mod multiplier_tests { while multiplier <= Multiplier::from_u32(1) { t.execute_with(|| { // imagine this tx was called. - let fee = TransactionPayment::compute_fee(len, &info, 0); + let fee = TransactionPayment::compute_fee(0, &info, 0); fees_paid += fee; // this will update the multiplier.