This repository was archived by the owner on Nov 15, 2023. It is now read-only.
  
  
  - 
                Notifications
    You must be signed in to change notification settings 
- Fork 2.7k
core/authority-discovery: Enable authorities to discover each other #3452
          
     Merged
      
      
    
  
     Merged
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            23 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      f72e1cb
              
                node/runtime: Add authority-discovery as session handler
              
              
                mxinden d34eb4f
              
                core/network: Make network worker return Dht events on poll
              
              
                mxinden 94a238a
              
                *: Add scaffolding and integration for core/authority-discovery module
              
              
                mxinden 7de7db7
              
                core/authority-discovery: Implement module logic itself
              
              
                mxinden ed294de
              
                core/network: Finish NetworkWoker if NetworkService stream finished
              
              
                mxinden fbc3a5b
              
                core/authority-discovery: Ensure being woken up on next interval tick
              
              
                mxinden 9de2655
              
                core/authority-discovery: Adjust interval to be proactive on
              
              
                mxinden 5d1042d
              
                core/authority-discovery: Implement unit tests
              
              
                mxinden 4421bad
              
                core/authority-discovery: Publish and query on different intervals
              
              
                mxinden 76db412
              
                *: Remove abstract type AuthorityId replaced by newtype Vec<u8>
              
              
                mxinden 2d025e0
              
                Merge remote-tracking branch 'paritytech/master' into authority-disco…
              
              
                mxinden 56da02c
              
                {core,srml}/authority-discovery: Adjust tests to merge
              
              
                mxinden 1a5f974
              
                node/runtime: Bump runtime spec and impl version
              
              
                mxinden 32214d9
              
                *: Instantiate authority discovery within node/cli
              
              
                mxinden 2f5c938
              
                Merge remote-tracking branch 'paritytech/master' into authority-disco…
              
              
                mxinden 30bd78e
              
                core/authority-discovery: Remove patch version in Cargo.toml
              
              
                mxinden 1a376bf
              
                core/authority-discovery: Add doc comments to Error enum
              
              
                mxinden c5d5a90
              
                authority-discovery: Encode address as Protobuf bytes instead of string
              
              
                mxinden d162540
              
                *: Have AuthorityApi.{sign,verify} borrow its inputs
              
              
                mxinden 024687e
              
                core/authority-discovery: Handle tokio timer errors
              
              
                mxinden 9c8534c
              
                Merge remote-tracking branch 'paritytech/master' into authority-disco…
              
              
                mxinden 2e954eb
              
                srml/authority-discovery: Address unit test failures
              
              
                mxinden c39c50e
              
                core/authority-discovery: Address unit test failures
              
              
                mxinden File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
      
      Oops, something went wrong.
      
    
  
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| [package] | ||
| name = "substrate-authority-discovery" | ||
| version = "2.0.0" | ||
| authors = ["Parity Technologies <[email protected]>"] | ||
| edition = "2018" | ||
| build = "build.rs" | ||
|  | ||
| [build-dependencies] | ||
| prost-build = "0.5" | ||
|  | ||
| [dependencies] | ||
| authority-discovery-primitives = { package = "substrate-authority-discovery-primitives", path = "./primitives", default-features = false } | ||
| bytes = "0.4" | ||
| client = { package = "substrate-client", path = "../../core/client" } | ||
| codec = { package = "parity-scale-codec", default-features = false, version = "1.0.3" } | ||
| derive_more = "0.14.0" | ||
| futures = "0.1" | ||
| keystore = { package = "substrate-keystore", path = "../../core/keystore" } | ||
| libp2p = { version = "0.12.0", default-features = false, features = ["secp256k1", "libp2p-websocket"] } | ||
| log = "0.4" | ||
| network = { package = "substrate-network", path = "../../core/network" } | ||
| primitives = { package = "substrate-primitives", path = "../primitives" } | ||
| prost = "0.5" | ||
| serde_json = "1.0" | ||
| sr-primitives = { path = "../../core/sr-primitives" } | ||
| tokio-timer = "0.2" | ||
|  | ||
| [dev-dependencies] | ||
| parking_lot = { version = "0.9.0" } | ||
| peerset = { package = "substrate-peerset", path = "../../core/peerset" } | ||
| test-client = { package = "substrate-test-runtime-client", path = "../../core/test-runtime/client" } | ||
| tokio = { version = "0.1"} | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| fn main() { | ||
| prost_build::compile_protos(&["src/schema/dht.proto"], &["src/schema"]).unwrap(); | ||
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| // Copyright 2019 Parity Technologies (UK) Ltd. | ||
| // This file is part of Substrate. | ||
|  | ||
| // Substrate is free software: you can redistribute it and/or modify | ||
| // it under the terms of the GNU General Public License as published by | ||
| // the Free Software Foundation, either version 3 of the License, or | ||
| // (at your option) any later version. | ||
|  | ||
| // Substrate is distributed in the hope that it will be useful, | ||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| // GNU General Public License for more details. | ||
|  | ||
| // You should have received a copy of the GNU General Public License | ||
| // along with Substrate. If not, see <http://www.gnu.org/licenses/>. | ||
|  | ||
| //! Authority discovery errors. | ||
|  | ||
| /// AuthorityDiscovery Result. | ||
| pub type Result<T> = std::result::Result<T, Error>; | ||
|  | ||
| /// Error type for the authority discovery module. | ||
| #[derive(Debug, derive_more::Display, derive_more::From)] | ||
| pub enum Error { | ||
| /// Failed to verify a dht payload with the given signature. | ||
| VerifyingDhtPayload, | ||
| /// Failed to hash the authority id to be used as a dht key. | ||
| HashingAuthorityId(libp2p::core::multiaddr::multihash::EncodeError), | ||
| /// Failed calling into the Substrate runtime. | ||
| CallingRuntime(client::error::Error), | ||
| /// Failed signing the dht payload via the Substrate runtime. | ||
| SigningDhtPayload, | ||
| /// From the Dht we only get the hashed authority id. In order to retrieve the actual authority id and to ensure it | ||
| /// is actually an authority, we match the hash against the hash of the authority id of all other authorities. This | ||
| /// error is the result of the above failing. | ||
| MatchingHashedAuthorityIdWithAuthorityId, | ||
| /// Failed to set the authority discovery peerset priority group in the peerset module. | ||
| SettingPeersetPriorityGroup(String), | ||
| /// Failed to encode a dht payload. | ||
| Encoding(prost::EncodeError), | ||
| /// Failed to decode a dht payload. | ||
| Decoding(prost::DecodeError), | ||
| /// Failed to parse a libp2p multi address. | ||
| ParsingMultiaddress(libp2p::core::multiaddr::Error), | ||
| /// Tokio timer error. | ||
| PollingTokioTimer(tokio_timer::Error) | ||
| } | ||
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.