ChainSafe / gossamer

🕸️ Go Implementation of the Polkadot Host
https://chainsafe.github.io/gossamer
GNU Lesser General Public License v3.0
433 stars 116 forks source link

Investigate statement distribution subsystem #4195

Open axaysagathiya opened 1 month ago

axaysagathiya commented 1 month ago

Issue summary

This parachain subsystem is responsible for

plan

axaysagathiya commented 1 month ago

There are 2 versions of the statement distribution protocol.

axaysagathiya commented 1 month ago

Statement distribution subsystem V2

axaysagathiya commented 1 month ago

Statement distribution subsystem V1

Peer Receipt State Machine

A: Initial State. Receive SignedFullStatement(Statement::Second): extract Statement, forward to Candidate Backing, proceed to B. Receive any other SignedFullStatement variant: drop it.

B: Receive any SignedFullStatement: check signature and determine whether the statement is new to us. if new, forward to Candidate Backing and circulate to other peers. Receive OverseerMessage::StopWork: proceed to C.

C: Receive any message for this block: drop it.

Large statements

axaysagathiya commented 1 month ago

To implement v1, we need to handle the main 3 kinds of messages.

  1. messages received from other subsystems
    • share signed statements with other validators
    • notification of candidate being backed
    • network bridge update
  2. request the large statements from the other validators
    • message to send a request to other validators
    • message to get an update of available peers to try fetching statements
    • report a peer who behaves worse than just not providing data
    • fetched finished
  3. respond to the large statement to the other validators
    • check if we have data and send it back to the requester
axaysagathiya commented 1 month ago

We need to have a separate Goroutine that will simultaneously process the requests we get from other validators to fetch the large statement for a candidate.

This Goroutine should ensure we process only some predecided number of requests simultaneously. Process the message and send back the large statement to the requester