From 35ed5c50034f7ea16006717becf5c320a59ca30c Mon Sep 17 00:00:00 2001 From: Justin Starry Date: Wed, 16 Feb 2022 16:42:30 +0800 Subject: [PATCH] Fix ed25519 builtin program handling --- runtime/src/builtins.rs | 19 ++++++++++++++++++- sdk/src/precompiles.rs | 2 +- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/runtime/src/builtins.rs b/runtime/src/builtins.rs index 0610afe17a4561..8bb618dbbe1f9b 100644 --- a/runtime/src/builtins.rs +++ b/runtime/src/builtins.rs @@ -129,10 +129,15 @@ fn genesis_builtins() -> Vec { solana_sdk::secp256k1_program::id(), dummy_process_instruction, ), + Builtin::new( + "ed25519_program", + solana_sdk::ed25519_program::id(), + dummy_process_instruction, + ), ] } -/// place holder for secp256k1, remove when the precompile program is deactivated via feature activation +/// place holder for precompile programs, remove when the precompile program is deactivated via feature activation fn dummy_process_instruction( _first_instruction_account: usize, _data: &[u8], @@ -172,6 +177,18 @@ fn feature_builtins() -> Vec<(Builtin, Pubkey, ActivationType)> { feature_set::prevent_calling_precompiles_as_programs::id(), ActivationType::RemoveProgram, ), + // TODO when feature `prevent_calling_precompiles_as_programs` is + // cleaned up also remove "ed25519_program" from the main builtins + // list + ( + Builtin::new( + "ed25519_program", + solana_sdk::ed25519_program::id(), + dummy_process_instruction, + ), + feature_set::prevent_calling_precompiles_as_programs::id(), + ActivationType::RemoveProgram, + ), ( Builtin::new( "address_lookup_table_program", diff --git a/sdk/src/precompiles.rs b/sdk/src/precompiles.rs index 5262c292318aa7..337d922523ee06 100644 --- a/sdk/src/precompiles.rs +++ b/sdk/src/precompiles.rs @@ -88,7 +88,7 @@ lazy_static! { ), Precompile::new( crate::ed25519_program::id(), - Some(ed25519_program_enabled::id()), + Some(prevent_calling_precompiles_as_programs::id()), crate::ed25519_instruction::verify, ), ];