Connects the attestation service to network components (#961)

* Sends attestations to the attestation service for processing

* Adds 'attnets' field to local ENR

* Adds ENR bitfield modification logic

* Link attestation service to discovery

- Updates discv5
- Links discover events to discovery
- Support for ENRBitfield

* Adds discovery config params, correct warnings

* Rust fmt fixes

* Correct tests
This commit is contained in:
Age Manning
2020-03-25 22:18:06 +11:00
committed by GitHub
parent fbcf0f8e2e
commit 6ca4f4709b
16 changed files with 381 additions and 149 deletions

View File

@@ -16,7 +16,7 @@ use eth2_libp2p::{
use futures::future::Future;
use futures::stream::Stream;
use processor::Processor;
use slog::{debug, o, trace, warn};
use slog::{crit, debug, o, trace, warn};
use std::sync::Arc;
use tokio::sync::mpsc;
use types::EthSpec;
@@ -224,19 +224,6 @@ impl<T: BeaconChainTypes> Router<T> {
}
self.processor.on_block_gossip(peer_id, block);
}
PubsubData::AggregateAndProofAttestation(_agg_attestation) => {
// TODO: Handle propagation conditions
self.propagate_message(id, peer_id);
// TODO Handle aggregate attestion
// self.processor
// .on_attestation_gossip(peer_id.clone(), &agg_attestation);
}
PubsubData::Attestation(boxed_shard_attestation) => {
// TODO: Handle propagation conditions
self.propagate_message(id, peer_id.clone());
self.processor
.on_attestation_gossip(peer_id, boxed_shard_attestation.1);
}
PubsubData::VoluntaryExit(_exit) => {
// TODO: Apply more sophisticated validation
self.propagate_message(id, peer_id.clone());
@@ -255,6 +242,19 @@ impl<T: BeaconChainTypes> Router<T> {
// TODO: Handle attester slashings
debug!(self.log, "Received an attester slashing"; "peer_id" => format!("{}", peer_id) );
}
// Attestations should never reach the router.
PubsubData::AggregateAndProofAttestation(_agg_attestation) => {
crit!(
self.log,
"Attestations should always be handled by the attestation service"
);
}
PubsubData::Attestation(_boxed_subnet_attestation) => {
crit!(
self.log,
"Attestations should always be handled by the attestation service"
);
}
}
}