grandpa: enable light clients to participate in gossip (#8796)

* network: allow gossiping to light clients

* grandpa: gossip global messages to light clients

* grandpa: don't send neighbor packets to light clients

* grandpa: fix tests

* grandpa: export run_grandpa_observer

* node: run grandpa observer on light client

* node: start network at end

* Use wasm_timer in finality-grandpa

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
This commit is contained in:
André Silva
2021-05-26 12:33:11 +01:00
committed by GitHub
parent 0d13e20b35
commit 61507e1ba3
12 changed files with 159 additions and 73 deletions
+10 -10
View File
@@ -25,7 +25,7 @@ use sc_network_test::{
Block, BlockImportAdapter, Hash, PassThroughVerifier, Peer, PeersClient, PeersFullClient,
TestClient, TestNetFactory, FullPeerConfig,
};
use sc_network::config::ProtocolConfig;
use sc_network::config::{ProtocolConfig, Role};
use parking_lot::{RwLock, Mutex};
use futures_timer::Delay;
use futures::executor::block_on;
@@ -277,7 +277,7 @@ fn initialize_grandpa(
justification_period: 32,
keystore: Some(keystore),
name: Some(format!("peer#{}", peer_id)),
is_authority: true,
local_role: Role::Authority,
observer_enabled: true,
telemetry: None,
},
@@ -421,7 +421,7 @@ fn finalize_3_voters_1_full_observer() {
justification_period: 32,
keystore: None,
name: Some(format!("peer#{}", peer_id)),
is_authority: true,
local_role: Role::Authority,
observer_enabled: true,
telemetry: None,
},
@@ -524,7 +524,7 @@ fn transition_3_voters_twice_1_full_observer() {
justification_period: 32,
keystore: Some(keystore),
name: Some(format!("peer#{}", peer_id)),
is_authority: true,
local_role: Role::Authority,
observer_enabled: true,
telemetry: None,
},
@@ -952,7 +952,7 @@ fn voter_persists_its_votes() {
justification_period: 32,
keystore: Some(bob_keystore.clone()),
name: Some(format!("peer#{}", 1)),
is_authority: true,
local_role: Role::Authority,
observer_enabled: true,
telemetry: None,
};
@@ -995,7 +995,7 @@ fn voter_persists_its_votes() {
justification_period: 32,
keystore: Some(keystore),
name: Some(format!("peer#{}", 0)),
is_authority: true,
local_role: Role::Authority,
observer_enabled: true,
telemetry: None,
},
@@ -1036,7 +1036,7 @@ fn voter_persists_its_votes() {
justification_period: 32,
keystore: Some(keystore),
name: Some(format!("peer#{}", 0)),
is_authority: true,
local_role: Role::Authority,
observer_enabled: true,
telemetry: None,
},
@@ -1196,7 +1196,7 @@ fn finalize_3_voters_1_light_observer() {
justification_period: 32,
keystore: None,
name: Some("observer".to_string()),
is_authority: false,
local_role: Role::Full,
observer_enabled: true,
telemetry: None,
},
@@ -1238,7 +1238,7 @@ fn voter_catches_up_to_latest_round_when_behind() {
justification_period: 32,
keystore,
name: Some(format!("peer#{}", peer_id)),
is_authority: true,
local_role: Role::Authority,
observer_enabled: true,
telemetry: None,
},
@@ -1361,7 +1361,7 @@ where
justification_period: 32,
keystore,
name: None,
is_authority: true,
local_role: Role::Authority,
observer_enabled: true,
telemetry: None,
};