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:
@@ -21,9 +21,9 @@ use crate::{
|
||||
ClientError,
|
||||
};
|
||||
use jsonrpsee::core::async_trait;
|
||||
use pezkuwi_subxt::{backend::legacy::LegacyRpcMethods, OnlineClient};
|
||||
use pezsp_core::H256;
|
||||
use std::sync::Arc;
|
||||
use pezkuwi_subxt::{backend::legacy::LegacyRpcMethods, OnlineClient};
|
||||
use tokio::sync::RwLock;
|
||||
|
||||
/// BlockInfoProvider cache and retrieves information about blocks.
|
||||
|
||||
@@ -254,11 +254,11 @@ fn rpc_module(is_dev: bool, client: Client) -> Result<RpcModule<()>, pezsc_servi
|
||||
let eth_api = EthRpcServerImpl::new(client.clone())
|
||||
.with_accounts(if is_dev {
|
||||
vec![
|
||||
crate::Account::from(subxt_signer::eth::dev::alith()),
|
||||
crate::Account::from(subxt_signer::eth::dev::baltathar()),
|
||||
crate::Account::from(subxt_signer::eth::dev::charleth()),
|
||||
crate::Account::from(subxt_signer::eth::dev::dorothy()),
|
||||
crate::Account::from(subxt_signer::eth::dev::ethan()),
|
||||
crate::Account::from(pezkuwi_subxt_signer::eth::dev::alith()),
|
||||
crate::Account::from(pezkuwi_subxt_signer::eth::dev::baltathar()),
|
||||
crate::Account::from(pezkuwi_subxt_signer::eth::dev::charleth()),
|
||||
crate::Account::from(pezkuwi_subxt_signer::eth::dev::dorothy()),
|
||||
crate::Account::from(pezkuwi_subxt_signer::eth::dev::ethan()),
|
||||
]
|
||||
} else {
|
||||
vec![]
|
||||
|
||||
@@ -26,6 +26,18 @@ use crate::{
|
||||
TracerType, TransactionInfo,
|
||||
};
|
||||
use jsonrpsee::types::{error::CALL_EXECUTION_FAILED_CODE, ErrorObjectOwned};
|
||||
use pezkuwi_subxt::{
|
||||
backend::{
|
||||
legacy::{rpc_methods::SystemHealth, LegacyRpcMethods},
|
||||
rpc::{
|
||||
reconnecting_rpc_client::{ExponentialBackoff, RpcClient as ReconnectingRpcClient},
|
||||
RpcClient,
|
||||
},
|
||||
},
|
||||
config::{HashFor, Header},
|
||||
ext::pezkuwi_subxt_rpcs::rpc_params,
|
||||
Config, OnlineClient,
|
||||
};
|
||||
use pezpallet_revive::{
|
||||
evm::{
|
||||
decode_revert_reason, Block, BlockNumberOrTag, BlockNumberOrTagOrHash, FeeHistoryResult,
|
||||
@@ -39,23 +51,12 @@ use pezsp_weights::Weight;
|
||||
use runtime_api::RuntimeApi;
|
||||
use std::{ops::Range, sync::Arc, time::Duration};
|
||||
use storage_api::StorageApi;
|
||||
use pezkuwi_subxt::{
|
||||
backend::{
|
||||
legacy::{rpc_methods::SystemHealth, LegacyRpcMethods},
|
||||
rpc::{
|
||||
reconnecting_rpc_client::{ExponentialBackoff, RpcClient as ReconnectingRpcClient},
|
||||
RpcClient,
|
||||
},
|
||||
},
|
||||
config::{HashFor, Header},
|
||||
ext::pezkuwi_subxt_rpcs::rpc_params,
|
||||
Config, OnlineClient,
|
||||
};
|
||||
use thiserror::Error;
|
||||
use tokio::sync::Mutex;
|
||||
|
||||
/// The bizinikiwi block type.
|
||||
pub type BizinikiwiBlock = pezkuwi_subxt::blocks::Block<SrcChainConfig, OnlineClient<SrcChainConfig>>;
|
||||
pub type BizinikiwiBlock =
|
||||
pezkuwi_subxt::blocks::Block<SrcChainConfig, OnlineClient<SrcChainConfig>>;
|
||||
|
||||
/// The bizinikiwi block header.
|
||||
pub type BizinikiwiBlockHeader = <SrcChainConfig as Config>::Header;
|
||||
|
||||
@@ -21,6 +21,7 @@ use crate::{
|
||||
ClientError,
|
||||
};
|
||||
use futures::TryFutureExt;
|
||||
use pezkuwi_subxt::{error::RuntimeApiError, OnlineClient};
|
||||
use pezpallet_revive::{
|
||||
evm::{
|
||||
Block as EthBlock, BlockNumberOrTagOrHash, BlockTag, GenericTransaction, ReceiptGasInfo,
|
||||
@@ -30,16 +31,14 @@ use pezpallet_revive::{
|
||||
};
|
||||
use pezsp_core::H256;
|
||||
use pezsp_timestamp::Timestamp;
|
||||
use pezkuwi_subxt::{
|
||||
error::RuntimeApiError,
|
||||
OnlineClient,
|
||||
};
|
||||
|
||||
const LOG_TARGET: &str = "eth-rpc::runtime_api";
|
||||
|
||||
/// A Wrapper around subxt Runtime API
|
||||
#[derive(Clone)]
|
||||
pub struct RuntimeApi(pezkuwi_subxt::runtime_api::RuntimeApi<SrcChainConfig, OnlineClient<SrcChainConfig>>);
|
||||
pub struct RuntimeApi(
|
||||
pezkuwi_subxt::runtime_api::RuntimeApi<SrcChainConfig, OnlineClient<SrcChainConfig>>,
|
||||
);
|
||||
|
||||
impl RuntimeApi {
|
||||
/// Create a new instance.
|
||||
|
||||
@@ -28,11 +28,14 @@ use pezsp_core::H256;
|
||||
|
||||
/// A wrapper around the Bizinikiwi Storage API.
|
||||
#[derive(Clone)]
|
||||
pub struct StorageApi(StorageClientAt<SrcChainConfig, OnlineClient<SrcChainConfig>>, H256);
|
||||
pub struct StorageApi(StorageClientAt<SrcChainConfig, OnlineClient<SrcChainConfig>>, #[expect(dead_code)] H256);
|
||||
|
||||
impl StorageApi {
|
||||
/// Create a new instance of the StorageApi.
|
||||
pub fn new(api: StorageClientAt<SrcChainConfig, OnlineClient<SrcChainConfig>>, block_hash: H256) -> Self {
|
||||
pub fn new(
|
||||
api: StorageClientAt<SrcChainConfig, OnlineClient<SrcChainConfig>>,
|
||||
block_hash: H256,
|
||||
) -> Self {
|
||||
Self(api, block_hash)
|
||||
}
|
||||
|
||||
@@ -45,12 +48,16 @@ impl StorageApi {
|
||||
let contract_address: pezkuwi_subxt::utils::H160 = contract_address.0.into();
|
||||
|
||||
let query = subxt_client::storage().revive().account_info_of();
|
||||
let Some(storage_value) = self.0.try_fetch(query, (contract_address,)).await
|
||||
let Some(storage_value) = self
|
||||
.0
|
||||
.try_fetch(query, (contract_address,))
|
||||
.await
|
||||
.map_err(|e| ClientError::SubxtError(e.into()))?
|
||||
else {
|
||||
return Err(ClientError::ContractNotFound);
|
||||
};
|
||||
let info = storage_value.decode()
|
||||
let info = storage_value
|
||||
.decode()
|
||||
.map_err(|e| ClientError::SubxtError(pezkuwi_subxt::Error::from(e)))?;
|
||||
|
||||
let AccountType::Contract(contract_info) = info.account_type else {
|
||||
|
||||
@@ -208,7 +208,7 @@ impl<Client: EthRpcClient + Send + Sync> TransactionBuilder<Client> {
|
||||
|
||||
#[test]
|
||||
fn test_dummy_payload_has_correct_len() {
|
||||
let signer = Account::from(subxt_signer::eth::dev::ethan());
|
||||
let signer = Account::from(pezkuwi_subxt_signer::eth::dev::ethan());
|
||||
let unsigned_tx: TransactionUnsigned =
|
||||
TransactionLegacyUnsigned { input: vec![42u8; 100].into(), ..Default::default() }.into();
|
||||
|
||||
|
||||
@@ -27,13 +27,13 @@ use crate::{
|
||||
};
|
||||
|
||||
use futures::{stream, StreamExt};
|
||||
use pezkuwi_subxt::{blocks::ExtrinsicDetails, OnlineClient};
|
||||
use pezpallet_revive::{
|
||||
create1,
|
||||
evm::{GenericTransaction, Log, ReceiptGasInfo, ReceiptInfo, TransactionSigned, H256, U256},
|
||||
};
|
||||
use pezsp_core::keccak_256;
|
||||
use std::{future::Future, pin::Pin, sync::Arc};
|
||||
use pezkuwi_subxt::{blocks::ExtrinsicDetails, OnlineClient};
|
||||
|
||||
type FetchReceiptDataFn = Arc<
|
||||
dyn Fn(H256) -> Pin<Box<dyn Future<Output = Option<Vec<ReceiptGasInfo>>> + Send>> + Send + Sync,
|
||||
@@ -147,7 +147,10 @@ impl ReceiptExtractor {
|
||||
&self,
|
||||
bizinikiwi_block: &BizinikiwiBlock,
|
||||
eth_block_hash: H256,
|
||||
ext: pezkuwi_subxt::blocks::ExtrinsicDetails<SrcChainConfig, pezkuwi_subxt::OnlineClient<SrcChainConfig>>,
|
||||
ext: pezkuwi_subxt::blocks::ExtrinsicDetails<
|
||||
SrcChainConfig,
|
||||
pezkuwi_subxt::OnlineClient<SrcChainConfig>,
|
||||
>,
|
||||
call: EthTransact,
|
||||
receipt_gas_info: ReceiptGasInfo,
|
||||
transaction_index: usize,
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
//! The generated subxt client.
|
||||
//! Generated against a bizinikiwi chain configured with [`pezpallet_revive`] using:
|
||||
//! subxt metadata --url ws://localhost:9944 -o rpc/revive_chain.scale
|
||||
pub use pezkuwi_subxt::config::PolkadotConfig as SrcChainConfig;
|
||||
pub use pezkuwi_subxt::PezkuwiConfig as SrcChainConfig;
|
||||
|
||||
#[pezkuwi_subxt::subxt(
|
||||
runtime_metadata_path = "revive_chain.scale",
|
||||
|
||||
@@ -30,6 +30,12 @@ use crate::{
|
||||
use anyhow::anyhow;
|
||||
use clap::Parser;
|
||||
use jsonrpsee::ws_client::{WsClient, WsClientBuilder};
|
||||
use pezkuwi_subxt::{
|
||||
backend::rpc::RpcClient,
|
||||
ext::pezkuwi_subxt_rpcs::rpc_params,
|
||||
tx::{SubmittableTransaction, TxStatus},
|
||||
OnlineClient,
|
||||
};
|
||||
use pezpallet_revive::{
|
||||
create1,
|
||||
evm::{
|
||||
@@ -38,12 +44,6 @@ use pezpallet_revive::{
|
||||
},
|
||||
};
|
||||
use std::{sync::Arc, thread};
|
||||
use pezkuwi_subxt::{
|
||||
backend::rpc::RpcClient,
|
||||
ext::pezkuwi_subxt_rpcs::rpc_params,
|
||||
tx::{SubmittableTransaction, TxStatus},
|
||||
OnlineClient,
|
||||
};
|
||||
|
||||
const LOG_TARGET: &str = "eth-rpc-tests";
|
||||
|
||||
@@ -148,7 +148,7 @@ async fn prepare_evm_transactions<Client: EthRpcClient + Sync + Send>(
|
||||
/// Prepare multiple Bizinikiwi transfer transactions with sequential nonces
|
||||
async fn prepare_bizinikiwi_transactions(
|
||||
node_client: &OnlineClient<SrcChainConfig>,
|
||||
signer: &subxt_signer::sr25519::Keypair,
|
||||
signer: &pezkuwi_subxt_signer::sr25519::Keypair,
|
||||
count: usize,
|
||||
) -> anyhow::Result<Vec<SubmittableTransaction<SrcChainConfig, OnlineClient<SrcChainConfig>>>> {
|
||||
let mut nonce = node_client.tx().account_nonce(&signer.public_key().into()).await?;
|
||||
@@ -161,8 +161,8 @@ async fn prepare_bizinikiwi_transactions(
|
||||
vec![pezkuwi_subxt::dynamic::Value::from_bytes(remark_data.as_bytes())],
|
||||
);
|
||||
|
||||
// Note: Using polkadot config from subxt (external crate)
|
||||
let params = pezkuwi_subxt::config::polkadot::PolkadotExtrinsicParamsBuilder::new()
|
||||
// Note: Using pezkuwi config from subxt (external crate)
|
||||
let params = pezkuwi_subxt::config::pezkuwi::PezkuwiExtrinsicParamsBuilder::new()
|
||||
.nonce(nonce)
|
||||
.build();
|
||||
|
||||
@@ -305,7 +305,7 @@ async fn run_all_eth_rpc_tests() -> anyhow::Result<()> {
|
||||
}
|
||||
|
||||
async fn test_transfer(client: Arc<WsClient>) -> anyhow::Result<()> {
|
||||
let ethan = Account::from(subxt_signer::eth::dev::ethan());
|
||||
let ethan = Account::from(pezkuwi_subxt_signer::eth::dev::ethan());
|
||||
let initial_balance = client.get_balance(ethan.address(), BlockTag::Latest.into()).await?;
|
||||
|
||||
let value = 1_000_000_000_000_000_000_000u128.into();
|
||||
@@ -332,7 +332,7 @@ async fn test_deploy_and_call(client: Arc<WsClient>) -> anyhow::Result<()> {
|
||||
let account = Account::default();
|
||||
|
||||
// Balance transfer
|
||||
let ethan = Account::from(subxt_signer::eth::dev::ethan());
|
||||
let ethan = Account::from(pezkuwi_subxt_signer::eth::dev::ethan());
|
||||
let initial_balance = client.get_balance(ethan.address(), BlockTag::Latest.into()).await?;
|
||||
let value = 1_000_000_000_000_000_000_000u128.into();
|
||||
let tx = TransactionBuilder::new(&client).value(value).to(ethan.address()).send().await?;
|
||||
@@ -446,7 +446,7 @@ async fn test_runtime_api_dry_run_addr_works(client: Arc<WsClient>) -> anyhow::R
|
||||
}
|
||||
|
||||
async fn test_invalid_transaction(client: Arc<WsClient>) -> anyhow::Result<()> {
|
||||
let ethan = Account::from(subxt_signer::eth::dev::ethan());
|
||||
let ethan = Account::from(pezkuwi_subxt_signer::eth::dev::ethan());
|
||||
|
||||
let err = TransactionBuilder::new(&client)
|
||||
.value(U256::from(1_000_000_000_000u128))
|
||||
@@ -473,8 +473,9 @@ async fn get_evm_block_from_storage(
|
||||
.unwrap();
|
||||
|
||||
let query = subxt_client::storage().revive().ethereum_block();
|
||||
let Some(block) = node_client.storage().at(block_hash).fetch(&query).await.unwrap() else {
|
||||
return Err(anyhow!("EVM block {block_hash:?} not found"));
|
||||
let block = match node_client.storage().at(block_hash).fetch(&query, ()).await {
|
||||
Ok(value) => value.decode()?,
|
||||
Err(_) => return Err(anyhow!("EVM block {block_hash:?} not found")),
|
||||
};
|
||||
Ok(block.0)
|
||||
}
|
||||
@@ -664,7 +665,7 @@ async fn test_block_hash_for_tag_with_block_tags_works(
|
||||
async fn test_multiple_transactions_in_block(client: Arc<WsClient>) -> anyhow::Result<()> {
|
||||
let num_transactions = 20;
|
||||
let alith = Account::default();
|
||||
let ethan = Account::from(subxt_signer::eth::dev::ethan());
|
||||
let ethan = Account::from(pezkuwi_subxt_signer::eth::dev::ethan());
|
||||
let amount = U256::from(1_000_000_000_000_000_000u128);
|
||||
|
||||
// Prepare EVM transfer transactions
|
||||
@@ -689,7 +690,7 @@ async fn test_mixed_evm_bizinikiwi_transactions(client: Arc<WsClient>) -> anyhow
|
||||
let num_bizinikiwi_txs = 7;
|
||||
|
||||
let alith = Account::default();
|
||||
let ethan = Account::from(subxt_signer::eth::dev::ethan());
|
||||
let ethan = Account::from(pezkuwi_subxt_signer::eth::dev::ethan());
|
||||
let amount = U256::from(500_000_000_000_000_000u128);
|
||||
|
||||
// Prepare EVM transactions
|
||||
@@ -699,7 +700,7 @@ async fn test_mixed_evm_bizinikiwi_transactions(client: Arc<WsClient>) -> anyhow
|
||||
|
||||
// Prepare bizinikiwi transactions (simple remarks)
|
||||
log::trace!(target: LOG_TARGET, "Creating {num_bizinikiwi_txs} bizinikiwi remark transactions");
|
||||
let alice_signer = subxt_signer::sr25519::dev::alice();
|
||||
let alice_signer = pezkuwi_subxt_signer::sr25519::dev::alice();
|
||||
let (node_client, _, _) = client::connect(SharedResources::pez_node_rpc_url()).await.unwrap();
|
||||
|
||||
let bizinikiwi_txs =
|
||||
@@ -777,11 +778,12 @@ async fn test_runtime_pallets_address_upload_code(client: Arc<WsClient>) -> anyh
|
||||
|
||||
// Step 5: Verify the code was actually uploaded
|
||||
let code_hash = H256(pezsp_io::hashing::keccak_256(&bytecode));
|
||||
let query = subxt_client::storage().revive().pristine_code(code_hash);
|
||||
let query = subxt_client::storage().revive().pristine_code();
|
||||
let block_hash: pezsp_core::H256 = get_bizinikiwi_block_hash(receipt.block_number).await?;
|
||||
let stored_code = node_client.storage().at(block_hash).fetch(&query).await?;
|
||||
assert!(stored_code.is_some(), "Code with hash {code_hash:?} should exist in storage");
|
||||
assert_eq!(stored_code.unwrap(), bytecode, "Stored code should match the uploaded bytecode");
|
||||
let stored_code: Vec<u8> = node_client.storage().at(block_hash).fetch(&query, (code_hash,)).await
|
||||
.expect("Code with hash should exist in storage")
|
||||
.decode()?;
|
||||
assert_eq!(stored_code, bytecode, "Stored code should match the uploaded bytecode");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user