Skip to content

Commit

Permalink
Remove system.fill_block
Browse files Browse the repository at this point in the history
  • Loading branch information
Neopallium committed Jan 19, 2023
1 parent 9a2d502 commit a142fd7
Showing 1 changed file with 6 additions and 17 deletions.
23 changes: 6 additions & 17 deletions frame/system/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ use sp_runtime::{
CheckEqual, Dispatchable, Hash, Lookup, LookupError, MaybeDisplay, MaybeMallocSizeOf,
MaybeSerializeDeserialize, Member, One, Saturating, SimpleBitOps, StaticLookup, Zero,
},
DispatchError, Perbill, RuntimeDebug,
DispatchError, RuntimeDebug,
};
#[cfg(any(feature = "std", test))]
use sp_std::map;
Expand Down Expand Up @@ -197,7 +197,6 @@ impl<MaxNormal: Get<u32>, MaxOverflow: Get<u32>> ConsumerLimits for (MaxNormal,
pub mod pallet {
use crate::{self as frame_system, pallet_prelude::*, *};
use frame_support::pallet_prelude::*;
use sp_runtime::DispatchErrorWithPostInfo;

/// System configuration trait. Implemented by runtime.
#[pallet::config]
Expand Down Expand Up @@ -371,21 +370,11 @@ pub mod pallet {

#[pallet::call]
impl<T: Config> Pallet<T> {
/// A dispatch that will fill the block weight up to the given ratio.
// TODO: This should only be available for testing, rather than in general usage, but
// that's not possible at present (since it's within the pallet macro).
#[pallet::weight(*_ratio * T::BlockWeights::get().max_block)]
pub fn fill_block(origin: OriginFor<T>, _ratio: Perbill) -> DispatchResultWithPostInfo {
match ensure_root(origin) {
Ok(_) => Ok(().into()),
Err(_) => {
// roughly same as a 4 byte remark since perbill is u32.
Err(DispatchErrorWithPostInfo {
post_info: Some(T::SystemWeightInfo::remark(4u32)).into(),
error: DispatchError::BadOrigin,
})
},
}
/// Placeholder for removed `fill_block`.
#[pallet::weight(1_000)]
pub fn placeholder_fill_block(origin: OriginFor<T>) -> DispatchResult {
ensure_signed_or_root(origin)?;
Ok(())
}

/// Make some on-chain remark.
Expand Down

0 comments on commit a142fd7

Please sign in to comment.