mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 14:01:06 +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
Generated
+12
@@ -2468,6 +2468,7 @@ dependencies = [
|
|||||||
"derive-syn-parse",
|
"derive-syn-parse",
|
||||||
"frame-support-procedural-tools",
|
"frame-support-procedural-tools",
|
||||||
"itertools",
|
"itertools",
|
||||||
|
"proc-macro-warning",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn",
|
"syn",
|
||||||
@@ -7511,6 +7512,17 @@ dependencies = [
|
|||||||
"version_check",
|
"version_check",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "proc-macro-warning"
|
||||||
|
version = "0.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9d4f284d87b9cedc2ff57223cbc4e3937cd6063c01e92c8e2a8c080df0013933"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro2"
|
name = "proc-macro2"
|
||||||
version = "1.0.51"
|
version = "1.0.51"
|
||||||
|
|||||||
@@ -120,14 +120,14 @@ pub mod pallet {
|
|||||||
#[pallet::call]
|
#[pallet::call]
|
||||||
impl<T: Config> Pallet<T> {
|
impl<T: Config> Pallet<T> {
|
||||||
#[pallet::call_index(0)]
|
#[pallet::call_index(0)]
|
||||||
#[pallet::weight(0)]
|
#[pallet::weight({0})]
|
||||||
pub fn emit_event(_origin: OriginFor<T>) -> DispatchResult {
|
pub fn emit_event(_origin: OriginFor<T>) -> DispatchResult {
|
||||||
Self::deposit_event(Event::TestEvent);
|
Self::deposit_event(Event::TestEvent);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pallet::call_index(1)]
|
#[pallet::call_index(1)]
|
||||||
#[pallet::weight(0)]
|
#[pallet::weight({0})]
|
||||||
pub fn noop(_origin: OriginFor<T>) -> DispatchResult {
|
pub fn noop(_origin: OriginFor<T>) -> DispatchResult {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ use sp_runtime::{
|
|||||||
use sp_std::prelude::*;
|
use sp_std::prelude::*;
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
|
|
||||||
#[frame_support::pallet]
|
#[frame_support::pallet(dev_mode)]
|
||||||
mod pallet_test {
|
mod pallet_test {
|
||||||
use frame_support::pallet_prelude::*;
|
use frame_support::pallet_prelude::*;
|
||||||
use frame_system::pallet_prelude::*;
|
use frame_system::pallet_prelude::*;
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ mod pallet_test {
|
|||||||
<T as OtherConfig>::OtherEvent: Into<<T as Config<I>>::RuntimeEvent>,
|
<T as OtherConfig>::OtherEvent: Into<<T as Config<I>>::RuntimeEvent>,
|
||||||
{
|
{
|
||||||
#[pallet::call_index(0)]
|
#[pallet::call_index(0)]
|
||||||
#[pallet::weight(0)]
|
#[pallet::weight({0})]
|
||||||
pub fn set_value(origin: OriginFor<T>, n: u32) -> DispatchResult {
|
pub fn set_value(origin: OriginFor<T>, n: u32) -> DispatchResult {
|
||||||
let _sender = ensure_signed(origin)?;
|
let _sender = ensure_signed(origin)?;
|
||||||
Value::<T, I>::put(n);
|
Value::<T, I>::put(n);
|
||||||
@@ -69,7 +69,7 @@ mod pallet_test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[pallet::call_index(1)]
|
#[pallet::call_index(1)]
|
||||||
#[pallet::weight(0)]
|
#[pallet::weight({0})]
|
||||||
pub fn dummy(origin: OriginFor<T>, _n: u32) -> DispatchResult {
|
pub fn dummy(origin: OriginFor<T>, _n: u32) -> DispatchResult {
|
||||||
let _sender = ensure_none(origin)?;
|
let _sender = ensure_none(origin)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ frame_support::construct_runtime!(
|
|||||||
|
|
||||||
mod mock_democracy {
|
mod mock_democracy {
|
||||||
pub use pallet::*;
|
pub use pallet::*;
|
||||||
#[frame_support::pallet]
|
#[frame_support::pallet(dev_mode)]
|
||||||
pub mod pallet {
|
pub mod pallet {
|
||||||
use frame_support::pallet_prelude::*;
|
use frame_support::pallet_prelude::*;
|
||||||
use frame_system::pallet_prelude::*;
|
use frame_system::pallet_prelude::*;
|
||||||
|
|||||||
@@ -229,7 +229,7 @@ pub mod pallet {
|
|||||||
/// This example is not focused on correctness of the oracle itself, but rather its
|
/// This example is not focused on correctness of the oracle itself, but rather its
|
||||||
/// purpose is to showcase offchain worker capabilities.
|
/// purpose is to showcase offchain worker capabilities.
|
||||||
#[pallet::call_index(0)]
|
#[pallet::call_index(0)]
|
||||||
#[pallet::weight(0)]
|
#[pallet::weight({0})]
|
||||||
pub fn submit_price(origin: OriginFor<T>, price: u32) -> DispatchResultWithPostInfo {
|
pub fn submit_price(origin: OriginFor<T>, price: u32) -> DispatchResultWithPostInfo {
|
||||||
// Retrieve sender of the transaction.
|
// Retrieve sender of the transaction.
|
||||||
let who = ensure_signed(origin)?;
|
let who = ensure_signed(origin)?;
|
||||||
@@ -255,7 +255,7 @@ pub mod pallet {
|
|||||||
/// This example is not focused on correctness of the oracle itself, but rather its
|
/// This example is not focused on correctness of the oracle itself, but rather its
|
||||||
/// purpose is to showcase offchain worker capabilities.
|
/// purpose is to showcase offchain worker capabilities.
|
||||||
#[pallet::call_index(1)]
|
#[pallet::call_index(1)]
|
||||||
#[pallet::weight(0)]
|
#[pallet::weight({0})]
|
||||||
pub fn submit_price_unsigned(
|
pub fn submit_price_unsigned(
|
||||||
origin: OriginFor<T>,
|
origin: OriginFor<T>,
|
||||||
_block_number: T::BlockNumber,
|
_block_number: T::BlockNumber,
|
||||||
@@ -272,7 +272,7 @@ pub mod pallet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[pallet::call_index(2)]
|
#[pallet::call_index(2)]
|
||||||
#[pallet::weight(0)]
|
#[pallet::weight({0})]
|
||||||
pub fn submit_price_unsigned_with_signed_payload(
|
pub fn submit_price_unsigned_with_signed_payload(
|
||||||
origin: OriginFor<T>,
|
origin: OriginFor<T>,
|
||||||
price_payload: PricePayload<T::Public, T::BlockNumber>,
|
price_payload: PricePayload<T::Public, T::BlockNumber>,
|
||||||
|
|||||||
@@ -694,7 +694,7 @@ mod tests {
|
|||||||
|
|
||||||
const TEST_KEY: &[u8] = b":test:key:";
|
const TEST_KEY: &[u8] = b":test:key:";
|
||||||
|
|
||||||
#[frame_support::pallet]
|
#[frame_support::pallet(dev_mode)]
|
||||||
mod custom {
|
mod custom {
|
||||||
use frame_support::pallet_prelude::*;
|
use frame_support::pallet_prelude::*;
|
||||||
use frame_system::pallet_prelude::*;
|
use frame_system::pallet_prelude::*;
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ pub mod pallet {
|
|||||||
///
|
///
|
||||||
/// May only be called from `T::AddOrigin`.
|
/// May only be called from `T::AddOrigin`.
|
||||||
#[pallet::call_index(0)]
|
#[pallet::call_index(0)]
|
||||||
#[pallet::weight(50_000_000)]
|
#[pallet::weight({50_000_000})]
|
||||||
pub fn add_member(origin: OriginFor<T>, who: AccountIdLookupOf<T>) -> DispatchResult {
|
pub fn add_member(origin: OriginFor<T>, who: AccountIdLookupOf<T>) -> DispatchResult {
|
||||||
T::AddOrigin::ensure_origin(origin)?;
|
T::AddOrigin::ensure_origin(origin)?;
|
||||||
let who = T::Lookup::lookup(who)?;
|
let who = T::Lookup::lookup(who)?;
|
||||||
@@ -191,7 +191,7 @@ pub mod pallet {
|
|||||||
///
|
///
|
||||||
/// May only be called from `T::RemoveOrigin`.
|
/// May only be called from `T::RemoveOrigin`.
|
||||||
#[pallet::call_index(1)]
|
#[pallet::call_index(1)]
|
||||||
#[pallet::weight(50_000_000)]
|
#[pallet::weight({50_000_000})]
|
||||||
pub fn remove_member(origin: OriginFor<T>, who: AccountIdLookupOf<T>) -> DispatchResult {
|
pub fn remove_member(origin: OriginFor<T>, who: AccountIdLookupOf<T>) -> DispatchResult {
|
||||||
T::RemoveOrigin::ensure_origin(origin)?;
|
T::RemoveOrigin::ensure_origin(origin)?;
|
||||||
let who = T::Lookup::lookup(who)?;
|
let who = T::Lookup::lookup(who)?;
|
||||||
@@ -215,7 +215,7 @@ pub mod pallet {
|
|||||||
///
|
///
|
||||||
/// Prime membership is *not* passed from `remove` to `add`, if extant.
|
/// Prime membership is *not* passed from `remove` to `add`, if extant.
|
||||||
#[pallet::call_index(2)]
|
#[pallet::call_index(2)]
|
||||||
#[pallet::weight(50_000_000)]
|
#[pallet::weight({50_000_000})]
|
||||||
pub fn swap_member(
|
pub fn swap_member(
|
||||||
origin: OriginFor<T>,
|
origin: OriginFor<T>,
|
||||||
remove: AccountIdLookupOf<T>,
|
remove: AccountIdLookupOf<T>,
|
||||||
@@ -249,7 +249,7 @@ pub mod pallet {
|
|||||||
///
|
///
|
||||||
/// May only be called from `T::ResetOrigin`.
|
/// May only be called from `T::ResetOrigin`.
|
||||||
#[pallet::call_index(3)]
|
#[pallet::call_index(3)]
|
||||||
#[pallet::weight(50_000_000)]
|
#[pallet::weight({50_000_000})]
|
||||||
pub fn reset_members(origin: OriginFor<T>, members: Vec<T::AccountId>) -> DispatchResult {
|
pub fn reset_members(origin: OriginFor<T>, members: Vec<T::AccountId>) -> DispatchResult {
|
||||||
T::ResetOrigin::ensure_origin(origin)?;
|
T::ResetOrigin::ensure_origin(origin)?;
|
||||||
|
|
||||||
@@ -272,7 +272,7 @@ pub mod pallet {
|
|||||||
///
|
///
|
||||||
/// Prime membership is passed from the origin account to `new`, if extant.
|
/// Prime membership is passed from the origin account to `new`, if extant.
|
||||||
#[pallet::call_index(4)]
|
#[pallet::call_index(4)]
|
||||||
#[pallet::weight(50_000_000)]
|
#[pallet::weight({50_000_000})]
|
||||||
pub fn change_key(origin: OriginFor<T>, new: AccountIdLookupOf<T>) -> DispatchResult {
|
pub fn change_key(origin: OriginFor<T>, new: AccountIdLookupOf<T>) -> DispatchResult {
|
||||||
let remove = ensure_signed(origin)?;
|
let remove = ensure_signed(origin)?;
|
||||||
let new = T::Lookup::lookup(new)?;
|
let new = T::Lookup::lookup(new)?;
|
||||||
@@ -307,7 +307,7 @@ pub mod pallet {
|
|||||||
///
|
///
|
||||||
/// May only be called from `T::PrimeOrigin`.
|
/// May only be called from `T::PrimeOrigin`.
|
||||||
#[pallet::call_index(5)]
|
#[pallet::call_index(5)]
|
||||||
#[pallet::weight(50_000_000)]
|
#[pallet::weight({50_000_000})]
|
||||||
pub fn set_prime(origin: OriginFor<T>, who: AccountIdLookupOf<T>) -> DispatchResult {
|
pub fn set_prime(origin: OriginFor<T>, who: AccountIdLookupOf<T>) -> DispatchResult {
|
||||||
T::PrimeOrigin::ensure_origin(origin)?;
|
T::PrimeOrigin::ensure_origin(origin)?;
|
||||||
let who = T::Lookup::lookup(who)?;
|
let who = T::Lookup::lookup(who)?;
|
||||||
@@ -321,7 +321,7 @@ pub mod pallet {
|
|||||||
///
|
///
|
||||||
/// May only be called from `T::PrimeOrigin`.
|
/// May only be called from `T::PrimeOrigin`.
|
||||||
#[pallet::call_index(6)]
|
#[pallet::call_index(6)]
|
||||||
#[pallet::weight(50_000_000)]
|
#[pallet::weight({50_000_000})]
|
||||||
pub fn clear_prime(origin: OriginFor<T>) -> DispatchResult {
|
pub fn clear_prime(origin: OriginFor<T>) -> DispatchResult {
|
||||||
T::PrimeOrigin::ensure_origin(origin)?;
|
T::PrimeOrigin::ensure_origin(origin)?;
|
||||||
Prime::<T, I>::kill();
|
Prime::<T, I>::kill();
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ pub mod pallet {
|
|||||||
/// ## Complexity
|
/// ## Complexity
|
||||||
/// - O(1).
|
/// - O(1).
|
||||||
#[pallet::call_index(0)]
|
#[pallet::call_index(0)]
|
||||||
#[pallet::weight(50_000_000)]
|
#[pallet::weight({50_000_000})]
|
||||||
pub fn set_name(origin: OriginFor<T>, name: Vec<u8>) -> DispatchResult {
|
pub fn set_name(origin: OriginFor<T>, name: Vec<u8>) -> DispatchResult {
|
||||||
let sender = ensure_signed(origin)?;
|
let sender = ensure_signed(origin)?;
|
||||||
|
|
||||||
@@ -160,7 +160,7 @@ pub mod pallet {
|
|||||||
/// ## Complexity
|
/// ## Complexity
|
||||||
/// - O(1).
|
/// - O(1).
|
||||||
#[pallet::call_index(1)]
|
#[pallet::call_index(1)]
|
||||||
#[pallet::weight(70_000_000)]
|
#[pallet::weight({70_000_000})]
|
||||||
pub fn clear_name(origin: OriginFor<T>) -> DispatchResult {
|
pub fn clear_name(origin: OriginFor<T>) -> DispatchResult {
|
||||||
let sender = ensure_signed(origin)?;
|
let sender = ensure_signed(origin)?;
|
||||||
|
|
||||||
@@ -183,7 +183,7 @@ pub mod pallet {
|
|||||||
/// ## Complexity
|
/// ## Complexity
|
||||||
/// - O(1).
|
/// - O(1).
|
||||||
#[pallet::call_index(2)]
|
#[pallet::call_index(2)]
|
||||||
#[pallet::weight(70_000_000)]
|
#[pallet::weight({70_000_000})]
|
||||||
pub fn kill_name(origin: OriginFor<T>, target: AccountIdLookupOf<T>) -> DispatchResult {
|
pub fn kill_name(origin: OriginFor<T>, target: AccountIdLookupOf<T>) -> DispatchResult {
|
||||||
T::ForceOrigin::ensure_origin(origin)?;
|
T::ForceOrigin::ensure_origin(origin)?;
|
||||||
|
|
||||||
@@ -207,7 +207,7 @@ pub mod pallet {
|
|||||||
/// ## Complexity
|
/// ## Complexity
|
||||||
/// - O(1).
|
/// - O(1).
|
||||||
#[pallet::call_index(3)]
|
#[pallet::call_index(3)]
|
||||||
#[pallet::weight(70_000_000)]
|
#[pallet::weight({70_000_000})]
|
||||||
pub fn force_name(
|
pub fn force_name(
|
||||||
origin: OriginFor<T>,
|
origin: OriginFor<T>,
|
||||||
target: AccountIdLookupOf<T>,
|
target: AccountIdLookupOf<T>,
|
||||||
|
|||||||
@@ -70,7 +70,7 @@
|
|||||||
//!
|
//!
|
||||||
//! #[pallet::call]
|
//! #[pallet::call]
|
||||||
//! impl<T: Config> Pallet<T> {
|
//! impl<T: Config> Pallet<T> {
|
||||||
//! #[pallet::weight(0)]
|
//! #[pallet::weight({0})]
|
||||||
//! pub fn candidate(origin: OriginFor<T>) -> DispatchResult {
|
//! pub fn candidate(origin: OriginFor<T>) -> DispatchResult {
|
||||||
//! let who = ensure_signed(origin)?;
|
//! let who = ensure_signed(origin)?;
|
||||||
//!
|
//!
|
||||||
@@ -311,7 +311,7 @@ pub mod pallet {
|
|||||||
/// The `index` parameter of this function must be set to
|
/// The `index` parameter of this function must be set to
|
||||||
/// the index of the transactor in the `Pool`.
|
/// the index of the transactor in the `Pool`.
|
||||||
#[pallet::call_index(0)]
|
#[pallet::call_index(0)]
|
||||||
#[pallet::weight(0)]
|
#[pallet::weight({0})]
|
||||||
pub fn submit_candidacy(origin: OriginFor<T>) -> DispatchResult {
|
pub fn submit_candidacy(origin: OriginFor<T>) -> DispatchResult {
|
||||||
let who = ensure_signed(origin)?;
|
let who = ensure_signed(origin)?;
|
||||||
ensure!(!<CandidateExists<T, I>>::contains_key(&who), Error::<T, I>::AlreadyInPool);
|
ensure!(!<CandidateExists<T, I>>::contains_key(&who), Error::<T, I>::AlreadyInPool);
|
||||||
@@ -341,7 +341,7 @@ pub mod pallet {
|
|||||||
/// The `index` parameter of this function must be set to
|
/// The `index` parameter of this function must be set to
|
||||||
/// the index of the transactor in the `Pool`.
|
/// the index of the transactor in the `Pool`.
|
||||||
#[pallet::call_index(1)]
|
#[pallet::call_index(1)]
|
||||||
#[pallet::weight(0)]
|
#[pallet::weight({0})]
|
||||||
pub fn withdraw_candidacy(origin: OriginFor<T>, index: u32) -> DispatchResult {
|
pub fn withdraw_candidacy(origin: OriginFor<T>, index: u32) -> DispatchResult {
|
||||||
let who = ensure_signed(origin)?;
|
let who = ensure_signed(origin)?;
|
||||||
|
|
||||||
@@ -360,7 +360,7 @@ pub mod pallet {
|
|||||||
/// The `index` parameter of this function must be set to
|
/// The `index` parameter of this function must be set to
|
||||||
/// the index of `dest` in the `Pool`.
|
/// the index of `dest` in the `Pool`.
|
||||||
#[pallet::call_index(2)]
|
#[pallet::call_index(2)]
|
||||||
#[pallet::weight(0)]
|
#[pallet::weight({0})]
|
||||||
pub fn kick(
|
pub fn kick(
|
||||||
origin: OriginFor<T>,
|
origin: OriginFor<T>,
|
||||||
dest: AccountIdLookupOf<T>,
|
dest: AccountIdLookupOf<T>,
|
||||||
@@ -385,7 +385,7 @@ pub mod pallet {
|
|||||||
/// The `index` parameter of this function must be set to
|
/// The `index` parameter of this function must be set to
|
||||||
/// the index of the `dest` in the `Pool`.
|
/// the index of the `dest` in the `Pool`.
|
||||||
#[pallet::call_index(3)]
|
#[pallet::call_index(3)]
|
||||||
#[pallet::weight(0)]
|
#[pallet::weight({0})]
|
||||||
pub fn score(
|
pub fn score(
|
||||||
origin: OriginFor<T>,
|
origin: OriginFor<T>,
|
||||||
dest: AccountIdLookupOf<T>,
|
dest: AccountIdLookupOf<T>,
|
||||||
@@ -425,7 +425,7 @@ pub mod pallet {
|
|||||||
///
|
///
|
||||||
/// May only be called from root.
|
/// May only be called from root.
|
||||||
#[pallet::call_index(4)]
|
#[pallet::call_index(4)]
|
||||||
#[pallet::weight(0)]
|
#[pallet::weight({0})]
|
||||||
pub fn change_member_count(origin: OriginFor<T>, count: u32) -> DispatchResult {
|
pub fn change_member_count(origin: OriginFor<T>, count: u32) -> DispatchResult {
|
||||||
ensure_root(origin)?;
|
ensure_root(origin)?;
|
||||||
Self::update_member_count(count).map_err(Into::into)
|
Self::update_member_count(count).map_err(Into::into)
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ pub mod pallet {
|
|||||||
/// ## Complexity
|
/// ## Complexity
|
||||||
/// - O(1).
|
/// - O(1).
|
||||||
#[pallet::call_index(2)]
|
#[pallet::call_index(2)]
|
||||||
#[pallet::weight(0)]
|
#[pallet::weight({0})] // FIXME
|
||||||
pub fn set_key(
|
pub fn set_key(
|
||||||
origin: OriginFor<T>,
|
origin: OriginFor<T>,
|
||||||
new: AccountIdLookupOf<T>,
|
new: AccountIdLookupOf<T>,
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ proc-macro2 = "1.0.37"
|
|||||||
quote = "1.0.10"
|
quote = "1.0.10"
|
||||||
syn = { version = "1.0.98", features = ["full"] }
|
syn = { version = "1.0.98", features = ["full"] }
|
||||||
frame-support-procedural-tools = { version = "4.0.0-dev", path = "./tools" }
|
frame-support-procedural-tools = { version = "4.0.0-dev", path = "./tools" }
|
||||||
|
proc-macro-warning = { version = "0.2.0", default-features = false }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["std"]
|
default = ["std"]
|
||||||
|
|||||||
@@ -54,30 +54,47 @@ pub fn expand_call(def: &mut Def) -> proc_macro2::TokenStream {
|
|||||||
.map(|fn_name| format!("Create a call with the variant `{}`.", fn_name))
|
.map(|fn_name| format!("Create a call with the variant `{}`.", fn_name))
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
let mut warning_structs = Vec::new();
|
let mut call_index_warnings = Vec::new();
|
||||||
let mut warning_names = Vec::new();
|
|
||||||
// Emit a warning for each call that is missing `call_index` when not in dev-mode.
|
// Emit a warning for each call that is missing `call_index` when not in dev-mode.
|
||||||
for method in &methods {
|
for method in &methods {
|
||||||
if method.explicit_call_index || def.dev_mode {
|
if method.explicit_call_index || def.dev_mode {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
let name = syn::Ident::new(&format!("{}", method.name), method.name.span());
|
let warning = proc_macro_warning::Warning::new_deprecated("ImplicitCallIndex")
|
||||||
let warning: syn::ItemStruct = syn::parse_quote!(
|
.index(call_index_warnings.len())
|
||||||
#[deprecated(note = r"
|
.old("use implicit call indices")
|
||||||
Implicit call indices are deprecated in favour of explicit ones.
|
.new("ensure that all calls have a `pallet::call_index` attribute or put the pallet into `dev` mode")
|
||||||
Please ensure that all calls have the `pallet::call_index` attribute or that the
|
.help_links(&[
|
||||||
`dev-mode` of the pallet is enabled. For more info see:
|
"https://github.com/paritytech/substrate/pull/12891",
|
||||||
<https://github.com/paritytech/substrate/pull/12891> and
|
"https://github.com/paritytech/substrate/pull/11381"
|
||||||
<https://github.com/paritytech/substrate/pull/11381>.")]
|
])
|
||||||
#[allow(non_camel_case_types)]
|
.span(method.name.span())
|
||||||
struct #name;
|
.build();
|
||||||
);
|
call_index_warnings.push(warning);
|
||||||
warning_names.push(name);
|
|
||||||
warning_structs.push(warning);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let fn_weight = methods.iter().map(|method| &method.weight);
|
let fn_weight = methods.iter().map(|method| &method.weight);
|
||||||
|
let mut weight_warnings = Vec::new();
|
||||||
|
for weight in fn_weight.clone() {
|
||||||
|
if def.dev_mode {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
match weight {
|
||||||
|
syn::Expr::Lit(lit) => {
|
||||||
|
let warning = proc_macro_warning::Warning::new_deprecated("ConstantWeight")
|
||||||
|
.index(weight_warnings.len())
|
||||||
|
.old("use hard-coded constant as call weight")
|
||||||
|
.new("benchmark all calls or put the pallet into `dev` mode")
|
||||||
|
.help_link("https://github.com/paritytech/substrate/pull/13798")
|
||||||
|
.span(lit.span())
|
||||||
|
.build();
|
||||||
|
weight_warnings.push(warning);
|
||||||
|
},
|
||||||
|
_ => {},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let fn_doc = methods.iter().map(|method| &method.docs).collect::<Vec<_>>();
|
let fn_doc = methods.iter().map(|method| &method.docs).collect::<Vec<_>>();
|
||||||
|
|
||||||
@@ -203,9 +220,10 @@ pub fn expand_call(def: &mut Def) -> proc_macro2::TokenStream {
|
|||||||
quote::quote_spanned!(span =>
|
quote::quote_spanned!(span =>
|
||||||
mod warnings {
|
mod warnings {
|
||||||
#(
|
#(
|
||||||
#warning_structs
|
#call_index_warnings
|
||||||
// This triggers each deprecated warning once.
|
)*
|
||||||
const _: Option<#warning_names> = None;
|
#(
|
||||||
|
#weight_warnings
|
||||||
)*
|
)*
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -218,7 +218,7 @@ pub mod pallet {
|
|||||||
|
|
||||||
/// Doc comment put in metadata
|
/// Doc comment put in metadata
|
||||||
#[pallet::call_index(1)]
|
#[pallet::call_index(1)]
|
||||||
#[pallet::weight(1)]
|
#[pallet::weight({1})]
|
||||||
pub fn foo_storage_layer(
|
pub fn foo_storage_layer(
|
||||||
_origin: OriginFor<T>,
|
_origin: OriginFor<T>,
|
||||||
#[pallet::compact] foo: u32,
|
#[pallet::compact] foo: u32,
|
||||||
@@ -232,20 +232,20 @@ pub mod pallet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[pallet::call_index(4)]
|
#[pallet::call_index(4)]
|
||||||
#[pallet::weight(1)]
|
#[pallet::weight({1})]
|
||||||
pub fn foo_index_out_of_order(_origin: OriginFor<T>) -> DispatchResult {
|
pub fn foo_index_out_of_order(_origin: OriginFor<T>) -> DispatchResult {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test for DispatchResult return type
|
// Test for DispatchResult return type
|
||||||
#[pallet::call_index(2)]
|
#[pallet::call_index(2)]
|
||||||
#[pallet::weight(1)]
|
#[pallet::weight({1})]
|
||||||
pub fn foo_no_post_info(_origin: OriginFor<T>) -> DispatchResult {
|
pub fn foo_no_post_info(_origin: OriginFor<T>) -> DispatchResult {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pallet::call_index(3)]
|
#[pallet::call_index(3)]
|
||||||
#[pallet::weight(1)]
|
#[pallet::weight({1})]
|
||||||
pub fn check_for_dispatch_context(_origin: OriginFor<T>) -> DispatchResult {
|
pub fn check_for_dispatch_context(_origin: OriginFor<T>) -> DispatchResult {
|
||||||
with_context::<(), _>(|_| ()).ok_or_else(|| DispatchError::Unavailable)
|
with_context::<(), _>(|_| ()).ok_or_else(|| DispatchError::Unavailable)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ use sp_io::{
|
|||||||
};
|
};
|
||||||
use sp_runtime::{DispatchError, ModuleError};
|
use sp_runtime::{DispatchError, ModuleError};
|
||||||
|
|
||||||
#[frame_support::pallet]
|
#[frame_support::pallet(dev_mode)]
|
||||||
pub mod pallet {
|
pub mod pallet {
|
||||||
use codec::MaxEncodedLen;
|
use codec::MaxEncodedLen;
|
||||||
use frame_support::{pallet_prelude::*, parameter_types, scale_info};
|
use frame_support::{pallet_prelude::*, parameter_types, scale_info};
|
||||||
|
|||||||
@@ -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`
|
error[E0277]: `<T as pallet::Config>::Bar` doesn't implement `std::fmt::Debug`
|
||||||
--> tests/pallet_ui/call_argument_invalid_bound.rs:21:36
|
--> 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`
|
error[E0277]: `<T as pallet::Config>::Bar` doesn't implement `std::fmt::Debug`
|
||||||
--> tests/pallet_ui/call_argument_invalid_bound_2.rs:21:36
|
--> 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`
|
error[E0277]: `Bar` doesn't implement `std::fmt::Debug`
|
||||||
--> tests/pallet_ui/call_argument_invalid_bound_3.rs:23:36
|
--> tests/pallet_ui/call_argument_invalid_bound_3.rs:23:36
|
||||||
|
|
|
|
||||||
|
|||||||
@@ -15,6 +15,11 @@ mod pallet {
|
|||||||
pub fn foo(_: OriginFor<T>) -> DispatchResult {
|
pub fn foo(_: OriginFor<T>) -> DispatchResult {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[pallet::weight(0)]
|
||||||
|
pub fn bar(_: OriginFor<T>) -> DispatchResult {
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,47 @@
|
|||||||
error: use of deprecated struct `pallet::warnings::foo`:
|
error: use of deprecated constant `pallet::warnings::ImplicitCallIndex_0::_w`:
|
||||||
Implicit call indices are deprecated in favour of explicit ones.
|
It is deprecated to use implicit call indices.
|
||||||
Please ensure that all calls have the `pallet::call_index` attribute or that the
|
Please instead ensure that all calls have a `pallet::call_index` attribute or put the pallet into `dev` mode.
|
||||||
`dev-mode` of the pallet is enabled. For more info see:
|
|
||||||
<https://github.com/paritytech/substrate/pull/12891> and
|
For more info see:
|
||||||
<https://github.com/paritytech/substrate/pull/11381>.
|
<https://github.com/paritytech/substrate/pull/12891>
|
||||||
|
<https://github.com/paritytech/substrate/pull/11381>
|
||||||
--> tests/pallet_ui/call_missing_index.rs:15:10
|
--> tests/pallet_ui/call_missing_index.rs:15:10
|
||||||
|
|
|
|
||||||
15 | pub fn foo(_: OriginFor<T>) -> DispatchResult {
|
15 | pub fn foo(_: OriginFor<T>) -> DispatchResult {
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
|
|
||||||
= note: `-D deprecated` implied by `-D warnings`
|
= 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]
|
#[frame_support::pallet]
|
||||||
mod pallet {
|
mod pallet {
|
||||||
use frame_support::pallet_prelude::DispatchResultWithPostInfo;
|
use frame_support::pallet_prelude::DispatchResult;
|
||||||
use frame_system::pallet_prelude::OriginFor;
|
use frame_system::pallet_prelude::OriginFor;
|
||||||
|
|
||||||
#[pallet::config]
|
#[pallet::config]
|
||||||
@@ -13,7 +13,7 @@ mod pallet {
|
|||||||
impl<T: Config> Pallet<T> {
|
impl<T: Config> Pallet<T> {
|
||||||
#[pallet::call_index(0)]
|
#[pallet::call_index(0)]
|
||||||
#[pallet::weight(10_000something)]
|
#[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`:
|
error: use of deprecated constant `pallet::warnings::ImplicitCallIndex_0::_w`:
|
||||||
Implicit call indices are deprecated in favour of explicit ones.
|
It is deprecated to use implicit call indices.
|
||||||
Please ensure that all calls have the `pallet::call_index` attribute or that the
|
Please instead ensure that all calls have a `pallet::call_index` attribute or put the pallet into `dev` mode.
|
||||||
`dev-mode` of the pallet is enabled. For more info see:
|
|
||||||
<https://github.com/paritytech/substrate/pull/12891> and
|
For more info see:
|
||||||
<https://github.com/paritytech/substrate/pull/11381>.
|
<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
|
--> tests/pallet_ui/dev_mode_without_arg_max_encoded_len.rs:25:10
|
||||||
|
|
|
|
||||||
25 | pub fn my_call(_origin: OriginFor<T>) -> DispatchResult {
|
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`
|
= 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
|
error[E0277]: the trait bound `Vec<u8>: MaxEncodedLen` is not satisfied
|
||||||
--> tests/pallet_ui/dev_mode_without_arg_max_encoded_len.rs:11:12
|
--> 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.)
|
|
||||||
@@ -22,7 +22,7 @@ use frame_support::{
|
|||||||
use pallet::*;
|
use pallet::*;
|
||||||
use sp_io::TestExternalities;
|
use sp_io::TestExternalities;
|
||||||
|
|
||||||
#[frame_support::pallet]
|
#[frame_support::pallet(dev_mode)]
|
||||||
pub mod pallet {
|
pub mod pallet {
|
||||||
use frame_support::{ensure, pallet_prelude::*};
|
use frame_support::{ensure, pallet_prelude::*};
|
||||||
use frame_system::pallet_prelude::*;
|
use frame_system::pallet_prelude::*;
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ use sp_runtime::{
|
|||||||
type BlockNumber = u64;
|
type BlockNumber = u64;
|
||||||
|
|
||||||
// example module to test behaviors.
|
// example module to test behaviors.
|
||||||
#[frame_support::pallet]
|
#[frame_support::pallet(dev_mode)]
|
||||||
pub mod example {
|
pub mod example {
|
||||||
use frame_support::{dispatch::WithPostDispatchInfo, pallet_prelude::*};
|
use frame_support::{dispatch::WithPostDispatchInfo, pallet_prelude::*};
|
||||||
use frame_system::pallet_prelude::*;
|
use frame_system::pallet_prelude::*;
|
||||||
@@ -91,7 +91,7 @@ pub mod example {
|
|||||||
|
|
||||||
mod mock_democracy {
|
mod mock_democracy {
|
||||||
pub use pallet::*;
|
pub use pallet::*;
|
||||||
#[frame_support::pallet]
|
#[frame_support::pallet(dev_mode)]
|
||||||
pub mod pallet {
|
pub mod pallet {
|
||||||
use frame_support::pallet_prelude::*;
|
use frame_support::pallet_prelude::*;
|
||||||
use frame_system::pallet_prelude::*;
|
use frame_system::pallet_prelude::*;
|
||||||
|
|||||||
Reference in New Issue
Block a user