diff --git a/integration_tests/src/config.rs b/integration_tests/src/config.rs index c4718f71..008f7700 100644 --- a/integration_tests/src/config.rs +++ b/integration_tests/src/config.rs @@ -121,7 +121,7 @@ impl InitialData { self.private_accounts .iter() .map(|(key_chain, account)| PrivateAccountPublicInitialData { - npk: key_chain.nullifier_public_key.clone(), + npk: key_chain.nullifier_public_key, account: account.clone(), }) .collect() diff --git a/integration_tests/tests/tps.rs b/integration_tests/tests/tps.rs index bd46849e..8b49c3be 100644 --- a/integration_tests/tests/tps.rs +++ b/integration_tests/tests/tps.rs @@ -250,8 +250,8 @@ fn build_privacy_transaction() -> PrivacyPreservingTransaction { Program::serialize_instruction(balance_to_move).unwrap(), vec![1, 2], vec![ - (sender_npk.clone(), sender_ss), - (recipient_npk.clone(), recipient_ss), + (sender_npk, sender_ss), + (recipient_npk, recipient_ss), ], vec![sender_nsk], vec![Some(proof)], diff --git a/sequencer/core/src/lib.rs b/sequencer/core/src/lib.rs index cbf8e910..47037fbd 100644 --- a/sequencer/core/src/lib.rs +++ b/sequencer/core/src/lib.rs @@ -1094,7 +1094,7 @@ mod tests { // Start a sequencer from config with a preconfigured private genesis account let mut config = setup_sequencer_config(); config.initial_private_accounts = Some(vec![PrivateAccountPublicInitialData { - npk: npk.clone(), + npk, account: genesis_account, }]); @@ -1110,7 +1110,7 @@ mod tests { vec![AccountWithMetadata::new(Account::default(), true, &npk)], Program::serialize_instruction(0_u128).unwrap(), vec![1], - vec![(npk.clone(), shared_secret)], + vec![(npk, shared_secret)], vec![nsk], vec![None], &Program::authenticated_transfer_program().into(), diff --git a/wallet/src/lib.rs b/wallet/src/lib.rs index 63ea8611..460cfcfd 100644 --- a/wallet/src/lib.rs +++ b/wallet/src/lib.rs @@ -393,7 +393,7 @@ impl WalletCore { acc_manager.visibility_mask().to_vec(), private_account_keys .iter() - .map(|keys| (keys.npk.clone(), keys.ssk)) + .map(|keys| (keys.npk, keys.ssk)) .collect::>(), acc_manager.private_account_auth(), acc_manager.private_account_membership_proofs(), @@ -407,7 +407,7 @@ impl WalletCore { Vec::from_iter(acc_manager.public_account_nonces()), private_account_keys .iter() - .map(|keys| (keys.npk.clone(), keys.vpk.clone(), keys.epk.clone())) + .map(|keys| (keys.npk, keys.vpk.clone(), keys.epk.clone())) .collect(), output, ) diff --git a/wallet/src/pinata_interactions.rs b/wallet/src/pinata_interactions.rs index b883e7e6..77549772 100644 --- a/wallet/src/pinata_interactions.rs +++ b/wallet/src/pinata_interactions.rs @@ -59,7 +59,7 @@ impl WalletCore { &nssa::program::Program::serialize_instruction(solution).unwrap(), &[0, 1], &produce_random_nonces(1), - &[(winner_npk.clone(), shared_secret_winner.clone())], + &[(winner_npk, shared_secret_winner.clone())], &[(winner_nsk.unwrap())], &[winner_proof], &program.into(), @@ -71,7 +71,7 @@ impl WalletCore { vec![pinata_account_id], vec![], vec![( - winner_npk.clone(), + winner_npk, winner_vpk.clone(), eph_holder_winner.generate_ephemeral_public_key(), )], @@ -126,7 +126,7 @@ impl WalletCore { &nssa::program::Program::serialize_instruction(solution).unwrap(), &[0, 2], &produce_random_nonces(1), - &[(winner_npk.clone(), shared_secret_winner.clone())], + &[(winner_npk, shared_secret_winner.clone())], &[], &[], &program.into(), @@ -138,7 +138,7 @@ impl WalletCore { vec![pinata_account_id], vec![], vec![( - winner_npk.clone(), + winner_npk, winner_vpk.clone(), eph_holder_winner.generate_ephemeral_public_key(), )], diff --git a/wallet/src/privacy_preserving_tx.rs b/wallet/src/privacy_preserving_tx.rs index 04056111..14a805c7 100644 --- a/wallet/src/privacy_preserving_tx.rs +++ b/wallet/src/privacy_preserving_tx.rs @@ -138,7 +138,7 @@ impl AccountManager { let eph_holder = EphemeralKeyHolder::new(&pre.npk); Some(PrivateAccountKeys { - npk: pre.npk.clone(), + npk: pre.npk, ssk: eph_holder.calculate_shared_secret_sender(&pre.vpk), vpk: pre.vpk.clone(), epk: eph_holder.generate_ephemeral_public_key(), diff --git a/wallet/src/transaction_utils.rs b/wallet/src/transaction_utils.rs index 1bcb971f..f2def802 100644 --- a/wallet/src/transaction_utils.rs +++ b/wallet/src/transaction_utils.rs @@ -108,8 +108,8 @@ impl WalletCore { &[1, 1], &produce_random_nonces(2), &[ - (from_npk.clone(), shared_secret_from.clone()), - (to_npk.clone(), shared_secret_to.clone()), + (from_npk, shared_secret_from.clone()), + (to_npk, shared_secret_to.clone()), ], &[ (from_nsk.unwrap(), from_proof.unwrap()), @@ -124,12 +124,12 @@ impl WalletCore { vec![], vec![ ( - from_npk.clone(), + from_npk, from_vpk.clone(), eph_holder_from.generate_ephemeral_public_key(), ), ( - to_npk.clone(), + to_npk, to_vpk.clone(), eph_holder_to.generate_ephemeral_public_key(), ), @@ -185,8 +185,8 @@ impl WalletCore { &[1, 2], &produce_random_nonces(2), &[ - (from_npk.clone(), shared_secret_from.clone()), - (to_npk.clone(), shared_secret_to.clone()), + (from_npk, shared_secret_from.clone()), + (to_npk, shared_secret_to.clone()), ], &[(from_nsk.unwrap(), from_proof.unwrap())], &program.into(), @@ -198,12 +198,12 @@ impl WalletCore { vec![], vec![ ( - from_npk.clone(), + from_npk, from_vpk.clone(), eph_holder_from.generate_ephemeral_public_key(), ), ( - to_npk.clone(), + to_npk, to_vpk.clone(), eph_holder_to.generate_ephemeral_public_key(), ), @@ -255,8 +255,8 @@ impl WalletCore { &[1, 2], &produce_random_nonces(2), &[ - (from_npk.clone(), shared_secret_from.clone()), - (to_npk.clone(), shared_secret_to.clone()), + (from_npk, shared_secret_from.clone()), + (to_npk, shared_secret_to.clone()), ], &[(from_nsk.unwrap(), from_proof.unwrap())], &program.into(), @@ -268,12 +268,12 @@ impl WalletCore { vec![], vec![ ( - from_npk.clone(), + from_npk, from_vpk.clone(), eph_holder.generate_ephemeral_public_key(), ), ( - to_npk.clone(), + to_npk, to_vpk.clone(), eph_holder.generate_ephemeral_public_key(), ), @@ -324,7 +324,7 @@ impl WalletCore { &instruction_data, &[1, 0], &produce_random_nonces(1), - &[(from_npk.clone(), shared_secret.clone())], + &[(from_npk, shared_secret.clone())], &[(from_nsk.unwrap(), from_proof.unwrap())], &program.into(), ) @@ -334,7 +334,7 @@ impl WalletCore { vec![to], vec![], vec![( - from_npk.clone(), + from_npk, from_vpk.clone(), eph_holder.generate_ephemeral_public_key(), )], @@ -385,7 +385,7 @@ impl WalletCore { &instruction_data, &[0, 1], &produce_random_nonces(1), - &[(to_npk.clone(), shared_secret.clone())], + &[(to_npk, shared_secret.clone())], &[(to_nsk.unwrap(), to_proof)], &program.into(), ) @@ -395,7 +395,7 @@ impl WalletCore { vec![from], vec![from_acc.nonce], vec![( - to_npk.clone(), + to_npk, to_vpk.clone(), eph_holder.generate_ephemeral_public_key(), )], @@ -451,7 +451,7 @@ impl WalletCore { &instruction_data, &[0, 2], &produce_random_nonces(1), - &[(to_npk.clone(), shared_secret.clone())], + &[(to_npk, shared_secret.clone())], &[], &program.into(), ) @@ -461,7 +461,7 @@ impl WalletCore { vec![from], vec![from_acc.nonce], vec![( - to_npk.clone(), + to_npk, to_vpk.clone(), eph_holder.generate_ephemeral_public_key(), )], @@ -513,7 +513,7 @@ impl WalletCore { &instruction_data, &[0, 2], &produce_random_nonces(1), - &[(to_npk.clone(), shared_secret.clone())], + &[(to_npk, shared_secret.clone())], &[], &program.into(), ) @@ -523,7 +523,7 @@ impl WalletCore { vec![from], vec![from_acc.nonce], vec![( - to_npk.clone(), + to_npk, to_vpk.clone(), eph_holder.generate_ephemeral_public_key(), )], @@ -565,7 +565,7 @@ impl WalletCore { &Program::serialize_instruction(instruction).unwrap(), &[2], &produce_random_nonces(1), - &[(from_npk.clone(), shared_secret_from.clone())], + &[(from_npk, shared_secret_from.clone())], &[], &Program::authenticated_transfer_program().into(), ) @@ -575,7 +575,7 @@ impl WalletCore { vec![], vec![], vec![( - from_npk.clone(), + from_npk, from_vpk.clone(), eph_holder_from.generate_ephemeral_public_key(), )],