fix: Resolve cargo clippy errors and add CI workflow plan
## Changes
### Clippy Fixes
- Fixed deprecated `cargo_bin` usage in 27 test files (added #![allow(deprecated)])
- Fixed uninlined_format_args in zombienet-sdk-tests
- Fixed subxt API changes in revive/rpc/tests.rs (fetch signature, StorageValue)
- Fixed dead_code warnings in validator-pool and identity-kyc mocks
- Fixed field name `i` -> `_i` in tasks example
### CI Infrastructure
- Added .claude/WORKFLOW_PLAN.md for tracking CI fix progress
- Updated lychee.toml and taplo.toml configs
### Files Modified
- 27 test files with deprecated cargo_bin fix
- bizinikiwi/pezframe/revive/rpc/src/tests.rs (subxt API)
- pezkuwi/pezpallets/validator-pool/src/{mock,tests}.rs
- pezcumulus/teyrchains/pezpallets/identity-kyc/src/mock.rs
- bizinikiwi/pezframe/examples/tasks/src/tests.rs
## Status
- cargo clippy: PASSING
- Next: cargo fmt, zepter, workspace checks
This commit is contained in:
@@ -24,15 +24,12 @@ codec = { features = ["derive", "max-encoded-len"], workspace = true }
|
||||
docify = { workspace = true }
|
||||
environmental = { workspace = true }
|
||||
frame-metadata = { features = ["current", "unstable"], workspace = true }
|
||||
pezframe-support-procedural = { workspace = true }
|
||||
impl-trait-for-tuples = { workspace = true }
|
||||
k256 = { features = ["ecdsa"], workspace = true }
|
||||
log = { workspace = true }
|
||||
macro_magic = { workspace = true }
|
||||
paste = { workspace = true, default-features = true }
|
||||
scale-info = { features = ["derive"], workspace = true }
|
||||
serde = { features = ["alloc", "derive"], workspace = true }
|
||||
serde_json = { features = ["alloc"], workspace = true }
|
||||
pezframe-support-procedural = { workspace = true }
|
||||
pezsp-api = { features = ["frame-metadata"], workspace = true }
|
||||
pezsp-arithmetic = { workspace = true }
|
||||
pezsp-core = { workspace = true }
|
||||
@@ -49,6 +46,9 @@ pezsp-std = { workspace = true }
|
||||
pezsp-tracing = { workspace = true }
|
||||
pezsp-trie = { workspace = true }
|
||||
pezsp-weights = { workspace = true }
|
||||
scale-info = { features = ["derive"], workspace = true }
|
||||
serde = { features = ["alloc", "derive"], workspace = true }
|
||||
serde_json = { features = ["alloc"], workspace = true }
|
||||
tt-call = { workspace = true }
|
||||
|
||||
aquamarine = { workspace = true }
|
||||
@@ -56,65 +56,65 @@ aquamarine = { workspace = true }
|
||||
[dev-dependencies]
|
||||
Inflector = { workspace = true }
|
||||
pezframe-system = { workspace = true, default-features = true }
|
||||
pretty_assertions = { workspace = true }
|
||||
pezsp-crypto-hashing = { workspace = true, default-features = true }
|
||||
pezsp-timestamp = { workspace = true, default-features = true }
|
||||
pretty_assertions = { workspace = true }
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = [
|
||||
"binary-merkle-tree/std",
|
||||
"codec/std",
|
||||
"environmental/std",
|
||||
"frame-metadata/std",
|
||||
"pezframe-support-procedural/std",
|
||||
"pezframe-system/std",
|
||||
"k256/std",
|
||||
"log/std",
|
||||
"scale-info/std",
|
||||
"serde/std",
|
||||
"serde_json/std",
|
||||
"pezsp-api/std",
|
||||
"pezsp-arithmetic/std",
|
||||
"pezsp-core/std",
|
||||
"pezsp-debug-derive/std",
|
||||
"pezsp-genesis-builder/std",
|
||||
"pezsp-inherents/std",
|
||||
"pezsp-io/std",
|
||||
"pezsp-metadata-ir/std",
|
||||
"pezsp-runtime/std",
|
||||
"pezsp-staking/std",
|
||||
"pezsp-state-machine/std",
|
||||
"pezsp-std/std",
|
||||
"pezsp-tracing/std",
|
||||
"pezsp-trie/std",
|
||||
"pezsp-weights/std",
|
||||
"binary-merkle-tree/std",
|
||||
"codec/std",
|
||||
"environmental/std",
|
||||
"frame-metadata/std",
|
||||
"k256/std",
|
||||
"log/std",
|
||||
"pezframe-support-procedural/std",
|
||||
"pezframe-system/std",
|
||||
"pezsp-api/std",
|
||||
"pezsp-arithmetic/std",
|
||||
"pezsp-core/std",
|
||||
"pezsp-debug-derive/std",
|
||||
"pezsp-genesis-builder/std",
|
||||
"pezsp-inherents/std",
|
||||
"pezsp-io/std",
|
||||
"pezsp-metadata-ir/std",
|
||||
"pezsp-runtime/std",
|
||||
"pezsp-staking/std",
|
||||
"pezsp-state-machine/std",
|
||||
"pezsp-std/std",
|
||||
"pezsp-tracing/std",
|
||||
"pezsp-trie/std",
|
||||
"pezsp-weights/std",
|
||||
"scale-info/std",
|
||||
"serde/std",
|
||||
"serde_json/std",
|
||||
]
|
||||
runtime-benchmarks = [
|
||||
"binary-merkle-tree/runtime-benchmarks",
|
||||
"pezframe-support-procedural/runtime-benchmarks",
|
||||
"pezframe-system/runtime-benchmarks",
|
||||
"pezsp-api/runtime-benchmarks",
|
||||
"pezsp-genesis-builder/runtime-benchmarks",
|
||||
"pezsp-inherents/runtime-benchmarks",
|
||||
"pezsp-io/runtime-benchmarks",
|
||||
"pezsp-runtime/runtime-benchmarks",
|
||||
"pezsp-staking/runtime-benchmarks",
|
||||
"pezsp-state-machine?/runtime-benchmarks",
|
||||
"pezsp-timestamp/runtime-benchmarks",
|
||||
"pezsp-trie/runtime-benchmarks",
|
||||
"binary-merkle-tree/runtime-benchmarks",
|
||||
"pezframe-support-procedural/runtime-benchmarks",
|
||||
"pezframe-system/runtime-benchmarks",
|
||||
"pezsp-api/runtime-benchmarks",
|
||||
"pezsp-genesis-builder/runtime-benchmarks",
|
||||
"pezsp-inherents/runtime-benchmarks",
|
||||
"pezsp-io/runtime-benchmarks",
|
||||
"pezsp-runtime/runtime-benchmarks",
|
||||
"pezsp-staking/runtime-benchmarks",
|
||||
"pezsp-state-machine?/runtime-benchmarks",
|
||||
"pezsp-timestamp/runtime-benchmarks",
|
||||
"pezsp-trie/runtime-benchmarks",
|
||||
]
|
||||
try-runtime = [
|
||||
"pezframe-system/try-runtime",
|
||||
"pezsp-debug-derive/force-debug",
|
||||
"pezsp-runtime/try-runtime",
|
||||
"pezframe-system/try-runtime",
|
||||
"pezsp-debug-derive/force-debug",
|
||||
"pezsp-runtime/try-runtime",
|
||||
]
|
||||
experimental = ["pezframe-support-procedural/experimental"]
|
||||
# By default some types have documentation, `no-metadata-docs` allows to reduce the documentation
|
||||
# in the metadata.
|
||||
no-metadata-docs = [
|
||||
"pezframe-support-procedural/no-metadata-docs",
|
||||
"pezsp-api/no-metadata-docs",
|
||||
"pezframe-support-procedural/no-metadata-docs",
|
||||
"pezsp-api/no-metadata-docs",
|
||||
]
|
||||
# By default some types have documentation, `full-metadata-docs` allows to add documentation to
|
||||
# more types in the metadata.
|
||||
|
||||
@@ -27,45 +27,45 @@ cfg-expr = { workspace = true }
|
||||
derive-syn-parse = { workspace = true }
|
||||
docify = { workspace = true }
|
||||
expander = { workspace = true }
|
||||
pezframe-support-procedural-tools = { workspace = true, default-features = true }
|
||||
itertools = { workspace = true }
|
||||
macro_magic = { features = ["proc_support"], workspace = true }
|
||||
pezframe-support-procedural-tools = { workspace = true, default-features = true }
|
||||
pezsp-crypto-hashing = { workspace = true }
|
||||
proc-macro-warning = { workspace = true }
|
||||
proc-macro2 = { workspace = true }
|
||||
quote = { workspace = true }
|
||||
pezsp-crypto-hashing = { workspace = true }
|
||||
syn = { features = ["full", "parsing", "visit-mut"], workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
codec = { features = [
|
||||
"derive",
|
||||
"max-encoded-len",
|
||||
"derive",
|
||||
"max-encoded-len",
|
||||
], workspace = true, default-features = true }
|
||||
pezframe-benchmarking = { workspace = true, default-features = true }
|
||||
pezframe-support = { workspace = true, default-features = true }
|
||||
pezframe-system = { workspace = true, default-features = true }
|
||||
pretty_assertions = { workspace = true }
|
||||
regex = { workspace = true }
|
||||
scale-info = { features = [
|
||||
"derive",
|
||||
], workspace = true, default-features = true }
|
||||
pezsp-io = { workspace = true, default-features = true }
|
||||
pezsp-metadata-ir = { workspace = true, default-features = true }
|
||||
pezsp-runtime = { features = [
|
||||
"serde",
|
||||
"serde",
|
||||
], workspace = true, default-features = true }
|
||||
pretty_assertions = { workspace = true }
|
||||
regex = { workspace = true }
|
||||
scale-info = { features = [
|
||||
"derive",
|
||||
], workspace = true, default-features = true }
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = [
|
||||
"codec/std",
|
||||
"pezframe-benchmarking/std",
|
||||
"pezframe-support/std",
|
||||
"pezframe-system/std",
|
||||
"scale-info/std",
|
||||
"pezsp-crypto-hashing/std",
|
||||
"pezsp-metadata-ir/std",
|
||||
"pezsp-runtime/std",
|
||||
"codec/std",
|
||||
"pezframe-benchmarking/std",
|
||||
"pezframe-support/std",
|
||||
"pezframe-system/std",
|
||||
"pezsp-crypto-hashing/std",
|
||||
"pezsp-metadata-ir/std",
|
||||
"pezsp-runtime/std",
|
||||
"scale-info/std",
|
||||
]
|
||||
no-metadata-docs = []
|
||||
experimental = []
|
||||
@@ -74,9 +74,9 @@ experimental = []
|
||||
tuples-96 = []
|
||||
tuples-128 = []
|
||||
runtime-benchmarks = [
|
||||
"pezframe-benchmarking/runtime-benchmarks",
|
||||
"pezframe-support/runtime-benchmarks",
|
||||
"pezframe-system/runtime-benchmarks",
|
||||
"pezsp-io/runtime-benchmarks",
|
||||
"pezsp-runtime/runtime-benchmarks",
|
||||
"pezframe-benchmarking/runtime-benchmarks",
|
||||
"pezframe-support/runtime-benchmarks",
|
||||
"pezframe-system/runtime-benchmarks",
|
||||
"pezsp-io/runtime-benchmarks",
|
||||
"pezsp-runtime/runtime-benchmarks",
|
||||
]
|
||||
|
||||
@@ -365,9 +365,11 @@ impl CallDef {
|
||||
}
|
||||
}
|
||||
|
||||
if weight_of_authorize.is_some() && authorize.is_none() {
|
||||
let msg = "Invalid pezpallet::call, weight_of_authorize attribute must be used with authorize attribute";
|
||||
return Err(syn::Error::new(weight_of_authorize.unwrap().span(), msg));
|
||||
if let Some(ref weight_expr) = weight_of_authorize {
|
||||
if authorize.is_none() {
|
||||
let msg = "Invalid pezpallet::call, weight_of_authorize attribute must be used with authorize attribute";
|
||||
return Err(syn::Error::new(weight_expr.span(), msg));
|
||||
}
|
||||
}
|
||||
|
||||
let authorize = if let Some(expr) = authorize {
|
||||
|
||||
@@ -22,8 +22,8 @@ proc-macro = true
|
||||
proc-macro2 = { workspace = true }
|
||||
quote = { features = ["proc-macro"], workspace = true }
|
||||
syn = { features = [
|
||||
"extra-traits",
|
||||
"full",
|
||||
"parsing",
|
||||
"proc-macro",
|
||||
"extra-traits",
|
||||
"full",
|
||||
"parsing",
|
||||
"proc-macro",
|
||||
], workspace = true }
|
||||
|
||||
@@ -190,7 +190,7 @@ mod tests {
|
||||
|
||||
// do translation.
|
||||
NumberMap::translate(
|
||||
|k: u32, v: u64| if k % 2 == 0 { Some(((k as u64) << 32) | v) } else { None },
|
||||
|k: u32, v: u64| if k.is_multiple_of(2) { Some(((k as u64) << 32) | v) } else { None },
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
|
||||
@@ -592,7 +592,7 @@ mod tests {
|
||||
pezsp_io::TestExternalities::default().execute_with(|| {
|
||||
const BUFFER_SIZE: usize = 300;
|
||||
// Ensure that the capacity isn't dividable by `300`.
|
||||
assert!(STORAGE_INPUT_BUFFER_CAPACITY % BUFFER_SIZE != 0, "Please update buffer size");
|
||||
assert!(!STORAGE_INPUT_BUFFER_CAPACITY.is_multiple_of(BUFFER_SIZE), "Please update buffer size");
|
||||
// Create some items where the last item is partially in the inner buffer so that
|
||||
// we need to fill the buffer to read the entire item.
|
||||
let data: Vec<Vec<u8>> = (0..=(STORAGE_INPUT_BUFFER_CAPACITY / BUFFER_SIZE))
|
||||
@@ -640,7 +640,7 @@ mod tests {
|
||||
|
||||
const BUFFER_SIZE: usize = 300;
|
||||
// Ensure that the capacity isn't dividable by `300`.
|
||||
assert!(STORAGE_INPUT_BUFFER_CAPACITY % BUFFER_SIZE != 0, "Please update buffer size");
|
||||
assert!(!STORAGE_INPUT_BUFFER_CAPACITY.is_multiple_of(BUFFER_SIZE), "Please update buffer size");
|
||||
// Create some items where the last item is partially in the inner buffer so that
|
||||
// we need to fill the buffer to read the entire item.
|
||||
let data: Vec<Vec<u8>> = (0..=(STORAGE_INPUT_BUFFER_CAPACITY / BUFFER_SIZE))
|
||||
|
||||
@@ -180,7 +180,7 @@ pub mod test_impl_filter_stack {
|
||||
pub struct BaseFilter;
|
||||
impl Contains<u32> for BaseFilter {
|
||||
fn contains(x: &u32) -> bool {
|
||||
x % 2 == 0
|
||||
x.is_multiple_of(2)
|
||||
}
|
||||
}
|
||||
impl_filter_stack!(
|
||||
|
||||
@@ -18,15 +18,11 @@ targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
[dependencies]
|
||||
codec = { features = ["derive"], workspace = true }
|
||||
frame-metadata = { features = ["current", "unstable"], workspace = true }
|
||||
pezframe-benchmarking = { workspace = true }
|
||||
pezframe-executive = { workspace = true }
|
||||
frame-metadata = { features = ["current", "unstable"], workspace = true }
|
||||
pezframe-support = { features = ["experimental"], workspace = true }
|
||||
pezframe-system = { workspace = true }
|
||||
pretty_assertions = { workspace = true }
|
||||
rustversion = { workspace = true }
|
||||
scale-info = { features = ["derive"], workspace = true }
|
||||
serde = { features = ["derive"], workspace = true }
|
||||
pezsp-api = { workspace = true }
|
||||
pezsp-arithmetic = { workspace = true }
|
||||
pezsp-core = { workspace = true }
|
||||
@@ -35,6 +31,10 @@ pezsp-metadata-ir = { workspace = true }
|
||||
pezsp-runtime = { workspace = true }
|
||||
pezsp-state-machine = { optional = true, workspace = true, default-features = true }
|
||||
pezsp-version = { workspace = true }
|
||||
pretty_assertions = { workspace = true }
|
||||
rustversion = { workspace = true }
|
||||
scale-info = { features = ["derive"], workspace = true }
|
||||
serde = { features = ["derive"], workspace = true }
|
||||
static_assertions = { workspace = true, default-features = true }
|
||||
trybuild = { features = ["diff"], workspace = true }
|
||||
# The "std" feature for this pezpallet is never activated on purpose, in order to test construct_runtime error message
|
||||
@@ -43,42 +43,42 @@ test-pezpallet = { workspace = true }
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = [
|
||||
"codec/std",
|
||||
"pezframe-benchmarking/std",
|
||||
"pezframe-executive/std",
|
||||
"frame-metadata/std",
|
||||
"pezframe-support/std",
|
||||
"pezframe-system/std",
|
||||
"scale-info/std",
|
||||
"serde/std",
|
||||
"pezsp-api/std",
|
||||
"pezsp-arithmetic/std",
|
||||
"pezsp-core/std",
|
||||
"pezsp-io/std",
|
||||
"pezsp-metadata-ir/std",
|
||||
"pezsp-runtime/std",
|
||||
"pezsp-state-machine/std",
|
||||
"pezsp-version/std",
|
||||
"test-pezpallet/std",
|
||||
"codec/std",
|
||||
"frame-metadata/std",
|
||||
"pezframe-benchmarking/std",
|
||||
"pezframe-executive/std",
|
||||
"pezframe-support/std",
|
||||
"pezframe-system/std",
|
||||
"pezsp-api/std",
|
||||
"pezsp-arithmetic/std",
|
||||
"pezsp-core/std",
|
||||
"pezsp-io/std",
|
||||
"pezsp-metadata-ir/std",
|
||||
"pezsp-runtime/std",
|
||||
"pezsp-state-machine/std",
|
||||
"pezsp-version/std",
|
||||
"scale-info/std",
|
||||
"serde/std",
|
||||
"test-pezpallet/std",
|
||||
]
|
||||
experimental = ["pezframe-support/experimental", "pezframe-system/experimental"]
|
||||
runtime-benchmarks = [
|
||||
"pezframe-benchmarking/runtime-benchmarks",
|
||||
"pezframe-executive/runtime-benchmarks",
|
||||
"pezframe-support/runtime-benchmarks",
|
||||
"pezframe-system/runtime-benchmarks",
|
||||
"pezsp-api/runtime-benchmarks",
|
||||
"pezsp-io/runtime-benchmarks",
|
||||
"pezsp-runtime/runtime-benchmarks",
|
||||
"pezsp-state-machine?/runtime-benchmarks",
|
||||
"pezsp-version/runtime-benchmarks",
|
||||
"test-pezpallet/runtime-benchmarks",
|
||||
"pezframe-benchmarking/runtime-benchmarks",
|
||||
"pezframe-executive/runtime-benchmarks",
|
||||
"pezframe-support/runtime-benchmarks",
|
||||
"pezframe-system/runtime-benchmarks",
|
||||
"pezsp-api/runtime-benchmarks",
|
||||
"pezsp-io/runtime-benchmarks",
|
||||
"pezsp-runtime/runtime-benchmarks",
|
||||
"pezsp-state-machine?/runtime-benchmarks",
|
||||
"pezsp-version/runtime-benchmarks",
|
||||
"test-pezpallet/runtime-benchmarks",
|
||||
]
|
||||
try-runtime = [
|
||||
"pezframe-executive/try-runtime",
|
||||
"pezframe-support/try-runtime",
|
||||
"pezframe-system/try-runtime",
|
||||
"pezsp-runtime/try-runtime",
|
||||
"pezframe-executive/try-runtime",
|
||||
"pezframe-support/try-runtime",
|
||||
"pezframe-system/try-runtime",
|
||||
"pezsp-runtime/try-runtime",
|
||||
]
|
||||
# WARNING:
|
||||
# Only CI runs with this feature enabled. This feature is for testing stuff related to the FRAME macros
|
||||
|
||||
@@ -20,25 +20,25 @@ targets = ["x86_64-unknown-linux-gnu"]
|
||||
codec = { features = ["derive"], workspace = true }
|
||||
pezframe-support = { workspace = true }
|
||||
pezframe-system = { workspace = true }
|
||||
scale-info = { features = ["derive"], workspace = true }
|
||||
pezsp-core = { workspace = true }
|
||||
pezsp-runtime = { workspace = true }
|
||||
pezsp-version = { workspace = true }
|
||||
scale-info = { features = ["derive"], workspace = true }
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = [
|
||||
"codec/std",
|
||||
"pezframe-support/std",
|
||||
"pezframe-system/std",
|
||||
"scale-info/std",
|
||||
"pezsp-core/std",
|
||||
"pezsp-runtime/std",
|
||||
"pezsp-version/std",
|
||||
"codec/std",
|
||||
"pezframe-support/std",
|
||||
"pezframe-system/std",
|
||||
"pezsp-core/std",
|
||||
"pezsp-runtime/std",
|
||||
"pezsp-version/std",
|
||||
"scale-info/std",
|
||||
]
|
||||
runtime-benchmarks = [
|
||||
"pezframe-support/runtime-benchmarks",
|
||||
"pezframe-system/runtime-benchmarks",
|
||||
"pezsp-runtime/runtime-benchmarks",
|
||||
"pezsp-version/runtime-benchmarks",
|
||||
"pezframe-support/runtime-benchmarks",
|
||||
"pezframe-system/runtime-benchmarks",
|
||||
"pezsp-runtime/runtime-benchmarks",
|
||||
"pezsp-version/runtime-benchmarks",
|
||||
]
|
||||
|
||||
@@ -20,22 +20,22 @@ targets = ["x86_64-unknown-linux-gnu"]
|
||||
codec = { features = ["derive"], workspace = true }
|
||||
pezframe-support = { workspace = true }
|
||||
pezframe-system = { workspace = true }
|
||||
pezsp-runtime = { workspace = true }
|
||||
scale-info = { features = ["derive"], workspace = true }
|
||||
serde = { features = ["derive"], workspace = true }
|
||||
pezsp-runtime = { workspace = true }
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = [
|
||||
"codec/std",
|
||||
"pezframe-support/std",
|
||||
"pezframe-system/std",
|
||||
"scale-info/std",
|
||||
"serde/std",
|
||||
"pezsp-runtime/std",
|
||||
"codec/std",
|
||||
"pezframe-support/std",
|
||||
"pezframe-system/std",
|
||||
"pezsp-runtime/std",
|
||||
"scale-info/std",
|
||||
"serde/std",
|
||||
]
|
||||
runtime-benchmarks = [
|
||||
"pezframe-support/runtime-benchmarks",
|
||||
"pezframe-system/runtime-benchmarks",
|
||||
"pezsp-runtime/runtime-benchmarks",
|
||||
"pezframe-support/runtime-benchmarks",
|
||||
"pezframe-system/runtime-benchmarks",
|
||||
"pezsp-runtime/runtime-benchmarks",
|
||||
]
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#![cfg(feature = "experimental")]
|
||||
|
||||
#[pezframe_support::pezpallet(dev_mode)]
|
||||
mod my_pallet {
|
||||
mod my_pezpallet {
|
||||
use pezframe_support::pezpallet_prelude::{StorageValue, ValueQuery};
|
||||
|
||||
#[pezpallet::config]
|
||||
@@ -36,8 +36,8 @@ mod my_pallet {
|
||||
#[pezpallet::task_condition(|i, j| i == 0u32 && j == 2u64)]
|
||||
#[pezpallet::task_list(vec![(0u32, 2u64), (2u32, 4u64)].iter())]
|
||||
#[pezpallet::task_weight(0.into())]
|
||||
fn foo(i: u32, j: u64) -> pezframe_support::pezpallet_prelude::DispatchResult {
|
||||
<SomeStorage<T, I>>::put((i, j));
|
||||
fn foo(_i: u32, _j: u64) -> pezframe_support::pezpallet_prelude::DispatchResult {
|
||||
<SomeStorage<T, I>>::put((_i, _j));
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
@@ -45,7 +45,7 @@ mod my_pallet {
|
||||
|
||||
// Another pezpallet for which we won't implement the default instance.
|
||||
#[pezframe_support::pezpallet(dev_mode)]
|
||||
mod my_pallet_2 {
|
||||
mod my_pezpallet_2 {
|
||||
use pezframe_support::pezpallet_prelude::{StorageValue, ValueQuery};
|
||||
|
||||
#[pezpallet::config]
|
||||
@@ -63,8 +63,8 @@ mod my_pallet_2 {
|
||||
#[pezpallet::task_condition(|i, j| i == 0u32 && j == 2u64)]
|
||||
#[pezpallet::task_list(vec![(0u32, 2u64), (2u32, 4u64)].iter())]
|
||||
#[pezpallet::task_weight(0.into())]
|
||||
fn foo(i: u32, j: u64) -> pezframe_support::pezpallet_prelude::DispatchResult {
|
||||
<SomeStorage<T, I>>::put((i, j));
|
||||
fn foo(_i: u32, _j: u64) -> pezframe_support::pezpallet_prelude::DispatchResult {
|
||||
<SomeStorage<T, I>>::put((_i, _j));
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
@@ -80,11 +80,11 @@ pezframe_support::construct_runtime!(
|
||||
pub enum Runtime
|
||||
{
|
||||
System: pezframe_system,
|
||||
MyPallet: my_pallet,
|
||||
MyPallet2: my_pallet::<Instance2>,
|
||||
MyPallet: my_pezpallet,
|
||||
MyPallet2: my_pezpallet::<Instance2>,
|
||||
#[cfg(feature = "frame-feature-testing")]
|
||||
MyPallet3: my_pallet::<Instance3>,
|
||||
MyPallet4: my_pallet_2::<Instance1>,
|
||||
MyPallet3: my_pezpallet::<Instance3>,
|
||||
MyPallet4: my_pezpallet_2::<Instance1>,
|
||||
}
|
||||
);
|
||||
|
||||
@@ -96,14 +96,14 @@ impl pezframe_system::Config for Runtime {
|
||||
type AccountId = AccountId;
|
||||
}
|
||||
|
||||
impl my_pallet::Config for Runtime {}
|
||||
impl my_pezpallet::Config for Runtime {}
|
||||
|
||||
impl my_pallet::Config<pezframe_support::instances::Instance2> for Runtime {}
|
||||
impl my_pezpallet::Config<pezframe_support::instances::Instance2> for Runtime {}
|
||||
|
||||
#[cfg(feature = "frame-feature-testing")]
|
||||
impl my_pallet::Config<pezframe_support::instances::Instance3> for Runtime {}
|
||||
impl my_pezpallet::Config<pezframe_support::instances::Instance3> for Runtime {}
|
||||
|
||||
impl my_pallet_2::Config<pezframe_support::instances::Instance1> for Runtime {}
|
||||
impl my_pezpallet_2::Config<pezframe_support::instances::Instance1> for Runtime {}
|
||||
|
||||
fn new_test_ext() -> pezsp_io::TestExternalities {
|
||||
use pezsp_runtime::BuildStorage;
|
||||
@@ -116,21 +116,21 @@ fn tasks_work() {
|
||||
new_test_ext().execute_with(|| {
|
||||
use pezframe_support::instances::{Instance1, Instance2};
|
||||
|
||||
let task = RuntimeTask::MyPallet(my_pallet::Task::<Runtime>::Foo { i: 0u32, j: 2u64 });
|
||||
let task = RuntimeTask::MyPallet(my_pezpallet::Task::<Runtime>::Foo { _i: 0u32, _j: 2u64 });
|
||||
|
||||
pezframe_support::assert_ok!(System::do_task(RuntimeOrigin::signed(1), task.clone(),));
|
||||
assert_eq!(my_pallet::SomeStorage::<Runtime>::get(), (0, 2));
|
||||
assert_eq!(my_pezpallet::SomeStorage::<Runtime>::get(), (0, 2));
|
||||
|
||||
let task = RuntimeTask::MyPallet2(my_pallet::Task::<Runtime, _>::Foo { i: 0u32, j: 2u64 });
|
||||
let task = RuntimeTask::MyPallet2(my_pezpallet::Task::<Runtime, _>::Foo { _i: 0u32, _j: 2u64 });
|
||||
|
||||
pezframe_support::assert_ok!(System::do_task(RuntimeOrigin::signed(1), task.clone(),));
|
||||
assert_eq!(my_pallet::SomeStorage::<Runtime, Instance2>::get(), (0, 2));
|
||||
assert_eq!(my_pezpallet::SomeStorage::<Runtime, Instance2>::get(), (0, 2));
|
||||
|
||||
let task =
|
||||
RuntimeTask::MyPallet4(my_pallet_2::Task::<Runtime, _>::Foo { i: 0u32, j: 2u64 });
|
||||
RuntimeTask::MyPallet4(my_pezpallet_2::Task::<Runtime, _>::Foo { _i: 0u32, _j: 2u64 });
|
||||
|
||||
pezframe_support::assert_ok!(System::do_task(RuntimeOrigin::signed(1), task.clone(),));
|
||||
assert_eq!(my_pallet_2::SomeStorage::<Runtime, Instance1>::get(), (0, 2));
|
||||
assert_eq!(my_pezpallet_2::SomeStorage::<Runtime, Instance1>::get(), (0, 2));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ fn do_task_unsigned_validation_rejects_external_source() {
|
||||
InvalidTransaction, TransactionSource, TransactionValidityError, ValidateUnsigned,
|
||||
};
|
||||
|
||||
let task = RuntimeTask::MyPallet(my_pallet::Task::<Runtime>::Foo { i: 0u32, j: 2u64 });
|
||||
let task = RuntimeTask::MyPallet(my_pezpallet::Task::<Runtime>::Foo { _i: 0u32, _j: 2u64 });
|
||||
let call = pezframe_system::Call::do_task { task };
|
||||
|
||||
assert!(matches!(
|
||||
|
||||
Reference in New Issue
Block a user