diff --git a/bin/node/runtime/src/lib.rs b/bin/node/runtime/src/lib.rs index bfac30db6c66f..b421a4f05ed1a 100644 --- a/bin/node/runtime/src/lib.rs +++ b/bin/node/runtime/src/lib.rs @@ -825,6 +825,7 @@ impl pallet_referenda::Config for Runtime { type Event = Event; type Scheduler = Scheduler; type Currency = pallet_balances::Pallet; + type SubmitOrigin = EnsureSigned; type CancelOrigin = EnsureRoot; type KillOrigin = EnsureRoot; type Slash = (); @@ -843,6 +844,7 @@ impl pallet_referenda::Config for Runtime { type Event = Event; type Scheduler = Scheduler; type Currency = pallet_balances::Pallet; + type SubmitOrigin = EnsureSigned; type CancelOrigin = EnsureRoot; type KillOrigin = EnsureRoot; type Slash = (); diff --git a/frame/referenda/src/lib.rs b/frame/referenda/src/lib.rs index 3fd54b54d331e..f21a78bcb7863 100644 --- a/frame/referenda/src/lib.rs +++ b/frame/referenda/src/lib.rs @@ -143,6 +143,8 @@ pub mod pallet { /// Currency type for this pallet. type Currency: ReservableCurrency; // Origins and unbalances. + /// Origin from which proposals may be submitted. + type SubmitOrigin: EnsureOrigin; /// Origin from which any vote may be cancelled. type CancelOrigin: EnsureOrigin; /// Origin from which any vote may be killed. @@ -343,7 +345,7 @@ pub mod pallet { impl, I: 'static> Pallet { /// Propose a referendum on a privileged action. /// - /// - `origin`: must be `Signed` and the account must have `SubmissionDeposit` funds + /// - `origin`: must be `SubmitOrigin` and the account must have `SubmissionDeposit` funds /// available. /// - `proposal_origin`: The origin from which the proposal should be executed. /// - `proposal_hash`: The hash of the proposal preimage. @@ -357,7 +359,7 @@ pub mod pallet { proposal_hash: T::Hash, enactment_moment: DispatchTime, ) -> DispatchResult { - let who = ensure_signed(origin)?; + let who = T::SubmitOrigin::ensure_origin(origin)?; let track = T::Tracks::track_for(&proposal_origin).map_err(|_| Error::::NoTrack)?; diff --git a/frame/referenda/src/mock.rs b/frame/referenda/src/mock.rs index a3026ce78e986..8b06fb3205e6f 100644 --- a/frame/referenda/src/mock.rs +++ b/frame/referenda/src/mock.rs @@ -215,6 +215,7 @@ impl Config for Test { type Event = Event; type Scheduler = Scheduler; type Currency = pallet_balances::Pallet; + type SubmitOrigin = frame_system::EnsureSigned; type CancelOrigin = EnsureSignedBy; type KillOrigin = EnsureRoot; type Slash = (); diff --git a/frame/referenda/src/tests.rs b/frame/referenda/src/tests.rs index 8134e024dda39..db55fdb8c40cf 100644 --- a/frame/referenda/src/tests.rs +++ b/frame/referenda/src/tests.rs @@ -28,8 +28,6 @@ use frame_support::{ }; use pallet_balances::Error as BalancesError; -// TODO: Scheduler should re-use `None` items in its `Agenda`. - #[test] fn params_should_work() { new_test_ext().execute_with(|| {