[][src]Crate sc_authority_discovery

Substrate authority discovery.

This crate enables Substrate authorities to directly connect to other authorities. AuthorityDiscovery implements the Future trait. By polling AuthorityDiscovery an authority:

  1. Makes itself discoverable

    1. Retrieves its external addresses (including peer id) or the ones of its sentry nodes.

    2. Signs the above.

    3. Puts the signature and the addresses on the libp2p Kademlia DHT.

  2. Discovers other authorities

    1. Retrieves the current set of authorities.

    2. Starts DHT queries for the ids of the authorities.

    3. Validates the signatures of the retrieved key value pairs.

    4. Adds the retrieved external addresses as priority nodes to the peerset.

When run as a sentry node, the authority discovery module does not publish any addresses to the DHT but still discovers validators and sentry nodes of validators, i.e. only step 2 (Discovers other authorities) is executed.

Structs

AuthorityDiscovery

An AuthorityDiscovery makes a given authority discoverable and discovers other authorities.

Enums

Role

Role an authority discovery module can run as.

Traits

NetworkProvider

NetworkProvider provides AuthorityDiscovery with all necessary hooks into the underlying Substrate networking. Using this trait abstraction instead of NetworkService directly is necessary to unit test AuthorityDiscovery.