261 Commits

Author SHA1 Message Date
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
Moudy
34f8b6cac8 docs: split miscoupled private-PDA test docs and clean phrasing
Addresses the following review comments:

- "Isn't two_mask_3_claims_under_same_seed_are_rejected already checking
  that there's a mechanism protecting against this exploit scenario?"
  The doc block at nssa/src/state.rs:2488-2504 mixes three paragraphs,
  one about reuse, one TODO about wallet side input, one exploit pin,
  all attached to two_mask_3_claims_under_same_seed_are_rejected. The
  reuse test below it had no doc at all. I split as follows: the
  exploit-pin paragraph stays on two_mask_3_claims_..., the reuse
  paragraph moves to a fresh docstring on
  mask_3_reuse_across_txs_currently_unsupported.

- "I don't understand this. I think this should fail because ... the
  input pre_state which is marked with is_authorized=true will make
  things fail."
  The reuse test's new docstring cites the actual reject site, the
  post-loop private_pda_bound_positions assertion in
  privacy_preserving_circuit.rs:185-192. At top level the Entry::Vacant
  arm accepts is_authorized=true unconditionally, the rejection comes
  from the bound-positions check firing because noop emits no Claim::Pda
  and there is no caller ChainedCall.pda_seeds.

- "let's dont have this TODO as part of the doc"
  The block is moved out into regular // comments immediately above
  mask_3_reuse_across_txs_currently_unsupported.

- "let's not add implementation details to docs"
  In caller_pda_seeds_authorize_mask_3_private_pda_for_callee's
  docstring, I dropped the parenthetical "(Occupied branch)" and the
  trailing sentence about which validate_and_sync_states code path gets
  exercised.

- "what does \`Claim::Pda(seed)\` / \`pda_seeds\` mean?"
  I rewrote the pda_family_binding docstring at
  privacy_preserving_circuit.rs:33-39: replaced the ambiguous
  "Claim::PrivatePda and ChainedCall's private seeds into plain
  Claim::Pda(seed) / pda_seeds" phrase with "a Claim::Pda(seed) in a
  program's post_state or a caller's ChainedCall.pda_seeds entry".

- Suggestion on nssa/src/validated_state_diff.rs:226 rewriting
  "The public-execution path only sees mask-0 accounts" to
  "The public-execution path only sees public accounts".
  Applied: "The public-execution path only sees public accounts".

- Clarification requested on the private_pda_bound_positions field:
  I expanded the docstring at privacy_preserving_circuit.rs:26-31 to
  state that binding is an idempotent property, not an event, and to
  enumerate the two proof paths that populate it (a Claim::Pda on a
  mask-3 pre_state, or a caller's pda_seeds matching under the private
  derivation).
2026-04-21 00:37:06 +02:00
Moudy
d3577f02bc fix: reject multiple family members under same (program, seed) in one tx 2026-04-17 15:36:20 +02:00
Moudy
f9a5a7635e refactor: make programs privacy-agnostic in the privacy circuit 2026-04-17 07:29:40 +02:00
Moudy
8da04ac898 fix: nightly fmt 2026-04-16 18:45:19 +02:00
Moudy
93c6921eaf Merge remote-tracking branch 'origin/main' into moudy/feat-private-pdas
# Conflicts:
#	artifacts/program_methods/amm.bin
#	artifacts/program_methods/associated_token_account.bin
#	artifacts/program_methods/authenticated_transfer.bin
#	artifacts/program_methods/clock.bin
#	artifacts/program_methods/pinata.bin
#	artifacts/program_methods/pinata_token.bin
#	artifacts/program_methods/privacy_preserving_circuit.bin
#	artifacts/program_methods/token.bin
#	artifacts/test_program_methods/burner.bin
#	artifacts/test_program_methods/chain_caller.bin
#	artifacts/test_program_methods/changer_claimer.bin
#	artifacts/test_program_methods/claimer.bin
#	artifacts/test_program_methods/clock_chain_caller.bin
#	artifacts/test_program_methods/data_changer.bin
#	artifacts/test_program_methods/extra_output.bin
#	artifacts/test_program_methods/flash_swap_callback.bin
#	artifacts/test_program_methods/flash_swap_initiator.bin
#	artifacts/test_program_methods/malicious_authorization_changer.bin
#	artifacts/test_program_methods/malicious_caller_program_id.bin
#	artifacts/test_program_methods/malicious_self_program_id.bin
#	artifacts/test_program_methods/minter.bin
#	artifacts/test_program_methods/missing_output.bin
#	artifacts/test_program_methods/modified_transfer.bin
#	artifacts/test_program_methods/nonce_changer.bin
#	artifacts/test_program_methods/noop.bin
#	artifacts/test_program_methods/pinata_cooldown.bin
#	artifacts/test_program_methods/program_owner_changer.bin
#	artifacts/test_program_methods/simple_balance_transfer.bin
#	artifacts/test_program_methods/time_locked_transfer.bin
#	artifacts/test_program_methods/validity_window.bin
#	artifacts/test_program_methods/validity_window_chain_caller.bin
#	nssa/core/src/program.rs
#	nssa/src/state.rs
2026-04-16 18:25:57 +02:00
Moudy
526c3cd978 test: add private PDA circuit tests and two guest programs 2026-04-16 18:07:32 +02:00
Daniil Polyakov
699e91363e feat: introduce more descriptive error messages for public execution 2026-04-13 21:25:18 +03:00
Sergio Chouhy
9d2c37ff08 fix function parameters 2026-04-10 17:15:23 -03:00
Sergio Chouhy
a0cba55035
Merge pull request #435 from logos-blockchain/schouhy/fix-genesis-nullifiers
fix: Add init nullifiers for preconfigured accounts on genesis
2026-04-10 16:37:25 -03:00
Sergio Chouhy
4b0a68889c Merge remote-tracking branch 'origin/main' into schouhy/fix-genesis-nullifiers 2026-04-07 16:05:42 -03:00
Moudy
27fbd10d92 fix: post-merge test fixes for caller_program_id and genesis_timestamp 2026-04-07 20:15:17 +02:00
Moudy
b22a989fbc merge main into feat-caller-program-id-and-flash-swap 2026-04-07 19:27:27 +02:00
Moudy
7d465dded7 fix: verify caller_program_id in program output 2026-04-07 19:03:06 +02:00
Sergio Chouhy
2d1896013b handle comments 2026-04-07 13:35:13 -03:00
Sergio Chouhy
50d402880c add nullifiers for preconfigured accounts on genesis 2026-04-06 21:44:31 -03:00
Sergio Chouhy
015999b3a5 add clock usage example programs 2026-04-04 00:23:43 -03:00
Moudy
032f6b8906 fix: use AccountId::new instead of From<ProgramId>, apply formatting 2026-04-03 23:24:13 +02:00
Sergio Chouhy
deae71b09f handle comments 2026-04-03 18:13:24 -03:00
moudyellaz
1d0c93e9cf test: verify malicious self_program_id is rejected in public execution 2026-04-03 22:13:58 +02:00
Moudy
3cfc74695b fix: compute intermediate states inside flash swap programs 2026-04-03 22:05:49 +02:00
Moudy
5b42d8ed9c fix: move flash swap types before all functions in test module 2026-04-03 18:14:49 +02:00
Moudy
324593c4c7 fix: format expect attribute 2026-04-03 16:08:08 +02:00
Moudy
eefaf64b6d fix: move flash swap types before tests, use expect instead of allow 2026-04-03 16:04:49 +02:00
Moudy
9fb55a75d6 fix: ordering of items and allow large_enum_variant in test module 2026-04-03 15:40:55 +02:00
Moudy
bc0583368d fix: set is_authorized on PDA accounts in flash swap chained calls 2026-04-03 15:18:23 +02:00
Sergio Chouhy
55c75c55ae fix clippy 2026-04-02 21:44:33 -03:00
Moudy
74e16db68f fix: apply formatting and rebuild artifacts 2026-04-03 01:17:42 +02:00
moudyellaz
af81719414 feat: add flash swap integration tests 2026-04-03 00:58:11 +02:00
moudyellaz
599724b72f feat: register flash_swap programs as test programs 2026-04-03 00:58:11 +02:00
Sergio Chouhy
6a467da3b1 fmt and clippy 2026-04-02 17:48:02 -03:00
Sergio Chouhy
29d66d2c2d small refactor 2026-04-02 17:40:58 -03:00
Sergio Chouhy
9915f09d6d refactor to enforce validation of state diff through constructors 2026-04-02 02:39:37 -03:00
Sergio Chouhy
40c7b308a9 add validated state diff 2026-04-02 01:09:58 -03:00
Sergio Chouhy
fa2fd857a9 minor refactor 2026-04-01 00:01:11 -03:00
Sergio Chouhy
3c5a1c9d0a Merge branch 'main' into schouhy/add-block-context-system-accounts 2026-03-31 20:53:10 -03:00
Moudy
a560562874 fix: use force_insert_account in pinata PDA test
The pda_mechanism_with_pinata_token_program test was broken after
PR #414 introduced Claim::Authorized for token account claiming.
Set up token accounts directly to focus the test on the PDA mechanism
in the pinata program's chained call.
2026-03-31 18:51:37 +02:00
Moudy
d4fb326f66 fix: remove stale validity_window ref and add missing timestamp args 2026-03-31 14:38:05 +02:00
Sergio Chouhy
f627910468 fmt 2026-03-31 13:51:12 +02:00
Sergio Chouhy
8bfaf9ef4a remove blockid from common 2026-03-31 13:50:47 +02:00
Sergio Chouhy
9d830411a1 rename timestamp_ms to timestamp 2026-03-31 13:50:30 +02:00
Sergio Chouhy
77c5032527 remove common TimeStamp 2026-03-31 13:50:30 +02:00
Sergio Chouhy
99f0ed03dc add type aliases 2026-03-31 13:50:06 +02:00
Sergio Chouhy
27b0ba7592 add tests for timestamp validity windows 2026-03-31 13:49:37 +02:00
Sergio Chouhy
9aa7caf3bf refactor validity window with generic 2026-03-31 13:49:12 +02:00
moudyellaz
c4567d163d style: apply cargo fmt 2026-03-31 13:46:25 +02:00
moudyellaz
5c592312f9 feat: extend ValidityWindow with Unix timestamp bounds 2026-03-31 13:46:08 +02:00
Sergio Chouhy
67baefeaee fmt and clippy 2026-03-31 01:45:07 -03:00
Sergio Chouhy
d8ffa22b81 add more clock accounts 2026-03-31 01:39:02 -03:00
Sergio Chouhy
d6a92f443e add tests 2026-03-31 00:24:49 -03:00