move PROGRAM_OWNERS to sdk (#34193)

* move PROGRAM_OWNERS to sdk

* Update sdk/src/account.rs

Co-authored-by: Alexander Meißner <AlexanderMeissner@gmx.net>

---------

Co-authored-by: HaoranYi <haoran.yi@solana.com>
Co-authored-by: Alexander Meißner <AlexanderMeissner@gmx.net>
This commit is contained in:
HaoranYi 2023-11-21 09:49:33 -06:00 committed by GitHub
parent 481c357543
commit 57dc7adda1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 7 deletions

View File

@ -125,9 +125,9 @@ use {
account::{
create_account_shared_data_with_fields as create_account, from_account, Account,
AccountSharedData, InheritableAccountFields, ReadableAccount, WritableAccount,
PROGRAM_OWNERS,
},
account_utils::StateMut,
bpf_loader, bpf_loader_deprecated,
bpf_loader_upgradeable::{self, UpgradeableLoaderState},
clock::{
BankId, Epoch, Slot, SlotCount, SlotIndex, UnixTimestamp, DEFAULT_HASHES_PER_TICK,
@ -5229,12 +5229,6 @@ impl Bank {
);
check_time.stop();
const PROGRAM_OWNERS: &[Pubkey] = &[
bpf_loader_upgradeable::id(),
bpf_loader::id(),
bpf_loader_deprecated::id(),
loader_v4::id(),
];
let mut program_accounts_map = self.filter_executable_program_accounts(
&self.ancestors,
sanitized_txs,

View File

@ -4,8 +4,10 @@
use qualifier_attr::qualifiers;
use {
crate::{
bpf_loader, bpf_loader_deprecated, bpf_loader_upgradeable,
clock::{Epoch, INITIAL_RENT_EPOCH},
lamports::LamportsError,
loader_v4,
pubkey::Pubkey,
},
serde::{
@ -753,6 +755,13 @@ pub fn create_is_signer_account_infos<'a>(
})
.collect()
}
+ /// Replacement for the executable flag: An account being owned by one of these contains a program.
pub const PROGRAM_OWNERS: &[Pubkey] = &[
bpf_loader_upgradeable::id(),
bpf_loader::id(),
bpf_loader_deprecated::id(),
loader_v4::id(),
];
#[cfg(test)]
pub mod tests {