Skip to content

Commit

Permalink
removes Packet Meta.sender_stake and find_packet_sender_stake_stage
Browse files Browse the repository at this point in the history
Packet Meta.sender_stake is unused since
solana-labs#26512
removed sender_stake from banking-stage buffer prioritization.
  • Loading branch information
behzadnouri committed Apr 6, 2023
1 parent 4564bcd commit 395aac4
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 257 deletions.
2 changes: 1 addition & 1 deletion core/benches/sigverify_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ fn bench_sigverify_stage(bencher: &mut Bencher, use_same_tx: bool) {
batch
.iter_mut()
.for_each(|packet| packet.meta_mut().flags |= PacketFlags::TRACER_PACKET);
packet_s.send(vec![batch]).unwrap();
packet_s.send(batch).unwrap();
}
let mut received = 0;
let mut total_tracer_packets_received_in_sigverify_stage = 0;
Expand Down
21 changes: 4 additions & 17 deletions core/benches/unprocessed_packet_batches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
extern crate test;

use {
rand::distributions::{Distribution, Uniform},
solana_core::{
forward_packet_batches_by_accounts::ForwardPacketBatchesByAccounts,
unprocessed_packet_batches::*,
Expand All @@ -30,16 +29,14 @@ fn build_packet_batch(
) -> (PacketBatch, Vec<usize>) {
let packet_batch = PacketBatch::new(
(0..packet_per_batch_count)
.map(|sender_stake| {
.map(|_| {
let tx = system_transaction::transfer(
&Keypair::new(),
&solana_sdk::pubkey::new_rand(),
1,
recent_blockhash.unwrap_or_else(Hash::new_unique),
);
let mut packet = Packet::from_data(None, tx).unwrap();
packet.meta_mut().sender_stake = sender_stake as u64;
packet
Packet::from_data(None, tx).unwrap()
})
.collect(),
);
Expand All @@ -52,9 +49,6 @@ fn build_randomized_packet_batch(
packet_per_batch_count: usize,
recent_blockhash: Option<Hash>,
) -> (PacketBatch, Vec<usize>) {
let mut rng = rand::thread_rng();
let distribution = Uniform::from(0..200_000);

let packet_batch = PacketBatch::new(
(0..packet_per_batch_count)
.map(|_| {
Expand All @@ -64,10 +58,7 @@ fn build_randomized_packet_batch(
1,
recent_blockhash.unwrap_or_else(Hash::new_unique),
);
let mut packet = Packet::from_data(None, tx).unwrap();
let sender_stake = distribution.sample(&mut rng);
packet.meta_mut().sender_stake = sender_stake as u64;
packet
Packet::from_data(None, tx).unwrap()
})
.collect(),
);
Expand Down Expand Up @@ -119,11 +110,7 @@ fn bench_packet_clone(bencher: &mut Bencher) {

let mut timer = Measure::start("insert_batch");
packet_batch.iter().for_each(|packet| {
let mut packet = packet.clone();
packet.meta_mut().sender_stake *= 2;
if packet.meta().sender_stake > 2 {
outer_packet = packet;
}
outer_packet = packet.clone();
});

timer.stop();
Expand Down
163 changes: 0 additions & 163 deletions core/src/find_packet_sender_stake_stage.rs

This file was deleted.

1 change: 0 additions & 1 deletion core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ pub mod cost_update_service;
pub mod drop_bank_service;
pub mod duplicate_repair_status;
pub mod fetch_stage;
pub mod find_packet_sender_stake_stage;
pub mod fork_choice;
pub mod forward_packet_batches_by_accounts;
pub mod gen_keys;
Expand Down
16 changes: 8 additions & 8 deletions core/src/sigverify_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
//! if perf-libs are available

use {
crate::{find_packet_sender_stake_stage::FindPacketSenderStakeReceiver, sigverify},
crate::sigverify,
core::time::Duration,
crossbeam_channel::{RecvTimeoutError, SendError},
crossbeam_channel::{Receiver, RecvTimeoutError, SendError},
itertools::Itertools,
solana_measure::measure::Measure,
solana_perf::{
Expand Down Expand Up @@ -236,7 +236,7 @@ impl SigVerifier for DisabledSigVerifier {

impl SigVerifyStage {
pub fn new<T: SigVerifier + 'static + Send>(
packet_receiver: FindPacketSenderStakeReceiver,
packet_receiver: Receiver<PacketBatch>,
verifier: T,
name: &'static str,
) -> Self {
Expand Down Expand Up @@ -292,11 +292,11 @@ impl SigVerifyStage {

fn verifier<const K: usize, T: SigVerifier>(
deduper: &Deduper<K, [u8]>,
recvr: &FindPacketSenderStakeReceiver,
recvr: &Receiver<PacketBatch>,
verifier: &mut T,
stats: &mut SigVerifierStats,
) -> Result<(), T::SendType> {
let (mut batches, num_packets, recv_duration) = streamer::recv_vec_packet_batches(recvr)?;
let (mut batches, num_packets, recv_duration) = streamer::recv_packet_batches(recvr)?;

let batches_len = batches.len();
debug!(
Expand Down Expand Up @@ -405,7 +405,7 @@ impl SigVerifyStage {
}

fn verifier_service<T: SigVerifier + 'static + Send>(
packet_receiver: FindPacketSenderStakeReceiver,
packet_receiver: Receiver<PacketBatch>,
mut verifier: T,
name: &'static str,
) -> JoinHandle<()> {
Expand Down Expand Up @@ -450,7 +450,7 @@ impl SigVerifyStage {
}

fn verifier_services<T: SigVerifier + 'static + Send>(
packet_receiver: FindPacketSenderStakeReceiver,
packet_receiver: Receiver<PacketBatch>,
verifier: T,
name: &'static str,
) -> JoinHandle<()> {
Expand Down Expand Up @@ -574,7 +574,7 @@ mod tests {
.iter_mut()
.for_each(|packet| packet.meta_mut().flags |= PacketFlags::TRACER_PACKET);
assert_eq!(batch.len(), packets_per_batch);
packet_s.send(vec![batch]).unwrap();
packet_s.send(batch).unwrap();
}
let mut received = 0;
let mut total_tracer_packets_received_in_sigverify_stage = 0;
Expand Down
34 changes: 2 additions & 32 deletions core/src/tpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ use {
GossipVerifiedVoteHashSender, VerifiedVoteSender, VoteTracker,
},
fetch_stage::FetchStage,
find_packet_sender_stake_stage::FindPacketSenderStakeStage,
sigverify::TransactionSigVerifier,
sigverify_stage::SigVerifyStage,
staked_nodes_updater_service::StakedNodesUpdaterService,
Expand Down Expand Up @@ -67,8 +66,6 @@ pub struct Tpu {
broadcast_stage: BroadcastStage,
tpu_quic_t: thread::JoinHandle<()>,
tpu_forwards_quic_t: thread::JoinHandle<()>,
find_packet_sender_stake_stage: FindPacketSenderStakeStage,
vote_find_packet_sender_stake_stage: FindPacketSenderStakeStage,
staked_nodes_updater_service: StakedNodesUpdaterService,
tracer_thread_hdl: TracerThread,
}
Expand Down Expand Up @@ -141,25 +138,6 @@ impl Tpu {
shared_staked_nodes_overrides,
);

let (find_packet_sender_stake_sender, find_packet_sender_stake_receiver) = unbounded();

let find_packet_sender_stake_stage = FindPacketSenderStakeStage::new(
packet_receiver,
find_packet_sender_stake_sender,
staked_nodes.clone(),
"Tpu",
);

let (vote_find_packet_sender_stake_sender, vote_find_packet_sender_stake_receiver) =
unbounded();

let vote_find_packet_sender_stake_stage = FindPacketSenderStakeStage::new(
vote_packet_receiver,
vote_find_packet_sender_stake_sender,
staked_nodes.clone(),
"Vote",
);

let (non_vote_sender, non_vote_receiver) = banking_tracer.create_channel_non_vote();

let stats = Arc::new(StreamStats::default());
Expand Down Expand Up @@ -205,18 +183,14 @@ impl Tpu {

let sigverify_stage = {
let verifier = TransactionSigVerifier::new(non_vote_sender);
SigVerifyStage::new(find_packet_sender_stake_receiver, verifier, "tpu-verifier")
SigVerifyStage::new(packet_receiver, verifier, "tpu-verifier")
};

let (tpu_vote_sender, tpu_vote_receiver) = banking_tracer.create_channel_tpu_vote();

let vote_sigverify_stage = {
let verifier = TransactionSigVerifier::new_reject_non_vote(tpu_vote_sender);
SigVerifyStage::new(
vote_find_packet_sender_stake_receiver,
verifier,
"tpu-vote-verifier",
)
SigVerifyStage::new(vote_packet_receiver, verifier, "tpu-vote-verifier")
};

let (gossip_vote_sender, gossip_vote_receiver) =
Expand Down Expand Up @@ -271,8 +245,6 @@ impl Tpu {
broadcast_stage,
tpu_quic_t,
tpu_forwards_quic_t,
find_packet_sender_stake_stage,
vote_find_packet_sender_stake_stage,
staked_nodes_updater_service,
tracer_thread_hdl,
}
Expand All @@ -285,8 +257,6 @@ impl Tpu {
self.vote_sigverify_stage.join(),
self.cluster_info_vote_listener.join(),
self.banking_stage.join(),
self.find_packet_sender_stake_stage.join(),
self.vote_find_packet_sender_stake_stage.join(),
self.staked_nodes_updater_service.join(),
self.tpu_quic_t.join(),
self.tpu_forwards_quic_t.join(),
Expand Down
Loading

0 comments on commit 395aac4

Please sign in to comment.