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 1.6k
*: Ensure GossipEngine is being polled #836
          
     Closed
      
      
    
  
     Closed
                    Changes from all commits
      Commits
    
    
  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
Large diffs are not rendered by default.
      
      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
    
  
  
    
              
  
    
      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
    
  
  
    
              
  
    
      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 | 
|---|---|---|
|  | @@ -334,11 +334,19 @@ pub fn register_validator<C: ChainContext + 'static, S: NetworkSpecialization<Bl | |
| let gossip_side = validator.clone(); | ||
| let gossip_engine = sc_network_gossip::GossipEngine::new( | ||
| service.clone(), | ||
| executor, | ||
| POLKADOT_ENGINE_ID, | ||
| gossip_side, | ||
| ); | ||
|  | ||
| // Ideally this would not be spawned as an orphaned task, but polled by | ||
| // `RegisteredMessageValidator` which in turn would be polled by a `ValidationNetwork`. | ||
| let spawn_res = executor.spawn_obj(futures::task::FutureObj::from(Box::new(gossip_engine.clone()))); | ||
|  | ||
| // Note: we consider the chances of an error to spawn a background task almost null. | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree, but should we panic instead? This code will only be run on node startup, maybe it makes sense to just fail right away? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A graceful exit would be hard to include, but maybe a warning would be good. | ||
| if spawn_res.is_err() { | ||
| log::error!(target: "polkadot-gossip", "Failed to spawn background task"); | ||
| } | ||
|  | ||
| RegisteredMessageValidator { | ||
| inner: validator as _, | ||
| service: Some(service), | ||
|  | ||
  
    
      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
    
  
  
    
              
  
    
      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 | 
|---|---|---|
|  | @@ -5,13 +5,13 @@ authors = ["Parity Technologies <[email protected]>"] | |
| edition = "2018" | ||
|  | ||
| [dependencies] | ||
| client = { package = "sc-client", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" } | ||
| client = { package = "sc-client", git = "https://github.com/mxinden/substrate", branch = "restructure-gossip-engine-polkadot-master" } | ||
| jsonrpc-core = "14.0.3" | ||
| polkadot-primitives = { path = "../primitives" } | ||
| sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" } | ||
| sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" } | ||
| sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" } | ||
| txpool-api = { package = "sp-transaction-pool", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" } | ||
| frame-rpc-system = { package = "substrate-frame-rpc-system", git = "https://github.com/paritytech/substrate", branch = "polkadot-master" } | ||
| pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" } | ||
| sp-runtime = { git = "https://github.com/mxinden/substrate", branch = "restructure-gossip-engine-polkadot-master" } | ||
| sp-api = { git = "https://github.com/mxinden/substrate", branch = "restructure-gossip-engine-polkadot-master" } | ||
| sc-rpc = { git = "https://github.com/mxinden/substrate", branch = "restructure-gossip-engine-polkadot-master" } | ||
| txpool-api = { package = "sp-transaction-pool", git = "https://github.com/mxinden/substrate", branch = "restructure-gossip-engine-polkadot-master" } | ||
| frame-rpc-system = { package = "substrate-frame-rpc-system", git = "https://github.com/mxinden/substrate", branch = "restructure-gossip-engine-polkadot-master" } | ||
| pallet-transaction-payment-rpc = { git = "https://github.com/mxinden/substrate", branch = "restructure-gossip-engine-polkadot-master" } | ||
| codec = { package = "parity-scale-codec", version = "1.1.0", default-features = false } | ||
      
      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.
  
    
  
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note that when we remove the legacy code we will use
protocol.rswhich could run this in a future.