Update Syncing logic (#1042)

* Prevent duplicate parent block lookups

* Updates logic for handling re-status'd peers

* Allow block lookup if the block is close to head

* Correct ordering of sync logs

* Remove comments in block processer, clean up sim
This commit is contained in:
Age Manning
2020-04-22 23:58:10 +10:00
committed by GitHub
parent aacec7a4a7
commit 0b82e9f8a9
14 changed files with 386 additions and 201 deletions

View File

@@ -78,27 +78,31 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
.short("s")
.long("speedup")
.takes_value(true)
.help("Speed up factor for eth1 blocks and slot production (default 15)"),
.default_value("15")
.help("Speed up factor for eth1 blocks and slot production"),
)
.arg(
Arg::with_name("initial_delay")
.short("i")
.long("initial_delay")
.takes_value(true)
.help("Epoch delay for new beacon node to start syncing (default 50)"),
.default_value("5")
.help("Epoch delay for new beacon node to start syncing"),
)
.arg(
Arg::with_name("sync_timeout")
.long("sync_timeout")
.takes_value(true)
.help("Number of epochs after which newly added beacon nodes must be synced (default 10)"),
.default_value("10")
.help("Number of epochs after which newly added beacon nodes must be synced"),
)
.arg(
Arg::with_name("strategy")
.long("strategy")
.takes_value(true)
.default_value("all")
.possible_values(&["one-node", "two-nodes", "mixed", "all"])
.help("Sync verification strategy to run. (default all)"),
.help("Sync verification strategy to run."),
),
)
}

View File

@@ -12,14 +12,14 @@ use tokio::timer::Interval;
use types::{Epoch, EthSpec};
pub fn run_syncing_sim(matches: &ArgMatches) -> Result<(), String> {
let initial_delay = value_t!(matches, "initial_delay", u64).unwrap_or(50);
let sync_delay = value_t!(matches, "sync_delay", u64).unwrap_or(10);
let speed_up_factor = value_t!(matches, "speedup", u64).unwrap_or(15);
let strategy = value_t!(matches, "strategy", String).unwrap_or("all".into());
let initial_delay = value_t!(matches, "initial_delay", u64).unwrap();
let sync_timeout = value_t!(matches, "sync_timeout", u64).unwrap();
let speed_up_factor = value_t!(matches, "speedup", u64).unwrap();
let strategy = value_t!(matches, "strategy", String).unwrap();
println!("Syncing Simulator:");
println!(" initial_delay:{}", initial_delay);
println!(" sync delay:{}", sync_delay);
println!(" sync timeout: {}", sync_timeout);
println!(" speed up factor:{}", speed_up_factor);
println!(" strategy:{}", strategy);
@@ -29,7 +29,7 @@ pub fn run_syncing_sim(matches: &ArgMatches) -> Result<(), String> {
syncing_sim(
speed_up_factor,
initial_delay,
sync_delay,
sync_timeout,
strategy,
log_level,
log_format,
@@ -39,7 +39,7 @@ pub fn run_syncing_sim(matches: &ArgMatches) -> Result<(), String> {
fn syncing_sim(
speed_up_factor: u64,
initial_delay: u64,
sync_delay: u64,
sync_timeout: u64,
strategy: String,
log_level: &str,
log_format: Option<&str>,
@@ -108,7 +108,7 @@ fn syncing_sim(
beacon_config.clone(),
slot_duration,
initial_delay,
sync_delay,
sync_timeout,
))
.join(final_future)
.map(|_| network)