Skip to content

Commit

Permalink
clean feature: dedupe_config_program_signers (solana-labs#34077)
Browse files Browse the repository at this point in the history
  • Loading branch information
jstarry authored Nov 16, 2023
1 parent 2573b7a commit 0817cb0
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions programs/config/src/config_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use {
bincode::deserialize,
solana_program_runtime::{declare_process_instruction, ic_msg},
solana_sdk::{
feature_set, instruction::InstructionError, program_utils::limited_deserialize,
pubkey::Pubkey, transaction_context::IndexOfAccount,
instruction::InstructionError, program_utils::limited_deserialize, pubkey::Pubkey,
transaction_context::IndexOfAccount,
},
std::collections::BTreeSet,
};
Expand Down Expand Up @@ -102,16 +102,12 @@ declare_process_instruction!(Entrypoint, DEFAULT_COMPUTE_UNITS, |invoke_context|
}
}

if invoke_context
.feature_set
.is_active(&feature_set::dedupe_config_program_signers::id())
{
let total_new_keys = key_list.keys.len();
let unique_new_keys = key_list.keys.into_iter().collect::<BTreeSet<_>>();
if unique_new_keys.len() != total_new_keys {
ic_msg!(invoke_context, "new config contains duplicate keys");
return Err(InstructionError::InvalidArgument);
}
// dedupe signers
let total_new_keys = key_list.keys.len();
let unique_new_keys = key_list.keys.into_iter().collect::<BTreeSet<_>>();
if unique_new_keys.len() != total_new_keys {
ic_msg!(invoke_context, "new config contains duplicate keys");
return Err(InstructionError::InvalidArgument);
}

// Check for Config data signers not present in incoming account update
Expand Down

0 comments on commit 0817cb0

Please sign in to comment.