This commit is contained in:
Sergio Chouhy 2025-07-19 19:12:56 -03:00
parent e6d1c67c5f
commit 8d09f2ff56
8 changed files with 10 additions and 19 deletions

View File

@ -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] {

View File

@ -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

View File

@ -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", "");

View File

@ -1,7 +1,4 @@
use core::{
account::Account,
types::{Commitment, Nullifier, PrivacyExecutionOutput},
};
use core::types::PrivacyExecutionOutput;
use risc0_zkvm::Receipt;

View File

@ -77,6 +77,6 @@ impl MockedSequencer {
return false;
}
return true;
true
}
}

View File

@ -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;

View File

@ -1,6 +1,5 @@
use core::account::Account;
use nssa;
use nssa::program::TransferMultipleProgram;

View File

@ -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<P: Program>(
commitment_tree_root: [u32; 8],
) -> Result<(Receipt, Vec<Account>), ()> {
// Prove inner program and get post state of the accounts
let num_inputs = inputs.len();
let inner_receipt = execute_and_prove_inner::<P>(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();