Add docs for slashing protection (#1760)

## Proposed Changes

* Add documentation about slashing protection, including how to troubleshoot issues and move between clients.
* Add an error message if the validator client is started with 0 validators. Previously it would hit an error relating to the slashing protection database not existing, which wrongly pushed people towards using the unsafe `--init-slashing-protection` flag.
This commit is contained in:
Michael Sproul
2020-10-13 22:10:07 +00:00
parent 95c96ac567
commit 467de4c8d0
3 changed files with 154 additions and 7 deletions

View File

@@ -107,6 +107,20 @@ impl<T: EthSpec> ProductionValidatorClient<T> {
.await
.map_err(|e| format!("Unable to initialize validators: {:?}", e))?;
info!(
log,
"Initialized validators";
"disabled" => validators.num_total().saturating_sub(validators.num_enabled()),
"enabled" => validators.num_enabled(),
);
if validators.num_enabled() == 0 {
return Err("Cannot run with 0 enabled validators. \
Please create or import validators before starting the validator client, \
or check your datadir configuration"
.to_string());
}
// Initialize slashing protection.
let slashing_db_path = config.validator_dir.join(SLASHING_PROTECTION_FILENAME);
let slashing_protection = if config.init_slashing_protection {
@@ -145,13 +159,6 @@ impl<T: EthSpec> ProductionValidatorClient<T> {
})?;
}
info!(
log,
"Initialized validators";
"disabled" => validators.num_total().saturating_sub(validators.num_enabled()),
"enabled" => validators.num_enabled(),
);
let beacon_node_url: Url = config
.beacon_node
.parse()