From be30378adea3578a65d6274209e2928925ed48ac Mon Sep 17 00:00:00 2001 From: Daniel Shiposha Date: Mon, 24 Oct 2022 12:55:23 +0000 Subject: [PATCH] fix: scheduler rebase --- --- a/pallets/scheduler/src/lib.rs +++ b/pallets/scheduler/src/lib.rs @@ -86,7 +86,7 @@ use sp_std::{borrow::Borrow, cmp::Ordering, marker::PhantomData, prelude::*}; use frame_support::{ - dispatch::{DispatchError, DispatchResult, Dispatchable, UnfilteredDispatchable, Parameter}, + dispatch::{DispatchError, DispatchResult, Dispatchable, UnfilteredDispatchable, Parameter, GetDispatchInfo}, traits::{ schedule::{self, DispatchTime, MaybeHashed}, NamedReservableCurrency, EnsureOrigin, Get, IsType, OriginTrait, PrivilegeCmp, @@ -101,7 +101,7 @@ pub type TaskAddress = (BlockNumber, u32); pub const MAX_TASK_ID_LENGTH_IN_BYTES: u8 = 16; -type ScheduledId = [u8; MAX_TASK_ID_LENGTH_IN_BYTES as usize]; +pub type ScheduledId = [u8; MAX_TASK_ID_LENGTH_IN_BYTES as usize]; pub type CallOrHashOf = MaybeHashed<::RuntimeCall, ::Hash>; @@ -231,10 +231,10 @@ /// The aggregated call type. type RuntimeCall: Parameter - + Dispatchable::RuntimeOrigin, PostInfo = PostDispatchInfo> - + UnfilteredDispatchable::RuntimeOrigin> + + Dispatchable::RuntimeOrigin, PostInfo = PostDispatchInfo> + + UnfilteredDispatchable::RuntimeOrigin> + GetDispatchInfo - + From>; + + From>; /// The maximum weight that may be scheduled per block for any dispatchables of less /// priority than `schedule::HARD_DEADLINE`. @@ -611,7 +611,7 @@ priority: schedule::Priority, ) -> DispatchResult { T::PrioritySetOrigin::ensure_origin(origin.clone())?; - let origin = ::Origin::from(origin); + let origin = ::RuntimeOrigin::from(origin); Self::do_change_named_priority(origin.caller().clone(), id, priority) } } --- a/runtime/common/config/pallets/scheduler.rs +++ b/runtime/common/config/pallets/scheduler.rs @@ -25,7 +25,7 @@ use codec::Decode; use crate::{ runtime_common::{scheduler::SchedulerPaymentExecutor, config::substrate::RuntimeBlockWeights}, - Runtime, Call, Event, Origin, OriginCaller, Balances, + Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, OriginCaller, Balances, }; use pallet_unique_scheduler::ScheduledEnsureOriginSuccess; use up_common::types::AccountId; --- a/runtime/common/config/test_pallets.rs +++ b/runtime/common/config/test_pallets.rs @@ -14,8 +14,8 @@ // You should have received a copy of the GNU General Public License // along with Unique Network. If not, see . -use crate::{Runtime, Event}; +use crate::{Runtime, RuntimeEvent}; impl pallet_test_utils::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; } --- a/runtime/common/construct_runtime/mod.rs +++ b/runtime/common/construct_runtime/mod.rs @@ -57,8 +57,8 @@ Inflation: pallet_inflation::{Pallet, Call, Storage} = 60, Unique: pallet_unique::{Pallet, Call, Storage, Event} = 61, - // #[runtimes(opal)] - // Scheduler: pallet_unique_scheduler::{Pallet, Call, Storage, Event} = 62, + #[runtimes(opal)] + Scheduler: pallet_unique_scheduler::{Pallet, Call, Storage, Event} = 62, Configuration: pallet_configuration::{Pallet, Call, Storage} = 63, --- a/runtime/common/scheduler.rs +++ b/runtime/common/scheduler.rs @@ -16,7 +16,7 @@ use frame_support::{ traits::NamedReservableCurrency, - weights::{GetDispatchInfo, PostDispatchInfo, DispatchInfo}, + dispatch::{GetDispatchInfo, PostDispatchInfo, DispatchInfo}, }; use sp_runtime::{ traits::{Dispatchable, Applyable, Member}, @@ -25,7 +25,7 @@ DispatchErrorWithPostInfo, DispatchError, }; use codec::Encode; -use crate::{Runtime, Call, Origin, Balances}; +use crate::{Runtime, RuntimeCall, RuntimeOrigin, Balances}; use up_common::types::{AccountId, Balance}; use fp_self_contained::SelfContainedCall; use pallet_unique_scheduler::DispatchCall; @@ -62,20 +62,20 @@ impl DispatchCall for SchedulerPaymentExecutor where - ::Call: Member - + Dispatchable + ::RuntimeCall: Member + + Dispatchable + SelfContainedCall + GetDispatchInfo + From>, SelfContainedSignedInfo: Send + Sync + 'static, - Call: From<::Call> - + From<::Call> + RuntimeCall: From<::RuntimeCall> + + From<::RuntimeCall> + SelfContainedCall, sp_runtime::AccountId32: From<::AccountId>, { fn dispatch_call( signer: Option<::AccountId>, - call: ::Call, + call: ::RuntimeCall, ) -> Result< Result>, TransactionValidityError, @@ -93,7 +93,7 @@ let extrinsic = fp_self_contained::CheckedExtrinsic::< AccountId, - Call, + RuntimeCall, SignedExtraScheduler, SelfContainedSignedInfo, > { @@ -107,7 +107,7 @@ fn reserve_balance( id: [u8; 16], sponsor: ::AccountId, - call: ::Call, + call: ::RuntimeCall, count: u32, ) -> Result<(), DispatchError> { let dispatch_info = call.get_dispatch_info(); @@ -125,7 +125,7 @@ fn pay_for_call( id: [u8; 16], sponsor: ::AccountId, - call: ::Call, + call: ::RuntimeCall, ) -> Result { let dispatch_info = call.get_dispatch_info(); let weight: Balance = --- a/test-pallets/utils/Cargo.toml +++ b/test-pallets/utils/Cargo.toml @@ -8,8 +8,8 @@ [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } pallet-unique-scheduler = { path = '../../pallets/scheduler', default-features = false } [features] --- a/test-pallets/utils/src/lib.rs +++ b/test-pallets/utils/src/lib.rs @@ -28,7 +28,7 @@ #[pallet::config] pub trait Config: frame_system::Config + pallet_unique_scheduler::Config { - type Event: From> + IsType<::Event>; + type RuntimeEvent: From> + IsType<::RuntimeEvent>; } #[pallet::event] -- gitstuff