Support local cluster edge case testing (#7135)

* Refactor local cluster to support killing a partition

* Rework run_network_partition

* Introduce fixed leader schedule

* Plumb fixed schedule into test
This commit is contained in:
carllin
2019-12-03 16:31:59 -08:00
committed by GitHub
parent f75c51ff71
commit f0a40862d6
10 changed files with 311 additions and 94 deletions

View File

@ -1033,7 +1033,7 @@ impl ReplayStage {
);
datapoint_error!(
"replay-stage-entry_verification_failure",
"replay-stage-block-error",
("slot", bank.slot(), i64),
("last_entry", last_entry.to_string(), String),
);

View File

@ -26,6 +26,7 @@ use solana_ledger::{
blocktree::{Blocktree, CompletedSlotsReceiver},
blocktree_processor::{self, BankForksInfo},
create_new_tmp_ledger,
leader_schedule::FixedSchedule,
leader_schedule_cache::LeaderScheduleCache,
};
use solana_metrics::datapoint_info;
@ -65,6 +66,7 @@ pub struct ValidatorConfig {
pub max_ledger_slots: Option<u64>,
pub broadcast_stage_type: BroadcastStageType,
pub partition_cfg: Option<PartitionCfg>,
pub fixed_leader_schedule: Option<FixedSchedule>,
}
impl Default for ValidatorConfig {
@ -83,6 +85,7 @@ impl Default for ValidatorConfig {
snapshot_config: None,
broadcast_stage_type: BroadcastStageType::Standard,
partition_cfg: None,
fixed_leader_schedule: None,
}
}
}
@ -182,6 +185,7 @@ impl Validator {
config.snapshot_config.clone(),
poh_verify,
config.dev_halt_at_slot,
config.fixed_leader_schedule.clone(),
);
let leader_schedule_cache = Arc::new(leader_schedule_cache);
@ -469,6 +473,7 @@ pub fn new_banks_from_blocktree(
snapshot_config: Option<SnapshotConfig>,
poh_verify: bool,
dev_halt_at_slot: Option<Slot>,
fixed_leader_schedule: Option<FixedSchedule>,
) -> (
Hash,
BankForks,
@ -506,7 +511,7 @@ pub fn new_banks_from_blocktree(
..blocktree_processor::ProcessOptions::default()
};
let (mut bank_forks, bank_forks_info, leader_schedule_cache) = bank_forks_utils::load(
let (mut bank_forks, bank_forks_info, mut leader_schedule_cache) = bank_forks_utils::load(
&genesis_config,
&blocktree,
account_paths,
@ -518,6 +523,8 @@ pub fn new_banks_from_blocktree(
std::process::exit(1);
});
leader_schedule_cache.set_fixed_leader_schedule(fixed_leader_schedule);
bank_forks.set_snapshot_config(snapshot_config);
(