Detailed validator monitoring (#2151)

## Issue Addressed

- Resolves #2064

## Proposed Changes

Adds a `ValidatorMonitor` struct which provides additional logging and Grafana metrics for specific validators.

Use `lighthouse bn --validator-monitor` to automatically enable monitoring for any validator that hits the [subnet subscription](https://ethereum.github.io/eth2.0-APIs/#/Validator/prepareBeaconCommitteeSubnet) HTTP API endpoint.

Also, use `lighthouse bn --validator-monitor-pubkeys` to supply a list of validators which will always be monitored.

See the new docs included in this PR for more info.

## TODO

- [x] Track validator balance, `slashed` status, etc.
- [x] ~~Register slashings in current epoch, not offense epoch~~
- [ ] Publish Grafana dashboard, update TODO link in docs
- [x] ~~#2130 is merged into this branch, resolve that~~
This commit is contained in:
Paul Hauner
2021-01-20 19:19:38 +00:00
parent 1eb0915301
commit 2b2a358522
29 changed files with 1646 additions and 37 deletions

View File

@@ -224,6 +224,7 @@ impl<E: EthSpec> WorkEvent<E> {
attestation: Attestation<E>,
subnet_id: SubnetId,
should_import: bool,
seen_timestamp: Duration,
) -> Self {
Self {
drop_during_sync: true,
@@ -233,6 +234,7 @@ impl<E: EthSpec> WorkEvent<E> {
attestation: Box::new(attestation),
subnet_id,
should_import,
seen_timestamp,
},
}
}
@@ -242,6 +244,7 @@ impl<E: EthSpec> WorkEvent<E> {
message_id: MessageId,
peer_id: PeerId,
aggregate: SignedAggregateAndProof<E>,
seen_timestamp: Duration,
) -> Self {
Self {
drop_during_sync: true,
@@ -249,6 +252,7 @@ impl<E: EthSpec> WorkEvent<E> {
message_id,
peer_id,
aggregate: Box::new(aggregate),
seen_timestamp,
},
}
}
@@ -258,6 +262,7 @@ impl<E: EthSpec> WorkEvent<E> {
message_id: MessageId,
peer_id: PeerId,
block: Box<SignedBeaconBlock<E>>,
seen_timestamp: Duration,
) -> Self {
Self {
drop_during_sync: false,
@@ -265,6 +270,7 @@ impl<E: EthSpec> WorkEvent<E> {
message_id,
peer_id,
block,
seen_timestamp,
},
}
}
@@ -391,16 +397,19 @@ pub enum Work<E: EthSpec> {
attestation: Box<Attestation<E>>,
subnet_id: SubnetId,
should_import: bool,
seen_timestamp: Duration,
},
GossipAggregate {
message_id: MessageId,
peer_id: PeerId,
aggregate: Box<SignedAggregateAndProof<E>>,
seen_timestamp: Duration,
},
GossipBlock {
message_id: MessageId,
peer_id: PeerId,
block: Box<SignedBeaconBlock<E>>,
seen_timestamp: Duration,
},
GossipVoluntaryExit {
message_id: MessageId,
@@ -833,12 +842,14 @@ impl<T: BeaconChainTypes> BeaconProcessor<T> {
attestation,
subnet_id,
should_import,
seen_timestamp,
} => worker.process_gossip_attestation(
message_id,
peer_id,
*attestation,
subnet_id,
should_import,
seen_timestamp,
),
/*
* Aggregated attestation verification.
@@ -847,7 +858,13 @@ impl<T: BeaconChainTypes> BeaconProcessor<T> {
message_id,
peer_id,
aggregate,
} => worker.process_gossip_aggregate(message_id, peer_id, *aggregate),
seen_timestamp,
} => worker.process_gossip_aggregate(
message_id,
peer_id,
*aggregate,
seen_timestamp,
),
/*
* Verification for beacon blocks received on gossip.
*/
@@ -855,7 +872,8 @@ impl<T: BeaconChainTypes> BeaconProcessor<T> {
message_id,
peer_id,
block,
} => worker.process_gossip_block(message_id, peer_id, *block),
seen_timestamp,
} => worker.process_gossip_block(message_id, peer_id, *block, seen_timestamp),
/*
* Voluntary exits received on gossip.
*/