mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 10:01:17 +00:00
New root_testing pallet (#12451)
* Move fill_block to RootOffences * docs * new pallet * new line * fix * Update frame/root-testing/src/lib.rs Co-authored-by: Bastian Köcher <git@kchr.de> * Update frame/root-testing/src/lib.rs Co-authored-by: Bastian Köcher <git@kchr.de> * Update bin/node/runtime/src/lib.rs Co-authored-by: Bastian Köcher <git@kchr.de> * Update frame/root-testing/src/lib.rs Co-authored-by: Bastian Köcher <git@kchr.de> * Update frame/root-testing/src/lib.rs Co-authored-by: Bastian Köcher <git@kchr.de> * Update frame/root-testing/src/lib.rs Co-authored-by: Bastian Köcher <git@kchr.de> * fixes * problem solved * revert * fix dependency * hopefully making the CI happy * ... * dummy call * remove dummy * fix warning Co-authored-by: Bastian Köcher <git@kchr.de>
This commit is contained in:
@@ -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;
|
||||
@@ -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]
|
||||
@@ -370,23 +369,6 @@ 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,
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
/// Make some on-chain remark.
|
||||
///
|
||||
/// # <weight>
|
||||
|
||||
@@ -24,7 +24,7 @@ use sp_core::H256;
|
||||
use sp_runtime::{
|
||||
testing::Header,
|
||||
traits::{BlakeTwo256, IdentityLookup},
|
||||
BuildStorage,
|
||||
BuildStorage, Perbill,
|
||||
};
|
||||
|
||||
type UncheckedExtrinsic = mocking::MockUncheckedExtrinsic<Test>;
|
||||
|
||||
Reference in New Issue
Block a user