lambdaclass / lambda_ethereum_consensus

Elixir implementation of an Ethereum consensus client, which offers high reliance & fault tolerance
Apache License 2.0
96 stars 33 forks source link

Duplicated and old aggregate attestations #1254

Open rodrigo-o opened 1 month ago

rodrigo-o commented 1 month ago

Context

During the work on #1244 duplicate attestations generated Invalid Signature errors at the time of block proposals when trying to generate aggregates (the BLS aggregate signature was computing the same aggregator more than once in the signature generated), this didn't happened before making the handle_new_block and handle_tick synchronous (i.e. without removing the GenServer and just converting casts to calls in the ValidatorManager the error was reproduced). A quick solution is already in place:

  # TODO: We need to check why we are producing duplicate attestations, this was generating invalid signatures
  unique_attestations = attestations |> Enum.uniq()

Description The purpose of this task is two-fold

  1. Understand the root cause of duplicated attestations and fix it We are receiving duplicates just from ourselves, this error pop-up only when we are publishing attestations, if we just receive them from other nodes we don't have this issue.

  2. Understand why we are still adding duplicate aggregate attestations in our block proposals (this was happening before #1244) This might be related to the previous one, given that we only uniquely filtered them at the aggregation step this behavior might be affecting also aggregates and not just committee attestations.

Example of a block with duplicated aggregate attestations:

image

rodrigo-o commented 1 week ago

This also happens now with sync_committee_messages as per #1284

rodrigo-o commented 6 days ago

Additionally this should tackle the issue that we add attestation for slot-2 to our blocks instead of slot-1 as the other nodes.