mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-09 03:31:45 +00:00
De-duplicate attestations in the slasher (#2767)
## Issue Addressed
Closes https://github.com/sigp/lighthouse/issues/2112
Closes https://github.com/sigp/lighthouse/issues/1861
## Proposed Changes
Collect attestations by validator index in the slasher, and use the magic of reference counting to automatically discard redundant attestations. This results in us storing only 1-2% of the attestations observed when subscribed to all subnets, which carries over to a 50-100x reduction in data stored 🎉
## Additional Info
There's some nuance to the configuration of the `slot-offset`. It has a profound effect on the effictiveness of de-duplication, see the docs added to the book for an explanation: 5442e695e5/book/src/slasher.md (slot-offset)
This commit is contained in:
@@ -451,6 +451,18 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
|
||||
.requires("slasher")
|
||||
.takes_value(true)
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("slasher-slot-offset")
|
||||
.long("slasher-slot-offset")
|
||||
.help(
|
||||
"Set the delay from the start of the slot at which the slasher should ingest \
|
||||
attestations. Only effective if the slasher-update-period is a multiple of the \
|
||||
slot duration."
|
||||
)
|
||||
.value_name("SECONDS")
|
||||
.requires("slasher")
|
||||
.takes_value(true)
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("slasher-history-length")
|
||||
.long("slasher-history-length")
|
||||
|
||||
@@ -448,6 +448,19 @@ pub fn get_config<E: EthSpec>(
|
||||
slasher_config.update_period = update_period;
|
||||
}
|
||||
|
||||
if let Some(slot_offset) =
|
||||
clap_utils::parse_optional::<f64>(cli_args, "slasher-slot-offset")?
|
||||
{
|
||||
if slot_offset.is_finite() {
|
||||
slasher_config.slot_offset = slot_offset;
|
||||
} else {
|
||||
return Err(format!(
|
||||
"invalid float for slasher-slot-offset: {}",
|
||||
slot_offset
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(history_length) =
|
||||
clap_utils::parse_optional(cli_args, "slasher-history-length")?
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user