Skip to content

Commit

Permalink
Warn if vaildator appears to be repairing excessively (part 1)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbiseda committed Oct 10, 2023
1 parent 982d29c commit 185ab33
Show file tree
Hide file tree
Showing 32 changed files with 241 additions and 76 deletions.
7 changes: 6 additions & 1 deletion banking-bench/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,12 @@ fn main() {
let cluster_info = {
let keypair = Arc::new(Keypair::new());
let node = Node::new_localhost_with_pubkey(&keypair.pubkey());
ClusterInfo::new(node.info, keypair, SocketAddrSpace::Unspecified)
ClusterInfo::new(
node.info,
keypair,
SocketAddrSpace::Unspecified,
/*known_validators*/ None,
)
};
let cluster_info = Arc::new(cluster_info);
let tpu_disable_quic = matches.is_present("tpu_disable_quic");
Expand Down
7 changes: 6 additions & 1 deletion core/benches/banking_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,12 @@ fn bench_banking(bencher: &mut Bencher, tx_type: TransactionType) {
let cluster_info = {
let keypair = Arc::new(Keypair::new());
let node = Node::new_localhost_with_pubkey(&keypair.pubkey());
ClusterInfo::new(node.info, keypair, SocketAddrSpace::Unspecified)
ClusterInfo::new(
node.info,
keypair,
SocketAddrSpace::Unspecified,
/*known_validators*/ None,
)
};
let cluster_info = Arc::new(cluster_info);
let (s, _r) = unbounded();
Expand Down
7 changes: 6 additions & 1 deletion core/src/accounts_hash_verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,12 @@ mod tests {
fn new_test_cluster_info() -> ClusterInfo {
let keypair = Arc::new(Keypair::new());
let contact_info = ContactInfo::new_localhost(&keypair.pubkey(), timestamp());
ClusterInfo::new(contact_info, keypair, SocketAddrSpace::Unspecified)
ClusterInfo::new(
contact_info,
keypair,
SocketAddrSpace::Unspecified,
/*known_validators*/ None,
)
}

#[test]
Expand Down
8 changes: 6 additions & 2 deletions core/src/banking_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -655,8 +655,12 @@ mod tests {
pub(crate) fn new_test_cluster_info(keypair: Option<Arc<Keypair>>) -> (Node, ClusterInfo) {
let keypair = keypair.unwrap_or_else(|| Arc::new(Keypair::new()));
let node = Node::new_localhost_with_pubkey(&keypair.pubkey());
let cluster_info =
ClusterInfo::new(node.info.clone(), keypair, SocketAddrSpace::Unspecified);
let cluster_info = ClusterInfo::new(
node.info.clone(),
keypair,
SocketAddrSpace::Unspecified,
/*known_validators*/ None,
);
(node, cluster_info)
}

Expand Down
7 changes: 6 additions & 1 deletion core/src/cluster_slots_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,12 @@ mod test {
let keypair = Arc::new(Keypair::new());
let pubkey = keypair.pubkey();
let node_info = Node::new_localhost_with_pubkey(&pubkey);
let cluster_info = ClusterInfo::new(node_info.info, keypair, SocketAddrSpace::Unspecified);
let cluster_info = ClusterInfo::new(
node_info.info,
keypair,
SocketAddrSpace::Unspecified,
/*known_validators*/ None,
);
ClusterSlotsService::update_lowest_slot(5, &cluster_info);
cluster_info.flush_push_queue();
let lowest = {
Expand Down
2 changes: 2 additions & 0 deletions core/src/repair/ancestor_hashes_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1256,6 +1256,7 @@ mod test {
responder_node.info.clone(),
Arc::new(keypair),
SocketAddrSpace::Unspecified,
/*known_validators*/ None,
);
let responder_serve_repair = ServeRepair::new(
Arc::new(cluster_info),
Expand Down Expand Up @@ -1350,6 +1351,7 @@ mod test {
Node::new_localhost_with_pubkey(&keypair.pubkey()).info,
Arc::new(keypair),
SocketAddrSpace::Unspecified,
/*known_validators*/ None,
));
let repair_whitelist = Arc::new(RwLock::new(HashSet::default()));
let requester_serve_repair = ServeRepair::new(
Expand Down
7 changes: 6 additions & 1 deletion core/src/repair/repair_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,12 @@ mod test {
fn new_test_cluster_info() -> ClusterInfo {
let keypair = Arc::new(Keypair::new());
let contact_info = ContactInfo::new_localhost(&keypair.pubkey(), timestamp());
ClusterInfo::new(contact_info, keypair, SocketAddrSpace::Unspecified)
ClusterInfo::new(
contact_info,
keypair,
SocketAddrSpace::Unspecified,
/*known_validators*/ None,
)
}

#[test]
Expand Down
7 changes: 6 additions & 1 deletion core/src/repair/serve_repair.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1969,7 +1969,12 @@ mod tests {
fn new_test_cluster_info() -> ClusterInfo {
let keypair = Arc::new(Keypair::new());
let contact_info = ContactInfo::new_localhost(&keypair.pubkey(), timestamp());
ClusterInfo::new(contact_info, keypair, SocketAddrSpace::Unspecified)
ClusterInfo::new(
contact_info,
keypair,
SocketAddrSpace::Unspecified,
/*known_validators*/ None,
)
}

#[test]
Expand Down
1 change: 1 addition & 0 deletions core/src/replay_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4162,6 +4162,7 @@ pub(crate) mod tests {
Node::new_localhost_with_pubkey(&my_pubkey).info,
Arc::new(my_keypairs.node_keypair.insecure_clone()),
SocketAddrSpace::Unspecified,
/*known_validators*/ None,
);
assert_eq!(my_pubkey, cluster_info.id());

Expand Down
8 changes: 6 additions & 2 deletions core/src/tvu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,8 +409,12 @@ pub mod tests {
let (repair_quic_endpoint_sender, _repair_quic_endpoint_receiver) =
tokio::sync::mpsc::channel(/*buffer:*/ 128);
//start cluster_info1
let cluster_info1 =
ClusterInfo::new(target1.info.clone(), keypair, SocketAddrSpace::Unspecified);
let cluster_info1 = ClusterInfo::new(
target1.info.clone(),
keypair,
SocketAddrSpace::Unspecified,
/*known_validators*/ None,
);
cluster_info1.insert_info(leader.info);
let cref1 = Arc::new(cluster_info1);

Expand Down
3 changes: 2 additions & 1 deletion core/src/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,7 @@ impl Validator {
node.info.clone(),
identity_keypair.clone(),
socket_addr_space,
config.known_validators.clone(),
);
cluster_info.set_contact_debug_interval(config.contact_debug_interval);
cluster_info.set_entrypoints(cluster_entrypoints);
Expand Down Expand Up @@ -974,7 +975,6 @@ impl Validator {
ledger_path,
config.validator_exit.clone(),
exit.clone(),
config.known_validators.clone(),
rpc_override_health_check.clone(),
startup_verification_complete,
optimistically_confirmed_bank.clone(),
Expand Down Expand Up @@ -2610,6 +2610,7 @@ mod tests {
ContactInfo::new_localhost(&node_keypair.pubkey(), timestamp()),
node_keypair,
SocketAddrSpace::Unspecified,
/*known_validators*/ None,
);

let (genesis_config, _mint_keypair) = create_genesis_config(1);
Expand Down
5 changes: 4 additions & 1 deletion core/src/window_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ impl WindowService {
let (duplicate_sender, duplicate_receiver) = unbounded();

let t_check_duplicate = Self::start_check_duplicate_thread(
cluster_info,
cluster_info.clone(),
exit.clone(),
blockstore.clone(),
duplicate_receiver,
Expand Down Expand Up @@ -442,6 +442,7 @@ impl WindowService {
};
let mut metrics = BlockstoreInsertionMetrics::default();
let mut ws_metrics = WindowServiceMetrics::default();

let mut last_print = Instant::now();
while !exit.load(Ordering::Relaxed) {
if let Err(e) = run_insert(
Expand Down Expand Up @@ -581,6 +582,7 @@ mod test {
contact_info,
Arc::new(keypair),
SocketAddrSpace::Unspecified,
/*known_validators*/ None,
);
run_check_duplicate(
&cluster_info,
Expand Down Expand Up @@ -615,6 +617,7 @@ mod test {
contact_info,
Arc::new(keypair),
SocketAddrSpace::Unspecified,
/*known_validators*/ None,
));

// Start duplicate thread receiving and inserting duplicates
Expand Down
1 change: 1 addition & 0 deletions core/tests/epoch_accounts_hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ impl TestEnvironment {
ContactInfo::new_localhost(&node_id.pubkey(), timestamp()),
Arc::clone(&node_id),
SocketAddrSpace::Unspecified,
/*known_validators*/ None,
));

let pruned_banks_receiver =
Expand Down
8 changes: 7 additions & 1 deletion core/tests/snapshots.rs
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,12 @@ fn test_concurrent_snapshot_packaging(
timestamp(), // wallclock
0u16, // shred_version
);
ClusterInfo::new(contact_info, keypair, SocketAddrSpace::Unspecified)
ClusterInfo::new(
contact_info,
keypair,
SocketAddrSpace::Unspecified,
/*known_validators*/ None,
)
});

let (snapshot_package_sender, snapshot_package_receiver) = crossbeam_channel::unbounded();
Expand Down Expand Up @@ -955,6 +960,7 @@ fn test_snapshots_with_background_services(
ContactInfo::new_localhost(&node_keypair.pubkey(), timestamp()),
node_keypair,
SocketAddrSpace::Unspecified,
/*known_validators*/ None,
));

let (pruned_banks_sender, pruned_banks_receiver) = unbounded();
Expand Down
Loading

0 comments on commit 185ab33

Please sign in to comment.