mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-22 06:14:38 +00:00
Implement slasher (#1567)
This is an implementation of a slasher that lives inside the BN and can be enabled via `lighthouse bn --slasher`. Features included in this PR: - [x] Detection of attester slashing conditions (double votes, surrounds existing, surrounded by existing) - [x] Integration into Lighthouse's attestation verification flow - [x] Detection of proposer slashing conditions - [x] Extraction of attestations from blocks as they are verified - [x] Compression of chunks - [x] Configurable history length - [x] Pruning of old attestations and blocks - [x] More tests Future work: * Focus on a slice of history separate from the most recent N epochs (e.g. epochs `current - K` to `current - M`) * Run out-of-process * Ingest attestations from the chain without a resync Design notes are here https://hackmd.io/@sproul/HJSEklmPL
This commit is contained in:
@@ -351,6 +351,43 @@ pub fn get_config<E: EthSpec>(
|
||||
};
|
||||
}
|
||||
|
||||
if cli_args.is_present("slasher") {
|
||||
let slasher_dir = if let Some(slasher_dir) = cli_args.value_of("slasher-dir") {
|
||||
PathBuf::from(slasher_dir)
|
||||
} else {
|
||||
client_config.data_dir.join("slasher_db")
|
||||
};
|
||||
|
||||
let mut slasher_config = slasher::Config::new(slasher_dir);
|
||||
|
||||
if let Some(update_period) = clap_utils::parse_optional(cli_args, "slasher-update-period")?
|
||||
{
|
||||
slasher_config.update_period = update_period;
|
||||
}
|
||||
|
||||
if let Some(history_length) =
|
||||
clap_utils::parse_optional(cli_args, "slasher-history-length")?
|
||||
{
|
||||
slasher_config.history_length = history_length;
|
||||
}
|
||||
|
||||
if let Some(max_db_size) = clap_utils::parse_optional(cli_args, "slasher-max-db-size")? {
|
||||
slasher_config.max_db_size_gbs = max_db_size;
|
||||
}
|
||||
|
||||
if let Some(chunk_size) = clap_utils::parse_optional(cli_args, "slasher-chunk-size")? {
|
||||
slasher_config.chunk_size = chunk_size;
|
||||
}
|
||||
|
||||
if let Some(validator_chunk_size) =
|
||||
clap_utils::parse_optional(cli_args, "slasher-validator-chunk-size")?
|
||||
{
|
||||
slasher_config.validator_chunk_size = validator_chunk_size;
|
||||
}
|
||||
|
||||
client_config.slasher = Some(slasher_config);
|
||||
}
|
||||
|
||||
Ok(client_config)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user