Skip to main content

Module peer_manager

Module peer_manager 

Source
Expand description

Tracks active peers and consists of an Actor and a Mailbox.

This actor acts as a layer on top of the commonware p2p network actor. It reads chain state to determine who this node should peer with, and registers these peers with the P2P actor.

The actor is configured via Config passed to the init function.

Other parts of the system interact with the actor through its Mailbox, which implements [AddressableManager], [commonware_p2p::Provider], and [commonware_consensus::Reporter] to receive [commonware_consensus::marshal::Update] from the marshal actor.

ยงHow peers are determined

The set of peers is the union of two subsets:

  1. Those entries in the Validator Config contract that have a field active == true.
  2. The dealers and players as per the last DKG outcome.

Because DKG ceremonies can fail, it happens that the DKG outcome contains validators that contain active == false in the contract. Therefore, the actor reads all entries in the contract to look up the egress and ingress addresses of the validators (active and inactive), before constructing an overall peer set {dealers, players, active validators} together with addresses.

Modulesยง

actor ๐Ÿ”’
ingress ๐Ÿ”’

Structsยง

Config ๐Ÿ”’
Configuration of the peer manager actor.

Functionsยง

init ๐Ÿ”’
Initializes a peer manager actor from a config with runtime context.