From 935a925fe91cf3ee2ade11009f01aee90e0c2011 Mon Sep 17 00:00:00 2001 From: Marvin Jones Date: Wed, 17 Jun 2026 17:34:11 -0400 Subject: [PATCH] CI fixes --- .../src/components/account_nonce_list.rs | 4 - lez/explorer_service/src/components/mod.rs | 11 +- .../src/components/search_results.rs | 4 - .../src/components/transaction_details.rs | 17 +- .../src/pages/transaction_page.rs | 6 +- lez/indexer/core/src/block_store.rs | 46 +++- lez/keycard_wallet/src/lib.rs | 4 + lez/sequencer/core/src/lib.rs | 24 +- lez/wallet/src/account_manager.rs | 30 ++- lez/wallet/src/cli/account.rs | 86 +++--- lez/wallet/src/cli/config.rs | 17 +- lez/wallet/src/cli/group.rs | 52 ++-- lez/wallet/src/cli/keycard.rs | 39 ++- lez/wallet/src/cli/programs/amm.rs | 10 +- lez/wallet/src/cli/programs/ata.rs | 27 +- .../src/cli/programs/native_token_transfer.rs | 96 ++++--- lez/wallet/src/cli/programs/token.rs | 247 ++++++++++-------- lez/wallet/src/lib.rs | 2 +- 18 files changed, 366 insertions(+), 356 deletions(-) diff --git a/lez/explorer_service/src/components/account_nonce_list.rs b/lez/explorer_service/src/components/account_nonce_list.rs index 661d8c58..d8b30aff 100644 --- a/lez/explorer_service/src/components/account_nonce_list.rs +++ b/lez/explorer_service/src/components/account_nonce_list.rs @@ -4,10 +4,6 @@ use leptos::prelude::*; use leptos_router::components::A; #[component] -#[expect( - clippy::needless_pass_by_value, - reason = "Leptos component props are passed by value by framework convention" -)] pub fn AccountNonceList(account_ids: Vec, nonces: Vec) -> impl IntoView { view! {
diff --git a/lez/explorer_service/src/components/mod.rs b/lez/explorer_service/src/components/mod.rs index d31c8336..3d0a4dae 100644 --- a/lez/explorer_service/src/components/mod.rs +++ b/lez/explorer_service/src/components/mod.rs @@ -1,5 +1,10 @@ +pub use account_nonce_list::AccountNonceList; pub use account_preview::AccountPreview; pub use block_preview::BlockPreview; +pub use search_results::SearchResultsView; +pub use transaction_details::{ + PrivacyPreservingTxDetails, ProgramDeploymentTxDetails, PublicTxDetails, +}; pub use transaction_preview::TransactionPreview; pub mod account_nonce_list; @@ -8,9 +13,3 @@ pub mod block_preview; pub mod search_results; pub mod transaction_details; pub mod transaction_preview; - -pub use account_nonce_list::AccountNonceList; -pub use search_results::SearchResultsView; -pub use transaction_details::{ - PrivacyPreservingTxDetails, ProgramDeploymentTxDetails, PublicTxDetails, -}; diff --git a/lez/explorer_service/src/components/search_results.rs b/lez/explorer_service/src/components/search_results.rs index a01aa066..1033e515 100644 --- a/lez/explorer_service/src/components/search_results.rs +++ b/lez/explorer_service/src/components/search_results.rs @@ -5,10 +5,6 @@ use crate::api::SearchResults; /// Search results view component #[component] -#[expect( - clippy::needless_pass_by_value, - reason = "Leptos component props are passed by value by framework convention" -)] pub fn SearchResultsView(results: SearchResults) -> impl IntoView { let SearchResults { blocks, diff --git a/lez/explorer_service/src/components/transaction_details.rs b/lez/explorer_service/src/components/transaction_details.rs index a79ab275..c82f7d80 100644 --- a/lez/explorer_service/src/components/transaction_details.rs +++ b/lez/explorer_service/src/components/transaction_details.rs @@ -8,10 +8,6 @@ use super::AccountNonceList; /// Public transaction details component #[component] -#[expect( - clippy::needless_pass_by_value, - reason = "Leptos component props are passed by value by framework convention" -)] pub fn PublicTxDetails(tx: PublicTransaction) -> impl IntoView { let PublicTransaction { hash: _, @@ -65,10 +61,6 @@ pub fn PublicTxDetails(tx: PublicTransaction) -> impl IntoView { /// Privacy-preserving transaction details component #[component] -#[expect( - clippy::needless_pass_by_value, - reason = "Leptos component props are passed by value by framework convention" -)] pub fn PrivacyPreservingTxDetails(tx: PrivacyPreservingTransaction) -> impl IntoView { let PrivacyPreservingTransaction { hash: _, @@ -137,15 +129,8 @@ pub fn PrivacyPreservingTxDetails(tx: PrivacyPreservingTransaction) -> impl Into /// Program deployment transaction details component #[component] -#[expect( - clippy::needless_pass_by_value, - reason = "Leptos component props are passed by value by framework convention" -)] pub fn ProgramDeploymentTxDetails(tx: ProgramDeploymentTransaction) -> impl IntoView { - let ProgramDeploymentTransaction { - hash: _, - message, - } = tx; + let ProgramDeploymentTransaction { hash: _, message } = tx; let ProgramDeploymentMessage { bytecode } = message; let bytecode_len = bytecode.len(); diff --git a/lez/explorer_service/src/pages/transaction_page.rs b/lez/explorer_service/src/pages/transaction_page.rs index 04ad1399..a99c269f 100644 --- a/lez/explorer_service/src/pages/transaction_page.rs +++ b/lez/explorer_service/src/pages/transaction_page.rs @@ -4,8 +4,10 @@ use indexer_service_protocol::{HashType, Transaction}; use leptos::prelude::*; use leptos_router::hooks::use_params_map; -use crate::api; -use crate::components::{PrivacyPreservingTxDetails, ProgramDeploymentTxDetails, PublicTxDetails}; +use crate::{ + api, + components::{PrivacyPreservingTxDetails, ProgramDeploymentTxDetails, PublicTxDetails}, +}; /// Transaction page component #[component] diff --git a/lez/indexer/core/src/block_store.rs b/lez/indexer/core/src/block_store.rs index 0f624221..c67148bd 100644 --- a/lez/indexer/core/src/block_store.rs +++ b/lez/indexer/core/src/block_store.rs @@ -211,17 +211,6 @@ mod tests { use super::*; - #[test] - fn correct_startup() { - let home = tempdir().unwrap(); - - let storage = IndexerStore::open_db(home.as_ref()).unwrap(); - - let final_id = storage.get_last_block_id().unwrap(); - - assert_eq!(final_id, None); - } - struct TestFixture { storage: IndexerStore, from: AccountId, @@ -229,6 +218,10 @@ mod tests { _home: tempfile::TempDir, } + #[expect( + clippy::arithmetic_side_effects, + reason = "test helper with bounded inputs" + )] async fn store_with_transfer_blocks( block_count: u64, prev_hash: Option, @@ -244,7 +237,11 @@ mod tests { let mut prev_hash = prev_hash; for i in 0..block_count { let tx = common::test_utils::create_transaction_native_token_transfer( - from, u128::from(i), to, 10, &sign_key, + from, + u128::from(i), + to, + 10, + &sign_key, ); let block_id = i + 1; @@ -260,7 +257,23 @@ mod tests { .unwrap(); } - TestFixture { storage, from, to, _home: home } + TestFixture { + storage, + from, + to, + _home: home, + } + } + + #[test] + fn correct_startup() { + let home = tempdir().unwrap(); + + let storage = IndexerStore::open_db(home.as_ref()).unwrap(); + + let final_id = storage.get_last_block_id().unwrap(); + + assert_eq!(final_id, None); } #[tokio::test] @@ -313,7 +326,12 @@ mod tests { #[tokio::test] async fn account_state_at_block() { - let TestFixture { storage, from, to, _home } = store_with_transfer_blocks(10, None).await; + let TestFixture { + storage, + from, + to, + _home, + } = store_with_transfer_blocks(10, None).await; let acc1_at_1 = storage.account_state_at_block(&from, 1).unwrap(); let acc2_at_1 = storage.account_state_at_block(&to, 1).unwrap(); diff --git a/lez/keycard_wallet/src/lib.rs b/lez/keycard_wallet/src/lib.rs index 41541ec0..a3ecd140 100644 --- a/lez/keycard_wallet/src/lib.rs +++ b/lez/keycard_wallet/src/lib.rs @@ -247,6 +247,10 @@ fn normalize_keycard_signature(py_signature: Vec) -> PyResult<[u8; 64]> { } } +#[expect( + clippy::needless_pass_by_value, + reason = "Zeroizing> is consumed to ensure the source is zeroed on drop" +)] fn zeroizing_fixed_bytes( label: &str, raw: Zeroizing>, diff --git a/lez/sequencer/core/src/lib.rs b/lez/sequencer/core/src/lib.rs index 004424d2..06e41bb0 100644 --- a/lez/sequencer/core/src/lib.rs +++ b/lez/sequencer/core/src/lib.rs @@ -36,6 +36,7 @@ pub mod config; pub mod mock; /// The origin of a transaction. +#[derive(Clone, Copy)] pub enum TransactionOrigin { /// Basic transactions submitted by users via RPC. User, @@ -69,20 +70,17 @@ impl SequencerCore { /// assumed to represent the correct latest state consistent with Bedrock-finalized data. /// If no database is found, the sequencer performs a fresh start from genesis, /// initializing its state with the accounts defined in the configuration file. - fn open_or_create_store( - config: &SequencerConfig, - ) -> (SequencerStore, lee::V03State, Block) { + fn open_or_create_store(config: &SequencerConfig) -> (SequencerStore, lee::V03State, Block) { let signing_key = lee::PrivateKey::try_new(config.signing_key).unwrap(); let db_path = config.home.join("rocksdb"); if db_path.exists() { - let store = - SequencerStore::open_db(&db_path, signing_key.clone()).unwrap_or_else(|err| { - panic!( - "Failed to open database at {} with error: {err}", - db_path.display() - ) - }); + let store = SequencerStore::open_db(&db_path, signing_key).unwrap_or_else(|err| { + panic!( + "Failed to open database at {} with error: {err}", + db_path.display() + ) + }); let state = store .get_lee_state() .expect("Failed to read state from store"); @@ -381,11 +379,7 @@ impl SequencerCore { } self.state - .transition_from_public_transaction( - public_tx, - block_height, - timestamp, - ) + .transition_from_public_transaction(public_tx, block_height, timestamp) .context("Failed to execute sequencer-generated transaction")?; } } diff --git a/lez/wallet/src/account_manager.rs b/lez/wallet/src/account_manager.rs index 87c0b829..77f713c1 100644 --- a/lez/wallet/src/account_manager.rs +++ b/lez/wallet/src/account_manager.rs @@ -226,23 +226,25 @@ impl AccountManager { } prepare_public_keycard_state(wallet, account_id, key_path).await? } - AccountIdentity::PrivateOwned(account_id) => { - State::Private(private_key_tree_acc_preparation(wallet, account_id, false).await?) - } + AccountIdentity::PrivateOwned(account_id) => State::Private( + private_key_tree_acc_preparation(wallet, account_id, false).await?, + ), AccountIdentity::PrivateForeign { npk, vpk, identifier, } => State::Private(private_foreign_acc_preparation(npk, vpk, identifier)), - AccountIdentity::PrivatePdaOwned(account_id) => { - State::Private(private_key_tree_acc_preparation(wallet, account_id, true).await?) - } + AccountIdentity::PrivatePdaOwned(account_id) => State::Private( + private_key_tree_acc_preparation(wallet, account_id, true).await?, + ), AccountIdentity::PrivatePdaForeign { account_id, npk, vpk, identifier, - } => State::Private(private_pda_foreign_acc_preparation(account_id, npk, vpk, identifier)), + } => State::Private(private_pda_foreign_acc_preparation( + account_id, npk, vpk, identifier, + )), AccountIdentity::PrivateShared { nsk, npk, @@ -251,7 +253,10 @@ impl AccountManager { } => { let account_id = lee::AccountId::from((&npk, identifier)); State::Private( - private_shared_acc_preparation(wallet, account_id, nsk, npk, vpk, identifier, false).await?, + private_shared_acc_preparation( + wallet, account_id, nsk, npk, vpk, identifier, false, + ) + .await?, ) } AccountIdentity::PrivatePdaShared { @@ -261,7 +266,10 @@ impl AccountManager { vpk, identifier, } => State::Private( - private_shared_acc_preparation(wallet, account_id, nsk, npk, vpk, identifier, true).await?, + private_shared_acc_preparation( + wallet, account_id, nsk, npk, vpk, identifier, true, + ) + .await?, ), }; @@ -459,7 +467,7 @@ async fn prepare_public_state( } else { None }; - let account = AccountWithMetadata::new(acc.clone(), sk.is_some(), account_id); + let account = AccountWithMetadata::new(acc, sk.is_some(), account_id); Ok(State::Public { account, sk }) } @@ -472,7 +480,7 @@ async fn prepare_public_keycard_state( .get_account_public(account_id) .await .map_err(ExecutionFailureKind::SequencerError)?; - let account = AccountWithMetadata::new(acc.clone(), true, account_id); + let account = AccountWithMetadata::new(acc, true, account_id); Ok(State::PublicKeycard { account, key_path }) } diff --git a/lez/wallet/src/cli/account.rs b/lez/wallet/src/cli/account.rs index efa8dbf5..b49cfb25 100644 --- a/lez/wallet/src/cli/account.rs +++ b/lez/wallet/src/cli/account.rs @@ -126,7 +126,7 @@ pub enum NewSubcommand { } impl NewSubcommand { - async fn handle_public( + fn handle_public( cci: Option, label: Option