Skip to content
  • Max Inden's avatar
    core/authority-discovery: Enable authorities to discover each other (#3452) · 027d8879
    Max Inden authored
    With the *authority-discovery* module an authoritative node makes itself
    discoverable and is able to discover other authorities. Once discovered, a node
    can directly connect to other authorities instead of multi-hop gossiping
    information.
    
    1. **Making itself discoverable**
    
        1. Retrieve its external addresses
    
        2. Adds its network peer id to the addresses
    
        3. Sign the above
    
        4. Put the signature and the addresses on the libp2p Kademlia DHT
    
    2. **Discovering other authorities**
    
        1. Retrieve the current set of authorities
    
        2. Start DHT queries for the ids of the authorities
    
        3. Validate the signatures of the retrieved key value pairs
    
        4. Add the retrieved external addresses as ~reserved~ priority nodes to the
           peerset
    
    
    * node/runtime: Add authority-discovery as session handler
    
    The srml/authority-discovery module implements the OneSessionHandler in
    order to keep its authority set in sync. This commit adds the module to
    the set of session handlers.
    
    * core/network: Make network worker return Dht events on poll
    
    Instead of network worker implement the Future trait, have it implement
    the Stream interface returning Dht events.
    
    For now these events are ignored in build_network_future but will be
    used by the core/authority-discovery module in subsequent commits.
    
    * *: Add scaffolding and integration for core/authority-discovery module
    
    * core/authority-discovery: Implement module logic itself
    027d8879