mirror of
https://github.com/logos-blockchain/logos-execution-zone.git
synced 2026-05-09 09:39:29 +00:00
fix: use AccountId::new instead of From<ProgramId>, apply formatting
This commit is contained in:
parent
1d0c93e9cf
commit
032f6b8906
@ -3719,19 +3719,14 @@ pub mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn malicious_self_program_id_rejected_in_public_execution() {
|
fn malicious_self_program_id_rejected_in_public_execution() {
|
||||||
let program = Program::malicious_self_program_id();
|
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 account = Account::default();
|
||||||
|
|
||||||
let mut state = V03State::new_with_genesis_accounts(&[], &[]).with_test_programs();
|
let mut state = V03State::new_with_genesis_accounts(&[], &[]).with_test_programs();
|
||||||
state.force_insert_account(acc_id, account);
|
state.force_insert_account(acc_id, account);
|
||||||
|
|
||||||
let message = public_transaction::Message::try_new(
|
let message =
|
||||||
program.id(),
|
public_transaction::Message::try_new(program.id(), vec![acc_id], vec![], ()).unwrap();
|
||||||
vec![acc_id],
|
|
||||||
vec![],
|
|
||||||
(),
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
let witness_set = public_transaction::WitnessSet::for_message(&message, &[]);
|
let witness_set = public_transaction::WitnessSet::for_message(&message, &[]);
|
||||||
let tx = PublicTransaction::new(message, witness_set);
|
let tx = PublicTransaction::new(message, witness_set);
|
||||||
|
|
||||||
|
|||||||
@ -24,8 +24,8 @@
|
|||||||
//!
|
//!
|
||||||
//! - `self_program_id`: enables a program to chain back to itself (step 3 above)
|
//! - `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
|
//! - `caller_program_id`: enables a program to restrict which callers can invoke an instruction
|
||||||
//! - Computed intermediate states: the initiator computes expected intermediate account
|
//! - Computed intermediate states: the initiator computes expected intermediate account states from
|
||||||
//! states from the pre_states and amount, keeping the instruction minimal.
|
//! the pre_states and amount, keeping the instruction minimal.
|
||||||
//! - Atomic rollback: if the callback doesn't return funds, the invariant check fails, and all
|
//! - 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.
|
//! state changes from steps 1 and 2 are rolled back automatically.
|
||||||
//!
|
//!
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user