Skip to content

Commit

Permalink
adds feature-gate code to enforce retransmitter signature verification
Browse files Browse the repository at this point in the history
  • Loading branch information
behzadnouri committed Jun 24, 2024
1 parent fae0a50 commit 8abd1d5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
5 changes: 5 additions & 0 deletions sdk/src/feature_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,10 @@ pub mod migrate_config_program_to_core_bpf {
solana_sdk::declare_id!("2Fr57nzzkLYXW695UdDxDeR5fhnZWSttZeZYemrnpGFV");
}

pub mod verify_retransmitter_signature {
solana_sdk::declare_id!("BZ5g4hRbu5hLQQBdPyo2z9icGyJ8Khiyj3QS6dhWijTb");
}

lazy_static! {
/// Map of feature identifiers to user-visible description
pub static ref FEATURE_NAMES: HashMap<Pubkey, &'static str> = [
Expand Down Expand Up @@ -1016,6 +1020,7 @@ lazy_static! {
(migrate_feature_gate_program_to_core_bpf::id(), "Migrate Feature Gate program to Core BPF (programify) #1003"),
(vote_only_full_fec_sets::id(), "vote only full fec sets"),
(migrate_config_program_to_core_bpf::id(), "Migrate Config program to Core BPF #1378"),
(verify_retransmitter_signature::id(), "Verify retransmitter signature #1840"),
/*************** ADD NEW FEATURES HERE ***************/
]
.iter()
Expand Down
16 changes: 15 additions & 1 deletion turbine/src/sigverify_shreds.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use {
crate::{
cluster_nodes::{self, ClusterNodesCache},
cluster_nodes::{self, check_feature_activation, ClusterNodesCache},
retransmit_stage::RetransmitStage,
},
crossbeam_channel::{Receiver, RecvTimeoutError, SendError, Sender},
Expand All @@ -19,6 +19,7 @@ use {
},
solana_sdk::{
clock::Slot,
feature_set,
pubkey::Pubkey,
signature::{Keypair, Signer},
},
Expand Down Expand Up @@ -201,6 +202,19 @@ fn run_shred_sigverify<const K: usize>(
stats
.num_invalid_retransmitter
.fetch_add(1, Ordering::Relaxed);
if shred::layout::get_slot(shred)
.map(|slot| {
check_feature_activation(
&feature_set::verify_retransmitter_signature::id(),
slot,
&root_bank,
)
})
.unwrap_or_default()
{
packet.meta_mut().set_discard(true);
return;
}
}
// We can ignore Error::InvalidShredVariant because that
// basically means that the shred is of a variant which
Expand Down

0 comments on commit 8abd1d5

Please sign in to comment.