use of tech.pegasys.teku.networking.eth2.gossip.subnets.AttestationSubnetSubscriptions in project teku by ConsenSys.
the class GossipForkSubscriptionsPhase0 method addGossipManagers.
protected void addGossipManagers(final ForkInfo forkInfo) {
AttestationSubnetSubscriptions attestationSubnetSubscriptions = new AttestationSubnetSubscriptions(spec, asyncRunner, discoveryNetwork, gossipEncoding, recentChainData, attestationProcessor, forkInfo, getMessageMaxSize());
blockGossipManager = new BlockGossipManager(recentChainData, spec, asyncRunner, discoveryNetwork, gossipEncoding, forkInfo, blockProcessor, getMessageMaxSize());
addGossipManager(blockGossipManager);
attestationGossipManager = new AttestationGossipManager(metricsSystem, attestationSubnetSubscriptions);
addGossipManager(attestationGossipManager);
aggregateGossipManager = new AggregateGossipManager(spec, recentChainData, asyncRunner, discoveryNetwork, gossipEncoding, forkInfo, aggregateProcessor, getMessageMaxSize());
addGossipManager(aggregateGossipManager);
voluntaryExitGossipManager = new VoluntaryExitGossipManager(recentChainData, asyncRunner, discoveryNetwork, gossipEncoding, forkInfo, voluntaryExitProcessor, getMessageMaxSize());
addGossipManager(voluntaryExitGossipManager);
proposerSlashingGossipManager = new ProposerSlashingGossipManager(recentChainData, asyncRunner, discoveryNetwork, gossipEncoding, forkInfo, proposerSlashingProcessor, getMessageMaxSize());
addGossipManager(proposerSlashingGossipManager);
attesterSlashingGossipManager = new AttesterSlashingGossipManager(spec, recentChainData, asyncRunner, discoveryNetwork, gossipEncoding, forkInfo, attesterSlashingProcessor, getMessageMaxSize());
addGossipManager(attesterSlashingGossipManager);
}
use of tech.pegasys.teku.networking.eth2.gossip.subnets.AttestationSubnetSubscriptions in project teku by ConsenSys.
the class SubnetScorerTest method shouldScoreCandidatePeersOnSubnetsWithFewPeersMoreHighly.
@Test
void shouldScoreCandidatePeersOnSubnetsWithFewPeersMoreHighly() {
final MockNodeId node1 = new MockNodeId(0);
final MockNodeId node2 = new MockNodeId(1);
final MockNodeId node3 = new MockNodeId(2);
final SubnetScorer scorer = SubnetScorer.create(PeerSubnetSubscriptions.builder(() -> schemaDefinitions).attestationSubnetSubscriptions(b -> b.addRelevantSubnet(1).addRelevantSubnet(2).addRelevantSubnet(3).addRelevantSubnet(5).addSubscriber(1, node2).addSubscriber(3, node3)).syncCommitteeSubnetSubscriptions(b -> b.addRelevantSubnet(1).addRelevantSubnet(2).addSubscriber(1, node1).addSubscriber(1, node2).addSubscriber(1, node3)).build());
assertCandidatePeerScores(scorer, entry(candidateWithSubnets(List.of(1, 3), List.of(1)), 562), entry(candidateWithSubnets(List.of(1), List.of(1)), 312), entry(candidateWithSubnets(List.of(2), List.of(1)), 1062), entry(candidateWithSubnets(List.of(3), List.of(1)), 312), entry(candidateWithSubnets(emptyList(), emptyList()), 0), entry(candidateWithSubnets(List.of(5), emptyList()), 1000), entry(candidateWithSubnets(List.of(4), emptyList()), 0), entry(candidateWithSubnets(emptyList(), List.of(2)), 1000), entry(candidateWithSubnets(emptyList(), List.of(3)), 0));
}
use of tech.pegasys.teku.networking.eth2.gossip.subnets.AttestationSubnetSubscriptions in project teku by ConsenSys.
the class SubnetScorerTest method shouldScoreExistingPeersOnSubnetsWithFewPeersMoreHighly.
@Test
void shouldScoreExistingPeersOnSubnetsWithFewPeersMoreHighly() {
final MockNodeId node1 = new MockNodeId(0);
final MockNodeId node2 = new MockNodeId(1);
final MockNodeId node3 = new MockNodeId(2);
final MockNodeId node4 = new MockNodeId(3);
final MockNodeId node5 = new MockNodeId(4);
final SubnetScorer scorer = SubnetScorer.create(PeerSubnetSubscriptions.builder(() -> schemaDefinitions).attestationSubnetSubscriptions(b -> b.addRelevantSubnet(1).addRelevantSubnet(2).addRelevantSubnet(3).addRelevantSubnet(4).addSubscriber(1, node1).addSubscriber(1, node2).addSubscriber(1, node3).addSubscriber(1, node4).addSubscriber(2, node1).addSubscriber(2, node2).addSubscriber(3, node3).addSubscriber(5, node2)).syncCommitteeSubnetSubscriptions(b -> b.addRelevantSubnet(3).addSubscriber(3, node1).addSubscriber(3, node4).addSubscriber(2, node3)).build());
assertExistingPeerScores(scorer, entry(node1, 562), entry(node2, 312), entry(node3, 1062), entry(node4, 312), entry(node5, 0));
}
Aggregations