Skip to content

Commit 54d08d7

Browse files
v2.0: adds feature-gate code to enforce retransmitter signature verification (backport of #1840) (#2415)
* adds feature-gate code to enforce retransmitter signature verification (#1840) (cherry picked from commit 79cb077) # Conflicts: # sdk/src/feature_set.rs * resolves merge conflicts --------- Co-authored-by: behzad nouri <[email protected]>
1 parent 9557d87 commit 54d08d7

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

sdk/src/feature_set.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -837,6 +837,10 @@ pub mod ed25519_precompile_verify_strict {
837837
solana_sdk::declare_id!("ed9tNscbWLYBooxWA7FE2B5KHWs8A6sxfY8EzezEcoo");
838838
}
839839

840+
pub mod verify_retransmitter_signature {
841+
solana_sdk::declare_id!("BZ5g4hRbu5hLQQBdPyo2z9icGyJ8Khiyj3QS6dhWijTb");
842+
}
843+
840844
lazy_static! {
841845
/// Map of feature identifiers to user-visible description
842846
pub static ref FEATURE_NAMES: HashMap<Pubkey, &'static str> = [
@@ -1041,6 +1045,7 @@ lazy_static! {
10411045
(zk_elgamal_proof_program_enabled::id(), "Enable ZkElGamalProof program SIMD-0153"),
10421046
(move_stake_and_move_lamports_ixs::id(), "Enable MoveStake and MoveLamports stake program instructions #1610"),
10431047
(ed25519_precompile_verify_strict::id(), "Use strict verification in ed25519 precompile SIMD-0152"),
1048+
(verify_retransmitter_signature::id(), "Verify retransmitter signature #1840"),
10441049
/*************** ADD NEW FEATURES HERE ***************/
10451050
]
10461051
.iter()

turbine/src/sigverify_shreds.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use {
22
crate::{
3-
cluster_nodes::{self, ClusterNodesCache},
3+
cluster_nodes::{self, check_feature_activation, ClusterNodesCache},
44
retransmit_stage::RetransmitStage,
55
},
66
crossbeam_channel::{Receiver, RecvTimeoutError, SendError, Sender},
@@ -19,6 +19,7 @@ use {
1919
},
2020
solana_sdk::{
2121
clock::Slot,
22+
feature_set,
2223
pubkey::Pubkey,
2324
signature::{Keypair, Signer},
2425
},
@@ -201,6 +202,19 @@ fn run_shred_sigverify<const K: usize>(
201202
stats
202203
.num_invalid_retransmitter
203204
.fetch_add(1, Ordering::Relaxed);
205+
if shred::layout::get_slot(shred)
206+
.map(|slot| {
207+
check_feature_activation(
208+
&feature_set::verify_retransmitter_signature::id(),
209+
slot,
210+
&root_bank,
211+
)
212+
})
213+
.unwrap_or_default()
214+
{
215+
packet.meta_mut().set_discard(true);
216+
return;
217+
}
204218
}
205219
// We can ignore Error::InvalidShredVariant because that
206220
// basically means that the shred is of a variant which

0 commit comments

Comments
 (0)