erigon icon indicating copy to clipboard operation
erigon copied to clipboard

Caplin: Add `ContributionAndProof`'s correct handling

Open Giulio2002 opened this issue 1 year ago • 0 comments

Add ContributionAndProof Handling to Caplin

Summary

This issue proposes the integration of ContributionAndProof message handling into Caplin (Consensus Layer). Handling these messages is crucial for validators to participate in the consensus layer, specifically in the sync committee contributions aggregation process.

Background

Ethereum 2.0 introduces a new consensus mechanism that relies on Proof of Stake (PoS) and sharding to improve scalability, security, and sustainability. Validators play a key role in this mechanism, and one of their responsibilities includes creating and aggregating sync committee contributions. ContributionAndProof messages are pivotal for this aggregation process, allowing validators to combine their contributions before they are included in the beacon block.

Proposal

Implement functionality within Caplin to correctly handle ContributionAndProof messages. This includes:

  • Validating these messages according to the Ethereum consensus specifications.
  • Aggregating valid contributions in an efficient and secure manner.
  • Propagating aggregated contributions to other nodes and the beacon chain.

Extra details

The current implementation of the sync committee contribution can be found at: https://github.com/ledgerwatch/erigon/blob/b876a588e082fb1fe3c899abb173f1ebfafde740/cl/phase1/forkchoice/on_operations.go#L232, This one does not work, so please rewrite this.

Secondly, we need to subscribe to the appropriate gossip topic to receive these messages, details can be found at: https://github.com/ethereum/consensus-specs/blob/dev/specs/altair/p2p-interface.md#sync_committee_contribution_and_proof

This document explain the gossip topic to subscribe to, and the validation rules to be implemented in OnContributionAndProof.

Tasks to be done

Re-Implement the logic OnContributionAndProof, which should include the validity criterion as explained in the p2p-interface specification

Giulio2002 avatar Feb 14 '24 23:02 Giulio2002