From 8d09f2ff56d1563c4a43c37db0cbfabd412ea905 Mon Sep 17 00:00:00 2001 From: Sergio Chouhy Date: Sat, 19 Jul 2025 19:12:56 -0300 Subject: [PATCH] clippy --- risc0-selective-privacy-poc/core/src/lib.rs | 5 +---- .../mocked_components/client/transfer_deshielded.rs | 2 +- .../examples/mocked_components/sequencer/mod.rs | 7 +++---- .../sequencer/process_privacy_execution.rs | 5 +---- .../sequencer/process_public_execution.rs | 2 +- risc0-selective-privacy-poc/examples/private_execution.rs | 2 +- risc0-selective-privacy-poc/examples/public_execution.rs | 1 - risc0-selective-privacy-poc/src/lib.rs | 5 ++--- 8 files changed, 10 insertions(+), 19 deletions(-) diff --git a/risc0-selective-privacy-poc/core/src/lib.rs b/risc0-selective-privacy-poc/core/src/lib.rs index 990071f..7650de1 100644 --- a/risc0-selective-privacy-poc/core/src/lib.rs +++ b/risc0-selective-privacy-poc/core/src/lib.rs @@ -2,10 +2,7 @@ pub mod account; pub mod types; pub mod visibility; -use crate::{ - account::Account, - types::{AuthenticationPath, Commitment, Key, Nullifier}, -}; +use crate::types::{AuthenticationPath, Commitment, Key, Nullifier}; use risc0_zkvm::sha::{Impl, Sha256}; pub fn hash(bytes: &[u32]) -> [u32; 8] { diff --git a/risc0-selective-privacy-poc/examples/mocked_components/client/transfer_deshielded.rs b/risc0-selective-privacy-poc/examples/mocked_components/client/transfer_deshielded.rs index 185a407..89d581f 100644 --- a/risc0-selective-privacy-poc/examples/mocked_components/client/transfer_deshielded.rs +++ b/risc0-selective-privacy-poc/examples/mocked_components/client/transfer_deshielded.rs @@ -22,7 +22,7 @@ impl MockedClient { let sender_commitment_auth_path = sequencer.get_authentication_path_for(&from_account.commitment()); // Fetch public account to deshield to - let to_account = sequencer.get_account(&to_address).unwrap(); + let to_account = sequencer.get_account(to_address).unwrap(); // Set account visibilities // First entry is the private sender. Second entry is the public receiver diff --git a/risc0-selective-privacy-poc/examples/mocked_components/sequencer/mod.rs b/risc0-selective-privacy-poc/examples/mocked_components/sequencer/mod.rs index aab2710..09501f9 100644 --- a/risc0-selective-privacy-poc/examples/mocked_components/sequencer/mod.rs +++ b/risc0-selective-privacy-poc/examples/mocked_components/sequencer/mod.rs @@ -1,11 +1,10 @@ use core::{ account::Account, bytes_to_words, - types::{Address, AuthenticationPath, Commitment, Nullifier, ProgramId}, + types::{Address, AuthenticationPath, Commitment, Nullifier}, }; use std::collections::{BTreeMap, HashSet}; -use program_methods::{PINATA_ID, TRANSFER_ID, TRANSFER_MULTIPLE_ID}; use sparse_merkle_tree::SparseMerkleTree; use crate::mocked_components::USER_CLIENTS; @@ -90,7 +89,7 @@ pub fn print_accounts(sequencer: &MockedSequencer, private_accounts: &[&Account] println!("{:-<20}", ""); for commitment in sequencer.commitment_tree.values().iter() { - println!("{:<20x}", commitment); + println!("{commitment:<20x}"); } println!("{:-<20}\n", ""); @@ -105,7 +104,7 @@ pub fn print_accounts(sequencer: &MockedSequencer, private_accounts: &[&Account] println!("{:-<20}", ""); for entry in formatted { - println!("{:<20}", entry); + println!("{entry:<20}"); } println!("{:-<20}\n", ""); diff --git a/risc0-selective-privacy-poc/examples/mocked_components/sequencer/process_privacy_execution.rs b/risc0-selective-privacy-poc/examples/mocked_components/sequencer/process_privacy_execution.rs index ce1715a..af240fc 100644 --- a/risc0-selective-privacy-poc/examples/mocked_components/sequencer/process_privacy_execution.rs +++ b/risc0-selective-privacy-poc/examples/mocked_components/sequencer/process_privacy_execution.rs @@ -1,7 +1,4 @@ -use core::{ - account::Account, - types::{Commitment, Nullifier, PrivacyExecutionOutput}, -}; +use core::types::PrivacyExecutionOutput; use risc0_zkvm::Receipt; diff --git a/risc0-selective-privacy-poc/examples/mocked_components/sequencer/process_public_execution.rs b/risc0-selective-privacy-poc/examples/mocked_components/sequencer/process_public_execution.rs index 70c14b4..87df57a 100644 --- a/risc0-selective-privacy-poc/examples/mocked_components/sequencer/process_public_execution.rs +++ b/risc0-selective-privacy-poc/examples/mocked_components/sequencer/process_public_execution.rs @@ -77,6 +77,6 @@ impl MockedSequencer { return false; } - return true; + true } } diff --git a/risc0-selective-privacy-poc/examples/private_execution.rs b/risc0-selective-privacy-poc/examples/private_execution.rs index 6963598..af80da9 100644 --- a/risc0-selective-privacy-poc/examples/private_execution.rs +++ b/risc0-selective-privacy-poc/examples/private_execution.rs @@ -1,7 +1,7 @@ use core::{ account::Account, bytes_to_words, - types::{Address, AuthenticationPath, Commitment, Nullifier}, + types::{Address, AuthenticationPath}, visibility::AccountVisibility, }; use nssa::program::TransferMultipleProgram; diff --git a/risc0-selective-privacy-poc/examples/public_execution.rs b/risc0-selective-privacy-poc/examples/public_execution.rs index 68dabf3..1bedb07 100644 --- a/risc0-selective-privacy-poc/examples/public_execution.rs +++ b/risc0-selective-privacy-poc/examples/public_execution.rs @@ -1,6 +1,5 @@ use core::account::Account; -use nssa; use nssa::program::TransferMultipleProgram; diff --git a/risc0-selective-privacy-poc/src/lib.rs b/risc0-selective-privacy-poc/src/lib.rs index 514b2a6..03d8869 100644 --- a/risc0-selective-privacy-poc/src/lib.rs +++ b/risc0-selective-privacy-poc/src/lib.rs @@ -1,6 +1,6 @@ use core::{ account::Account, - types::{Commitment, Nonce, Nullifier, ProgramOutput}, + types::{Nonce, ProgramOutput}, visibility::AccountVisibility, }; use program_methods::{OUTER_ELF, OUTER_ID}; @@ -95,12 +95,11 @@ pub fn execute_offchain( commitment_tree_root: [u32; 8], ) -> Result<(Receipt, Vec), ()> { // Prove inner program and get post state of the accounts - let num_inputs = inputs.len(); let inner_receipt = execute_and_prove_inner::

(inputs, instruction_data)?; let inner_program_output: ProgramOutput = inner_receipt.journal.decode().map_err(|_| ())?; // Sample fresh random nonces for the outputs of this execution - let output_nonces: Vec<_> = (0..num_inputs).map(|_| new_random_nonce()).collect(); + let output_nonces: Vec<_> = (0..inputs.len()).map(|_| new_random_nonce()).collect(); // Prove outer program. let mut env_builder = ExecutorEnv::builder();