From e1f8406da0975e3aa68ba78da0f0b585dfb40e7e Mon Sep 17 00:00:00 2001 From: AdiosXia Date: Fri, 2 Jul 2021 02:06:43 +0800 Subject: [PATCH] [Manta-PC]Add pallet_scheduler into Manta-pc (#100) * Add pallet_scheduler into Manta-pc --- .DS_Store | Bin 6148 -> 0 bytes Cargo.lock | 1 + runtime/manta-pc/Cargo.toml | 2 ++ runtime/manta-pc/src/lib.rs | 24 ++++++++++++++++++++++++ 4 files changed, 27 insertions(+) delete mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index ca2b7874ee44cef1857d5487e8c8184223131c55..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeH~F$w}f3`G;&La^D=avBfd4F=H@>;(h`8(BfodXDZ-CJ2t!BJu;tpJXO1`-+{7 zi0JxuSc&u^GJ~7S(n4d3ypw~RWiQwJa2ZeM@rat$Cvn!+@Lrnz*rt#G36KB@kN^q% z5COZlVY7KvMiL+a5_l4@??Zx{=Fn2rKOG1@0zf;I-LUpq0-CG<&7q|#Dlm=dL8DcD z46(YmLsOi~p`~hV7meXV4M3`}dgXhH(h?7~0-B+w9;*1Wg-e+&OK|2Hj6Nq_|Y zjDU8VVY9|d#ohY$dRE^>)z$?L_2URHKLJSWDqg_du%B!J&7q|#Dlq;CI0gn1_$q-1 D?w=C8 diff --git a/Cargo.lock b/Cargo.lock index ea4734c48..c64998200 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4312,6 +4312,7 @@ dependencies = [ "pallet-multisig", "pallet-proxy", "pallet-randomness-collective-flip", + "pallet-scheduler", "pallet-session", "pallet-sudo", "pallet-timestamp", diff --git a/runtime/manta-pc/Cargo.toml b/runtime/manta-pc/Cargo.toml index 09358b5a1..b5a756ef3 100644 --- a/runtime/manta-pc/Cargo.toml +++ b/runtime/manta-pc/Cargo.toml @@ -50,6 +50,7 @@ pallet-timestamp = { version = '3.0.0', git = 'https://github.com/paritytech/sub pallet-transaction-payment = { version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', default-features = false, branch = "master" } pallet-transaction-payment-rpc-runtime-api = { version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', default-features = false, branch = "master" } pallet-utility = { version = '3.0.0', git = 'https://github.com/paritytech/substrate.git', default-features = false, branch = "master" } +pallet-scheduler = { version = '3.0.0', git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } # Cumulus dependencies cumulus-pallet-aura-ext = { git = 'https://github.com/paritytech/cumulus.git', default-features = false, branch = "master" } @@ -126,6 +127,7 @@ std = [ 'pallet-proxy/std', 'pallet-utility/std', 'pallet-randomness-collective-flip/std', + 'pallet-scheduler/std', 'pallet-transaction-payment-rpc-runtime-api/std', 'pallet-timestamp/std', 'pallet-session/std', diff --git a/runtime/manta-pc/src/lib.rs b/runtime/manta-pc/src/lib.rs index 566dace6d..a0c7554b5 100644 --- a/runtime/manta-pc/src/lib.rs +++ b/runtime/manta-pc/src/lib.rs @@ -212,6 +212,27 @@ impl pallet_transaction_payment::Config for Runtime { type FeeMultiplierUpdate = SlowAdjustingFeeUpdate; } +parameter_types! { + // The maximum weight that may be scheduled per block for any + // dispatchables of less priority than schedule::HARD_DEADLINE. + pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * + RuntimeBlockWeights::get().max_block; + // The maximum number of scheduled calls in the queue for a single block. + // Not strictly enforced, but used for weight estimation. + pub const MaxScheduledPerBlock: u32 = 50; +} + +impl pallet_scheduler::Config for Runtime { + type Event = Event; + type Origin = Origin; + type PalletsOrigin = OriginCaller; + type Call = Call; + type MaximumWeight = MaximumSchedulerWeight; + type ScheduleOrigin = EnsureRoot; + type MaxScheduledPerBlock = MaxScheduledPerBlock; + type WeightInfo = pallet_scheduler::weights::SubstrateWeight; +} + parameter_types! { pub const AssetDeposit: Balance = 100 * MA; // 100 DOLLARS deposit to create asset pub const ApprovalDeposit: Balance = NativeTokenExistentialDeposit::get(); @@ -608,6 +629,9 @@ construct_runtime!( RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Call, Storage} = 2, Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent} = 3, ParachainInfo: parachain_info::{Pallet, Storage, Config} = 4, + Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event} = 5, + + // Monetary stuff. Balances: pallet_balances::{Pallet, Call, Storage, Config, Event} = 10,