From 032f6b8906898d90c6edbf657b2db7d24974b448 Mon Sep 17 00:00:00 2001 From: Moudy Date: Fri, 3 Apr 2026 23:24:13 +0200 Subject: [PATCH] fix: use AccountId::new instead of From, apply formatting --- nssa/src/state.rs | 11 +++-------- .../guest/src/bin/flash_swap_initiator.rs | 4 ++-- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/nssa/src/state.rs b/nssa/src/state.rs index 140420dd..c5cdae4b 100644 --- a/nssa/src/state.rs +++ b/nssa/src/state.rs @@ -3719,19 +3719,14 @@ pub mod tests { #[test] fn malicious_self_program_id_rejected_in_public_execution() { let program = Program::malicious_self_program_id(); - let acc_id = AccountId::from(program.id()); + let acc_id = AccountId::new([99; 32]); let account = Account::default(); let mut state = V03State::new_with_genesis_accounts(&[], &[]).with_test_programs(); state.force_insert_account(acc_id, account); - let message = public_transaction::Message::try_new( - program.id(), - vec![acc_id], - vec![], - (), - ) - .unwrap(); + let message = + public_transaction::Message::try_new(program.id(), vec![acc_id], vec![], ()).unwrap(); let witness_set = public_transaction::WitnessSet::for_message(&message, &[]); let tx = PublicTransaction::new(message, witness_set); 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 7c178b28..f4f0c65b 100644 --- a/test_program_methods/guest/src/bin/flash_swap_initiator.rs +++ b/test_program_methods/guest/src/bin/flash_swap_initiator.rs @@ -24,8 +24,8 @@ //! //! - `self_program_id`: enables a program to chain back to itself (step 3 above) //! - `caller_program_id`: enables a program to restrict which callers can invoke an instruction -//! - Computed intermediate states: the initiator computes expected intermediate account -//! states from the pre_states and amount, keeping the instruction minimal. +//! - Computed intermediate states: the initiator computes expected intermediate account states from +//! the pre_states and amount, keeping the instruction minimal. //! - Atomic rollback: if the callback doesn't return funds, the invariant check fails, and all //! state changes from steps 1 and 2 are rolled back automatically. //!