Skip to content

Commit

Permalink
[secp256k1] Remove old libsecp256k1_fail_on_bad_count features (#2795)
Browse files Browse the repository at this point in the history
  • Loading branch information
samkim-crypto authored Sep 25, 2024
1 parent 192ba91 commit b4ae724
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 3 additions & 9 deletions sdk/src/secp256k1_instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -791,9 +791,7 @@ use {
crate::{instruction::Instruction, precompiles::PrecompileError},
digest::Digest,
serde_derive::{Deserialize, Serialize},
solana_feature_set::{
libsecp256k1_fail_on_bad_count, libsecp256k1_fail_on_bad_count2, FeatureSet,
},
solana_feature_set::FeatureSet,
};

pub const HASHED_PUBKEY_SERIALIZED_SIZE: usize = 20;
Expand Down Expand Up @@ -926,17 +924,13 @@ pub fn construct_eth_pubkey(
pub fn verify(
data: &[u8],
instruction_datas: &[&[u8]],
feature_set: &FeatureSet,
_feature_set: &FeatureSet,
) -> Result<(), PrecompileError> {
if data.is_empty() {
return Err(PrecompileError::InvalidInstructionDataSize);
}
let count = data[0] as usize;
if (feature_set.is_active(&libsecp256k1_fail_on_bad_count::id())
|| feature_set.is_active(&libsecp256k1_fail_on_bad_count2::id()))
&& count == 0
&& data.len() > 1
{
if count == 0 && data.len() > 1 {
// count is zero but the instruction data indicates that is probably not
// correct, fail the instruction to catch probable invalid secp256k1
// instruction construction.
Expand Down

0 comments on commit b4ae724

Please sign in to comment.