fix: use AccountId::new instead of From<ProgramId>, apply formatting

This commit is contained in:
Moudy 2026-04-03 23:24:13 +02:00
parent 1d0c93e9cf
commit 032f6b8906
2 changed files with 5 additions and 10 deletions

View File

@ -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);

View File

@ -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.
//!