Feature cleanup (#19528)
This commit is contained in:
@ -23,7 +23,7 @@ use solana_sdk::{
|
||||
feature_set::{
|
||||
blake3_syscall_enabled, close_upgradeable_program_accounts, disable_fees_sysvar,
|
||||
enforce_aligned_host_addrs, libsecp256k1_0_5_upgrade_enabled, mem_overlap_fix,
|
||||
memory_ops_syscalls, secp256k1_recover_syscall_enabled,
|
||||
secp256k1_recover_syscall_enabled,
|
||||
},
|
||||
hash::{Hasher, HASH_BYTES},
|
||||
ic_msg,
|
||||
@ -158,12 +158,10 @@ pub fn register_syscalls(
|
||||
syscall_registry
|
||||
.register_syscall_by_name(b"sol_get_rent_sysvar", SyscallGetRentSysvar::call)?;
|
||||
|
||||
if invoke_context.is_feature_active(&memory_ops_syscalls::id()) {
|
||||
syscall_registry.register_syscall_by_name(b"sol_memcpy_", SyscallMemcpy::call)?;
|
||||
syscall_registry.register_syscall_by_name(b"sol_memmove_", SyscallMemmove::call)?;
|
||||
syscall_registry.register_syscall_by_name(b"sol_memcmp_", SyscallMemcmp::call)?;
|
||||
syscall_registry.register_syscall_by_name(b"sol_memset_", SyscallMemset::call)?;
|
||||
}
|
||||
|
||||
// Cross-program invocation syscalls
|
||||
syscall_registry
|
||||
@ -290,43 +288,40 @@ pub fn bind_syscall_context_objects<'a>(
|
||||
None,
|
||||
)?;
|
||||
|
||||
bind_feature_gated_syscall_context_object!(
|
||||
vm,
|
||||
invoke_context.is_feature_active(&memory_ops_syscalls::id()),
|
||||
vm.bind_syscall_context_object(
|
||||
Box::new(SyscallMemcpy {
|
||||
cost: invoke_context.get_compute_budget().cpi_bytes_per_unit,
|
||||
compute_meter: invoke_context.get_compute_meter(),
|
||||
loader_id,
|
||||
mem_overlap_fix: invoke_context.is_feature_active(&mem_overlap_fix::id()),
|
||||
}),
|
||||
);
|
||||
bind_feature_gated_syscall_context_object!(
|
||||
vm,
|
||||
invoke_context.is_feature_active(&memory_ops_syscalls::id()),
|
||||
None,
|
||||
)?;
|
||||
vm.bind_syscall_context_object(
|
||||
Box::new(SyscallMemmove {
|
||||
cost: invoke_context.get_compute_budget().cpi_bytes_per_unit,
|
||||
compute_meter: invoke_context.get_compute_meter(),
|
||||
loader_id,
|
||||
}),
|
||||
);
|
||||
bind_feature_gated_syscall_context_object!(
|
||||
vm,
|
||||
invoke_context.is_feature_active(&memory_ops_syscalls::id()),
|
||||
None,
|
||||
)?;
|
||||
vm.bind_syscall_context_object(
|
||||
Box::new(SyscallMemcmp {
|
||||
cost: invoke_context.get_compute_budget().cpi_bytes_per_unit,
|
||||
compute_meter: invoke_context.get_compute_meter(),
|
||||
loader_id,
|
||||
}),
|
||||
);
|
||||
bind_feature_gated_syscall_context_object!(
|
||||
vm,
|
||||
invoke_context.is_feature_active(&memory_ops_syscalls::id()),
|
||||
None,
|
||||
)?;
|
||||
vm.bind_syscall_context_object(
|
||||
Box::new(SyscallMemset {
|
||||
cost: invoke_context.get_compute_budget().cpi_bytes_per_unit,
|
||||
compute_meter: invoke_context.get_compute_meter(),
|
||||
loader_id,
|
||||
}),
|
||||
);
|
||||
None,
|
||||
)?;
|
||||
|
||||
bind_feature_gated_syscall_context_object!(
|
||||
vm,
|
||||
invoke_context.is_feature_active(&blake3_syscall_enabled::id()),
|
||||
|
@ -24,9 +24,7 @@ pub fn process_instruction(
|
||||
let config_keyed_account = &mut keyed_account_at_index(keyed_accounts, 0)?;
|
||||
let current_data: ConfigKeys = {
|
||||
let config_account = config_keyed_account.try_account_ref_mut()?;
|
||||
if invoke_context.is_feature_active(&feature_set::check_program_owner::id())
|
||||
&& config_account.owner() != &crate::id()
|
||||
{
|
||||
if config_account.owner() != &crate::id() {
|
||||
return Err(InstructionError::InvalidAccountOwner);
|
||||
}
|
||||
|
||||
|
@ -38,11 +38,7 @@ pub fn process_instruction(
|
||||
let me = &keyed_account_at_index(keyed_accounts, 0)?;
|
||||
|
||||
if me.owner()? != id() {
|
||||
if invoke_context.is_feature_active(&feature_set::check_program_owner::id()) {
|
||||
return Err(InstructionError::InvalidAccountOwner);
|
||||
} else {
|
||||
return Err(InstructionError::IncorrectProgramId);
|
||||
}
|
||||
}
|
||||
|
||||
match limited_deserialize(data)? {
|
||||
|
@ -321,9 +321,7 @@ pub fn process_instruction(
|
||||
|
||||
let me = &mut keyed_account_at_index(keyed_accounts, 0)?;
|
||||
|
||||
if invoke_context.is_feature_active(&feature_set::check_program_owner::id())
|
||||
&& me.owner()? != id()
|
||||
{
|
||||
if me.owner()? != id() {
|
||||
return Err(InstructionError::InvalidAccountOwner);
|
||||
}
|
||||
|
||||
|
@ -247,9 +247,7 @@ impl Accounts {
|
||||
payer_index = Some(i);
|
||||
}
|
||||
|
||||
if solana_sdk::sysvar::instructions::check_id(key)
|
||||
&& feature_set.is_active(&feature_set::instructions_sysvar_enabled::id())
|
||||
{
|
||||
if solana_sdk::sysvar::instructions::check_id(key) {
|
||||
if message.is_writable(i) {
|
||||
return Err(TransactionError::InvalidAccountIndex);
|
||||
}
|
||||
|
@ -10,8 +10,7 @@ use solana_sdk::{
|
||||
account::{AccountSharedData, ReadableAccount, WritableAccount},
|
||||
compute_budget::ComputeBudget,
|
||||
feature_set::{
|
||||
instructions_sysvar_enabled, neon_evm_compute_budget, tx_wide_compute_cap,
|
||||
updated_verify_policy, FeatureSet,
|
||||
neon_evm_compute_budget, tx_wide_compute_cap, updated_verify_policy, FeatureSet,
|
||||
},
|
||||
fee_calculator::FeeCalculator,
|
||||
hash::Hash,
|
||||
@ -477,7 +476,6 @@ impl MessageProcessor {
|
||||
) -> Result<(), InstructionError> {
|
||||
// Fixup the special instructions key if present
|
||||
// before the account pre-values are taken care of
|
||||
if feature_set.is_active(&instructions_sysvar_enabled::id()) {
|
||||
for (pubkey, accont) in accounts.iter().take(message.account_keys.len()) {
|
||||
if instructions::check_id(pubkey) {
|
||||
let mut mut_account_ref = accont.borrow_mut();
|
||||
@ -488,7 +486,6 @@ impl MessageProcessor {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let program_id = instruction.program_id(&message.account_keys);
|
||||
|
||||
|
@ -26,10 +26,6 @@ use solana_sdk::{
|
||||
};
|
||||
use std::collections::{HashMap, HashSet};
|
||||
|
||||
pub mod instructions_sysvar_enabled {
|
||||
solana_sdk::declare_id!("EnvhHCLvg55P7PDtbvR1NwuTuAeodqpusV3MR5QEK8gs");
|
||||
}
|
||||
|
||||
pub mod deprecate_rewards_sysvar {
|
||||
solana_sdk::declare_id!("GaBtBJvmS4Arjj5W1NmFcyvPjsHN38UGYDq2MDwbs9Qu");
|
||||
}
|
||||
@ -87,10 +83,6 @@ pub mod check_init_vote_data {
|
||||
solana_sdk::declare_id!("3ccR6QpxGYsAbWyfevEtBNGfWV4xBffxRj2tD6A9i39F");
|
||||
}
|
||||
|
||||
pub mod check_program_owner {
|
||||
solana_sdk::declare_id!("5XnbR5Es9YXEARRuP6mdvoxiW3hx5atNNeBmwVd8P3QD");
|
||||
}
|
||||
|
||||
pub mod enforce_aligned_host_addrs {
|
||||
solana_sdk::declare_id!("6Qob9Z4RwGdf599FDVCqsjuKjR8ZFR3oVs2ByRLWBsua");
|
||||
}
|
||||
@ -99,10 +91,6 @@ pub mod stake_program_v4 {
|
||||
solana_sdk::declare_id!("Dc7djyhP9aLfdq2zktpvskeAjpG56msCU1yexpxXiWZb");
|
||||
}
|
||||
|
||||
pub mod memory_ops_syscalls {
|
||||
solana_sdk::declare_id!("ENQi37wsVhTvFz2gUiZAAbqFEWGN2jwFsqdEDTE8A4MU");
|
||||
}
|
||||
|
||||
pub mod secp256k1_recover_syscall_enabled {
|
||||
solana_sdk::declare_id!("6RvdSWHh8oh72Dp7wMTS2DBkf3fRPtChfNrAo3cZZoXJ");
|
||||
}
|
||||
@ -202,7 +190,6 @@ pub mod close_upgradeable_program_accounts {
|
||||
lazy_static! {
|
||||
/// Map of feature identifiers to user-visible description
|
||||
pub static ref FEATURE_NAMES: HashMap<Pubkey, &'static str> = [
|
||||
(instructions_sysvar_enabled::id(), "instructions sysvar"),
|
||||
(deprecate_rewards_sysvar::id(), "deprecate unused rewards sysvar"),
|
||||
(pico_inflation::id(), "pico inflation"),
|
||||
(full_inflation::devnet_and_testnet::id(), "full inflation on devnet and testnet"),
|
||||
@ -216,10 +203,8 @@ lazy_static! {
|
||||
(full_inflation::mainnet::certusone::vote::id(), "community vote allowing Certus One to enable full inflation"),
|
||||
(warp_timestamp_again::id(), "warp timestamp again, adjust bounding to 25% fast 80% slow #15204"),
|
||||
(check_init_vote_data::id(), "check initialized Vote data"),
|
||||
(check_program_owner::id(), "limit programs to operating on accounts owned by itself"),
|
||||
(enforce_aligned_host_addrs::id(), "enforce aligned host addresses"),
|
||||
(stake_program_v4::id(), "solana_stake_program v4"),
|
||||
(memory_ops_syscalls::id(), "add syscalls for memory operations"),
|
||||
(secp256k1_recover_syscall_enabled::id(), "secp256k1_recover syscall"),
|
||||
(add_missing_program_error_mappings::id(), "add missing program error mappings"),
|
||||
(system_transfer_zero_check::id(), "perform all checks for transfers of 0 lamports"),
|
||||
|
Reference in New Issue
Block a user