Skip to content

Commit

Permalink
Check for loader v4 in check_loader_id
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasSte committed Mar 6, 2024
1 parent b950e9b commit 62d3ab1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
3 changes: 2 additions & 1 deletion programs/bpf_loader/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ use {
},
instruction::{AccountMeta, InstructionError},
loader_upgradeable_instruction::UpgradeableLoaderInstruction,
native_loader,
loader_v4, native_loader,
program_utils::limited_deserialize,
pubkey::Pubkey,
saturating_add_assign,
Expand Down Expand Up @@ -193,6 +193,7 @@ pub fn check_loader_id(id: &Pubkey) -> bool {
bpf_loader::check_id(id)
|| bpf_loader_deprecated::check_id(id)
|| bpf_loader_upgradeable::check_id(id)
|| loader_v4::check_id(id)
}

/// Only used in macro, do not use directly!
Expand Down
9 changes: 4 additions & 5 deletions svm/src/transaction_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,10 @@ impl<FG: ForkGraph> TransactionBatchProcessor<FG> {
Some(account) => account,
};

debug_assert!(solana_bpf_loader_program::check_loader_id(
program_account.owner()
));

if loader_v4::check_id(program_account.owner()) {
return solana_loader_v4_program::get_state(program_account.data())
.ok()
Expand All @@ -832,10 +836,6 @@ impl<FG: ForkGraph> TransactionBatchProcessor<FG> {
));
}

debug_assert!(solana_bpf_loader_program::check_loader_id(
program_account.owner()
));

if !bpf_loader_upgradeable::check_id(program_account.owner()) {
return ProgramAccountLoadResult::ProgramOfLoaderV1orV2(program_account);
}
Expand All @@ -862,7 +862,6 @@ impl<FG: ForkGraph> TransactionBatchProcessor<FG> {
);
}
}

ProgramAccountLoadResult::InvalidAccountData(environments.program_runtime_v1.clone())
}

Expand Down

0 comments on commit 62d3ab1

Please sign in to comment.