Commit Graph
2409 Commits
Author SHA1 Message Date
jonesmarvin8 58fdb7e74c Merge branch 'marvin/refactor-wallet-pub-acc' into marvin/keycard-commands 2026-04-28 18:09:52 -04:00
jonesmarvin8 f94b05ac0f Merge branch 'marvin/signature-bip340-fixes' into marvin/refactor-wallet-pub-acc 2026-04-28 18:08:19 -04:00
jonesmarvin8 8dd0919aa2 fix deny 2026-04-28 18:06:06 -04:00
jonesmarvin8 cc78901c7a add test 2026-04-28 18:01:52 -04:00
jonesmarvin8 a87b722a52 add hash_message tests 2026-04-28 17:45:13 -04:00
jonesmarvin8 269a1df390 fixed from earlier merge 2026-04-28 16:32:42 -04:00
jonesmarvin8 30b96b1aaf remove keycard-py 2026-04-28 15:56:53 -04:00
jonesmarvin8 40b5dd899b fixed deny 2026-04-28 15:42:35 -04:00
jonesmarvin8 dd78314ca0 Merge branch 'marvin/refactor-wallet-pub-acc' into marvin/keycard-commands 2026-04-28 14:17:15 -04:00
jonesmarvin8 27905d94d6 addressed more comments 2026-04-28 14:13:04 -04:00
jonesmarvin8 d5dea3e115 fix integration test issue and updated keycard firmware 2026-04-28 14:10:54 -04:00
jonesmarvin8 f44562eb8f ci fixes 2026-04-27 20:34:38 -04:00
jonesmarvin8 23b3261dd8 Merge branch 'marvin/refactor-wallet-pub-acc' into marvin/keycard-commands 2026-04-27 20:19:32 -04:00
jonesmarvin8 e5eae57a5f fix ci 2026-04-27 20:12:57 -04:00
jonesmarvin8 b396756e8d addressed some comments 2026-04-27 20:07:47 -04:00
jonesmarvin8 935ef1db46 Merge branch 'marvin/signature-bip340-fixes' into marvin/refactor-wallet-pub-acc 2026-04-27 18:57:34 -04:00
jonesmarvin8 469d5bdad9 CI fixes 2026-04-27 18:51:57 -04:00
jonesmarvin8 016d063329 CI fixes 2026-04-27 18:47:02 -04:00
jonesmarvin8 2926c808d3 Removed privacy txs for keycard 2026-04-27 16:37:21 -04:00
jonesmarvin8 9ef69ef684 Add domain separators 2026-04-27 16:33:00 -04:00
jonesmarvin8 e319c8fa55 Revert "Removed privacy keycard calls"
This reverts commit d70ef505a1.
2026-04-27 16:30:46 -04:00
jonesmarvin8 d70ef505a1 Removed privacy keycard calls 2026-04-27 16:30:27 -04:00
jonesmarvin8 2381961621 Merge branch 'marvin/signature-bip340-fixes' into marvin/keycard-commands 2026-04-27 08:38:21 -04:00
jonesmarvin8 8386d3ab17 fixes 2026-04-26 22:50:16 -04:00
jonesmarvin8 24f6f1f8ca fixes 2026-04-26 21:29:54 -04:00
jonesmarvin8 5bcf1a253b Revert "fixes"
This reverts commit 41f34f4ff4.
2026-04-26 21:28:11 -04:00
jonesmarvin8 41f34f4ff4 fixes 2026-04-26 20:27:22 -04:00
jonesmarvin8 a99fccd704 Merge branch 'marvin/signature-bip340-fixes' into marvin/refactor-wallet-pub-acc 2026-04-25 23:42:59 -04:00
jonesmarvin8 cd1ab87fc3 fix unit test 2026-04-25 23:11:32 -04:00
jonesmarvin8 7b4f973f96 refactor and add pin support to program facades 2026-04-24 22:10:04 -04:00
jonesmarvin8 93a1487553 Merge branch 'marvin/refactor-wallet-pub-acc' into marvin/keycard-commands 2026-04-24 12:05:17 -04:00
jonesmarvin8 1cea188e38 Merge branch 'marvin/signature-bip340-fixes' into marvin/refactor-wallet-pub-acc 2026-04-24 12:04:15 -04:00
jonesmarvin8 72c35416df fmt 2026-04-24 11:36:14 -04:00
jonesmarvin8 be33f39dc5 fix BIP-340 signatures for fixed sized messages 2026-04-24 11:23:53 -04:00
jonesmarvin8 fac4e86e40 Updates for signatures with keycard 2026-04-23 17:45:43 -04:00
jonesmarvin8 9f1c8bdf29 fixed load for non continuous run 2026-04-23 09:47:09 -04:00
jonesmarvin8 096522ebb9 fixes 2026-04-22 21:23:33 -04:00
Moudy 00d3140490 Merge pull request #446 from logos-blockchain/moudy/feat-private-pdas
feat: private PDA support in the privacy circuit
2026-04-22 23:07:18 +02:00
Moudy 86ff3670c0 fix: bump rustls-webpki to 0.103.13 for RUSTSEC-2026-0104
Upstream advisory, reachable panic in certificate revocation list
parsing via `BorrowedCertRevocationList::from_der` /
`OwnedCertRevocationList::from_der`. Unrelated to this PR, dropped
into the advisory DB since the last green CI run and broke the `deny`
job. Fix is the recommended version bump.
2026-04-22 16:02:56 +02:00
Moudy e5b77a27d5 refactor: localize private_pda_npk_by_position and extract authorization helper
Addresses the following review comments from @Arjentix:

- "I think we can move this into `derive_from_outputs()`"
  (on the position → npk map construction in main())
  I moved the construction inside ExecutionState::derive_from_outputs
  and stored the map as a field of ExecutionState. derive_from_outputs
  now takes `private_account_keys` directly and builds the map as part
  of state initialization. main() no longer owns the intermediate
  structure. validate_and_sync_states reads the npk through
  self.private_pda_npk_by_position.

- "Let's move this whole `is_authorized` computation into a separate
  function. This became really bulky"
  I extracted the caller-seeds resolution, family-binding recording,
  and is_authorized computation into a free function
  `resolve_authorization_and_record_bindings`. It takes the three
  field borrows it needs (`&mut pda_family_binding`, `&mut
  private_pda_bound_positions`, `&private_pda_npk_by_position`), same
  shape as `assert_family_binding`. A method would have conflicted
  with the `&mut self.post_states` borrow held by the Occupied match
  arm; the free function lets rustc split-borrow the self fields.
2026-04-22 15:55:35 +02:00
Moudy 22aa5ef70b refactor: simplify PDA API docs and rename compute_authorized_pdas
Addresses the following review comments from @Arjentix:

- "I think there are too many internal implementation information
  exposed here. This structure is used by our users, program devs. And
  they should not care about distinction between private or public pda
  or different masks"
  (on ChainedCall.pda_seeds, same feedback repeated on Claim::Pda)
  I rewrote both docstrings to drop internal details (visibility masks,
  per-form derivation names, npk handling). Program devs see only that
  they emit a seed and the `AccountId` is derived from
  `(program_id, seed)` regardless of whether the account is public or
  private.

- "Let's reflect the new nuance in the name"
  (on compute_authorized_pdas returning public-form derivations only)
  I renamed the function to `compute_public_authorized_pdas`. After
  the PR #446 rework the function only returns public-form
  derivations, the private-form authorization lives in the circuit
  guest. Updated the call site in nssa/src/validated_state_diff.rs
  and the two unit tests.
2026-04-22 15:34:15 +02:00
jonesmarvin8 f892b92ee7 update commands 2026-04-21 18:27:14 -04:00
jonesmarvin8 d88d297574 add script file for easier wallet access 2026-04-21 17:42:27 -04:00
jonesmarvin8 eb9df0c224 Merge branch 'marvin/refactor-wallet-pub-acc' into marvin/keycard-commands 2026-04-21 13:43:02 -04:00
jonesmarvin8 0390977acf reorganization 2026-04-21 13:40:15 -04:00
Moudy 0183eac5cc refactor: unify PDA AccountId construction via AccountId::for_{public,private}_pda
Addresses the following review comment:

- "I think this should be a constructor `AccountId::for_private_pda`.
  Consider also removing the existing `impl From<(ProgramId, Seed)> for
  AccountId` for public pdas in favor of a `AccountId::for_public_pda`
  to have a unified way of constructing pdas"

I replaced `impl From<(&ProgramId, &PdaSeed)> for AccountId` with
`AccountId::for_public_pda(program_id: &ProgramId, seed: &PdaSeed) ->
Self` and replaced the free function `private_pda_account_id(...)`
with `AccountId::for_private_pda(program_id: &ProgramId, seed:
&PdaSeed, npk: &NullifierPublicKey) -> Self`. Both live in an inherent
`impl AccountId` block in nssa/core/src/program.rs next to the PDA
derivation logic. Migrated all call sites across nssa/core,
nssa/src/state.rs, nssa/src/validated_state_diff.rs,
program_methods/guest/src/bin/privacy_preserving_circuit.rs,
programs/amm/core, programs/associated_token_account/core, the example
tail-call binary, and the ATA tutorial doc. Test function names that
referenced the old free function were also renamed
(private_pda_account_id_* to for_private_pda_*).
2026-04-21 12:35:19 +02:00
Moudy 68d43d7f2b test: exercise callee authorization in private-PDA delegation tests
Addresses the following review comments:

- "Shouldn't we use a program that checks authorization in this test as
  callee? If not, I'm not sure if we are fully testing what the test
  docs describe (namely, that the callee got the input account with
  is_authorized=true). Maybe add a variant of the noop that checks the
  input account is authorized."
  I added test_program_methods/guest/src/bin/auth_asserting_noop.rs:
  same shape as noop.rs except it asserts pre.is_authorized == true for
  every pre_state before echoing the post_states. Any unauthorized
  pre_state panics the guest, failing the whole circuit proof. I added
  Program::auth_asserting_noop() as the matching helper. In
  caller_pda_seeds_authorize_private_pda_for_callee and
  caller_pda_seeds_with_wrong_seed_rejects_private_pda_for_callee, I
  swapped Program::noop() for Program::auth_asserting_noop() as the
  callee. The positive test now proves the callee actually sees
  is_authorized=true, not just that the circuit's consistency check did
  not reject. The negative test doubles its evidence, both the
  circuit's authorization reconciliation and the callee guest would now
  reject a wrong-seed delegation.

- "This branching logic is only correct because we are not supporting
  non-authorized private accounts with non-default values. Likely to be
  changed in the future. I'm sure there's use cases for this. For
  example the multisig program if ran completely private it would need
  a private non-default and non-authorized input account."
  Agreed. Supporting this needs wallet-supplied `(seed, owner)` side
  input so the npk-to-account_id binding can be re-verified for an
  existing private PDA without a fresh Claim::Pda or a caller
  pda_seeds match. I handled this in the second PR. I added a
  TODO(private-pdas-pr-2/3) marker on the `else` branch in
  privacy_preserving_circuit.rs:3 => { ... } so the constraint is
  visible to future maintainers, along with a comment noting the
  multisig use case.
2026-04-21 02:08:02 +02:00
Moudy d22c142a37 fix: rebuild artifacts 2026-04-21 01:44:29 +02:00
Moudy e8b17eef27 refactor: rename mask3 to private_pda in tests and circuit
Addresses the following review comments:

- "I'd rename all mask_3 references in test names and variables to a
  private pda wording. If in the future we change the mask number for
  the private pda, this naming will silently get outdated."
  I renamed all tests and the local variable mask3_account to
  private_pda_account.

- "Let's use more descriptive names. `mask3` is not very meaningful."
  I renamed all `mask3` into `private_pda`. Panic messages and .expect
  strings updated to match. Doc comments that factually describe the
  encoding (e.g. "mask-3 account" meaning "an account whose visibility
  mask is 3") are left as-is since they are accurate and remain stable
  until the mask value itself changes.

- "..._panics" to "..._fails"
  Covered above. The tests assert Err(CircuitProvingError), so
  execute_and_prove returns an Err, the test process itself never
  panics.

- "we can return `Some((*seed, true, caller))` to avoid having to unwrap
  the `caller_program_id` again in line 290"
  I changed matched_caller_seed from Option<(PdaSeed, bool)> to
  Option<(PdaSeed, bool, ProgramId)>, return the `caller` captured by
  the enclosing and_then from each match arm, and dropped the .expect
  at the consumer site. Bundled with the rename since both touch the
  same branch and a single guest ELF rebuild covers them.
2026-04-21 01:43:57 +02:00
Moudy 00cae12d41 docs: drop "wallet" references from nssa crate
Addresses the following review comments:

- "I'd keep this crate independent of wallet references"
  I replaced all with "supplied npk".

- Rename request on locals attested_keys/wallet_keys
  In mask_3_wallet_npk_mismatch_panics the two key sets play distinct
  roles, one produces the pre_state's account_id (the registered pair)
  and the other is supplied in private_account_keys as the mismatched
  npk. Collapsing both to `keys` would be misleading. I renamed to
  keys_a and keys_b with an inline comment noting which one is the
  registered one and which one is mismatched.
2026-04-21 01:02:22 +02:00