mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-20 21:34:46 +00:00
Introduce a queue for attestations from the network (#1511)
## Issue Addressed N/A ## Proposed Changes Introduces the `GossipProcessor`, a multi-threaded (multi-tasked?), non-blocking processor for some messages from the network which require verification and import into the `BeaconChain`. Initial testing indicates that this massively improves system stability by (a) moving block tasks from the normal executor (b) spreading out attestation load. ## Additional Info TBC
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
//! syncing-related responses to the Sync manager.
|
||||
#![allow(clippy::unit_arg)]
|
||||
|
||||
pub mod gossip_processor;
|
||||
pub mod processor;
|
||||
|
||||
use crate::error;
|
||||
@@ -215,29 +216,17 @@ impl<T: BeaconChainTypes> Router<T> {
|
||||
match gossip_message {
|
||||
// Attestations should never reach the router.
|
||||
PubsubMessage::AggregateAndProofAttestation(aggregate_and_proof) => {
|
||||
if let Some(gossip_verified) = self
|
||||
.processor
|
||||
.verify_aggregated_attestation_for_gossip(peer_id.clone(), *aggregate_and_proof)
|
||||
{
|
||||
self.propagate_message(id, peer_id.clone());
|
||||
self.processor
|
||||
.import_aggregated_attestation(peer_id, gossip_verified);
|
||||
}
|
||||
self.processor
|
||||
.on_aggregated_attestation_gossip(id, peer_id, *aggregate_and_proof);
|
||||
}
|
||||
PubsubMessage::Attestation(subnet_attestation) => {
|
||||
if let Some(gossip_verified) =
|
||||
self.processor.verify_unaggregated_attestation_for_gossip(
|
||||
peer_id.clone(),
|
||||
subnet_attestation.1.clone(),
|
||||
subnet_attestation.0,
|
||||
)
|
||||
{
|
||||
self.propagate_message(id, peer_id.clone());
|
||||
if should_process {
|
||||
self.processor
|
||||
.import_unaggregated_attestation(peer_id, gossip_verified);
|
||||
}
|
||||
}
|
||||
self.processor.on_unaggregated_attestation_gossip(
|
||||
id,
|
||||
peer_id,
|
||||
subnet_attestation.1.clone(),
|
||||
subnet_attestation.0,
|
||||
should_process,
|
||||
);
|
||||
}
|
||||
PubsubMessage::BeaconBlock(block) => {
|
||||
match self.processor.should_forward_block(block) {
|
||||
|
||||
Reference in New Issue
Block a user