mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-17 05:31:02 +00:00
Refund weight in system::fillBlock (#11754)
* fix * pushed * node: fix fee multiplier test Co-authored-by: André Silva <andrerfosilva@gmail.com>
This commit is contained in:
Generated
+1
@@ -4732,6 +4732,7 @@ dependencies = [
|
|||||||
"pallet-balances",
|
"pallet-balances",
|
||||||
"pallet-contracts",
|
"pallet-contracts",
|
||||||
"pallet-im-online",
|
"pallet-im-online",
|
||||||
|
"pallet-sudo",
|
||||||
"pallet-timestamp",
|
"pallet-timestamp",
|
||||||
"pallet-transaction-payment",
|
"pallet-transaction-payment",
|
||||||
"pallet-treasury",
|
"pallet-treasury",
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ node-testing = { version = "3.0.0-dev", path = "../testing" }
|
|||||||
pallet-balances = { version = "4.0.0-dev", path = "../../../frame/balances" }
|
pallet-balances = { version = "4.0.0-dev", path = "../../../frame/balances" }
|
||||||
pallet-contracts = { version = "4.0.0-dev", path = "../../../frame/contracts" }
|
pallet-contracts = { version = "4.0.0-dev", path = "../../../frame/contracts" }
|
||||||
pallet-im-online = { version = "4.0.0-dev", path = "../../../frame/im-online" }
|
pallet-im-online = { version = "4.0.0-dev", path = "../../../frame/im-online" }
|
||||||
|
pallet-sudo = { version = "4.0.0-dev", path = "../../../frame/sudo" }
|
||||||
pallet-timestamp = { version = "4.0.0-dev", path = "../../../frame/timestamp" }
|
pallet-timestamp = { version = "4.0.0-dev", path = "../../../frame/timestamp" }
|
||||||
pallet-treasury = { version = "4.0.0-dev", path = "../../../frame/treasury" }
|
pallet-treasury = { version = "4.0.0-dev", path = "../../../frame/treasury" }
|
||||||
pallet-transaction-payment = { version = "4.0.0-dev", path = "../../../frame/transaction-payment" }
|
pallet-transaction-payment = { version = "4.0.0-dev", path = "../../../frame/transaction-payment" }
|
||||||
|
|||||||
@@ -58,8 +58,10 @@ fn fee_multiplier_increases_and_decreases_on_big_weight() {
|
|||||||
},
|
},
|
||||||
CheckedExtrinsic {
|
CheckedExtrinsic {
|
||||||
signed: Some((charlie(), signed_extra(0, 0))),
|
signed: Some((charlie(), signed_extra(0, 0))),
|
||||||
function: Call::System(frame_system::Call::fill_block {
|
function: Call::Sudo(pallet_sudo::Call::sudo {
|
||||||
ratio: Perbill::from_percent(60),
|
call: Box::new(Call::System(frame_system::Call::fill_block {
|
||||||
|
ratio: Perbill::from_percent(60),
|
||||||
|
})),
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -197,6 +197,7 @@ impl<MaxNormal: Get<u32>, MaxOverflow: Get<u32>> ConsumerLimits for (MaxNormal,
|
|||||||
pub mod pallet {
|
pub mod pallet {
|
||||||
use crate::{self as frame_system, pallet_prelude::*, *};
|
use crate::{self as frame_system, pallet_prelude::*, *};
|
||||||
use frame_support::pallet_prelude::*;
|
use frame_support::pallet_prelude::*;
|
||||||
|
use sp_runtime::DispatchErrorWithPostInfo;
|
||||||
|
|
||||||
/// System configuration trait. Implemented by runtime.
|
/// System configuration trait. Implemented by runtime.
|
||||||
#[pallet::config]
|
#[pallet::config]
|
||||||
@@ -371,8 +372,16 @@ pub mod pallet {
|
|||||||
// that's not possible at present (since it's within the pallet macro).
|
// that's not possible at present (since it's within the pallet macro).
|
||||||
#[pallet::weight(*_ratio * T::BlockWeights::get().max_block)]
|
#[pallet::weight(*_ratio * T::BlockWeights::get().max_block)]
|
||||||
pub fn fill_block(origin: OriginFor<T>, _ratio: Perbill) -> DispatchResultWithPostInfo {
|
pub fn fill_block(origin: OriginFor<T>, _ratio: Perbill) -> DispatchResultWithPostInfo {
|
||||||
ensure_root(origin)?;
|
match ensure_root(origin) {
|
||||||
Ok(().into())
|
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.
|
/// Make some on-chain remark.
|
||||||
|
|||||||
Reference in New Issue
Block a user