This commit is contained in:
Sergio Chouhy
2026-05-07 01:41:35 -03:00
parent d4334c4694
commit f722d257a3
16 changed files with 190 additions and 99 deletions
@@ -1,6 +1,9 @@
use nssa_core::{
account::AccountWithMetadata,
program::{AccountPostState, ChainedCall, PdaSeed, ProgramId, ProgramInput, ProgramOutput, read_nssa_inputs},
program::{
AccountPostState, ChainedCall, PdaSeed, ProgramId, ProgramInput, ProgramOutput,
read_nssa_inputs,
},
};
use risc0_zkvm::serde::to_vec;
@@ -8,14 +11,13 @@ use risc0_zkvm::serde::to_vec;
///
/// The `is_fund` flag selects the operating mode:
///
/// - `false` (Spend): pre_states = [pda (authorized), recipient].
/// Debits the PDA. The PDA-to-npk binding is established via `pda_seeds` in the chained
/// call to auth_transfer.
/// - `false` (Spend): pre_states = [pda (authorized), recipient]. Debits the PDA. The PDA-to-npk
/// binding is established via `pda_seeds` in the chained call to auth_transfer.
///
/// - `true` (Fund): pre_states = [sender (authorized), pda (foreign/uninitialized)].
/// Credits the PDA. A direct call to auth_transfer cannot bind the PDA because auth_transfer
/// uses `Claim::Authorized`, not `Claim::Pda`. Routing through this proxy establishes the
/// binding via `pda_seeds` in the chained call.
/// - `true` (Fund): pre_states = [sender (authorized), pda (foreign/uninitialized)]. Credits the
/// PDA. A direct call to auth_transfer cannot bind the PDA because auth_transfer uses
/// `Claim::Authorized`, not `Claim::Pda`. Routing through this proxy establishes the binding via
/// `pda_seeds` in the chained call.
type Instruction = (PdaSeed, u128, ProgramId, bool);
fn main() {