From 27fbd10d927907262d9d206c3e3d8d16d21b8f8d Mon Sep 17 00:00:00 2001 From: Moudy Date: Tue, 7 Apr 2026 20:15:17 +0200 Subject: [PATCH] fix: post-merge test fixes for caller_program_id and genesis_timestamp --- nssa/src/state.rs | 12 ++++++------ nssa/src/validated_state_diff.rs | 6 ++++++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/nssa/src/state.rs b/nssa/src/state.rs index 8e0f5af7..7753e1a3 100644 --- a/nssa/src/state.rs +++ b/nssa/src/state.rs @@ -3944,7 +3944,7 @@ pub mod tests { ..Account::default() }; - let mut state = V03State::new_with_genesis_accounts(&[], &[]).with_test_programs(); + let mut state = V03State::new_with_genesis_accounts(&[], &[], 0).with_test_programs(); state.force_insert_account(vault_id, vault_account); state.force_insert_account(receiver_id, receiver_account); @@ -3995,7 +3995,7 @@ pub mod tests { ..Account::default() }; - let mut state = V03State::new_with_genesis_accounts(&[], &[]).with_test_programs(); + let mut state = V03State::new_with_genesis_accounts(&[], &[], 0).with_test_programs(); state.force_insert_account(vault_id, vault_account); state.force_insert_account(receiver_id, receiver_account); @@ -4052,7 +4052,7 @@ pub mod tests { ..Account::default() }; - let mut state = V03State::new_with_genesis_accounts(&[], &[]).with_test_programs(); + let mut state = V03State::new_with_genesis_accounts(&[], &[], 0).with_test_programs(); state.force_insert_account(vault_id, vault_account); state.force_insert_account(receiver_id, receiver_account); @@ -4093,7 +4093,7 @@ pub mod tests { ..Account::default() }; - let mut state = V03State::new_with_genesis_accounts(&[], &[]).with_test_programs(); + let mut state = V03State::new_with_genesis_accounts(&[], &[], 0).with_test_programs(); state.force_insert_account(vault_id, vault_account); let instruction = FlashSwapInstruction::InvariantCheck { @@ -4123,7 +4123,7 @@ pub mod tests { let acc_id = AccountId::new([99; 32]); let account = Account::default(); - let mut state = V03State::new_with_genesis_accounts(&[], &[]).with_test_programs(); + let mut state = V03State::new_with_genesis_accounts(&[], &[], 0).with_test_programs(); state.force_insert_account(acc_id, account); let message = @@ -4144,7 +4144,7 @@ pub mod tests { let acc_id = AccountId::new([99; 32]); let account = Account::default(); - let mut state = V03State::new_with_genesis_accounts(&[], &[]).with_test_programs(); + let mut state = V03State::new_with_genesis_accounts(&[], &[], 0).with_test_programs(); state.force_insert_account(acc_id, account); let message = diff --git a/nssa/src/validated_state_diff.rs b/nssa/src/validated_state_diff.rs index 90fa3e6c..38e8be61 100644 --- a/nssa/src/validated_state_diff.rs +++ b/nssa/src/validated_state_diff.rs @@ -159,6 +159,12 @@ impl ValidatedStateDiff { NssaError::InvalidProgramBehavior ); + // Verify that the program output's caller_program_id matches the actual caller. + ensure!( + program_output.caller_program_id == caller_program_id, + NssaError::InvalidProgramBehavior + ); + // Verify execution corresponds to a well-behaved program. // See the # Programs section for the definition of the `validate_execution` method. ensure!(