mirror of
https://github.com/logos-blockchain/logos-execution-zone.git
synced 2026-06-29 10:29:32 +00:00
refactor: use CommitmentSetDigest directly instead of Option for init commitment root
Address PR #546 review feedback: the circuit now accepts CommitmentSetDigest directly on init variants (PrivateAuthorizedInit, PrivateUnauthorized, PrivatePdaInit), with callers providing DUMMY_COMMITMENT_HASH as the default. Also fixes duplicate resolve_external_seed from rebase and rebuilds artifacts.
This commit is contained in:
parent
f9d80cd67a
commit
7eada86040
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -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<lee_core::CommitmentSetDigest>,
|
||||
commitment_root: lee_core::CommitmentSetDigest,
|
||||
) -> Result<lee_core::PrivacyPreservingCircuitOutput> {
|
||||
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!(
|
||||
|
||||
@ -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)),
|
||||
},
|
||||
];
|
||||
|
||||
@ -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(),
|
||||
|
||||
@ -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<usize, (ProgramId, PdaSeed)>,
|
||||
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,
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -38,7 +38,7 @@ pub enum InputAccountIdentity {
|
||||
ssk: SharedSecretKey,
|
||||
nsk: NullifierSecretKey,
|
||||
identifier: Identifier,
|
||||
commitment_root: Option<CommitmentSetDigest>,
|
||||
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<CommitmentSetDigest>,
|
||||
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<CommitmentSetDigest>,
|
||||
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) ==
|
||||
|
||||
@ -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(),
|
||||
|
||||
@ -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)),
|
||||
},
|
||||
],
|
||||
|
||||
@ -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<State>,
|
||||
pin: Option<String>,
|
||||
dummy_commitment_root: Option<CommitmentSetDigest>,
|
||||
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 {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user