• Max Inden's avatar
    srml/authority-discovery: Introduce srml module to sign and verify (#3385) · 495ccb60
    Max Inden authored
    In order to have authorities (validators) discover each other, they need
    to publish their public addresses by their ip address on the Kademlia
    Dht indexed by their public key. This payload needs to be signed by a
    key identifying them as a valid authority.
    
    Code inside `/core` does not know the current set of authorities nor
    can it assume what kind of cryptography primitives are currently in use.
    Instead it can retrieve its public key and the current set of
    authorities from the runtime and have it sign and verify Dht payloads.
    
    This commit enables code in `/core` to do so by introducing a srml
    module and runtime api to:
    
    1. Retrieve own public key.
    
    2. Retrieve public keys of current authority set.
    
    3. Sign a Dht payload.
    
    4. Verify a Dht payload.
    
    This commit makes the logic from the previous commit
    (`core/consensus/common/primitives.ConsensusApi`)
    444bf719 obsolete and thus removes it.
    495ccb60