mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 02:21:14 +00:00
Allow specify schedule dispatch origin (#6387)
* allow specify schedule dispatch origin * fix tests * use caller origin for scheduled * fix tests * line width * check origin for cancel * line width * fix some issues for benchmarking * fix doc test * another way to constraint origin * fix build issues * fix cancel * line width * fix benchmarks * bump version * enable runtime upgrade * add migration code and test * Update frame/scheduler/src/lib.rs Co-authored-by: Gavin Wood <github@gavwood.com> * expose migration method * add notes * bump version * remove on_runtime_upgrade * fix test Co-authored-by: Gavin Wood <github@gavwood.com>
This commit is contained in:
@@ -79,6 +79,7 @@ fn add_referendum<T: Trait>(n: u32) -> Result<ReferendumIndex, &'static str> {
|
||||
1.into(),
|
||||
None,
|
||||
63,
|
||||
system::RawOrigin::Root.into(),
|
||||
Call::enact_proposal(proposal_hash, referendum_index).into(),
|
||||
).map_err(|_| "failed to schedule named")?;
|
||||
Ok(referendum_index)
|
||||
|
||||
@@ -279,7 +279,10 @@ pub trait Trait: frame_system::Trait + Sized {
|
||||
type Slash: OnUnbalanced<NegativeImbalanceOf<Self>>;
|
||||
|
||||
/// The Scheduler.
|
||||
type Scheduler: ScheduleNamed<Self::BlockNumber, Self::Proposal>;
|
||||
type Scheduler: ScheduleNamed<Self::BlockNumber, Self::Proposal, Self::PalletsOrigin>;
|
||||
|
||||
/// Overarching type of all pallets origins.
|
||||
type PalletsOrigin: From<system::RawOrigin<Self::AccountId>>;
|
||||
|
||||
/// The maximum number of votes for an account.
|
||||
///
|
||||
@@ -1625,6 +1628,7 @@ impl<T: Trait> Module<T> {
|
||||
when,
|
||||
None,
|
||||
63,
|
||||
system::RawOrigin::Root.into(),
|
||||
Call::enact_proposal(status.proposal_hash, index).into(),
|
||||
).is_err() {
|
||||
frame_support::print("LOGIC ERROR: bake_referendum/schedule_named failed");
|
||||
|
||||
@@ -31,7 +31,7 @@ use sp_runtime::{
|
||||
testing::Header, Perbill,
|
||||
};
|
||||
use pallet_balances::{BalanceLock, Error as BalancesError};
|
||||
use frame_system::EnsureSignedBy;
|
||||
use frame_system::{EnsureSignedBy, EnsureRoot};
|
||||
|
||||
mod cancellation;
|
||||
mod delegation;
|
||||
@@ -123,8 +123,10 @@ parameter_types! {
|
||||
impl pallet_scheduler::Trait for Test {
|
||||
type Event = Event;
|
||||
type Origin = Origin;
|
||||
type PalletsOrigin = OriginCaller;
|
||||
type Call = Call;
|
||||
type MaximumWeight = MaximumSchedulerWeight;
|
||||
type ScheduleOrigin = EnsureRoot<u64>;
|
||||
}
|
||||
parameter_types! {
|
||||
pub const ExistentialDeposit: u64 = 1;
|
||||
@@ -196,6 +198,7 @@ impl super::Trait for Test {
|
||||
type Scheduler = Scheduler;
|
||||
type MaxVotes = MaxVotes;
|
||||
type OperationalPreimageOrigin = EnsureSignedBy<Six, u64>;
|
||||
type PalletsOrigin = OriginCaller;
|
||||
}
|
||||
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
|
||||
Reference in New Issue
Block a user