diff --git a/artifacts/lee/privacy_preserving_circuit/privacy_preserving_circuit.bin b/artifacts/lee/privacy_preserving_circuit/privacy_preserving_circuit.bin index 57eead3b..b68ee11b 100644 Binary files a/artifacts/lee/privacy_preserving_circuit/privacy_preserving_circuit.bin and b/artifacts/lee/privacy_preserving_circuit/privacy_preserving_circuit.bin differ diff --git a/artifacts/lez/programs/amm.bin b/artifacts/lez/programs/amm.bin index 1cd07ff0..1ceee2e9 100644 Binary files a/artifacts/lez/programs/amm.bin and b/artifacts/lez/programs/amm.bin differ diff --git a/artifacts/lez/programs/associated_token_account.bin b/artifacts/lez/programs/associated_token_account.bin index 0a5310b4..d57b256c 100644 Binary files a/artifacts/lez/programs/associated_token_account.bin and b/artifacts/lez/programs/associated_token_account.bin differ diff --git a/artifacts/lez/programs/authenticated_transfer.bin b/artifacts/lez/programs/authenticated_transfer.bin index 60fb5ed8..a8599024 100644 Binary files a/artifacts/lez/programs/authenticated_transfer.bin and b/artifacts/lez/programs/authenticated_transfer.bin differ diff --git a/artifacts/lez/programs/bridge.bin b/artifacts/lez/programs/bridge.bin index f7200f10..880d40e2 100644 Binary files a/artifacts/lez/programs/bridge.bin and b/artifacts/lez/programs/bridge.bin differ diff --git a/artifacts/lez/programs/clock.bin b/artifacts/lez/programs/clock.bin index ca84ef7b..5b62e1ca 100644 Binary files a/artifacts/lez/programs/clock.bin and b/artifacts/lez/programs/clock.bin differ diff --git a/artifacts/lez/programs/faucet.bin b/artifacts/lez/programs/faucet.bin index 191b55cc..0b398415 100644 Binary files a/artifacts/lez/programs/faucet.bin and b/artifacts/lez/programs/faucet.bin differ diff --git a/artifacts/lez/programs/pinata.bin b/artifacts/lez/programs/pinata.bin index b3ae5ba0..eace5cd7 100644 Binary files a/artifacts/lez/programs/pinata.bin and b/artifacts/lez/programs/pinata.bin differ diff --git a/artifacts/lez/programs/pinata_token.bin b/artifacts/lez/programs/pinata_token.bin index 51b744e1..e6e9e40d 100644 Binary files a/artifacts/lez/programs/pinata_token.bin and b/artifacts/lez/programs/pinata_token.bin differ diff --git a/artifacts/lez/programs/token.bin b/artifacts/lez/programs/token.bin index 8285ab49..492e9c42 100644 Binary files a/artifacts/lez/programs/token.bin and b/artifacts/lez/programs/token.bin differ diff --git a/artifacts/lez/programs/vault.bin b/artifacts/lez/programs/vault.bin index 6c46f24f..934d3539 100644 Binary files a/artifacts/lez/programs/vault.bin and b/artifacts/lez/programs/vault.bin differ diff --git a/integration_tests/tests/auth_transfer/private.rs b/integration_tests/tests/auth_transfer/private.rs index 1fe5cbff..3e285472 100644 --- a/integration_tests/tests/auth_transfer/private.rs +++ b/integration_tests/tests/auth_transfer/private.rs @@ -712,7 +712,7 @@ async fn ppt_cant_chain_call_faucet() -> Result<()> { npk, ssk, identifier: 1337, - commitment_root: None, + commitment_root: DUMMY_COMMITMENT_HASH, seed: None, }, ], @@ -726,9 +726,9 @@ async fn ppt_cant_chain_call_faucet() -> Result<()> { async fn prove_init_with_commitment_root( ctx: &TestContext, - commitment_root: Option, + commitment_root: lee_core::CommitmentSetDigest, ) -> Result { - let program = Program::authenticated_transfer_program(); + let program = programs::authenticated_transfer(); let sender_id = ctx.existing_public_accounts()[0]; let sender_pre = AccountWithMetadata::new( ctx.sequencer_client().get_account(sender_id).await?, @@ -780,7 +780,7 @@ async fn init_with_dummy_commitment_root_produces_valid_root() -> Result<()> { let npk = NullifierPublicKey::from(&nsk); let recipient_account_id = AccountId::for_regular_private_account(&npk, 0); - let output = prove_init_with_commitment_root(&ctx, Some(expected_digest)).await?; + let output = prove_init_with_commitment_root(&ctx, expected_digest).await?; assert_eq!(output.new_nullifiers.len(), 1); let (nullifier, digest) = &output.new_nullifiers[0]; @@ -805,8 +805,8 @@ async fn init_nullifier_digest_is_bound_to_commitment_root() -> Result<()> { .expect("DUMMY_COMMITMENT must be in genesis commitment set"); let expected_digest = compute_digest_for_path(&DUMMY_COMMITMENT, &dummy_proof); - let output_with_root = prove_init_with_commitment_root(&ctx, Some(expected_digest)).await?; - let output_without_root = prove_init_with_commitment_root(&ctx, None).await?; + let output_with_root = prove_init_with_commitment_root(&ctx, expected_digest).await?; + let output_without_root = prove_init_with_commitment_root(&ctx, DUMMY_COMMITMENT_HASH).await?; assert_eq!(output_with_root.new_nullifiers[0].1, expected_digest); assert_eq!( diff --git a/integration_tests/tests/private_pda.rs b/integration_tests/tests/private_pda.rs index 4b82ea41..81ff8467 100644 --- a/integration_tests/tests/private_pda.rs +++ b/integration_tests/tests/private_pda.rs @@ -22,7 +22,7 @@ use lee::{ program::Program, }; use lee_core::{ - EncryptedAccountData, InputAccountIdentity, NullifierPublicKey, + DUMMY_COMMITMENT_HASH, EncryptedAccountData, InputAccountIdentity, NullifierPublicKey, account::{Account, AccountWithMetadata}, encryption::ViewingPublicKey, program::PdaSeed, @@ -78,7 +78,7 @@ async fn fund_private_pda( npk, ssk, identifier, - commitment_root: None, + commitment_root: DUMMY_COMMITMENT_HASH, seed: Some((seed, authority_program_id)), }, ]; diff --git a/integration_tests/tests/tps.rs b/integration_tests/tests/tps.rs index 772fdb76..0b9a1002 100644 --- a/integration_tests/tests/tps.rs +++ b/integration_tests/tests/tps.rs @@ -23,7 +23,8 @@ use lee::{ public_transaction as putx, }; use lee_core::{ - EncryptedAccountData, InputAccountIdentity, MembershipProof, NullifierPublicKey, + DUMMY_COMMITMENT_HASH, EncryptedAccountData, InputAccountIdentity, MembershipProof, + NullifierPublicKey, account::{AccountWithMetadata, Nonce, data::Data}, encryption::ViewingPublicKey, }; @@ -314,7 +315,7 @@ fn build_privacy_transaction() -> PrivacyPreservingTransaction { npk: recipient_npk, ssk: recipient_ss, identifier: 0, - commitment_root: None, + commitment_root: DUMMY_COMMITMENT_HASH, }, ], &program.into(), diff --git a/lee/privacy_preserving_circuit/src/execution_state.rs b/lee/privacy_preserving_circuit/src/execution_state.rs index 1326ab41..4e81f9ce 100644 --- a/lee/privacy_preserving_circuit/src/execution_state.rs +++ b/lee/privacy_preserving_circuit/src/execution_state.rs @@ -510,66 +510,6 @@ fn resolve_external_seed( /// once (different npks under the same seed) and let a callee mix balances across them. Free /// function so callers can pass `&mut self.pda_family_binding` without holding a borrow on /// the surrounding struct's other fields. -fn resolve_external_seed( - account_identities: &[InputAccountIdentity], - pre_state_position: usize, - pre_account_id: AccountId, - is_authorized: bool, - private_pda_bound_positions: &mut HashMap, - pda_family_binding: &mut HashMap<(ProgramId, PdaSeed), AccountId>, -) { - let external_seed = match account_identities.get(pre_state_position) { - Some(InputAccountIdentity::PrivatePdaInit { - npk, - identifier, - seed: Some((seed, authority_program_id)), - .. - }) => { - let expected = AccountId::for_private_pda(authority_program_id, seed, npk, *identifier); - assert_eq!( - pre_account_id, expected, - "External seed mismatch for PrivatePdaInit at position {pre_state_position}" - ); - Some((*seed, *authority_program_id)) - } - Some(InputAccountIdentity::PrivatePdaUpdate { - nsk, - identifier, - seed: Some((seed, authority_program_id)), - .. - }) => { - let npk = NullifierPublicKey::from(nsk); - let expected = - AccountId::for_private_pda(authority_program_id, seed, &npk, *identifier); - assert_eq!( - pre_account_id, expected, - "External seed mismatch for PrivatePdaUpdate at position {pre_state_position}" - ); - Some((*seed, *authority_program_id)) - } - _ => None, - }; - - if let Some((seed, authority_program_id)) = external_seed { - assert!( - !is_authorized, - "Private PDA with externally-provided seed must not be authorized at position {pre_state_position}" - ); - bind_private_pda_position( - private_pda_bound_positions, - pre_state_position, - authority_program_id, - seed, - ); - assert_family_binding( - pda_family_binding, - authority_program_id, - seed, - pre_account_id, - ); - } -} - fn assert_family_binding( bindings: &mut HashMap<(ProgramId, PdaSeed), AccountId>, program_id: ProgramId, diff --git a/lee/privacy_preserving_circuit/src/output.rs b/lee/privacy_preserving_circuit/src/output.rs index 559170e7..74c1cccc 100644 --- a/lee/privacy_preserving_circuit/src/output.rs +++ b/lee/privacy_preserving_circuit/src/output.rs @@ -1,7 +1,7 @@ use lee_core::{ - Commitment, CommitmentSetDigest, DUMMY_COMMITMENT_HASH, EncryptedAccountData, EncryptionScheme, - EphemeralPublicKey, InputAccountIdentity, MembershipProof, Nullifier, NullifierPublicKey, - NullifierSecretKey, PrivacyPreservingCircuitOutput, PrivateAccountKind, SharedSecretKey, + Commitment, CommitmentSetDigest, EncryptedAccountData, EncryptionScheme, EphemeralPublicKey, + InputAccountIdentity, MembershipProof, Nullifier, NullifierPublicKey, NullifierSecretKey, + PrivacyPreservingCircuitOutput, PrivateAccountKind, SharedSecretKey, account::{Account, AccountId, Nonce}, compute_digest_for_path, }; @@ -20,7 +20,7 @@ struct PrivateOutputHandler<'ctx> { } impl PrivateOutputHandler<'_> { - fn authorized_init(self, nsk: &NullifierSecretKey) { + fn authorized_init(self, nsk: &NullifierSecretKey, commitment_root: &CommitmentSetDigest) { let npk = NullifierPublicKey::from(nsk); let account_id = derive_and_verify_account_id(&npk, self.identifier, self.pre_state.account_id); @@ -35,7 +35,7 @@ impl PrivateOutputHandler<'_> { "Found new private account with non default values" ); - let (new_nullifier, new_nonce) = init_nullifier_and_nonce(&account_id); + let (new_nullifier, new_nonce) = init_nullifier_and_nonce(&account_id, commitment_root); let kind = PrivateAccountKind::Regular(self.identifier); self.emit_private_output(&account_id, &kind, new_nullifier, new_nonce); @@ -67,7 +67,7 @@ impl PrivateOutputHandler<'_> { self.emit_private_output(&account_id, &kind, new_nullifier, new_nonce); } - fn unauthorized(self, npk: &NullifierPublicKey) { + fn unauthorized(self, npk: &NullifierPublicKey, commitment_root: &CommitmentSetDigest) { let account_id = derive_and_verify_account_id(npk, self.identifier, self.pre_state.account_id); @@ -81,7 +81,7 @@ impl PrivateOutputHandler<'_> { "Found new private account marked as authorized." ); - let (new_nullifier, new_nonce) = init_nullifier_and_nonce(&account_id); + let (new_nullifier, new_nonce) = init_nullifier_and_nonce(&account_id, commitment_root); let kind = PrivateAccountKind::Regular(self.identifier); self.emit_private_output(&account_id, &kind, new_nullifier, new_nonce); @@ -89,6 +89,7 @@ impl PrivateOutputHandler<'_> { fn pda_init( self, + commitment_root: &CommitmentSetDigest, pos: usize, pda_seed_by_position: &std::collections::HashMap< usize, @@ -108,7 +109,8 @@ impl PrivateOutputHandler<'_> { "New private PDA must be default" ); - let (new_nullifier, new_nonce) = init_nullifier_and_nonce(&self.pre_state.account_id); + let (new_nullifier, new_nonce) = + init_nullifier_and_nonce(&self.pre_state.account_id, commitment_root); let account_id = self.pre_state.account_id; let (authority_program_id, seed) = pda_seed_by_position @@ -203,10 +205,13 @@ impl PrivateOutputHandler<'_> { } } -fn init_nullifier_and_nonce(account_id: &AccountId) -> ((Nullifier, CommitmentSetDigest), Nonce) { +fn init_nullifier_and_nonce( + account_id: &AccountId, + commitment_root: &CommitmentSetDigest, +) -> ((Nullifier, CommitmentSetDigest), Nonce) { let nullifier = ( Nullifier::for_account_initialization(account_id), - DUMMY_COMMITMENT_HASH, + *commitment_root, ); let nonce = Nonce::private_account_nonce_init(account_id); (nullifier, nonce) @@ -271,6 +276,7 @@ pub fn compute_circuit_output( ssk, nsk, identifier, + commitment_root, } => PrivateOutputHandler { output: &mut output, output_index: &mut output_index, @@ -281,7 +287,7 @@ pub fn compute_circuit_output( ssk, identifier: *identifier, } - .authorized_init(nsk), + .authorized_init(nsk, commitment_root), InputAccountIdentity::PrivateAuthorizedUpdate { epk, view_tag, @@ -306,6 +312,7 @@ pub fn compute_circuit_output( npk, ssk, identifier, + commitment_root, } => PrivateOutputHandler { output: &mut output, output_index: &mut output_index, @@ -316,13 +323,14 @@ pub fn compute_circuit_output( ssk, identifier: *identifier, } - .unauthorized(npk), + .unauthorized(npk, commitment_root), InputAccountIdentity::PrivatePdaInit { epk, view_tag, npk: _, ssk, identifier, + commitment_root, seed: _, } => PrivateOutputHandler { output: &mut output, @@ -334,7 +342,7 @@ pub fn compute_circuit_output( ssk, identifier: *identifier, } - .pda_init(pos, &pda_seed_by_position), + .pda_init(commitment_root, pos, &pda_seed_by_position), InputAccountIdentity::PrivatePdaUpdate { epk, view_tag, diff --git a/lee/state_machine/core/src/circuit_io.rs b/lee/state_machine/core/src/circuit_io.rs index 46aa35b4..88b214d4 100644 --- a/lee/state_machine/core/src/circuit_io.rs +++ b/lee/state_machine/core/src/circuit_io.rs @@ -38,7 +38,7 @@ pub enum InputAccountIdentity { ssk: SharedSecretKey, nsk: NullifierSecretKey, identifier: Identifier, - commitment_root: Option, + commitment_root: CommitmentSetDigest, }, /// Update of an authorized standalone private account: existing on-chain commitment, with /// membership proof. @@ -58,7 +58,7 @@ pub enum InputAccountIdentity { npk: NullifierPublicKey, ssk: SharedSecretKey, identifier: Identifier, - commitment_root: Option, + commitment_root: CommitmentSetDigest, }, /// Init of a private PDA, unauthorized. The npk-to-account_id binding is proven upstream /// via `Claim::Pda(seed)` or a caller's `pda_seeds` match. The identifier diversifies the @@ -70,7 +70,7 @@ pub enum InputAccountIdentity { npk: NullifierPublicKey, ssk: SharedSecretKey, identifier: Identifier, - commitment_root: Option, + commitment_root: CommitmentSetDigest, /// When `Some((seed, authority_program_id))`, the circuit binds this position via the /// external derivation check /// `AccountId::for_private_pda(authority_program_id, seed, npk, identifier) == diff --git a/lee/state_machine/src/privacy_preserving_transaction/circuit.rs b/lee/state_machine/src/privacy_preserving_transaction/circuit.rs index dee222b0..e7d8f8d4 100644 --- a/lee/state_machine/src/privacy_preserving_transaction/circuit.rs +++ b/lee/state_machine/src/privacy_preserving_transaction/circuit.rs @@ -273,7 +273,7 @@ mod tests { npk: recipient_keys.npk(), ssk: shared_secret, identifier: 0, - commitment_root: None, + commitment_root: DUMMY_COMMITMENT_HASH, }, ], &crate::test_methods::simple_balance_transfer().into(), @@ -388,7 +388,7 @@ mod tests { npk: recipient_keys.npk(), ssk: shared_secret_2, identifier: 0, - commitment_root: None, + commitment_root: DUMMY_COMMITMENT_HASH, }, ], &program.into(), @@ -462,7 +462,7 @@ mod tests { npk: account_keys.npk(), ssk: shared_secret, identifier: 0, - commitment_root: None, + commitment_root: DUMMY_COMMITMENT_HASH, }], &program_with_deps, ); @@ -494,7 +494,7 @@ mod tests { npk, ssk: shared_secret, identifier, - commitment_root: None, + commitment_root: DUMMY_COMMITMENT_HASH, seed: None, }], &program.clone().into(), @@ -544,7 +544,7 @@ mod tests { npk, ssk: shared_secret_pda, identifier: 0, - commitment_root: None, + commitment_root: DUMMY_COMMITMENT_HASH, seed: None, }], &program_with_deps, @@ -600,7 +600,7 @@ mod tests { npk, ssk: shared_secret_pda, identifier: 0, - commitment_root: None, + commitment_root: DUMMY_COMMITMENT_HASH, seed: None, }, InputAccountIdentity::Public, @@ -659,7 +659,7 @@ mod tests { npk: shared_npk, ssk: shared_secret, identifier: shared_identifier, - commitment_root: None, + commitment_root: DUMMY_COMMITMENT_HASH, }, ], &program.into(), @@ -690,7 +690,7 @@ mod tests { ssk, nsk: keys.nsk, identifier, - commitment_root: None, + commitment_root: DUMMY_COMMITMENT_HASH, }], &program.into(), ) @@ -706,40 +706,24 @@ mod tests { /// to `PrivateAccountKind::Regular` carrying the correct identifier. #[test] fn private_unauthorized_init_encrypts_regular_kind_with_identifier() { - let program = Program::authenticated_transfer_program(); + let program = crate::test_methods::claimer(); let keys = test_private_account_keys_1(); let identifier: u128 = 99; let ssk = SharedSecretKey::encapsulate_deterministic(&keys.vpk(), &[0_u8; 32], 0).0; - - let sender = AccountWithMetadata::new( - Account { - program_owner: program.id(), - balance: 1, - ..Account::default() - }, - true, - AccountId::new([0; 32]), - ); let recipient_id = AccountId::for_regular_private_account(&keys.npk(), identifier); let recipient = AccountWithMetadata::new(Account::default(), false, recipient_id); let (output, _) = execute_and_prove( - vec![sender, recipient], - Program::serialize_instruction(authenticated_transfer_core::Instruction::Transfer { - amount: 1, - }) - .unwrap(), - vec![ - InputAccountIdentity::Public, - InputAccountIdentity::PrivateUnauthorized { - epk: EphemeralPublicKey(Vec::new()), - view_tag: EncryptedAccountData::compute_view_tag(&keys.npk(), &keys.vpk()), - npk: keys.npk(), - ssk, - identifier, - commitment_root: None, - }, - ], + vec![recipient], + Program::serialize_instruction(()).unwrap(), + vec![InputAccountIdentity::PrivateUnauthorized { + epk: EphemeralPublicKey(Vec::new()), + view_tag: EncryptedAccountData::compute_view_tag(&keys.npk(), &keys.vpk()), + npk: keys.npk(), + ssk, + identifier, + commitment_root: DUMMY_COMMITMENT_HASH, + }], &program.into(), ) .unwrap(); @@ -873,7 +857,7 @@ mod tests { npk, ssk: shared_secret, identifier: 99, - commitment_root: None, + commitment_root: DUMMY_COMMITMENT_HASH, seed: None, }], &program.into(), diff --git a/lee/state_machine/src/state.rs b/lee/state_machine/src/state.rs index 3c5720a2..b8116833 100644 --- a/lee/state_machine/src/state.rs +++ b/lee/state_machine/src/state.rs @@ -2,8 +2,7 @@ use std::collections::{BTreeSet, HashMap, HashSet}; use borsh::{BorshDeserialize, BorshSerialize}; use lee_core::{ - BlockId, Commitment, CommitmentSetDigest, DUMMY_COMMITMENT, MembershipProof, Nullifier, - Timestamp, + BlockId, Commitment, CommitmentSetDigest, DUMMY_COMMITMENT, MembershipProof, Nullifier, Timestamp, account::{Account, AccountId}, program::ProgramId, }; @@ -327,8 +326,8 @@ pub mod tests { use std::collections::HashMap; use lee_core::{ - BlockId, Commitment, EncryptedAccountData, InputAccountIdentity, Nullifier, - NullifierPublicKey, NullifierSecretKey, SharedSecretKey, Timestamp, + BlockId, Commitment, DUMMY_COMMITMENT_HASH, EncryptedAccountData, InputAccountIdentity, + Nullifier, NullifierPublicKey, NullifierSecretKey, SharedSecretKey, Timestamp, account::{Account, AccountId, AccountWithMetadata, Nonce, data::Data}, encryption::{EphemeralPublicKey, ViewingPublicKey}, program::{ @@ -1192,7 +1191,7 @@ pub mod tests { npk: recipient_keys.npk(), ssk: shared_secret, identifier: 0, - commitment_root: None, + commitment_root: DUMMY_COMMITMENT_HASH, }, ], &crate::test_methods::simple_balance_transfer().into(), @@ -1260,7 +1259,7 @@ pub mod tests { npk: recipient_keys.npk(), ssk: shared_secret_2, identifier: 0, - commitment_root: None, + commitment_root: DUMMY_COMMITMENT_HASH, }, ], &program.into(), @@ -1910,7 +1909,7 @@ pub mod tests { 0, ) .0, - commitment_root: None, + commitment_root: DUMMY_COMMITMENT_HASH, identifier: 0, }, ], @@ -1977,7 +1976,7 @@ pub mod tests { 0, ) .0, - commitment_root: None, + commitment_root: DUMMY_COMMITMENT_HASH, identifier: 0, }, ], @@ -2044,7 +2043,7 @@ pub mod tests { 0, ) .0, - commitment_root: None, + commitment_root: DUMMY_COMMITMENT_HASH, identifier: 0, }, ], @@ -2111,7 +2110,7 @@ pub mod tests { 0, ) .0, - commitment_root: None, + commitment_root: DUMMY_COMMITMENT_HASH, identifier: 0, }, ], @@ -2178,7 +2177,7 @@ pub mod tests { 0, ) .0, - commitment_root: None, + commitment_root: DUMMY_COMMITMENT_HASH, identifier: 0, }, ], @@ -2243,7 +2242,7 @@ pub mod tests { 0, ) .0, - commitment_root: None, + commitment_root: DUMMY_COMMITMENT_HASH, identifier: 0, }, ], @@ -2287,7 +2286,7 @@ pub mod tests { npk, ssk: shared_secret, identifier: u128::MAX, - commitment_root: None, + commitment_root: DUMMY_COMMITMENT_HASH, seed: None, }, ], @@ -2323,7 +2322,7 @@ pub mod tests { npk, ssk: shared_secret, identifier: u128::MAX, - commitment_root: None, + commitment_root: DUMMY_COMMITMENT_HASH, seed: None, }], &program.into(), @@ -2367,7 +2366,7 @@ pub mod tests { npk: npk_b, ssk: shared_secret, identifier: u128::MAX, - commitment_root: None, + commitment_root: DUMMY_COMMITMENT_HASH, seed: None, }], &program.into(), @@ -2407,7 +2406,7 @@ pub mod tests { npk, ssk: shared_secret, identifier: u128::MAX, - commitment_root: None, + commitment_root: DUMMY_COMMITMENT_HASH, seed: None, }], &program_with_deps, @@ -2450,7 +2449,7 @@ pub mod tests { npk, ssk: shared_secret, identifier: u128::MAX, - commitment_root: None, + commitment_root: DUMMY_COMMITMENT_HASH, seed: None, }], &program_with_deps, @@ -2492,7 +2491,7 @@ pub mod tests { npk: keys_a.npk(), ssk: shared_a, identifier: u128::MAX, - commitment_root: None, + commitment_root: DUMMY_COMMITMENT_HASH, seed: None, }, InputAccountIdentity::PrivatePdaInit { @@ -2501,7 +2500,7 @@ pub mod tests { npk: keys_b.npk(), ssk: shared_b, identifier: u128::MAX, - commitment_root: None, + commitment_root: DUMMY_COMMITMENT_HASH, seed: None, }, ], @@ -2546,7 +2545,7 @@ pub mod tests { npk, ssk: shared_secret, identifier: u128::MAX, - commitment_root: None, + commitment_root: DUMMY_COMMITMENT_HASH, seed: None, }], &program.into(), @@ -3318,7 +3317,7 @@ pub mod tests { ssk: shared_secret, nsk: private_keys.nsk, identifier: 0, - commitment_root: None, + commitment_root: DUMMY_COMMITMENT_HASH, }], &program.into(), ) @@ -3366,7 +3365,7 @@ pub mod tests { npk: private_keys.npk(), ssk: shared_secret, identifier: 0, - commitment_root: None, + commitment_root: DUMMY_COMMITMENT_HASH, }], &program.into(), ) @@ -3418,7 +3417,7 @@ pub mod tests { ssk: shared_secret, nsk: private_keys.nsk, identifier: 0, - commitment_root: None, + commitment_root: DUMMY_COMMITMENT_HASH, }], &claimer_program.into(), ) @@ -3465,7 +3464,7 @@ pub mod tests { ssk: shared_secret2, nsk: private_keys.nsk, identifier: 0, - commitment_root: None, + commitment_root: DUMMY_COMMITMENT_HASH, }], &noop_program.into(), ); @@ -3808,7 +3807,7 @@ pub mod tests { npk: account_keys.npk(), ssk: shared_secret, identifier: 0, - commitment_root: None, + commitment_root: DUMMY_COMMITMENT_HASH, }], &validity_window_program.into(), ) @@ -3877,7 +3876,7 @@ pub mod tests { npk: account_keys.npk(), ssk: shared_secret, identifier: 0, - commitment_root: None, + commitment_root: DUMMY_COMMITMENT_HASH, }], &validity_window_program.into(), ) @@ -4222,7 +4221,7 @@ pub mod tests { npk: alice_npk, ssk: alice_shared_0, identifier: 0, - commitment_root: None, + commitment_root: DUMMY_COMMITMENT_HASH, seed: Some((seed, proxy_id)), }, ], @@ -4263,7 +4262,7 @@ pub mod tests { npk: alice_npk, ssk: alice_shared_1, identifier: 1, - commitment_root: None, + commitment_root: DUMMY_COMMITMENT_HASH, seed: Some((seed, proxy_id)), }, ], diff --git a/lez/wallet/src/account_manager.rs b/lez/wallet/src/account_manager.rs index 93256ba1..ae4e3945 100644 --- a/lez/wallet/src/account_manager.rs +++ b/lez/wallet/src/account_manager.rs @@ -5,9 +5,8 @@ use key_protocol::key_management::ephemeral_key_holder::EphemeralKeyHolder; use keycard_wallet::{KeycardWallet, python_path}; use lee::{AccountId, PrivateKey, PublicKey, Signature}; use lee_core::{ - CommitmentSetDigest, Identifier, InputAccountIdentity, MembershipProof, NullifierPublicKey, - NullifierSecretKey, - SharedSecretKey, + CommitmentSetDigest, DUMMY_COMMITMENT_HASH, Identifier, InputAccountIdentity, MembershipProof, + NullifierPublicKey, NullifierSecretKey, SharedSecretKey, account::{AccountWithMetadata, Nonce}, encryption::{EncryptedAccountData, EphemeralPublicKey, ViewingPublicKey}, }; @@ -188,7 +187,7 @@ enum State { pub struct AccountManager { states: Vec, pin: Option, - dummy_commitment_root: Option, + dummy_commitment_root: CommitmentSetDigest, } impl AccountManager { @@ -350,8 +349,9 @@ impl AccountManager { .get_commitment_root() .await .map_err(ExecutionFailureKind::SequencerError)? + .unwrap_or(DUMMY_COMMITMENT_HASH) } else { - None + DUMMY_COMMITMENT_HASH }; Ok(Self {