From 0d46f0798a42d8347ed951316b3b07e1bd7886f4 Mon Sep 17 00:00:00 2001 From: Sergio Chouhy Date: Thu, 19 Mar 2026 18:50:45 -0300 Subject: [PATCH] clippy --- bedrock_client/src/lib.rs | 2 +- common/src/sequencer_client.rs | 2 +- .../src/pages/transaction_page.rs | 11 +++++++++ indexer/service/src/mock_service.rs | 3 ++- integration_tests/src/config.rs | 2 +- nssa/src/state.rs | 4 ++-- programs/amm/src/tests.rs | 14 +++++------ sequencer_core/src/lib.rs | 4 ++-- sequencer_rpc/src/process.rs | 2 +- wallet-ffi/src/pinata.rs | 9 +++---- wallet-ffi/src/transfer.rs | 24 +++++++------------ 11 files changed, 39 insertions(+), 38 deletions(-) diff --git a/bedrock_client/src/lib.rs b/bedrock_client/src/lib.rs index fdd14f72..4e9bfffd 100644 --- a/bedrock_client/src/lib.rs +++ b/bedrock_client/src/lib.rs @@ -46,7 +46,7 @@ impl BedrockClient { info!("Creating Bedrock client with node URL {node_url}"); let client = Client::builder() //Add more fields if needed - .timeout(std::time::Duration::from_secs(60)) + .timeout(std::time::Duration::from_mins(1)) .build() .context("Failed to build HTTP client")?; diff --git a/common/src/sequencer_client.rs b/common/src/sequencer_client.rs index d52e4585..b75bbe04 100644 --- a/common/src/sequencer_client.rs +++ b/common/src/sequencer_client.rs @@ -55,7 +55,7 @@ impl SequencerClient { Ok(Self { client: Client::builder() // Add more fields if needed - .timeout(std::time::Duration::from_secs(60)) + .timeout(std::time::Duration::from_mins(1)) // Should be kept in sync with server keep-alive settings .pool_idle_timeout(std::time::Duration::from_secs(5)) .build()?, diff --git a/explorer_service/src/pages/transaction_page.rs b/explorer_service/src/pages/transaction_page.rs index 211dc505..963454ea 100644 --- a/explorer_service/src/pages/transaction_page.rs +++ b/explorer_service/src/pages/transaction_page.rs @@ -177,11 +177,18 @@ pub fn TransactionPage() -> impl IntoView { encrypted_private_post_states, new_commitments, new_nullifiers, + validity_window } = message; let WitnessSet { signatures_and_public_keys: _, proof, } = witness_set; + let validity_window_formatted = match validity_window.0 { + (Some(start), Some(end)) => format!("from {start} to {end}"), + (Some(start), None) => format!("from {start}"), + (None, Some(end)) => format!("until {end}"), + (None, None) => "unbounded".to_owned(), + }; let proof_len = proof.0.len(); view! { @@ -212,6 +219,10 @@ pub fn TransactionPage() -> impl IntoView { "Proof Size:" {format!("{proof_len} bytes")} +
+ "Validity Window:" + {validity_window_formatted} +

"Public Accounts"

diff --git a/indexer/service/src/mock_service.rs b/indexer/service/src/mock_service.rs index bc131740..bfd66597 100644 --- a/indexer/service/src/mock_service.rs +++ b/indexer/service/src/mock_service.rs @@ -13,7 +13,7 @@ use indexer_service_protocol::{ CommitmentSetDigest, Data, EncryptedAccountData, HashType, MantleMsgId, PrivacyPreservingMessage, PrivacyPreservingTransaction, ProgramDeploymentMessage, ProgramDeploymentTransaction, ProgramId, PublicMessage, PublicTransaction, Signature, - Transaction, WitnessSet, + Transaction, WitnessSet, ValidityWindow }; use jsonrpsee::{core::SubscriptionResult, types::ErrorObjectOwned}; @@ -121,6 +121,7 @@ impl MockIndexerService { indexer_service_protocol::Nullifier([tx_idx as u8; 32]), CommitmentSetDigest([0xff; 32]), )], + validity_window: ValidityWindow((None, None)), }, witness_set: WitnessSet { signatures_and_public_keys: vec![], diff --git a/integration_tests/src/config.rs b/integration_tests/src/config.rs index 4d8539cc..16d6c359 100644 --- a/integration_tests/src/config.rs +++ b/integration_tests/src/config.rs @@ -211,7 +211,7 @@ pub fn sequencer_config( max_block_size, mempool_max_size, block_create_timeout, - retry_pending_blocks_timeout: Duration::from_secs(120), + retry_pending_blocks_timeout: Duration::from_mins(2), port: 0, initial_accounts: initial_data.sequencer_initial_accounts(), initial_commitments: initial_data.sequencer_initial_commitments(), diff --git a/nssa/src/state.rs b/nssa/src/state.rs index ba372879..ec2950fb 100644 --- a/nssa/src/state.rs +++ b/nssa/src/state.rs @@ -3044,7 +3044,7 @@ pub mod tests { if is_inside_validity_window { assert!(result.is_ok()); } else { - assert!(matches!(result, Err(NssaError::OutOfValidityWindow))) + assert!(matches!(result, Err(NssaError::OutOfValidityWindow))); } } @@ -3106,7 +3106,7 @@ pub mod tests { if is_inside_validity_window { assert!(result.is_ok()); } else { - assert!(matches!(result, Err(NssaError::OutOfValidityWindow))) + assert!(matches!(result, Err(NssaError::OutOfValidityWindow))); } } diff --git a/programs/amm/src/tests.rs b/programs/amm/src/tests.rs index e1e8698d..63692c4d 100644 --- a/programs/amm/src/tests.rs +++ b/programs/amm/src/tests.rs @@ -2741,7 +2741,7 @@ fn simple_amm_remove() { ); let tx = PublicTransaction::new(message, witness_set); - state.transition_from_public_transaction(&tx).unwrap(); + state.transition_from_public_transaction(&tx, 1).unwrap(); let pool_post = state.get_account_by_id(IdForExeTests::pool_definition_id()); let vault_a_post = state.get_account_by_id(IdForExeTests::vault_a_id()); @@ -2822,7 +2822,7 @@ fn simple_amm_new_definition_inactive_initialized_pool_and_uninit_user_lp() { ); let tx = PublicTransaction::new(message, witness_set); - state.transition_from_public_transaction(&tx).unwrap(); + state.transition_from_public_transaction(&tx, 1).unwrap(); let pool_post = state.get_account_by_id(IdForExeTests::pool_definition_id()); let vault_a_post = state.get_account_by_id(IdForExeTests::vault_a_id()); @@ -2907,7 +2907,7 @@ fn simple_amm_new_definition_inactive_initialized_pool_init_user_lp() { ); let tx = PublicTransaction::new(message, witness_set); - state.transition_from_public_transaction(&tx).unwrap(); + state.transition_from_public_transaction(&tx, 1).unwrap(); let pool_post = state.get_account_by_id(IdForExeTests::pool_definition_id()); let vault_a_post = state.get_account_by_id(IdForExeTests::vault_a_id()); @@ -2980,7 +2980,7 @@ fn simple_amm_new_definition_uninitialized_pool() { ); let tx = PublicTransaction::new(message, witness_set); - state.transition_from_public_transaction(&tx).unwrap(); + state.transition_from_public_transaction(&tx, 1).unwrap(); let pool_post = state.get_account_by_id(IdForExeTests::pool_definition_id()); let vault_a_post = state.get_account_by_id(IdForExeTests::vault_a_id()); @@ -3043,7 +3043,7 @@ fn simple_amm_add() { ); let tx = PublicTransaction::new(message, witness_set); - state.transition_from_public_transaction(&tx).unwrap(); + state.transition_from_public_transaction(&tx, 1).unwrap(); let pool_post = state.get_account_by_id(IdForExeTests::pool_definition_id()); let vault_a_post = state.get_account_by_id(IdForExeTests::vault_a_id()); @@ -3101,7 +3101,7 @@ fn simple_amm_swap_1() { ); let tx = PublicTransaction::new(message, witness_set); - state.transition_from_public_transaction(&tx).unwrap(); + state.transition_from_public_transaction(&tx, 1).unwrap(); let pool_post = state.get_account_by_id(IdForExeTests::pool_definition_id()); let vault_a_post = state.get_account_by_id(IdForExeTests::vault_a_id()); @@ -3152,7 +3152,7 @@ fn simple_amm_swap_2() { ); let tx = PublicTransaction::new(message, witness_set); - state.transition_from_public_transaction(&tx).unwrap(); + state.transition_from_public_transaction(&tx, 1).unwrap(); let pool_post = state.get_account_by_id(IdForExeTests::pool_definition_id()); let vault_a_post = state.get_account_by_id(IdForExeTests::vault_a_id()); diff --git a/sequencer_core/src/lib.rs b/sequencer_core/src/lib.rs index 949a2796..e2a7b73d 100644 --- a/sequencer_core/src/lib.rs +++ b/sequencer_core/src/lib.rs @@ -336,7 +336,7 @@ impl SequencerCore u64 { self.chain_height .checked_add(1) - .expect(&format!("Max block height reached: {}", self.chain_height)) + .unwrap_or_else(|| panic!("Max block height reached: {}", self.chain_height)) } } @@ -412,7 +412,7 @@ mod tests { node_url: "http://not-used-in-unit-tests".parse().unwrap(), auth: None, }, - retry_pending_blocks_timeout: Duration::from_secs(60 * 4), + retry_pending_blocks_timeout: Duration::from_mins(4), indexer_rpc_url: "ws://localhost:8779".parse().unwrap(), } } diff --git a/sequencer_rpc/src/process.rs b/sequencer_rpc/src/process.rs index 17c46f03..2fe9bed1 100644 --- a/sequencer_rpc/src/process.rs +++ b/sequencer_rpc/src/process.rs @@ -400,7 +400,7 @@ mod tests { initial_accounts, initial_commitments: vec![], signing_key: *sequencer_sign_key_for_testing().value(), - retry_pending_blocks_timeout: Duration::from_secs(60 * 4), + retry_pending_blocks_timeout: Duration::from_mins(4), bedrock_config: BedrockConfig { backoff: BackoffConfig { start_delay: Duration::from_millis(100), diff --git a/wallet-ffi/src/pinata.rs b/wallet-ffi/src/pinata.rs index 7c8e21d0..36838b55 100644 --- a/wallet-ffi/src/pinata.rs +++ b/wallet-ffi/src/pinata.rs @@ -77,8 +77,7 @@ pub unsafe extern "C" fn wallet_ffi_claim_pinata( match block_on(pinata.claim(pinata_id, winner_id, solution)) { Ok(response) => { let tx_hash = CString::new(response.tx_hash.to_string()) - .map(std::ffi::CString::into_raw) - .unwrap_or(ptr::null_mut()); + .map_or(ptr::null_mut(), std::ffi::CString::into_raw); unsafe { (*out_result).tx_hash = tx_hash; @@ -184,8 +183,7 @@ pub unsafe extern "C" fn wallet_ffi_claim_pinata_private_owned_already_initializ ) { Ok((response, _shared_key)) => { let tx_hash = CString::new(response.tx_hash.to_string()) - .map(std::ffi::CString::into_raw) - .unwrap_or(ptr::null_mut()); + .map_or(ptr::null_mut(), std::ffi::CString::into_raw); unsafe { (*out_result).tx_hash = tx_hash; @@ -270,8 +268,7 @@ pub unsafe extern "C" fn wallet_ffi_claim_pinata_private_owned_not_initialized( match block_on(pinata.claim_private_owned_account(pinata_id, winner_id, solution)) { Ok((response, _shared_key)) => { let tx_hash = CString::new(response.tx_hash.to_string()) - .map(std::ffi::CString::into_raw) - .unwrap_or(ptr::null_mut()); + .map_or(ptr::null_mut(), std::ffi::CString::into_raw); unsafe { (*out_result).tx_hash = tx_hash; diff --git a/wallet-ffi/src/transfer.rs b/wallet-ffi/src/transfer.rs index da1892dd..ea188f9b 100644 --- a/wallet-ffi/src/transfer.rs +++ b/wallet-ffi/src/transfer.rs @@ -75,8 +75,7 @@ pub unsafe extern "C" fn wallet_ffi_transfer_public( match block_on(transfer.send_public_transfer(from_id, to_id, amount)) { Ok(response) => { let tx_hash = CString::new(response.tx_hash.to_string()) - .map(std::ffi::CString::into_raw) - .unwrap_or(ptr::null_mut()); + .map_or(ptr::null_mut(), std::ffi::CString::into_raw); unsafe { (*out_result).tx_hash = tx_hash; @@ -165,8 +164,7 @@ pub unsafe extern "C" fn wallet_ffi_transfer_shielded( ) { Ok((response, _shared_key)) => { let tx_hash = CString::new(response.tx_hash) - .map(std::ffi::CString::into_raw) - .unwrap_or(ptr::null_mut()); + .map_or(ptr::null_mut(), std::ffi::CString::into_raw); unsafe { (*out_result).tx_hash = tx_hash; @@ -246,8 +244,7 @@ pub unsafe extern "C" fn wallet_ffi_transfer_deshielded( match block_on(transfer.send_deshielded_transfer(from_id, to_id, amount)) { Ok((response, _shared_key)) => { let tx_hash = CString::new(response.tx_hash) - .map(std::ffi::CString::into_raw) - .unwrap_or(ptr::null_mut()); + .map_or(ptr::null_mut(), std::ffi::CString::into_raw); unsafe { (*out_result).tx_hash = tx_hash; @@ -335,8 +332,7 @@ pub unsafe extern "C" fn wallet_ffi_transfer_private( { Ok((response, _shared_key)) => { let tx_hash = CString::new(response.tx_hash) - .map(std::ffi::CString::into_raw) - .unwrap_or(ptr::null_mut()); + .map_or(ptr::null_mut(), std::ffi::CString::into_raw); unsafe { (*out_result).tx_hash = tx_hash; @@ -419,8 +415,7 @@ pub unsafe extern "C" fn wallet_ffi_transfer_shielded_owned( match block_on(transfer.send_shielded_transfer(from_id, to_id, amount)) { Ok((response, _shared_key)) => { let tx_hash = CString::new(response.tx_hash) - .map(std::ffi::CString::into_raw) - .unwrap_or(ptr::null_mut()); + .map_or(ptr::null_mut(), std::ffi::CString::into_raw); unsafe { (*out_result).tx_hash = tx_hash; @@ -503,8 +498,7 @@ pub unsafe extern "C" fn wallet_ffi_transfer_private_owned( match block_on(transfer.send_private_transfer_to_owned_account(from_id, to_id, amount)) { Ok((response, _shared_keys)) => { let tx_hash = CString::new(response.tx_hash) - .map(std::ffi::CString::into_raw) - .unwrap_or(ptr::null_mut()); + .map_or(ptr::null_mut(), std::ffi::CString::into_raw); unsafe { (*out_result).tx_hash = tx_hash; @@ -575,8 +569,7 @@ pub unsafe extern "C" fn wallet_ffi_register_public_account( match block_on(transfer.register_account(account_id)) { Ok(response) => { let tx_hash = CString::new(response.tx_hash.to_string()) - .map(std::ffi::CString::into_raw) - .unwrap_or(ptr::null_mut()); + .map_or(ptr::null_mut(), std::ffi::CString::into_raw); unsafe { (*out_result).tx_hash = tx_hash; @@ -647,8 +640,7 @@ pub unsafe extern "C" fn wallet_ffi_register_private_account( match block_on(transfer.register_account_private(account_id)) { Ok((res, _secret)) => { let tx_hash = CString::new(res.tx_hash) - .map(std::ffi::CString::into_raw) - .unwrap_or(ptr::null_mut()); + .map_or(ptr::null_mut(), std::ffi::CString::into_raw); unsafe { (*out_result).tx_hash = tx_hash;