diff --git a/artifacts/test_program_methods/flash_swap_callback.bin b/artifacts/test_program_methods/flash_swap_callback.bin index ebae1c82..8a529f24 100644 Binary files a/artifacts/test_program_methods/flash_swap_callback.bin and b/artifacts/test_program_methods/flash_swap_callback.bin differ diff --git a/artifacts/test_program_methods/flash_swap_initiator.bin b/artifacts/test_program_methods/flash_swap_initiator.bin index ed2abdba..3168bd07 100644 Binary files a/artifacts/test_program_methods/flash_swap_initiator.bin and b/artifacts/test_program_methods/flash_swap_initiator.bin differ diff --git a/nssa/src/state.rs b/nssa/src/state.rs index fdc2e873..9b56bcc1 100644 --- a/nssa/src/state.rs +++ b/nssa/src/state.rs @@ -3537,8 +3537,8 @@ pub mod tests { let callback = Program::flash_swap_callback(); let token = Program::authenticated_transfer_program(); - let vault_id = AccountId::from((&initiator.id(), &PdaSeed::new([0u8; 32]))); - let receiver_id = AccountId::from((&callback.id(), &PdaSeed::new([1u8; 32]))); + let vault_id = AccountId::from((&initiator.id(), &PdaSeed::new([0_u8; 32]))); + let receiver_id = AccountId::from((&callback.id(), &PdaSeed::new([1_u8; 32]))); let initial_balance: u128 = 1000; let amount_out: u128 = 100; @@ -3641,8 +3641,8 @@ pub mod tests { let callback = Program::flash_swap_callback(); let token = Program::authenticated_transfer_program(); - let vault_id = AccountId::from((&initiator.id(), &PdaSeed::new([0u8; 32]))); - let receiver_id = AccountId::from((&callback.id(), &PdaSeed::new([1u8; 32]))); + let vault_id = AccountId::from((&initiator.id(), &PdaSeed::new([0_u8; 32]))); + let receiver_id = AccountId::from((&callback.id(), &PdaSeed::new([1_u8; 32]))); let initial_balance: u128 = 1000; let amount_out: u128 = 100; @@ -3735,8 +3735,8 @@ pub mod tests { let callback = Program::flash_swap_callback(); let token = Program::authenticated_transfer_program(); - let vault_id = AccountId::from((&initiator.id(), &PdaSeed::new([0u8; 32]))); - let receiver_id = AccountId::from((&callback.id(), &PdaSeed::new([1u8; 32]))); + let vault_id = AccountId::from((&initiator.id(), &PdaSeed::new([0_u8; 32]))); + let receiver_id = AccountId::from((&callback.id(), &PdaSeed::new([1_u8; 32]))); let initial_balance: u128 = 1000; @@ -3835,7 +3835,7 @@ pub mod tests { let initiator = Program::flash_swap_initiator(); let token = Program::authenticated_transfer_program(); - let vault_id = AccountId::from((&initiator.id(), &PdaSeed::new([0u8; 32]))); + let vault_id = AccountId::from((&initiator.id(), &PdaSeed::new([0_u8; 32]))); let vault_account = Account { program_owner: token.id(), diff --git a/test_program_methods/guest/src/bin/flash_swap_callback.rs b/test_program_methods/guest/src/bin/flash_swap_callback.rs index 3ecd0445..4419f8f0 100644 --- a/test_program_methods/guest/src/bin/flash_swap_callback.rs +++ b/test_program_methods/guest/src/bin/flash_swap_callback.rs @@ -67,12 +67,15 @@ fn main() { if instruction.return_funds { // Happy path: return the borrowed funds via a token transfer (receiver → vault). // The receiver is a PDA of this callback program (seed = [1u8; 32]). + // Mark the receiver as authorized since it will be PDA-authorized in this chained call. + let mut receiver_authorized = receiver_pre.clone(); + receiver_authorized.is_authorized = true; let transfer_instruction = risc0_zkvm::serde::to_vec(&instruction.amount) .expect("transfer instruction serialization"); chained_calls.push(ChainedCall { program_id: instruction.token_program_id, - pre_states: vec![receiver_pre.clone(), vault_pre.clone()], + pre_states: vec![receiver_authorized, vault_pre.clone()], instruction_data: transfer_instruction, pda_seeds: vec![PdaSeed::new([1u8; 32])], }); diff --git a/test_program_methods/guest/src/bin/flash_swap_initiator.rs b/test_program_methods/guest/src/bin/flash_swap_initiator.rs index 0cf067ec..ae906d33 100644 --- a/test_program_methods/guest/src/bin/flash_swap_initiator.rs +++ b/test_program_methods/guest/src/bin/flash_swap_initiator.rs @@ -110,11 +110,14 @@ fn main() { // Chained call 1: Token transfer (vault → receiver). // The vault is a PDA of this initiator program (seed = [0u8; 32]), so we provide // the PDA seed to authorize the token program to debit the vault on our behalf. + // Mark the vault as authorized since it will be PDA-authorized in this chained call. + let mut vault_authorized = vault_pre.clone(); + vault_authorized.is_authorized = true; let transfer_instruction = risc0_zkvm::serde::to_vec(&amount_out).expect("transfer instruction serialization"); let call_1 = ChainedCall { program_id: token_program_id, - pre_states: vec![vault_pre.clone(), receiver_pre.clone()], + pre_states: vec![vault_authorized, receiver_pre.clone()], instruction_data: transfer_instruction, pda_seeds: vec![PdaSeed::new([0u8; 32])], };