From f9cbfc5b6867197844988c21c7c7b0292a96c413 Mon Sep 17 00:00:00 2001 From: Snowmead Date: Wed, 9 Aug 2023 12:31:28 -0700 Subject: [PATCH 01/12] Update pallet scheduler documentation, warning section, guidelines update --- Cargo.lock | 14 +++++---- frame/scheduler/Cargo.toml | 9 ++++-- frame/scheduler/src/lib.rs | 61 +++++++++++++++++++++++++----------- frame/scheduler/src/tests.rs | 2 ++ 4 files changed, 60 insertions(+), 26 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ed6a4c356d10f..8ebf348490087 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2156,11 +2156,11 @@ dependencies = [ [[package]] name = "docify" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6491709f76fb7ceb951244daf624d480198b427556084391d6e3c33d3ae74b9" +checksum = "029de870d175d11969524d91a3fb2cbf6d488b853bff99d41cf65e533ac7d9d2" dependencies = [ - "docify_macros 0.2.0", + "docify_macros 0.2.1", ] [[package]] @@ -2182,9 +2182,9 @@ dependencies = [ [[package]] name = "docify_macros" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffc5338a9f72ce29a81377d9039798fcc926fb471b2004666caf48e446dffbbf" +checksum = "cac43324656a1b05eb0186deb51f27d2d891c704c37f34de281ef6297ba193e5" dependencies = [ "common-path", "derive-syn-parse", @@ -2194,6 +2194,7 @@ dependencies = [ "regex", "syn 2.0.18", "termcolor", + "toml 0.7.4", "walkdir", ] @@ -6692,7 +6693,7 @@ dependencies = [ name = "pallet-fast-unstake" version = "4.0.0-dev" dependencies = [ - "docify 0.2.0", + "docify 0.2.1", "frame-benchmarking", "frame-election-provider-support", "frame-support", @@ -7340,6 +7341,7 @@ dependencies = [ name = "pallet-scheduler" version = "4.0.0-dev" dependencies = [ + "docify 0.2.1", "frame-benchmarking", "frame-support", "frame-system", diff --git a/frame/scheduler/Cargo.toml b/frame/scheduler/Cargo.toml index 67506fbfee3bb..57d810662d653 100644 --- a/frame/scheduler/Cargo.toml +++ b/frame/scheduler/Cargo.toml @@ -10,9 +10,13 @@ description = "FRAME Scheduler pallet" readme = "README.md" [dependencies] -codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false, features = ["derive"] } +codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false, features = [ + "derive", +] } log = { version = "0.4.17", default-features = false } -scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.5.0", default-features = false, features = [ + "derive", +] } frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, path = "../benchmarking" } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" } @@ -20,6 +24,7 @@ sp-io = { version = "23.0.0", default-features = false, path = "../../primitives sp-runtime = { version = "24.0.0", default-features = false, path = "../../primitives/runtime" } sp-std = { version = "8.0.0", default-features = false, path = "../../primitives/std" } sp-weights = { version = "20.0.0", default-features = false, path = "../../primitives/weights" } +docify = "0.2.1" [dev-dependencies] pallet-preimage = { version = "4.0.0-dev", path = "../preimage" } diff --git a/frame/scheduler/src/lib.rs b/frame/scheduler/src/lib.rs index 77adb18146161..b8333553f842a 100644 --- a/frame/scheduler/src/lib.rs +++ b/frame/scheduler/src/lib.rs @@ -15,38 +15,63 @@ // See the License for the specific language governing permissions and // limitations under the License. -//! # Scheduler -//! A Pallet for scheduling dispatches. +//! # Scheduler Pallet //! -//! - [`Config`] -//! - [`Call`] -//! - [`Pallet`] +//! A Pallet for scheduling runtime calls. //! //! ## Overview //! -//! This Pallet exposes capabilities for scheduling dispatches to occur at a -//! specified block number or at a specified period. These scheduled dispatches +//! This Pallet exposes capabilities for scheduling runtime calls to occur at a +//! specified block number or at a specified period. These scheduled runtime calls //! may be named or anonymous and may be canceled. //! -//! **NOTE:** The scheduled calls will be dispatched with the default filter +//! **NOTE:** The scheduled runtime calls will be dispatched with the default filter //! for the origin: namely `frame_system::Config::BaseCallFilter` for all origin //! except root which will get no filter. And not the filter contained in origin //! use to call `fn schedule`. //! //! If a call is scheduled using proxy or whatever mecanism which adds filter, -//! then those filter will not be used when dispatching the schedule call. +//! then those filter will not be used when dispatching the schedule runtime call. //! -//! ## Interface +//! ## Pallet API //! -//! ### Dispatchable Functions +//! See the [`pallet`] module for more information about the interfaces this pallet exposes, +//! including its configuration trait, dispatchables, storage items, events and errors. //! -//! * `schedule` - schedule a dispatch, which may be periodic, to occur at a specified block and -//! with a specified priority. -//! * `cancel` - cancel a scheduled dispatch, specified by block number and index. -//! * `schedule_named` - augments the `schedule` interface with an additional `Vec` parameter -//! that can be used for identification. -//! * `cancel_named` - the named complement to the cancel function. - +//! ### Warning +//! +//! This Pallet executes all scheduled runtime calls in the +//! [`frame_support::traits::Hooks::on_initialize`] hook. +//! +//! **Do NOT schedule runtime calls if they satisfy any of the following points:** +//! +//! * [ ] Runtime call does not need to be executed at a specific block (not a hard requirement). +//! Use [`frame_support::traits::Hooks::on_idle`] hook for runtime calls that can be executed +//! after some block but do not need to be executed at a specific block. +//! * [ ] No unbounded iterations. +//! * [ ] Runtime call weight exceeds configured [`Config::MaximumWeight`]. +//! If you are scheduling a heavy weight runtime call, make sure to set the `MaximumWeight` type +//! according to your chain's needs. You can find the weight conversions to real time from these +//! [`sp_weights::constants`]. +//! +//! Please be aware that any scheduled runtime calls executed in a future block may __fail__ or may +//! result in __unintended behavior__ since the runtime could have upgraded between the time of +//! scheduling and execution. For example, the runtime upgrade could have: +//! +//! * Modified the implementation of the runtime call (runtime specification upgrade). +//! * Could lead to unintended behavior. +//! * Removed or changed the ordering/index of the runtime call. +//! * Could fail due to the runtime call index not being part of the `Call`. +//! * Could lead to unintended behavior, such as executing another runtime call with the same +//! index. +//! +//! ### Examples +//! +//! 1. Scheduling a runtime call at a specific block +#![doc = docify::embed!("src/tests.rs", basic_scheduling_works)] +//! +//! 2. Scheduling a preimage hash of a runtime call at a specifc block +#![doc = docify::embed!("src/tests.rs", scheduling_with_preimages_works)] // Ensure we're `no_std` when compiling for Wasm. #![cfg_attr(not(feature = "std"), no_std)] diff --git a/frame/scheduler/src/tests.rs b/frame/scheduler/src/tests.rs index a0cac897d43df..ea94d5dd664b8 100644 --- a/frame/scheduler/src/tests.rs +++ b/frame/scheduler/src/tests.rs @@ -30,6 +30,7 @@ use sp_runtime::traits::Hash; use substrate_test_utils::assert_eq_uvec; #[test] +#[docify::export] fn basic_scheduling_works() { new_test_ext().execute_with(|| { let call = @@ -52,6 +53,7 @@ fn basic_scheduling_works() { } #[test] +#[docify::export] fn scheduling_with_preimages_works() { new_test_ext().execute_with(|| { let call = From 1613d41de53f566a57597a9cbed9a77a01218b27 Mon Sep 17 00:00:00 2001 From: Michael Assaf <94772640+snowmead@users.noreply.github.com> Date: Sat, 12 Aug 2023 12:28:54 -0400 Subject: [PATCH 02/12] Update call filter note Co-authored-by: Kelvin Bonilla --- frame/scheduler/src/lib.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/frame/scheduler/src/lib.rs b/frame/scheduler/src/lib.rs index b8333553f842a..fbfa4a000c3a2 100644 --- a/frame/scheduler/src/lib.rs +++ b/frame/scheduler/src/lib.rs @@ -25,10 +25,9 @@ //! specified block number or at a specified period. These scheduled runtime calls //! may be named or anonymous and may be canceled. //! -//! **NOTE:** The scheduled runtime calls will be dispatched with the default filter -//! for the origin: namely `frame_system::Config::BaseCallFilter` for all origin -//! except root which will get no filter. And not the filter contained in origin -//! use to call `fn schedule`. +//! **NOTE:** Instead of the filter contained in the origin used to call `fn schedule`, scheduled runtime calls will be +//! dispatched with the default filter for the origin: namely `frame_system::Config::BaseCallFilter` for all origin +//! types (except root which will get no filter). //! //! If a call is scheduled using proxy or whatever mecanism which adds filter, //! then those filter will not be used when dispatching the schedule runtime call. From eb5e32fc33c2a9856b271c29ed228074edfb2cfb Mon Sep 17 00:00:00 2001 From: Snowmead Date: Sat, 12 Aug 2023 12:32:58 -0400 Subject: [PATCH 03/12] revert format cargo --- Cargo.lock | 2 +- frame/scheduler/Cargo.toml | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a780ad5cebcc9..8400aadeca355 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6995,7 +6995,7 @@ dependencies = [ name = "pallet-scheduler" version = "4.0.0-dev" dependencies = [ - "docify 0.2.1", + "docify", "frame-benchmarking", "frame-support", "frame-system", diff --git a/frame/scheduler/Cargo.toml b/frame/scheduler/Cargo.toml index a3a9660e20c38..1d583d0892f9c 100644 --- a/frame/scheduler/Cargo.toml +++ b/frame/scheduler/Cargo.toml @@ -10,13 +10,9 @@ description = "FRAME Scheduler pallet" readme = "README.md" [dependencies] -codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false, features = [ - "derive", -] } +codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false, features = ["derive"] } log = { version = "0.4.17", default-features = false } -scale-info = { version = "2.5.0", default-features = false, features = [ - "derive", -] } +scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, path = "../benchmarking" } frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" } frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" } From d0afed48deff360ee4edc9f0f1017d857a0f16f5 Mon Sep 17 00:00:00 2001 From: Michael Assaf <94772640+snowmead@users.noreply.github.com> Date: Sat, 12 Aug 2023 16:05:28 -0400 Subject: [PATCH 04/12] Doc wording Co-authored-by: Keith Yeung --- frame/scheduler/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frame/scheduler/src/lib.rs b/frame/scheduler/src/lib.rs index fbfa4a000c3a2..6095dcf41421d 100644 --- a/frame/scheduler/src/lib.rs +++ b/frame/scheduler/src/lib.rs @@ -54,7 +54,7 @@ //! [`sp_weights::constants`]. //! //! Please be aware that any scheduled runtime calls executed in a future block may __fail__ or may -//! result in __unintended behavior__ since the runtime could have upgraded between the time of +//! result in __undefined behavior__ since the runtime could have upgraded between the time of //! scheduling and execution. For example, the runtime upgrade could have: //! //! * Modified the implementation of the runtime call (runtime specification upgrade). From a754cf06de5db19c2cd0418106601ff3e93a0724 Mon Sep 17 00:00:00 2001 From: Michael Assaf <94772640+snowmead@users.noreply.github.com> Date: Sat, 12 Aug 2023 16:05:39 -0400 Subject: [PATCH 05/12] Doc wording Co-authored-by: Keith Yeung --- frame/scheduler/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frame/scheduler/src/lib.rs b/frame/scheduler/src/lib.rs index 6095dcf41421d..36a45b543e8bf 100644 --- a/frame/scheduler/src/lib.rs +++ b/frame/scheduler/src/lib.rs @@ -58,7 +58,7 @@ //! scheduling and execution. For example, the runtime upgrade could have: //! //! * Modified the implementation of the runtime call (runtime specification upgrade). -//! * Could lead to unintended behavior. +//! * Could lead to undefined behavior. //! * Removed or changed the ordering/index of the runtime call. //! * Could fail due to the runtime call index not being part of the `Call`. //! * Could lead to unintended behavior, such as executing another runtime call with the same From 4b47c095e34849526b72833a2285854e8bba1d26 Mon Sep 17 00:00:00 2001 From: Michael Assaf <94772640+snowmead@users.noreply.github.com> Date: Sat, 12 Aug 2023 16:05:47 -0400 Subject: [PATCH 06/12] Co-authored-by: Keith Yeung Ammend comments related to documentation --- frame/scheduler/src/lib.rs | 50 +++++++++++++++++++++--------------- frame/scheduler/src/tests.rs | 27 ++++++++++++++++++- 2 files changed, 56 insertions(+), 21 deletions(-) diff --git a/frame/scheduler/src/lib.rs b/frame/scheduler/src/lib.rs index 36a45b543e8bf..0cf517630cf4f 100644 --- a/frame/scheduler/src/lib.rs +++ b/frame/scheduler/src/lib.rs @@ -15,29 +15,49 @@ // See the License for the specific language governing permissions and // limitations under the License. +//! > Made with *Substrate*, for *Polkadot*. +//! +//! [![github]](https://github.com/paritytech/substrate/frame/fast-unstake) - +//! [![polkadot]](https://polkadot.network) +//! +//! [polkadot]: https://img.shields.io/badge/polkadot-E6007A?style=for-the-badge&logo=polkadot&logoColor=white +//! [github]: https://img.shields.io/badge/github-8da0cb?style=for-the-badge&labelColor=555555&logo=github +//! //! # Scheduler Pallet //! //! A Pallet for scheduling runtime calls. //! //! ## Overview //! -//! This Pallet exposes capabilities for scheduling runtime calls to occur at a -//! specified block number or at a specified period. These scheduled runtime calls -//! may be named or anonymous and may be canceled. +//! This Pallet exposes capabilities for scheduling runtime calls to occur at a specified block +//! number or at a specified period. These scheduled runtime calls may be named or anonymous and may +//! be canceled. //! -//! **NOTE:** Instead of the filter contained in the origin used to call `fn schedule`, scheduled runtime calls will be -//! dispatched with the default filter for the origin: namely `frame_system::Config::BaseCallFilter` for all origin -//! types (except root which will get no filter). +//! **NOTE:** Instead of the filter contained in the origin used to call `fn schedule`, scheduled +//! runtime calls will be dispatched with the default filter for the origin: namely +//! `frame_system::Config::BaseCallFilter` for all origin types (except root which will get no +//! filter). +//! +//! If a call is scheduled using proxy or whatever mecanism which adds filter, then those filter +//! will not be used when dispatching the schedule runtime call. +//! +//! ### Examples //! -//! If a call is scheduled using proxy or whatever mecanism which adds filter, -//! then those filter will not be used when dispatching the schedule runtime call. +//! 1. Scheduling a runtime call at a specific block. +#![doc = docify::embed!("src/tests.rs", basic_scheduling_works)] +//! +//! 2. Scheduling a preimage hash of a runtime call at a specifc block +#![doc = docify::embed!("src/tests.rs", scheduling_with_preimages_works)] +// Ensure we're `no_std` when compiling for Wasm. +#![cfg_attr(not(feature = "std"), no_std)] //! //! ## Pallet API //! //! See the [`pallet`] module for more information about the interfaces this pallet exposes, //! including its configuration trait, dispatchables, storage items, events and errors. //! -//! ### Warning +//! +//! ## Warning //! //! This Pallet executes all scheduled runtime calls in the //! [`frame_support::traits::Hooks::on_initialize`] hook. @@ -61,18 +81,8 @@ //! * Could lead to undefined behavior. //! * Removed or changed the ordering/index of the runtime call. //! * Could fail due to the runtime call index not being part of the `Call`. -//! * Could lead to unintended behavior, such as executing another runtime call with the same +//! * Could lead to undefined behavior, such as executing another runtime call with the same //! index. -//! -//! ### Examples -//! -//! 1. Scheduling a runtime call at a specific block -#![doc = docify::embed!("src/tests.rs", basic_scheduling_works)] -//! -//! 2. Scheduling a preimage hash of a runtime call at a specifc block -#![doc = docify::embed!("src/tests.rs", scheduling_with_preimages_works)] -// Ensure we're `no_std` when compiling for Wasm. -#![cfg_attr(not(feature = "std"), no_std)] #[cfg(feature = "runtime-benchmarks")] mod benchmarking; diff --git a/frame/scheduler/src/tests.rs b/frame/scheduler/src/tests.rs index ea94d5dd664b8..423e06e77eb72 100644 --- a/frame/scheduler/src/tests.rs +++ b/frame/scheduler/src/tests.rs @@ -33,9 +33,15 @@ use substrate_test_utils::assert_eq_uvec; #[docify::export] fn basic_scheduling_works() { new_test_ext().execute_with(|| { + // Call to schedule let call = RuntimeCall::Logger(LoggerCall::log { i: 42, weight: Weight::from_parts(10, 0) }); + + // BaseCallFilter should be implemented to accept `Logger::log` runtime call which is + // implemented for `BaseFilter` in the mock runtime assert!(!::BaseCallFilter::contains(&call)); + + // Schedule call to be executed at the the 4th block assert_ok!(Scheduler::do_schedule( DispatchTime::At(4), None, @@ -43,10 +49,15 @@ fn basic_scheduling_works() { root(), Preimage::bound(call).unwrap() )); + + // `log` runtime call should not have executed yet run_to_block(3); assert!(logger::log().is_empty()); + run_to_block(4); + // `log` runtime call should have executed at block 4 assert_eq!(logger::log(), vec![(root(), 42u32)]); + run_to_block(100); assert_eq!(logger::log(), vec![(root(), 42u32)]); }); @@ -56,21 +67,35 @@ fn basic_scheduling_works() { #[docify::export] fn scheduling_with_preimages_works() { new_test_ext().execute_with(|| { + // Call to schedule let call = RuntimeCall::Logger(LoggerCall::log { i: 42, weight: Weight::from_parts(10, 0) }); + let hash = ::Hashing::hash_of(&call); let len = call.using_encoded(|x| x.len()) as u32; - // Important to use here `Bounded::Lookup` to ensure that we request the hash. + + // Important to use here `Bounded::Lookup` to ensure that that the Scheduler can request the + // hash from PreImage to dispatch the call let hashed = Bounded::Lookup { hash, len }; + + // Schedule call to be executed at block 4 with the PreImage hash assert_ok!(Scheduler::do_schedule(DispatchTime::At(4), None, 127, root(), hashed)); + + // Register preimage on chain assert_ok!(Preimage::note_preimage(RuntimeOrigin::signed(0), call.encode())); assert!(Preimage::is_requested(&hash)); + + // `log` runtime call should not have executed yet run_to_block(3); assert!(logger::log().is_empty()); + run_to_block(4); + // preimage should no have been removed when executed by the scheduler assert!(!Preimage::len(&hash).is_some()); assert!(!Preimage::is_requested(&hash)); + // `log` runtime call should have executed at block 4 assert_eq!(logger::log(), vec![(root(), 42u32)]); + run_to_block(100); assert_eq!(logger::log(), vec![(root(), 42u32)]); }); From 71be2079b2a6461be9d05883f563ef2359b0440d Mon Sep 17 00:00:00 2001 From: Snowmead Date: Mon, 14 Aug 2023 10:25:19 -0400 Subject: [PATCH 07/12] Include additional warning section in `on_initialize` hook --- frame/scheduler/src/lib.rs | 20 +++++--------------- frame/support/src/traits/hooks.rs | 5 +++++ 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/frame/scheduler/src/lib.rs b/frame/scheduler/src/lib.rs index 0cf517630cf4f..7aa62434caa36 100644 --- a/frame/scheduler/src/lib.rs +++ b/frame/scheduler/src/lib.rs @@ -33,7 +33,7 @@ //! number or at a specified period. These scheduled runtime calls may be named or anonymous and may //! be canceled. //! -//! **NOTE:** Instead of the filter contained in the origin used to call `fn schedule`, scheduled +//! __NOTE:__ Instead of the filter contained in the origin used to call `fn schedule`, scheduled //! runtime calls will be dispatched with the default filter for the origin: namely //! `frame_system::Config::BaseCallFilter` for all origin types (except root which will get no //! filter). @@ -56,22 +56,10 @@ //! See the [`pallet`] module for more information about the interfaces this pallet exposes, //! including its configuration trait, dispatchables, storage items, events and errors. //! -//! //! ## Warning //! -//! This Pallet executes all scheduled runtime calls in the -//! [`frame_support::traits::Hooks::on_initialize`] hook. -//! -//! **Do NOT schedule runtime calls if they satisfy any of the following points:** -//! -//! * [ ] Runtime call does not need to be executed at a specific block (not a hard requirement). -//! Use [`frame_support::traits::Hooks::on_idle`] hook for runtime calls that can be executed -//! after some block but do not need to be executed at a specific block. -//! * [ ] No unbounded iterations. -//! * [ ] Runtime call weight exceeds configured [`Config::MaximumWeight`]. -//! If you are scheduling a heavy weight runtime call, make sure to set the `MaximumWeight` type -//! according to your chain's needs. You can find the weight conversions to real time from these -//! [`sp_weights::constants`]. +//! This Pallet executes all scheduled runtime calls in the [`on_initialize`] hook. Do not execute +//! any runtime calls which should not be considered mandatory. //! //! Please be aware that any scheduled runtime calls executed in a future block may __fail__ or may //! result in __undefined behavior__ since the runtime could have upgraded between the time of @@ -83,6 +71,8 @@ //! * Could fail due to the runtime call index not being part of the `Call`. //! * Could lead to undefined behavior, such as executing another runtime call with the same //! index. +//! +//! [`on_initialize`]: frame_support::traits::Hooks::on_initialize #[cfg(feature = "runtime-benchmarks")] mod benchmarking; diff --git a/frame/support/src/traits/hooks.rs b/frame/support/src/traits/hooks.rs index 3f9c6b1507d39..f898e2cce53d8 100644 --- a/frame/support/src/traits/hooks.rs +++ b/frame/support/src/traits/hooks.rs @@ -270,9 +270,14 @@ pub trait Hooks { /// Must return the non-negotiable weight of both itself and whatever [`Hooks::on_finalize`] /// wishes to consume. /// + /// ## Warning + /// /// The weight returned by this is treated as `DispatchClass::Mandatory`, meaning that /// it MUST BE EXECUTED. If this is not the case, consider using [`Hooks::on_idle`] instead. /// + /// Try to keep any arbitrary execution __deterministic__ and within __minimal__ time + /// complexity. For example, do not execute any unbounded iterations. + /// /// NOTE: This function is called BEFORE ANY extrinsic in a block is applied, including inherent /// extrinsics. Hence for instance, if you runtime includes `pallet-timestamp`, the `timestamp` /// is not yet up to date at this point. From dd276bd50309d4c5ee53c2d4b66bf16dbfe66712 Mon Sep 17 00:00:00 2001 From: Michael Assaf <94772640+snowmead@users.noreply.github.com> Date: Mon, 14 Aug 2023 13:49:48 -0400 Subject: [PATCH 08/12] Amend doc Co-authored-by: Sam Johnson --- frame/scheduler/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frame/scheduler/src/lib.rs b/frame/scheduler/src/lib.rs index 7aa62434caa36..bb24a4e936380 100644 --- a/frame/scheduler/src/lib.rs +++ b/frame/scheduler/src/lib.rs @@ -38,7 +38,7 @@ //! `frame_system::Config::BaseCallFilter` for all origin types (except root which will get no //! filter). //! -//! If a call is scheduled using proxy or whatever mecanism which adds filter, then those filter +//! If a call is scheduled using proxy or whatever mechanism which adds filter, then those filter //! will not be used when dispatching the schedule runtime call. //! //! ### Examples From 163bdcfd876cfeeadff51ccf494ef0aedbcd9643 Mon Sep 17 00:00:00 2001 From: Michael Assaf <94772640+snowmead@users.noreply.github.com> Date: Mon, 14 Aug 2023 13:49:55 -0400 Subject: [PATCH 09/12] Amend doc Co-authored-by: Sam Johnson --- frame/scheduler/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frame/scheduler/src/lib.rs b/frame/scheduler/src/lib.rs index bb24a4e936380..1a413cce69469 100644 --- a/frame/scheduler/src/lib.rs +++ b/frame/scheduler/src/lib.rs @@ -33,7 +33,7 @@ //! number or at a specified period. These scheduled runtime calls may be named or anonymous and may //! be canceled. //! -//! __NOTE:__ Instead of the filter contained in the origin used to call `fn schedule`, scheduled +//! __NOTE:__ Instead of using the filter contained in the origin to call `fn schedule`, scheduled //! runtime calls will be dispatched with the default filter for the origin: namely //! `frame_system::Config::BaseCallFilter` for all origin types (except root which will get no //! filter). From 9cee4d30f246e1705a2d5371a4846663cf00c162 Mon Sep 17 00:00:00 2001 From: Snowmead Date: Mon, 14 Aug 2023 13:54:14 -0400 Subject: [PATCH 10/12] Move no_std to appropriate place --- frame/scheduler/src/lib.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frame/scheduler/src/lib.rs b/frame/scheduler/src/lib.rs index 1a413cce69469..3538331bbd4ca 100644 --- a/frame/scheduler/src/lib.rs +++ b/frame/scheduler/src/lib.rs @@ -48,8 +48,7 @@ //! //! 2. Scheduling a preimage hash of a runtime call at a specifc block #![doc = docify::embed!("src/tests.rs", scheduling_with_preimages_works)] -// Ensure we're `no_std` when compiling for Wasm. -#![cfg_attr(not(feature = "std"), no_std)] + //! //! ## Pallet API //! @@ -74,6 +73,9 @@ //! //! [`on_initialize`]: frame_support::traits::Hooks::on_initialize +// Ensure we're `no_std` when compiling for Wasm. +#![cfg_attr(not(feature = "std"), no_std)] + #[cfg(feature = "runtime-benchmarks")] mod benchmarking; pub mod migration; From 070b2ff8f6a4dcfec1db40908af39a79a47522ca Mon Sep 17 00:00:00 2001 From: Michael Assaf <94772640+snowmead@users.noreply.github.com> Date: Mon, 14 Aug 2023 19:37:15 -0400 Subject: [PATCH 11/12] Amend doc Co-authored-by: Nate Armstrong --- frame/scheduler/src/tests.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frame/scheduler/src/tests.rs b/frame/scheduler/src/tests.rs index 423e06e77eb72..4a4a1fce3526e 100644 --- a/frame/scheduler/src/tests.rs +++ b/frame/scheduler/src/tests.rs @@ -41,7 +41,7 @@ fn basic_scheduling_works() { // implemented for `BaseFilter` in the mock runtime assert!(!::BaseCallFilter::contains(&call)); - // Schedule call to be executed at the the 4th block + // Schedule call to be executed at the 4th block assert_ok!(Scheduler::do_schedule( DispatchTime::At(4), None, From 6dbaac2c2d2b1541f0ae674d6184d678652a216e Mon Sep 17 00:00:00 2001 From: Michael Assaf <94772640+snowmead@users.noreply.github.com> Date: Mon, 14 Aug 2023 19:37:30 -0400 Subject: [PATCH 12/12] Amend comment Co-authored-by: Nate Armstrong --- frame/scheduler/src/tests.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frame/scheduler/src/tests.rs b/frame/scheduler/src/tests.rs index 4a4a1fce3526e..477df5579dcf1 100644 --- a/frame/scheduler/src/tests.rs +++ b/frame/scheduler/src/tests.rs @@ -90,7 +90,7 @@ fn scheduling_with_preimages_works() { assert!(logger::log().is_empty()); run_to_block(4); - // preimage should no have been removed when executed by the scheduler + // preimage should not have been removed when executed by the scheduler assert!(!Preimage::len(&hash).is_some()); assert!(!Preimage::is_requested(&hash)); // `log` runtime call should have executed at block 4