mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-11 20:01:08 +00:00
Introduce SubmitOrigin to Referenda pallet config (#11567)
This commit is contained in:
@@ -825,6 +825,7 @@ impl pallet_referenda::Config for Runtime {
|
||||
type Event = Event;
|
||||
type Scheduler = Scheduler;
|
||||
type Currency = pallet_balances::Pallet<Self>;
|
||||
type SubmitOrigin = EnsureSigned<AccountId>;
|
||||
type CancelOrigin = EnsureRoot<AccountId>;
|
||||
type KillOrigin = EnsureRoot<AccountId>;
|
||||
type Slash = ();
|
||||
@@ -843,6 +844,7 @@ impl pallet_referenda::Config<pallet_referenda::Instance2> for Runtime {
|
||||
type Event = Event;
|
||||
type Scheduler = Scheduler;
|
||||
type Currency = pallet_balances::Pallet<Self>;
|
||||
type SubmitOrigin = EnsureSigned<AccountId>;
|
||||
type CancelOrigin = EnsureRoot<AccountId>;
|
||||
type KillOrigin = EnsureRoot<AccountId>;
|
||||
type Slash = ();
|
||||
|
||||
@@ -143,6 +143,8 @@ pub mod pallet {
|
||||
/// Currency type for this pallet.
|
||||
type Currency: ReservableCurrency<Self::AccountId>;
|
||||
// Origins and unbalances.
|
||||
/// Origin from which proposals may be submitted.
|
||||
type SubmitOrigin: EnsureOrigin<Self::Origin, Success = Self::AccountId>;
|
||||
/// Origin from which any vote may be cancelled.
|
||||
type CancelOrigin: EnsureOrigin<Self::Origin>;
|
||||
/// Origin from which any vote may be killed.
|
||||
@@ -343,7 +345,7 @@ pub mod pallet {
|
||||
impl<T: Config<I>, I: 'static> Pallet<T, I> {
|
||||
/// 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<T::BlockNumber>,
|
||||
) -> DispatchResult {
|
||||
let who = ensure_signed(origin)?;
|
||||
let who = T::SubmitOrigin::ensure_origin(origin)?;
|
||||
|
||||
let track =
|
||||
T::Tracks::track_for(&proposal_origin).map_err(|_| Error::<T, I>::NoTrack)?;
|
||||
|
||||
@@ -215,6 +215,7 @@ impl Config for Test {
|
||||
type Event = Event;
|
||||
type Scheduler = Scheduler;
|
||||
type Currency = pallet_balances::Pallet<Self>;
|
||||
type SubmitOrigin = frame_system::EnsureSigned<u64>;
|
||||
type CancelOrigin = EnsureSignedBy<Four, u64>;
|
||||
type KillOrigin = EnsureRoot<u64>;
|
||||
type Slash = ();
|
||||
|
||||
@@ -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(|| {
|
||||
|
||||
Reference in New Issue
Block a user