diff --git a/tests/eth2/core/beacon/tools/builder/test_aggregator.py b/tests/eth2/core/beacon/tools/builder/test_aggregator.py index e5bc3c4d1a..6312c545b3 100644 --- a/tests/eth2/core/beacon/tools/builder/test_aggregator.py +++ b/tests/eth2/core/beacon/tools/builder/test_aggregator.py @@ -54,7 +54,7 @@ def test_aggregator_selection(validator_count, privkeys, genesis_state, config): ) -def test_get_get_aggregate_from_valid_committee_attestations( +def test_get_aggregate_from_valid_committee_attestations( sample_attestation_params, privkeys, genesis_state, config ): committee_size = 16 diff --git a/trinity/components/eth2/beacon/validator.py b/trinity/components/eth2/beacon/validator.py index 4f82fa5ada..c7bfc72ebc 100644 --- a/trinity/components/eth2/beacon/validator.py +++ b/trinity/components/eth2/beacon/validator.py @@ -437,6 +437,10 @@ async def attest(self, slot: Slot) -> Tuple[Attestation, ...]: self.import_attestation(attestation) await self.p2p_node.broadcast_attestation_to_subnet(attestation, subnet_id) + # Log the last epoch that the validator attested + for index in attesting_validators_indices: + self.latest_attested_epoch[index] = epoch + attestations = attestations + (attestation,) # TODO: Aggregate attestations diff --git a/trinity/protocol/bcc_libp2p/servers.py b/trinity/protocol/bcc_libp2p/servers.py index 75714b29a5..2e481d4815 100644 --- a/trinity/protocol/bcc_libp2p/servers.py +++ b/trinity/protocol/bcc_libp2p/servers.py @@ -180,10 +180,13 @@ async def _handle_committee_beacon_attestation_loop(self) -> None: topic = PUBSUB_TOPIC_COMMITTEE_BEACON_ATTESTATION.substitute( subnet_id=str(subnet_id) ) - await self._handle_message( - topic, - self._handle_committee_beacon_attestation, - ) + try: + queue = self.topic_msg_queues[topic] + message = queue.get_nowait() + except asyncio.QueueEmpty: + continue + else: + await self._handle_committee_beacon_attestation(message) async def _handle_aggregate_and_proof_loop(self) -> None: await self._handle_message(