diff --git a/integration_tests/tests/auth_transfer/private.rs b/integration_tests/tests/auth_transfer/private.rs index af016dc6..da0938c7 100644 --- a/integration_tests/tests/auth_transfer/private.rs +++ b/integration_tests/tests/auth_transfer/private.rs @@ -638,7 +638,7 @@ async fn prove_init_with_commitment_root( })?, vec![ InputAccountIdentity::Public, - InputAccountIdentity::PrivateUnauthorized { + InputAccountIdentity::PrivateForeignInit { vpk, random_seed: [0; 32], npk, diff --git a/integration_tests/tests/tps.rs b/integration_tests/tests/tps.rs index 71fb132b..d4cda513 100644 --- a/integration_tests/tests/tps.rs +++ b/integration_tests/tests/tps.rs @@ -298,7 +298,7 @@ fn build_privacy_transaction() -> PrivacyPreservingTransaction { membership_proof: proof, identifier: 0, }, - InputAccountIdentity::PrivateUnauthorized { + InputAccountIdentity::PrivateForeignInit { vpk: recipient_vpk, random_seed: [0; 32], npk: recipient_npk, diff --git a/lee/privacy_preserving_circuit/src/output.rs b/lee/privacy_preserving_circuit/src/output.rs index c9543e05..8fae795f 100644 --- a/lee/privacy_preserving_circuit/src/output.rs +++ b/lee/privacy_preserving_circuit/src/output.rs @@ -117,7 +117,7 @@ pub fn compute_circuit_output( new_nonce, ); } - InputAccountIdentity::PrivateUnauthorized { + InputAccountIdentity::PrivateForeignInit { vpk, random_seed, npk, @@ -133,8 +133,8 @@ pub fn compute_circuit_output( "Found new private account with non default values", ); assert!( - !pre_state.is_authorized, - "Found new private account marked as authorized." + pre_state.is_authorized, + "Found new private account marked as unauthorized." ); let new_nullifier = ( diff --git a/lee/state_machine/core/src/circuit_io.rs b/lee/state_machine/core/src/circuit_io.rs index d441ff19..1cac1df6 100644 --- a/lee/state_machine/core/src/circuit_io.rs +++ b/lee/state_machine/core/src/circuit_io.rs @@ -48,7 +48,7 @@ pub enum InputAccountIdentity { }, /// Init of a standalone private account the caller does not own (e.g. a recipient who /// doesn't yet exist on chain). No `nsk`, no membership proof. - PrivateUnauthorized { + PrivateForeignInit { vpk: ViewingPublicKey, random_seed: [u8; 32], npk: NullifierPublicKey, @@ -125,7 +125,7 @@ impl InputAccountIdentity { Self::Public | Self::PrivateAuthorizedInit { .. } | Self::PrivateAuthorizedUpdate { .. } - | Self::PrivateUnauthorized { .. } => None, + | Self::PrivateForeignInit { .. } => None, } } } diff --git a/lee/state_machine/src/privacy_preserving_transaction/circuit/tests.rs b/lee/state_machine/src/privacy_preserving_transaction/circuit/tests.rs index 005a9230..ac9db51b 100644 --- a/lee/state_machine/src/privacy_preserving_transaction/circuit/tests.rs +++ b/lee/state_machine/src/privacy_preserving_transaction/circuit/tests.rs @@ -89,7 +89,7 @@ fn prove_privacy_preserving_execution_circuit_public_and_private_pre_accounts() Program::serialize_instruction(balance_to_move).unwrap(), vec![ InputAccountIdentity::Public, - InputAccountIdentity::PrivateUnauthorized { + InputAccountIdentity::PrivateForeignInit { vpk: recipient_keys.vpk(), random_seed: [0; 32], npk: recipient_keys.npk(), @@ -204,7 +204,7 @@ fn prove_privacy_preserving_execution_circuit_fully_private() { .expect("sender's commitment must be in the set"), identifier: 0, }, - InputAccountIdentity::PrivateUnauthorized { + InputAccountIdentity::PrivateForeignInit { vpk: recipient_keys.vpk(), random_seed: [0; 32], npk: recipient_keys.npk(), @@ -271,7 +271,7 @@ fn circuit_fails_when_chained_validity_windows_have_empty_intersection() { let result = execute_and_prove( vec![pre], instruction, - vec![InputAccountIdentity::PrivateUnauthorized { + vec![InputAccountIdentity::PrivateForeignInit { vpk: account_keys.vpk(), random_seed: [0; 32], npk: account_keys.npk(), @@ -455,7 +455,7 @@ fn shared_account_receives_via_simple_transfer() { instruction, vec![ InputAccountIdentity::Public, - InputAccountIdentity::PrivateUnauthorized { + InputAccountIdentity::PrivateForeignInit { vpk: shared_keys.vpk(), random_seed: [0; 32], npk: shared_npk, @@ -507,7 +507,7 @@ fn private_authorized_init_encrypts_regular_kind_with_identifier() { ); } -/// `PrivateUnauthorized` with a non-default identifier produces a ciphertext that decrypts +/// `PrivateForeignInit` with a non-default identifier produces a ciphertext that decrypts /// to `PrivateAccountKind::Regular` carrying the correct identifier. #[test] fn private_unauthorized_init_encrypts_regular_kind_with_identifier() { @@ -526,7 +526,7 @@ fn private_unauthorized_init_encrypts_regular_kind_with_identifier() { let (output, _) = execute_and_prove( vec![recipient], Program::serialize_instruction(()).unwrap(), - vec![InputAccountIdentity::PrivateUnauthorized { + vec![InputAccountIdentity::PrivateForeignInit { vpk: keys.vpk(), random_seed: [0; 32], npk: keys.npk(), diff --git a/lee/state_machine/src/state/tests/circuit.rs b/lee/state_machine/src/state/tests/circuit.rs index c13a7370..4875c76a 100644 --- a/lee/state_machine/src/state/tests/circuit.rs +++ b/lee/state_machine/src/state/tests/circuit.rs @@ -68,7 +68,7 @@ fn circuit_fails_if_invalid_auth_keys_are_provided() { membership_proof: (0, vec![]), identifier: 0, }, - InputAccountIdentity::PrivateUnauthorized { + InputAccountIdentity::PrivateForeignInit { vpk: recipient_keys.vpk(), random_seed: [0; 32], npk: recipient_keys.npk(), @@ -117,7 +117,7 @@ fn circuit_should_fail_if_new_private_account_with_non_default_balance_is_provid membership_proof: (0, vec![]), identifier: 0, }, - InputAccountIdentity::PrivateUnauthorized { + InputAccountIdentity::PrivateForeignInit { vpk: recipient_keys.vpk(), random_seed: [0; 32], npk: recipient_keys.npk(), @@ -166,7 +166,7 @@ fn circuit_should_fail_if_new_private_account_with_non_default_program_owner_is_ membership_proof: (0, vec![]), identifier: 0, }, - InputAccountIdentity::PrivateUnauthorized { + InputAccountIdentity::PrivateForeignInit { vpk: recipient_keys.vpk(), random_seed: [0; 32], npk: recipient_keys.npk(), @@ -215,7 +215,7 @@ fn circuit_should_fail_if_new_private_account_with_non_default_data_is_provided( membership_proof: (0, vec![]), identifier: 0, }, - InputAccountIdentity::PrivateUnauthorized { + InputAccountIdentity::PrivateForeignInit { vpk: recipient_keys.vpk(), random_seed: [0; 32], npk: recipient_keys.npk(), @@ -264,7 +264,7 @@ fn circuit_should_fail_if_new_private_account_with_non_default_nonce_is_provided membership_proof: (0, vec![]), identifier: 0, }, - InputAccountIdentity::PrivateUnauthorized { + InputAccountIdentity::PrivateForeignInit { vpk: recipient_keys.vpk(), random_seed: [0; 32], npk: recipient_keys.npk(), @@ -311,7 +311,7 @@ fn circuit_should_fail_if_new_private_account_is_provided_with_default_values_bu membership_proof: (0, vec![]), identifier: 0, }, - InputAccountIdentity::PrivateUnauthorized { + InputAccountIdentity::PrivateForeignInit { vpk: recipient_keys.vpk(), random_seed: [0; 32], npk: recipient_keys.npk(), @@ -782,7 +782,7 @@ fn private_unauthorized_uninitialized_account_can_still_be_claimed() { let (output, proof) = execute_and_prove( vec![unauthorized_account], Program::serialize_instruction(()).unwrap(), - vec![InputAccountIdentity::PrivateUnauthorized { + vec![InputAccountIdentity::PrivateForeignInit { vpk: private_keys.vpk(), random_seed: [0; 32], npk: private_keys.npk(), diff --git a/lee/state_machine/src/state/tests/mod.rs b/lee/state_machine/src/state/tests/mod.rs index 55a99ead..1d6b87a2 100644 --- a/lee/state_machine/src/state/tests/mod.rs +++ b/lee/state_machine/src/state/tests/mod.rs @@ -278,7 +278,7 @@ fn shielded_balance_transfer_for_tests( Program::serialize_instruction(balance_to_move).unwrap(), vec![ InputAccountIdentity::Public, - InputAccountIdentity::PrivateUnauthorized { + InputAccountIdentity::PrivateForeignInit { vpk: recipient_keys.vpk(), random_seed: [0; 32], npk: recipient_keys.npk(), @@ -336,7 +336,7 @@ fn private_balance_transfer_for_tests( .expect("sender's commitment must be in state"), identifier: 0, }, - InputAccountIdentity::PrivateUnauthorized { + InputAccountIdentity::PrivateForeignInit { vpk: recipient_keys.vpk(), random_seed: [0; 32], npk: recipient_keys.npk(), diff --git a/lee/state_machine/src/state/tests/validity_window.rs b/lee/state_machine/src/state/tests/validity_window.rs index 12e7c229..4581aa89 100644 --- a/lee/state_machine/src/state/tests/validity_window.rs +++ b/lee/state_machine/src/state/tests/validity_window.rs @@ -138,7 +138,7 @@ fn validity_window_works_in_privacy_preserving_transactions( let (output, proof) = crate::privacy_preserving_transaction::circuit::execute_and_prove( vec![pre], Program::serialize_instruction(instruction).unwrap(), - vec![InputAccountIdentity::PrivateUnauthorized { + vec![InputAccountIdentity::PrivateForeignInit { vpk: account_keys.vpk(), random_seed: [0; 32], npk: account_keys.npk(), @@ -203,7 +203,7 @@ fn timestamp_validity_window_works_in_privacy_preserving_transactions( let (output, proof) = crate::privacy_preserving_transaction::circuit::execute_and_prove( vec![pre], Program::serialize_instruction(instruction).unwrap(), - vec![InputAccountIdentity::PrivateUnauthorized { + vec![InputAccountIdentity::PrivateForeignInit { vpk: account_keys.vpk(), random_seed: [0; 32], npk: account_keys.npk(), diff --git a/lez/wallet/src/account_manager.rs b/lez/wallet/src/account_manager.rs index a5f900d6..a7bd00b5 100644 --- a/lez/wallet/src/account_manager.rs +++ b/lez/wallet/src/account_manager.rs @@ -262,7 +262,7 @@ impl AccountManager { identifier, } => { let acc = lee_core::account::Account::default(); - let auth_acc = AccountWithMetadata::new(acc, false, (&npk, &vpk, identifier)); + let auth_acc = AccountWithMetadata::new(acc, true, (&npk, &vpk, identifier)); let mut random_seed: [u8; 32] = [0; 32]; OsRng.fill_bytes(&mut random_seed); let pre = AccountPreparedData { @@ -454,7 +454,7 @@ impl AccountManager { identifier: pre.identifier, commitment_root: self.dummy_commitment_root, }, - (None, _) => InputAccountIdentity::PrivateUnauthorized { + (None, _) => InputAccountIdentity::PrivateForeignInit { vpk: pre.vpk.clone(), random_seed: pre.random_seed, npk: pre.npk,