Skip to content

Commit

Permalink
add short description to all message handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
haikoschol committed Dec 2, 2024
1 parent c9854f3 commit 29ca596
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion docs/docs/design/parachain-protocol/bitfield-distribution.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,20 +111,44 @@ the subsystem is instructed by the overseer to work on, it needs to maintain the

- [`validationprotocol.BitfieldDistributionMessage`](https://github.com/paritytech/polkadot-sdk/blob/1e3b8e1639c1cf784eabf0a9afcab1f3987e0ca4/polkadot/node/network/bitfield-distribution/src/lib.rs#L519)

Check the bitfield for any relevant messages, relay them to interested peers and adjust peer reputation. Only needs to
support version 2 and 3 of the network protocol, but this should probably be taken care of by the handler for
`PeerConnected`.

Ensure tests cover all cases of invalid/irrelevant messages.

- [`DistributeBitfield`](https://github.com/paritytech/polkadot-sdk/blob/1e3b8e1639c1cf784eabf0a9afcab1f3987e0ca4/polkadot/node/network/bitfield-distribution/src/lib.rs#L350)

This is the internal message from other subsystems. The bitfield passed in this message has already been checked. Send
a gossip message on the network based on the grid topology and a `ProvisionableDataBitfield` message to the overseer.

- [`networkbridgevent.PeerConnected`](https://github.com/paritytech/polkadot-sdk/blob/1e3b8e1639c1cf784eabf0a9afcab1f3987e0ca4/polkadot/node/network/bitfield-distribution/src/lib.rs#L712)

Only add peers with protocol version 2 or 3.
Only add peers with protocol version 2 or 3. Add them to the per-peer state with a default view.

- [`networkbridgevent.PeerDisconnected`](https://github.com/paritytech/polkadot-sdk/blob/1e3b8e1639c1cf784eabf0a9afcab1f3987e0ca4/polkadot/node/network/bitfield-distribution/src/lib.rs#L720)

Just remove the peer from the per-peer state.

- [`networkbridgevent.NewGossipTopology`](https://github.com/paritytech/polkadot-sdk/blob/1e3b8e1639c1cf784eabf0a9afcab1f3987e0ca4/polkadot/node/network/bitfield-distribution/src/lib.rs#L725)

Updating the grid topology might result in new "local grid neighbours", some of which might already be connected. Set
the view for these peers to the default view.

- [`networkbridgevent.PeerViewChange`](https://github.com/paritytech/polkadot-sdk/blob/1e3b8e1639c1cf784eabf0a9afcab1f3987e0ca4/polkadot/node/network/bitfield-distribution/src/lib.rs#L765)

For peers that are present in the per-peer state and are local grid neighbours, send them all previously received
messages that are revelant to their updated view.

- [`networkbridgevent.OurViewChange`](https://github.com/paritytech/polkadot-sdk/blob/1e3b8e1639c1cf784eabf0a9afcab1f3987e0ca4/polkadot/node/network/bitfield-distribution/src/lib.rs#L787)

Remove relay parents from the subsystem state that are not present in the new view.

- [`networkbridgevent.UpdatedAuthorityIDs`](https://github.com/paritytech/polkadot-sdk/blob/1e3b8e1639c1cf784eabf0a9afcab1f3987e0ca4/polkadot/node/network/bitfield-distribution/src/lib.rs#L777)

Update the current grid topology with the new authority IDs.

- [`parachaintypes.ActiveLeavesUpdateSignal`](https://github.com/paritytech/polkadot-sdk/blob/1e3b8e1639c1cf784eabf0a9afcab1f3987e0ca4/polkadot/node/network/bitfield-distribution/src/lib.rs#L289)

Query the signing context and validator set from the runtime for the new relay parent and store them in the subsystem
state.

0 comments on commit 29ca596

Please sign in to comment.