add EnsureWithSuccess (#12775)

* add EnsureWithSuccess

* Apply suggestions from code review

Co-authored-by: Bastian Köcher <git@kchr.de>

* add docs

Co-authored-by: Bastian Köcher <git@kchr.de>
Co-authored-by: parity-processbot <>
This commit is contained in:
Xiliang Chen
2022-11-26 04:29:56 +13:00
committed by GitHub
parent 5ca7dc1b87
commit 1ee7fe3697
2 changed files with 33 additions and 2 deletions
+3 -2
View File
@@ -44,7 +44,7 @@ use frame_support::{
};
use frame_system::{
limits::{BlockLength, BlockWeights},
EnsureRoot, EnsureRootWithSuccess, EnsureSigned,
EnsureRoot, EnsureRootWithSuccess, EnsureSigned, EnsureWithSuccess,
};
pub use node_primitives::{AccountId, Signature};
use node_primitives::{AccountIndex, Balance, BlockNumber, Hash, Index, Moment};
@@ -1076,6 +1076,7 @@ parameter_types! {
pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry");
pub const MaximumReasonLength: u32 = 300;
pub const MaxApprovals: u32 = 100;
pub const MaxBalance: Balance = Balance::max_value();
}
impl pallet_treasury::Config for Runtime {
@@ -1100,7 +1101,7 @@ impl pallet_treasury::Config for Runtime {
type SpendFunds = Bounties;
type WeightInfo = pallet_treasury::weights::SubstrateWeight<Runtime>;
type MaxApprovals = MaxApprovals;
type SpendOrigin = frame_support::traits::NeverEnsureOrigin<u128>;
type SpendOrigin = EnsureWithSuccess<EnsureRoot<AccountId>, AccountId, MaxBalance>;
}
parameter_types! {