Dont call precompiled programs (#19930)
This commit is contained in:
@@ -46,6 +46,7 @@ macro_rules! with_program_logging {
|
||||
pub enum ActivationType {
|
||||
NewProgram,
|
||||
NewVersion,
|
||||
RemoveProgram,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
@@ -91,7 +92,7 @@ pub struct Builtins {
|
||||
/// Builtin programs that are always available
|
||||
pub genesis_builtins: Vec<Builtin>,
|
||||
|
||||
/// Builtin programs activated dynamically by feature
|
||||
/// Builtin programs activated or deactivated dynamically by feature
|
||||
pub feature_builtins: Vec<(Builtin, Pubkey, ActivationType)>,
|
||||
}
|
||||
|
||||
@@ -121,11 +122,20 @@ fn genesis_builtins() -> Vec<Builtin> {
|
||||
Builtin::new(
|
||||
"secp256k1_program",
|
||||
solana_sdk::secp256k1_program::id(),
|
||||
solana_secp256k1_program::process_instruction,
|
||||
dummy_process_instruction,
|
||||
),
|
||||
]
|
||||
}
|
||||
|
||||
/// place holder for secp256k1, remove when the precompile program is deactivated via feature activation
|
||||
fn dummy_process_instruction(
|
||||
_program_id: &Pubkey,
|
||||
_data: &[u8],
|
||||
_invoke_context: &mut dyn InvokeContext,
|
||||
) -> Result<(), InstructionError> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Builtin programs activated dynamically by feature
|
||||
///
|
||||
/// Note: If the feature_builtin is intended to replace another builtin program, it must have a new
|
||||
@@ -145,14 +155,17 @@ fn feature_builtins() -> Vec<(Builtin, Pubkey, ActivationType)> {
|
||||
feature_set::tx_wide_compute_cap::id(),
|
||||
ActivationType::NewProgram,
|
||||
),
|
||||
// TODO when feature `prevent_calling_precompiles_as_programs` is
|
||||
// cleaned up also remove "secp256k1_program" from the main builtins
|
||||
// list
|
||||
(
|
||||
Builtin::new(
|
||||
"ed25519_program",
|
||||
solana_sdk::ed25519_program::id(),
|
||||
solana_ed25519_program::process_instruction,
|
||||
"secp256k1_program",
|
||||
solana_sdk::secp256k1_program::id(),
|
||||
dummy_process_instruction,
|
||||
),
|
||||
feature_set::ed25519_program_enabled::id(),
|
||||
ActivationType::NewProgram,
|
||||
feature_set::prevent_calling_precompiles_as_programs::id(),
|
||||
ActivationType::RemoveProgram,
|
||||
),
|
||||
]
|
||||
}
|
||||
|
Reference in New Issue
Block a user