Start leader based on Poh tick height. (#3084)

* Start leader based on poh and test

* Equalize validator and leader stakes in LocalCluster

* Clear WorkingBank on poh_recorder reset
This commit is contained in:
anatoly yakovenko
2019-03-05 17:56:51 -08:00
committed by carllin
parent 9491999a95
commit 1c0cfb17a3
7 changed files with 160 additions and 50 deletions

View File

@@ -6,7 +6,7 @@ use solana::local_cluster::LocalCluster;
use solana::rpc::JsonRpcConfig;
#[test]
fn test_spend_and_verify_all_nodes_1() -> () {
fn test_spend_and_verify_all_nodes_1() {
solana_logger::setup();
let num_nodes = 1;
let local = LocalCluster::new(num_nodes, 10_000, 100);
@@ -18,7 +18,7 @@ fn test_spend_and_verify_all_nodes_1() -> () {
}
#[test]
fn test_spend_and_verify_all_nodes_2() -> () {
fn test_spend_and_verify_all_nodes_2() {
solana_logger::setup();
let num_nodes = 2;
let local = LocalCluster::new(num_nodes, 10_000, 100);
@@ -30,7 +30,7 @@ fn test_spend_and_verify_all_nodes_2() -> () {
}
#[test]
fn test_spend_and_verify_all_nodes_3() -> () {
fn test_spend_and_verify_all_nodes_3() {
solana_logger::setup();
let num_nodes = 3;
let local = LocalCluster::new(num_nodes, 10_000, 100);
@@ -43,7 +43,7 @@ fn test_spend_and_verify_all_nodes_3() -> () {
#[test]
#[should_panic]
fn test_fullnode_exit_safe_config_should_panic_2() -> () {
fn test_fullnode_exit_default_config_should_panic() {
solana_logger::setup();
let num_nodes = 2;
let local = LocalCluster::new(num_nodes, 10_000, 100);
@@ -51,7 +51,7 @@ fn test_fullnode_exit_safe_config_should_panic_2() -> () {
}
#[test]
fn test_fullnode_exit_unsafe_config_2() -> () {
fn test_fullnode_exit_2() {
solana_logger::setup();
let num_nodes = 2;
let mut fullnode_exit = FullnodeConfig::default();
@@ -59,3 +59,29 @@ fn test_fullnode_exit_unsafe_config_2() -> () {
let local = LocalCluster::new_with_config(num_nodes, 10_000, 100, &fullnode_exit);
cluster_tests::fullnode_exit(&local.entry_point_info, num_nodes);
}
#[test]
fn test_leader_failure_2() {
let num_nodes = 2;
let mut fullnode_exit = FullnodeConfig::default();
fullnode_exit.rpc_config = JsonRpcConfig::TestOnlyAllowRpcFullnodeExit;
let local = LocalCluster::new_with_config(num_nodes, 10_000, 100, &fullnode_exit);
cluster_tests::kill_entry_and_spend_and_verify_rest(
&local.entry_point_info,
&local.funding_keypair,
num_nodes,
);
}
#[test]
fn test_leader_failure_3() {
let num_nodes = 3;
let mut fullnode_exit = FullnodeConfig::default();
fullnode_exit.rpc_config = JsonRpcConfig::TestOnlyAllowRpcFullnodeExit;
let local = LocalCluster::new_with_config(num_nodes, 10_000, 100, &fullnode_exit);
cluster_tests::kill_entry_and_spend_and_verify_rest(
&local.entry_point_info,
&local.funding_keypair,
num_nodes,
);
}