From b286d78d907f2f26c22f29f6482a60ea16586d59 Mon Sep 17 00:00:00 2001 From: firke Date: Mon, 13 Sep 2021 16:49:05 +0100 Subject: [PATCH] Fixes runtime::system: Bad mandatory: BadOrigin error. --- runtime/opportunity/src/lib.rs | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/runtime/opportunity/src/lib.rs b/runtime/opportunity/src/lib.rs index 82a955ab..62e63fea 100644 --- a/runtime/opportunity/src/lib.rs +++ b/runtime/opportunity/src/lib.rs @@ -111,7 +111,6 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, Runtime, AllPallets, - RemoveCollectiveFlip, >; /// We assume that ~10% of the block weight is consumed by `on_initalize` handlers. @@ -180,7 +179,7 @@ parameter_types! { impl frame_system::Config for Runtime { /// The basic call filter to use in dispatchable. - type BaseCallFilter = (); + type BaseCallFilter = frame_support::traits::AllowAll; /// Block & extrinsics weights: base values and limits. type BlockWeights = RuntimeBlockWeights; /// The maximum length of a block (in bytes). @@ -686,6 +685,12 @@ parameter_types! { // pub const StakingUnsignedPriority: TransactionPriority = TransactionPriority::max_value() / 2; } +type SlashCancelOrigin = EnsureOneOf< + AccountId, + EnsureRoot, + pallet_collective::EnsureProportionAtLeast<_3, _4, AccountId, CouncilCollective>, +>; + impl pallet_staking::Config for Runtime { const MAX_NOMINATIONS: u32 = 16; type Currency = Balances; @@ -697,7 +702,7 @@ impl pallet_staking::Config for Runtime { type Reward = (); type SessionsPerEra = SessionsPerEra; type SlashDeferDuration = SlashDeferDuration; - type SlashCancelOrigin = frame_system::EnsureRoot; + type SlashCancelOrigin = SlashCancelOrigin; type BondingDuration = BondingDuration; type SessionInterface = Self; type NextNewSession = Session; @@ -922,16 +927,6 @@ construct_runtime!( } ); -pub struct RemoveCollectiveFlip; -impl frame_support::traits::OnRuntimeUpgrade for RemoveCollectiveFlip { - fn on_runtime_upgrade() -> Weight { - use frame_support::storage::migration; - // Remove the storage value `RandomMaterial` from removed pallet `RandomnessCollectiveFlip` - migration::remove_storage_prefix(b"RandomnessCollectiveFlip", b"RandomMaterial", b""); - ::DbWeight::get().writes(1) - } -} - #[cfg(not(feature = "disable-runtime-api"))] sp_api::impl_runtime_apis! { impl sp_api::Core for Runtime {