erigon icon indicating copy to clipboard operation
erigon copied to clipboard

Caplin: Add sync committees aggregation

Open Giulio2002 opened this issue 1 year ago • 2 comments

Sync Committee Contribution pooling

First of all, a distinction:

  • Sync Committee Messages are single unaggregated messages from a specific validator
  • Sync Committee Contributions are aggregated messages from many validators.

We get these 2 messages from 2 different gossip sources, and then after validating the Gossip rules, we send everything to the pool which aggregate the sync committee or contribution into another aggregate.

Sync Committee subscription: /eth/v1/validator/sync_committee_subscriptions

The subscription just starts to subscribe to the Sync Committee's Gossip channel. it is actually really simple, here is the pseudo-code for how the subscription happen for each ValidatorIndex requested:

Function PostEthV1ValidatorSyncCommitteeSubscriptions
    Request: ValidatorIndicies []uint64


    Get the head state of the blockchain


    For each subRequest in ValidatorIndicies do

        
        Compute the subnets for the validator index from subRequest using the headState

        For each subnet in syncnets do
            Construct a topic name for the sync committee subnet
                    Subscribe to the topic with the sync committee subnet the topic with the calculated expiry time in sentinel
            
End Function

Extras

  • /eth/v1/validator/contribution_and_proofs - Submit to the node a contribution to be republished on the Gossip.
  • /eth/v1/validator/sync_committee_contribution - Retrieve a contribution (from the pool) that we have aggregated from the gossip.
  • /eth/v1/beacon/pool/sync_committees - Submit to the node a sync sync committee messages to be republished on the Gossip.

Giulio2002 avatar Mar 28 '24 00:03 Giulio2002

Please retry analysis of this Pull-Request directly on SonarCloud

sonarqubecloud[bot] avatar Mar 29 '24 01:03 sonarqubecloud[bot]

bro didn't pass lint check

domiwei avatar Apr 05 '24 15:04 domiwei

bro didn't pass lint check

Bro now passes lint check

Giulio2002 avatar Apr 05 '24 21:04 Giulio2002