forked from paritytech/substrate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Warn on missing
pallet::call_index
(paritytech#12894)
* Warn on missing call_index Signed-off-by: Oliver Tale-Yazdi <[email protected]> * Suppress camel case warning Signed-off-by: Oliver Tale-Yazdi <[email protected]> * Simplify code Signed-off-by: Oliver Tale-Yazdi <[email protected]> * Disallow warnings in pallet-ui tests Signed-off-by: Oliver Tale-Yazdi <[email protected]> * Add pallet UI test Signed-off-by: Oliver Tale-Yazdi <[email protected]> * Update Pallet UI Signed-off-by: Oliver Tale-Yazdi <[email protected]> * fmt Signed-off-by: Oliver Tale-Yazdi <[email protected]> * Use module instead of function Signed-off-by: Oliver Tale-Yazdi <[email protected]> * Update pallet-ui Signed-off-by: Oliver Tale-Yazdi <[email protected]> Signed-off-by: Oliver Tale-Yazdi <[email protected]>
- Loading branch information
Showing
12 changed files
with
115 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 9 additions & 9 deletions
18
frame/support/test/tests/pallet_ui/call_argument_invalid_bound.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
error[E0277]: `<T as pallet::Config>::Bar` doesn't implement `std::fmt::Debug` | ||
--> tests/pallet_ui/call_argument_invalid_bound.rs:20:36 | ||
--> tests/pallet_ui/call_argument_invalid_bound.rs:21:36 | ||
| | ||
20 | pub fn foo(origin: OriginFor<T>, bar: T::Bar) -> DispatchResultWithPostInfo { | ||
| ^^^ `<T as pallet::Config>::Bar` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug` | ||
21 | pub fn foo(origin: OriginFor<T>, _bar: T::Bar) -> DispatchResultWithPostInfo { | ||
| ^^^^ `<T as pallet::Config>::Bar` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug` | ||
| | ||
= help: the trait `std::fmt::Debug` is not implemented for `<T as pallet::Config>::Bar` | ||
= note: required for `&<T as pallet::Config>::Bar` to implement `std::fmt::Debug` | ||
= note: required for the cast from `&<T as pallet::Config>::Bar` to the object type `dyn std::fmt::Debug` | ||
|
||
error[E0277]: the trait bound `<T as pallet::Config>::Bar: Clone` is not satisfied | ||
--> tests/pallet_ui/call_argument_invalid_bound.rs:20:36 | ||
--> tests/pallet_ui/call_argument_invalid_bound.rs:21:36 | ||
| | ||
20 | pub fn foo(origin: OriginFor<T>, bar: T::Bar) -> DispatchResultWithPostInfo { | ||
| ^^^ the trait `Clone` is not implemented for `<T as pallet::Config>::Bar` | ||
21 | pub fn foo(origin: OriginFor<T>, _bar: T::Bar) -> DispatchResultWithPostInfo { | ||
| ^^^^ the trait `Clone` is not implemented for `<T as pallet::Config>::Bar` | ||
|
||
error[E0369]: binary operation `==` cannot be applied to type `&<T as pallet::Config>::Bar` | ||
--> tests/pallet_ui/call_argument_invalid_bound.rs:20:36 | ||
--> tests/pallet_ui/call_argument_invalid_bound.rs:21:36 | ||
| | ||
20 | pub fn foo(origin: OriginFor<T>, bar: T::Bar) -> DispatchResultWithPostInfo { | ||
| ^^^ | ||
21 | pub fn foo(origin: OriginFor<T>, _bar: T::Bar) -> DispatchResultWithPostInfo { | ||
| ^^^^ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
frame/support/test/tests/pallet_ui/call_argument_invalid_bound_3.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#[frame_support::pallet] | ||
mod pallet { | ||
use frame_support::pallet_prelude::DispatchResult; | ||
use frame_system::pallet_prelude::OriginFor; | ||
|
||
#[pallet::config] | ||
pub trait Config: frame_system::Config {} | ||
|
||
#[pallet::pallet] | ||
pub struct Pallet<T>(core::marker::PhantomData<T>); | ||
|
||
#[pallet::call] | ||
impl<T: Config> Pallet<T> { | ||
#[pallet::weight(0)] | ||
pub fn foo(_: OriginFor<T>) -> DispatchResult { | ||
Ok(()) | ||
} | ||
} | ||
} | ||
|
||
fn main() { | ||
} |
12 changes: 12 additions & 0 deletions
12
frame/support/test/tests/pallet_ui/call_missing_index.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
error: use of deprecated struct `pallet::warnings::foo`: | ||
Implicit call indices are deprecated in favour of explicit ones. | ||
Please ensure that all calls have the `pallet::call_index` attribute or that the | ||
`dev-mode` of the pallet is enabled. For more info see: | ||
<https://github.com/paritytech/substrate/pull/12891> and | ||
<https://github.com/paritytech/substrate/pull/11381>. | ||
--> tests/pallet_ui/call_missing_index.rs:15:10 | ||
| | ||
15 | pub fn foo(_: OriginFor<T>) -> DispatchResult { | ||
| ^^^ | ||
| | ||
= note: `-D deprecated` implied by `-D warnings` |
13 changes: 13 additions & 0 deletions
13
frame/support/test/tests/pallet_ui/dev_mode_without_arg_max_encoded_len.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters