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:
@@ -13,14 +13,15 @@
|
||||
//!
|
||||
//! FRAME pallets, as per described in [`crate::pezkuwi_sdk::frame_runtime`] are:
|
||||
//!
|
||||
//! > A pezpallet is a unit of encapsulated logic. It has a clearly defined responsibility and can be
|
||||
//! > A pezpallet is a unit of encapsulated logic. It has a clearly defined responsibility and can
|
||||
//! > be
|
||||
//! linked to other pallets.
|
||||
//!
|
||||
//! That is to say:
|
||||
//!
|
||||
//! * *encapsulated*: Ideally, a FRAME pezpallet contains encapsulated logic which has clear
|
||||
//! boundaries. It is generally a bad idea to build a single monolithic pezpallet that does multiple
|
||||
//! things, such as handling currencies, identities and staking all at the same time.
|
||||
//! boundaries. It is generally a bad idea to build a single monolithic pezpallet that does
|
||||
//! multiple things, such as handling currencies, identities and staking all at the same time.
|
||||
//! * *linked to other pallets*: But, adhering extensively to the above also hinders the ability to
|
||||
//! write useful applications. Pallets often need to work with each other, communicate and use
|
||||
//! each other's functionalities.
|
||||
@@ -63,15 +64,15 @@
|
||||
//!
|
||||
//! ## Example
|
||||
//!
|
||||
//! Consider the following example, in which `pezpallet-foo` needs another pezpallet to provide the block
|
||||
//! author to it, and `pezpallet-author` which has access to this information.
|
||||
//! Consider the following example, in which `pezpallet-foo` needs another pezpallet to provide the
|
||||
//! block author to it, and `pezpallet-author` which has access to this information.
|
||||
#![doc = docify::embed!("./src/reference_docs/frame_pallet_coupling.rs", pezpallet_foo)]
|
||||
#![doc = docify::embed!("./src/reference_docs/frame_pallet_coupling.rs", pezpallet_author)]
|
||||
//!
|
||||
//! ### Tight Coupling Pallets
|
||||
//!
|
||||
//! To tightly couple `pezpallet-foo` and `pezpallet-author`, we use Rust's supertrait system. When a
|
||||
//! pezpallet makes its own `trait Config` be bounded by another pezpallet's `trait Config`, it is
|
||||
//! To tightly couple `pezpallet-foo` and `pezpallet-author`, we use Rust's supertrait system. When
|
||||
//! a pezpallet makes its own `trait Config` be bounded by another pezpallet's `trait Config`, it is
|
||||
//! expressing two things:
|
||||
//!
|
||||
//! 1. That it can only exist in a runtime if the other pezpallet is also present.
|
||||
@@ -93,12 +94,12 @@
|
||||
//!
|
||||
//! > We sometimes refer to such traits that help two pallets interact as "glue traits".
|
||||
//!
|
||||
//! Next, `pezpallet-foo` states that it needs this trait to be provided to it, at the runtime level,
|
||||
//! via an associated type:
|
||||
//! Next, `pezpallet-foo` states that it needs this trait to be provided to it, at the runtime
|
||||
//! level, via an associated type:
|
||||
#![doc = docify::embed!("./src/reference_docs/frame_pallet_coupling.rs", loose_config)]
|
||||
//!
|
||||
//! Then, `pezpallet-foo` can use this trait to obtain the block author, without knowing where it comes
|
||||
//! from:
|
||||
//! Then, `pezpallet-foo` can use this trait to obtain the block author, without knowing where it
|
||||
//! comes from:
|
||||
#![doc = docify::embed!("./src/reference_docs/frame_pallet_coupling.rs", loose_usage)]
|
||||
//!
|
||||
//! Then, if `pezpallet-author` implements this glue-trait:
|
||||
@@ -120,9 +121,9 @@
|
||||
//!
|
||||
//! ## Frame System
|
||||
//!
|
||||
//! With the above information in context, we can conclude that **`pezframe_system` is a special pezpallet
|
||||
//! that is tightly coupled with every other pezpallet**. This is because it provides the fundamental
|
||||
//! system functionality that every pezpallet needs, such as some types like
|
||||
//! With the above information in context, we can conclude that **`pezframe_system` is a special
|
||||
//! pezpallet that is tightly coupled with every other pezpallet**. This is because it provides the
|
||||
//! fundamental system functionality that every pezpallet needs, such as some types like
|
||||
//! [`frame::prelude::pezframe_system::Config::AccountId`],
|
||||
//! [`frame::prelude::pezframe_system::Config::Hash`], and some functionality such as block number,
|
||||
//! etc.
|
||||
@@ -132,18 +133,19 @@
|
||||
//! To recap, consider the following rules of thumb:
|
||||
//!
|
||||
//! * In all cases, try and break down big pallets apart with clear boundaries of responsibility. In
|
||||
//! general, it is easier to argue about multiple pezpallet if they only communicate together via a
|
||||
//! known trait, rather than having access to all of each others public items, such as storage and
|
||||
//! dispatchables.
|
||||
//! general, it is easier to argue about multiple pezpallet if they only communicate together via
|
||||
//! a known trait, rather than having access to all of each others public items, such as storage
|
||||
//! and dispatchables.
|
||||
//! * If a group of pallets is meant to work together, but is not foreseen to be generalized, or
|
||||
//! used by others, consider tightly coupling pallets, *if it simplifies the development*.
|
||||
//! * If a pezpallet needs a functionality provided by another pezpallet, but multiple implementations can
|
||||
//! be foreseen, consider loosely coupling pallets.
|
||||
//! * If a pezpallet needs a functionality provided by another pezpallet, but multiple
|
||||
//! implementations can be foreseen, consider loosely coupling pallets.
|
||||
//!
|
||||
//! For example, all pallets in `pezkuwi-sdk` that needed to work with currencies could have been
|
||||
//! tightly coupled with [`pezpallet_balances`]. But, `pezkuwi-sdk` also provides [`pezpallet_assets`]
|
||||
//! (and more implementations by the community), therefore all pallets use traits to loosely couple
|
||||
//! with balances or assets pezpallet. More on this in [`crate::reference_docs::frame_tokens`].
|
||||
//! tightly coupled with [`pezpallet_balances`]. But, `pezkuwi-sdk` also provides
|
||||
//! [`pezpallet_assets`] (and more implementations by the community), therefore all pallets use
|
||||
//! traits to loosely couple with balances or assets pezpallet. More on this in
|
||||
//! [`crate::reference_docs::frame_tokens`].
|
||||
//!
|
||||
//! ## Further References
|
||||
//!
|
||||
@@ -201,7 +203,8 @@ pub mod pezpallet_foo_tight {
|
||||
pub struct Pezpallet<T>(_);
|
||||
|
||||
#[docify::export(tight_config)]
|
||||
/// This pezpallet can only live in a runtime that has both `pezframe_system` and `pezpallet_author`.
|
||||
/// This pezpallet can only live in a runtime that has both `pezframe_system` and
|
||||
/// `pezpallet_author`.
|
||||
#[pezpallet::config]
|
||||
pub trait Config: pezframe_system::Config + pezpallet_author::Config {}
|
||||
|
||||
@@ -269,8 +272,8 @@ impl<AccountId> AuthorProvider<AccountId> for () {
|
||||
|
||||
pub mod runtime {
|
||||
use super::*;
|
||||
use pezcumulus_pezpallet_aura_ext::pezpallet;
|
||||
use frame::{runtime::prelude::*, testing_prelude::*};
|
||||
use pezcumulus_pezpallet_aura_ext::pezpallet;
|
||||
|
||||
construct_runtime!(
|
||||
pub struct Runtime {
|
||||
|
||||
Reference in New Issue
Block a user