Enable cluster tests (#3372)
* Cluster tests * stable! * fixup! stable! * fixup! fixup! stable! * fixup! fixup! fixup! stable! * fixup! fixup! fixup! fixup! stable! * fixed space * add getNumBlocksSinceSignatureConfirmation entry for the json rpc docs * Check in upcoming epochs for potential leadership slots in next_leader_slot()
This commit is contained in:
committed by
GitHub
parent
402a733cd7
commit
148e08a8a5
@@ -7,11 +7,14 @@ use crate::cluster_info::FULLNODE_PORT_RANGE;
|
||||
use crate::contact_info::ContactInfo;
|
||||
use crate::entry::{Entry, EntrySlice};
|
||||
use crate::gossip_service::discover;
|
||||
use crate::locktower::VOTE_THRESHOLD_DEPTH;
|
||||
use solana_client::thin_client::create_client;
|
||||
use solana_sdk::hash::Hash;
|
||||
use solana_sdk::signature::{Keypair, KeypairUtil, Signature};
|
||||
use solana_sdk::system_transaction::SystemTransaction;
|
||||
use solana_sdk::timing::{DEFAULT_SLOTS_PER_EPOCH, DEFAULT_TICKS_PER_SLOT, NUM_TICKS_PER_SECOND};
|
||||
use solana_sdk::timing::{
|
||||
DEFAULT_TICKS_PER_SLOT, NUM_CONSECUTIVE_LEADER_SLOTS, NUM_TICKS_PER_SECOND,
|
||||
};
|
||||
use std::io;
|
||||
use std::thread::sleep;
|
||||
use std::time::Duration;
|
||||
@@ -40,12 +43,13 @@ pub fn spend_and_verify_all_nodes(
|
||||
client.get_recent_blockhash().unwrap(),
|
||||
0,
|
||||
);
|
||||
let confs = VOTE_THRESHOLD_DEPTH + 1;
|
||||
let sig = client
|
||||
.retry_transfer(&funding_keypair, &mut transaction, 5)
|
||||
.retry_transfer_until_confirmed(&funding_keypair, &mut transaction, 5, confs)
|
||||
.unwrap();
|
||||
for validator in &cluster_nodes {
|
||||
let client = create_client(validator.client_facing_addr(), FULLNODE_PORT_RANGE);
|
||||
client.poll_for_signature(&sig).unwrap();
|
||||
client.poll_for_signature_confirmation(&sig, confs).unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -127,14 +131,18 @@ pub fn kill_entry_and_spend_and_verify_rest(
|
||||
let cluster_nodes = discover(&entry_point_info.gossip, nodes).unwrap();
|
||||
assert!(cluster_nodes.len() >= nodes);
|
||||
let client = create_client(entry_point_info.client_facing_addr(), FULLNODE_PORT_RANGE);
|
||||
info!("sleeping for an epoch");
|
||||
sleep(Duration::from_millis(SLOT_MILLIS * DEFAULT_SLOTS_PER_EPOCH));
|
||||
info!("done sleeping for an epoch");
|
||||
info!("sleeping for 2 leader fortnights");
|
||||
sleep(Duration::from_millis(
|
||||
SLOT_MILLIS * NUM_CONSECUTIVE_LEADER_SLOTS * 2,
|
||||
));
|
||||
info!("done sleeping for 2 fortnights");
|
||||
info!("killing entry point");
|
||||
assert!(client.fullnode_exit().unwrap());
|
||||
info!("sleeping for a slot");
|
||||
sleep(Duration::from_millis(SLOT_MILLIS));
|
||||
info!("done sleeping for a slot");
|
||||
info!("sleeping for 2 leader fortnights");
|
||||
sleep(Duration::from_millis(
|
||||
SLOT_MILLIS * NUM_CONSECUTIVE_LEADER_SLOTS,
|
||||
));
|
||||
info!("done sleeping for 2 fortnights");
|
||||
for ingress_node in &cluster_nodes {
|
||||
if ingress_node.id == entry_point_info.id {
|
||||
continue;
|
||||
@@ -163,8 +171,15 @@ pub fn kill_entry_and_spend_and_verify_rest(
|
||||
0,
|
||||
);
|
||||
|
||||
let confs = VOTE_THRESHOLD_DEPTH + 1;
|
||||
let sig = {
|
||||
match client.retry_transfer(&funding_keypair, &mut transaction, 5) {
|
||||
let sig = client.retry_transfer_until_confirmed(
|
||||
&funding_keypair,
|
||||
&mut transaction,
|
||||
5,
|
||||
confs,
|
||||
);
|
||||
match sig {
|
||||
Err(e) => {
|
||||
result = Err(e);
|
||||
continue;
|
||||
@@ -174,7 +189,7 @@ pub fn kill_entry_and_spend_and_verify_rest(
|
||||
}
|
||||
};
|
||||
|
||||
match poll_all_nodes_for_signature(&entry_point_info, &cluster_nodes, &sig) {
|
||||
match poll_all_nodes_for_signature(&entry_point_info, &cluster_nodes, &sig, confs) {
|
||||
Err(e) => {
|
||||
result = Err(e);
|
||||
}
|
||||
@@ -190,13 +205,14 @@ fn poll_all_nodes_for_signature(
|
||||
entry_point_info: &ContactInfo,
|
||||
cluster_nodes: &[ContactInfo],
|
||||
sig: &Signature,
|
||||
confs: usize,
|
||||
) -> io::Result<()> {
|
||||
for validator in cluster_nodes {
|
||||
if validator.id == entry_point_info.id {
|
||||
continue;
|
||||
}
|
||||
let client = create_client(validator.client_facing_addr(), FULLNODE_PORT_RANGE);
|
||||
client.poll_for_signature(&sig)?;
|
||||
client.poll_for_signature_confirmation(&sig, confs)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
Reference in New Issue
Block a user