Skip to content

Commit 49c162e

Browse files
authored
Merge pull request #15 from docknetwork/root-fast-track
Allow `RawOrigin::Root` to fast-track supermajority proposals
2 parents a31722d + 23607c1 commit 49c162e

File tree

1 file changed

+7
-2
lines changed
  • substrate/frame/democracy/src

1 file changed

+7
-2
lines changed

substrate/frame/democracy/src/lib.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ impl<AccountId: Encode + Decode> DepositPaybackTarget<AccountId> {
415415
pub mod pallet {
416416
use super::{DispatchResult, *};
417417
use frame_support::pallet_prelude::*;
418-
use frame_system::pallet_prelude::*;
418+
use frame_system::{pallet_prelude::*, RawOrigin};
419419

420420
#[pallet::pallet]
421421
#[pallet::generate_store(pub(super) trait Store)]
@@ -1071,6 +1071,11 @@ pub mod pallet {
10711071
voting_period: T::BlockNumber,
10721072
delay: T::BlockNumber,
10731073
) -> DispatchResult {
1074+
let (is_root, origin) = match origin.into() {
1075+
Ok(RawOrigin::Root) => (true, RawOrigin::Root.into()),
1076+
Ok(other) => (false, other.into()),
1077+
Err(origin) => (false, origin),
1078+
};
10741079
// Rather complicated bit of code to ensure that either:
10751080
// - `voting_period` is at least `FastTrackVotingPeriod` and `origin` is
10761081
// `FastTrackOrigin`; or
@@ -1093,7 +1098,7 @@ pub mod pallet {
10931098
let (e_proposal_hash, threshold) =
10941099
<NextExternal<T>>::get().ok_or(Error::<T>::ProposalMissing)?;
10951100
ensure!(
1096-
threshold != VoteThreshold::SuperMajorityApprove,
1101+
is_root || threshold != VoteThreshold::SuperMajorityApprove,
10971102
Error::<T>::NotSimpleMajority,
10981103
);
10991104
ensure!(proposal_hash == e_proposal_hash, Error::<T>::InvalidHash);

0 commit comments

Comments
 (0)