Skip to content

Commit

Permalink
use executable flag for legacy bpf loader
Browse files Browse the repository at this point in the history
  • Loading branch information
HaoranYi committed Nov 27, 2023
1 parent 03d53ba commit 3b58901
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions sdk/src/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,14 @@ pub const PROGRAM_OWNERS: &[Pubkey] = &[

/// Return true if the account program is executable.
pub fn is_executable(account: &AccountSharedData) -> bool {
// bpf_loader still relies on `executable` on the program account. When the
// program account is finalized, the loader will mark `executable` flag on
// the account. Once we disable the deployment of these two loaders, we can
// remove the following dependency on `executable`.
if bpf_loader::check_id(account.owner()) || bpf_loader_deprecated::check_id(account.owner()) {
account.executable();
}

if account.data().is_empty() {
// empty account is not executable.
return false;
Expand Down

0 comments on commit 3b58901

Please sign in to comment.