Remove native id check in pda creation (#19595)
This commit is contained in:
@ -1,8 +1,5 @@
|
||||
#![allow(clippy::integer_arithmetic)]
|
||||
use crate::{
|
||||
bpf_loader, bpf_loader_deprecated, config, decode_error::DecodeError, feature, hash::hashv,
|
||||
secp256k1_program, stake, system_program, sysvar, vote,
|
||||
};
|
||||
use crate::{decode_error::DecodeError, hash::hashv};
|
||||
|
||||
use borsh::{BorshDeserialize, BorshSchema, BorshSerialize};
|
||||
use num_derive::{FromPrimitive, ToPrimitive};
|
||||
@ -214,10 +211,6 @@ impl Pubkey {
|
||||
}
|
||||
}
|
||||
|
||||
if program_id.is_native_program_id() {
|
||||
return Err(PubkeyError::IllegalOwner);
|
||||
}
|
||||
|
||||
// Perform the calculation inline, calling this from within a program is
|
||||
// not supported
|
||||
#[cfg(not(target_arch = "bpf"))]
|
||||
@ -368,22 +361,6 @@ impl Pubkey {
|
||||
#[cfg(not(target_arch = "bpf"))]
|
||||
crate::program_stubs::sol_log(&self.to_string());
|
||||
}
|
||||
|
||||
pub fn is_native_program_id(&self) -> bool {
|
||||
let all_program_ids = [
|
||||
bpf_loader::id(),
|
||||
bpf_loader_deprecated::id(),
|
||||
feature::id(),
|
||||
config::program::id(),
|
||||
stake::program::id(),
|
||||
stake::config::id(),
|
||||
vote::program::id(),
|
||||
secp256k1_program::id(),
|
||||
system_program::id(),
|
||||
sysvar::id(),
|
||||
];
|
||||
all_program_ids.contains(self)
|
||||
}
|
||||
}
|
||||
|
||||
impl AsRef<[u8]> for Pubkey {
|
||||
@ -600,20 +577,6 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_is_native_program_id() {
|
||||
assert!(bpf_loader::id().is_native_program_id());
|
||||
assert!(bpf_loader_deprecated::id().is_native_program_id());
|
||||
assert!(config::program::id().is_native_program_id());
|
||||
assert!(feature::id().is_native_program_id());
|
||||
assert!(secp256k1_program::id().is_native_program_id());
|
||||
assert!(stake::program::id().is_native_program_id());
|
||||
assert!(stake::config::id().is_native_program_id());
|
||||
assert!(system_program::id().is_native_program_id());
|
||||
assert!(sysvar::id().is_native_program_id());
|
||||
assert!(vote::program::id().is_native_program_id());
|
||||
}
|
||||
|
||||
fn pubkey_from_seed_by_marker(marker: &[u8]) -> Result<Pubkey, PubkeyError> {
|
||||
let key = Pubkey::new_unique();
|
||||
let owner = Pubkey::default();
|
||||
|
Reference in New Issue
Block a user