Skip to content

Commit

Permalink
(Issue 6) Replace SubmitOrigin with root
Browse files Browse the repository at this point in the history
  • Loading branch information
maltekliemann committed Dec 9, 2024
1 parent f664336 commit 41d8752
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
1 change: 0 additions & 1 deletion runtime/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1203,7 +1203,6 @@ macro_rules! impl_config_traits {
type Oracle = DecisionMarketOracle<Runtime>;
type RuntimeEvent = RuntimeEvent;
type Scheduler = Scheduler;
type SubmitOrigin = EnsureRoot<AccountId>;
type WeightInfo = zrml_futarchy::weights::WeightInfo<Runtime>;
}

Expand Down
12 changes: 6 additions & 6 deletions zrml/futarchy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,14 @@ mod pallet {
use alloc::fmt::Debug;
use core::marker::PhantomData;
use frame_support::{
pallet_prelude::{EnsureOrigin, IsType, StorageMap, StorageVersion, ValueQuery, Weight},
pallet_prelude::{IsType, StorageMap, StorageVersion, ValueQuery, Weight},
traits::{schedule::v3::Anon as ScheduleAnon, Bounded, Hooks, OriginTrait},
transactional, Blake2_128Concat, BoundedVec,
};
use frame_system::pallet_prelude::{BlockNumberFor, OriginFor};
use frame_system::{
ensure_root,
pallet_prelude::{BlockNumberFor, OriginFor},
};
use parity_scale_codec::{Decode, Encode, MaxEncodedLen};
use scale_info::TypeInfo;
use sp_runtime::{
Expand Down Expand Up @@ -94,9 +97,6 @@ mod pallet {
/// Scheduler interface for executing proposals.
type Scheduler: ScheduleAnon<BlockNumberFor<Self>, CallOf<Self>, PalletsOriginOf<Self>>;

/// The origin that is allowed to submit proposals.
type SubmitOrigin: EnsureOrigin<Self::RuntimeOrigin>;

type WeightInfo: WeightInfoZeitgeist;
}

Expand Down Expand Up @@ -160,7 +160,7 @@ mod pallet {
duration: BlockNumberFor<T>,
proposal: Proposal<T>,
) -> DispatchResult {
T::SubmitOrigin::ensure_origin(origin)?;
ensure_root(origin)?;

Self::do_submit_proposal(duration, proposal)
}
Expand Down
3 changes: 1 addition & 2 deletions zrml/futarchy/src/mock/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use crate::{
weights::WeightInfo,
};
use frame_support::{construct_runtime, parameter_types, traits::Everything};
use frame_system::{mocking::MockBlock, EnsureRoot};
use frame_system::mocking::MockBlock;
use sp_runtime::traits::{BlakeTwo256, ConstU32, IdentityLookup};
use zeitgeist_primitives::{
constants::mock::{BlockHashCount, ExistentialDeposit, MaxLocks, MaxReserves},
Expand Down Expand Up @@ -93,6 +93,5 @@ impl zrml_futarchy::Config for Runtime {
type Oracle = MockOracle;
type RuntimeEvent = RuntimeEvent;
type Scheduler = MockScheduler;
type SubmitOrigin = EnsureRoot<<Runtime as frame_system::Config>::AccountId>;
type WeightInfo = WeightInfo<Runtime>;
}

0 comments on commit 41d8752

Please sign in to comment.