mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 15:47:58 +00:00
Uniform pallet warnings (#13798)
* Use proc-macro-warning crate Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Fixup Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Fix pallet_ui tests Also renamed some of the odd-named ones. Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Update dep Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Ignore hardcoded weight warning To be fixed in https://github.com/paritytech/substrate/issues/13813 Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Fix test pallet Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Fix more tests Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> --------- Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: parity-processbot <>
This commit is contained in:
committed by
GitHub
parent
846ec8cd01
commit
07dcd47d59
@@ -1,3 +1,16 @@
|
||||
error: use of deprecated constant `pallet::warnings::ConstantWeight_0::_w`:
|
||||
It is deprecated to use hard-coded constant as call weight.
|
||||
Please instead benchmark all calls or put the pallet into `dev` mode.
|
||||
|
||||
For more info see:
|
||||
<https://github.com/paritytech/substrate/pull/13798>
|
||||
--> tests/pallet_ui/call_argument_invalid_bound.rs:19:20
|
||||
|
|
||||
19 | #[pallet::weight(0)]
|
||||
| ^
|
||||
|
|
||||
= note: `-D deprecated` implied by `-D warnings`
|
||||
|
||||
error[E0277]: `<T as pallet::Config>::Bar` doesn't implement `std::fmt::Debug`
|
||||
--> tests/pallet_ui/call_argument_invalid_bound.rs:21:36
|
||||
|
|
||||
|
||||
@@ -1,3 +1,16 @@
|
||||
error: use of deprecated constant `pallet::warnings::ConstantWeight_0::_w`:
|
||||
It is deprecated to use hard-coded constant as call weight.
|
||||
Please instead benchmark all calls or put the pallet into `dev` mode.
|
||||
|
||||
For more info see:
|
||||
<https://github.com/paritytech/substrate/pull/13798>
|
||||
--> tests/pallet_ui/call_argument_invalid_bound_2.rs:19:20
|
||||
|
|
||||
19 | #[pallet::weight(0)]
|
||||
| ^
|
||||
|
|
||||
= note: `-D deprecated` implied by `-D warnings`
|
||||
|
||||
error[E0277]: `<T as pallet::Config>::Bar` doesn't implement `std::fmt::Debug`
|
||||
--> tests/pallet_ui/call_argument_invalid_bound_2.rs:21:36
|
||||
|
|
||||
|
||||
@@ -1,3 +1,16 @@
|
||||
error: use of deprecated constant `pallet::warnings::ConstantWeight_0::_w`:
|
||||
It is deprecated to use hard-coded constant as call weight.
|
||||
Please instead benchmark all calls or put the pallet into `dev` mode.
|
||||
|
||||
For more info see:
|
||||
<https://github.com/paritytech/substrate/pull/13798>
|
||||
--> tests/pallet_ui/call_argument_invalid_bound_3.rs:21:20
|
||||
|
|
||||
21 | #[pallet::weight(0)]
|
||||
| ^
|
||||
|
|
||||
= note: `-D deprecated` implied by `-D warnings`
|
||||
|
||||
error[E0277]: `Bar` doesn't implement `std::fmt::Debug`
|
||||
--> tests/pallet_ui/call_argument_invalid_bound_3.rs:23:36
|
||||
|
|
||||
|
||||
@@ -15,6 +15,11 @@ mod pallet {
|
||||
pub fn foo(_: OriginFor<T>) -> DispatchResult {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[pallet::weight(0)]
|
||||
pub fn bar(_: OriginFor<T>) -> DispatchResult {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,47 @@
|
||||
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>.
|
||||
error: use of deprecated constant `pallet::warnings::ImplicitCallIndex_0::_w`:
|
||||
It is deprecated to use implicit call indices.
|
||||
Please instead ensure that all calls have a `pallet::call_index` attribute or put the pallet into `dev` mode.
|
||||
|
||||
For more info see:
|
||||
<https://github.com/paritytech/substrate/pull/12891>
|
||||
<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`
|
||||
|
||||
error: use of deprecated constant `pallet::warnings::ImplicitCallIndex_1::_w`:
|
||||
It is deprecated to use implicit call indices.
|
||||
Please instead ensure that all calls have a `pallet::call_index` attribute or put the pallet into `dev` mode.
|
||||
|
||||
For more info see:
|
||||
<https://github.com/paritytech/substrate/pull/12891>
|
||||
<https://github.com/paritytech/substrate/pull/11381>
|
||||
--> tests/pallet_ui/call_missing_index.rs:20:10
|
||||
|
|
||||
20 | pub fn bar(_: OriginFor<T>) -> DispatchResult {
|
||||
| ^^^
|
||||
|
||||
error: use of deprecated constant `pallet::warnings::ConstantWeight_0::_w`:
|
||||
It is deprecated to use hard-coded constant as call weight.
|
||||
Please instead benchmark all calls or put the pallet into `dev` mode.
|
||||
|
||||
For more info see:
|
||||
<https://github.com/paritytech/substrate/pull/13798>
|
||||
--> tests/pallet_ui/call_missing_index.rs:14:20
|
||||
|
|
||||
14 | #[pallet::weight(0)]
|
||||
| ^
|
||||
|
||||
error: use of deprecated constant `pallet::warnings::ConstantWeight_1::_w`:
|
||||
It is deprecated to use hard-coded constant as call weight.
|
||||
Please instead benchmark all calls or put the pallet into `dev` mode.
|
||||
|
||||
For more info see:
|
||||
<https://github.com/paritytech/substrate/pull/13798>
|
||||
--> tests/pallet_ui/call_missing_index.rs:19:20
|
||||
|
|
||||
19 | #[pallet::weight(0)]
|
||||
| ^
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
#[frame_support::pallet]
|
||||
mod pallet {
|
||||
use frame_support::pallet_prelude::DispatchResultWithPostInfo;
|
||||
use frame_support::pallet_prelude::DispatchResult;
|
||||
use frame_system::pallet_prelude::OriginFor;
|
||||
|
||||
#[pallet::config]
|
||||
@@ -13,7 +13,7 @@ mod pallet {
|
||||
impl<T: Config> Pallet<T> {
|
||||
#[pallet::call_index(0)]
|
||||
#[pallet::weight(10_000something)]
|
||||
pub fn foo(origin: OriginFor<T>) -> DispatchResultWithPostInfo { Ok(().into()) }
|
||||
pub fn foo(_: OriginFor<T>) -> DispatchResult { Ok(()) }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
error: invalid suffix `something` for number literal
|
||||
--> tests/pallet_ui/call_weight_argument_has_suffix.rs:15:26
|
||||
|
|
||||
15 | #[pallet::weight(10_000something)]
|
||||
| ^^^^^^^^^^^^^^^ invalid suffix `something`
|
||||
|
|
||||
= help: the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.)
|
||||
|
||||
error: use of deprecated constant `pallet::warnings::ConstantWeight_0::_w`:
|
||||
It is deprecated to use hard-coded constant as call weight.
|
||||
Please instead benchmark all calls or put the pallet into `dev` mode.
|
||||
|
||||
For more info see:
|
||||
<https://github.com/paritytech/substrate/pull/13798>
|
||||
--> tests/pallet_ui/call_weight_argument_has_suffix.rs:15:26
|
||||
|
|
||||
15 | #[pallet::weight(10_000something)]
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D deprecated` implied by `-D warnings`
|
||||
@@ -0,0 +1,21 @@
|
||||
#[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::call_index(0)]
|
||||
#[pallet::weight(123_u64)]
|
||||
pub fn foo(_: OriginFor<T>) -> DispatchResult { Ok(()) }
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
error: use of deprecated constant `pallet::warnings::ConstantWeight_0::_w`:
|
||||
It is deprecated to use hard-coded constant as call weight.
|
||||
Please instead benchmark all calls or put the pallet into `dev` mode.
|
||||
|
||||
For more info see:
|
||||
<https://github.com/paritytech/substrate/pull/13798>
|
||||
--> tests/pallet_ui/call_weight_const_warning.rs:15:26
|
||||
|
|
||||
15 | #[pallet::weight(123_u64)]
|
||||
| ^^^^^^^
|
||||
|
|
||||
= note: `-D deprecated` implied by `-D warnings`
|
||||
@@ -0,0 +1,25 @@
|
||||
#[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::call_index(0)]
|
||||
#[pallet::weight(123)]
|
||||
pub fn foo(_: OriginFor<T>) -> DispatchResult { Ok(()) }
|
||||
|
||||
#[pallet::call_index(1)]
|
||||
#[pallet::weight(123_custom_prefix)]
|
||||
pub fn bar(_: OriginFor<T>) -> DispatchResult { Ok(()) }
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
error: invalid suffix `custom_prefix` for number literal
|
||||
--> tests/pallet_ui/call_weight_const_warning_twice.rs:19:26
|
||||
|
|
||||
19 | #[pallet::weight(123_custom_prefix)]
|
||||
| ^^^^^^^^^^^^^^^^^ invalid suffix `custom_prefix`
|
||||
|
|
||||
= help: the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.)
|
||||
|
||||
error: use of deprecated constant `pallet::warnings::ConstantWeight_0::_w`:
|
||||
It is deprecated to use hard-coded constant as call weight.
|
||||
Please instead benchmark all calls or put the pallet into `dev` mode.
|
||||
|
||||
For more info see:
|
||||
<https://github.com/paritytech/substrate/pull/13798>
|
||||
--> tests/pallet_ui/call_weight_const_warning_twice.rs:15:26
|
||||
|
|
||||
15 | #[pallet::weight(123)]
|
||||
| ^^^
|
||||
|
|
||||
= note: `-D deprecated` implied by `-D warnings`
|
||||
|
||||
error: use of deprecated constant `pallet::warnings::ConstantWeight_1::_w`:
|
||||
It is deprecated to use hard-coded constant as call weight.
|
||||
Please instead benchmark all calls or put the pallet into `dev` mode.
|
||||
|
||||
For more info see:
|
||||
<https://github.com/paritytech/substrate/pull/13798>
|
||||
--> tests/pallet_ui/call_weight_const_warning_twice.rs:19:26
|
||||
|
|
||||
19 | #[pallet::weight(123_custom_prefix)]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
+18
-6
@@ -1,9 +1,10 @@
|
||||
error: use of deprecated struct `pallet::warnings::my_call`:
|
||||
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>.
|
||||
error: use of deprecated constant `pallet::warnings::ImplicitCallIndex_0::_w`:
|
||||
It is deprecated to use implicit call indices.
|
||||
Please instead ensure that all calls have a `pallet::call_index` attribute or put the pallet into `dev` mode.
|
||||
|
||||
For more info see:
|
||||
<https://github.com/paritytech/substrate/pull/12891>
|
||||
<https://github.com/paritytech/substrate/pull/11381>
|
||||
--> tests/pallet_ui/dev_mode_without_arg_max_encoded_len.rs:25:10
|
||||
|
|
||||
25 | pub fn my_call(_origin: OriginFor<T>) -> DispatchResult {
|
||||
@@ -11,6 +12,17 @@ error: use of deprecated struct `pallet::warnings::my_call`:
|
||||
|
|
||||
= note: `-D deprecated` implied by `-D warnings`
|
||||
|
||||
error: use of deprecated constant `pallet::warnings::ConstantWeight_0::_w`:
|
||||
It is deprecated to use hard-coded constant as call weight.
|
||||
Please instead benchmark all calls or put the pallet into `dev` mode.
|
||||
|
||||
For more info see:
|
||||
<https://github.com/paritytech/substrate/pull/13798>
|
||||
--> tests/pallet_ui/dev_mode_without_arg_max_encoded_len.rs:24:20
|
||||
|
|
||||
24 | #[pallet::weight(0)]
|
||||
| ^
|
||||
|
||||
error[E0277]: the trait bound `Vec<u8>: MaxEncodedLen` is not satisfied
|
||||
--> tests/pallet_ui/dev_mode_without_arg_max_encoded_len.rs:11:12
|
||||
|
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
error: invalid suffix `something` for number literal
|
||||
--> tests/pallet_ui/weight_argument_has_suffix.rs:15:26
|
||||
|
|
||||
15 | #[pallet::weight(10_000something)]
|
||||
| ^^^^^^^^^^^^^^^ invalid suffix `something`
|
||||
|
|
||||
= help: the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.)
|
||||
Reference in New Issue
Block a user