mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-11 18:04:18 +00:00
Configurable epochs-per-state-diff
This commit is contained in:
@@ -566,6 +566,16 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
|
||||
.default_value("4")
|
||||
.takes_value(true)
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("epochs-per-state-diff")
|
||||
.long("epochs-per-state-diff")
|
||||
.value_name("EPOCHS")
|
||||
.help("Number of epochs between state diffs stored in the database. Lower values \
|
||||
result in more writes and more data stored, while higher values result in \
|
||||
more block replaying and longer load times in case of cache miss.")
|
||||
.default_value("4")
|
||||
.takes_value(true)
|
||||
)
|
||||
/*
|
||||
* Misc.
|
||||
*/
|
||||
|
||||
@@ -403,6 +403,12 @@ pub fn get_config<E: EthSpec>(
|
||||
client_config.store_migrator.epochs_per_run = epochs_per_migration;
|
||||
}
|
||||
|
||||
if let Some(epochs_per_state_diff) =
|
||||
clap_utils::parse_optional(cli_args, "epochs-per-state-diff")?
|
||||
{
|
||||
client_config.store.epochs_per_state_diff = epochs_per_state_diff;
|
||||
}
|
||||
|
||||
/*
|
||||
* Zero-ports
|
||||
*
|
||||
|
||||
@@ -1371,6 +1371,24 @@ fn db_migration_period_override() {
|
||||
.run_with_zero_port()
|
||||
.with_config(|config| assert_eq!(config.store_migrator.epochs_per_run, 128));
|
||||
}
|
||||
#[test]
|
||||
fn epochs_per_state_diff_default() {
|
||||
CommandLineTest::new()
|
||||
.run_with_zero_port()
|
||||
.with_config(|config| {
|
||||
assert_eq!(
|
||||
config.store.epochs_per_state_diff,
|
||||
beacon_node::beacon_chain::store::config::DEFAULT_EPOCHS_PER_STATE_DIFF
|
||||
)
|
||||
});
|
||||
}
|
||||
#[test]
|
||||
fn epochs_per_state_diff_override() {
|
||||
CommandLineTest::new()
|
||||
.flag("epochs-per-state-diff", Some("1"))
|
||||
.run_with_zero_port()
|
||||
.with_config(|config| assert_eq!(config.store.epochs_per_state_diff, 1));
|
||||
}
|
||||
|
||||
// Tests for Slasher flags.
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user