From 36f79a6e577b729d65df76bf3eb2e2317a586669 Mon Sep 17 00:00:00 2001 From: Svyatoslav Nikolsky Date: Tue, 7 May 2019 17:26:49 +0300 Subject: [PATCH 1/4] ignore light nodes in ConsensusGossip --- core/network/src/consensus_gossip.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/network/src/consensus_gossip.rs b/core/network/src/consensus_gossip.rs index 668b30de79544..95753c54a775b 100644 --- a/core/network/src/consensus_gossip.rs +++ b/core/network/src/consensus_gossip.rs @@ -265,6 +265,11 @@ impl ConsensusGossip { /// Handle new connected peer. pub fn new_peer(&mut self, protocol: &mut Context, who: PeerId, roles: Roles) { + // light nodes are not valid targets for consensus gossip messages + if !roles.intersects(Roles::FULL | Roles::AUTHORITY) { + return; + } + trace!(target:"gossip", "Registering {:?} {}", roles, who); self.peers.insert(who.clone(), PeerConsensus { known_messages: HashSet::new(), From 14551e9340a6f4b1fe3ea746cb61e98c6486668b Mon Sep 17 00:00:00 2001 From: Svyatoslav Nikolsky Date: Tue, 7 May 2019 18:07:47 +0300 Subject: [PATCH 2/4] fixed method name --- core/client/src/light/call_executor.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/client/src/light/call_executor.rs b/core/client/src/light/call_executor.rs index 47c11b93fae20..8f90aaf54e489 100644 --- a/core/client/src/light/call_executor.rs +++ b/core/client/src/light/call_executor.rs @@ -148,7 +148,7 @@ where } fn runtime_version(&self, id: &BlockId) -> ClientResult { - let call_result = self.call(id, "version", &[], ExecutionStrategy::NativeElseWasm, NeverOffchainExt::new())?; + let call_result = self.call(id, "Core_version", &[], ExecutionStrategy::NativeElseWasm, NeverOffchainExt::new())?; RuntimeVersion::decode(&mut call_result.as_slice()) .ok_or_else(|| ClientError::VersionInvalid.into()) } From 4c12668ec98e7cf154dbd4c6b14d6b67fd8a0bd3 Mon Sep 17 00:00:00 2001 From: Svyatoslav Nikolsky Date: Tue, 7 May 2019 18:08:10 +0300 Subject: [PATCH 3/4] temporary disabled penalty when block is announced --- core/network/src/protocol.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/network/src/protocol.rs b/core/network/src/protocol.rs index dd3b759949e7d..e62bea42540ba 100644 --- a/core/network/src/protocol.rs +++ b/core/network/src/protocol.rs @@ -991,7 +991,7 @@ impl, H: ExHashT> Protocol { hash, &header, ); - self.network_chan.send(NetworkMsg::ReportPeer(who, BLOCK_ANNOUNCE_REPUTATION_CHANGE)); + //self.network_chan.send(NetworkMsg::ReportPeer(who, BLOCK_ANNOUNCE_REPUTATION_CHANGE)); } fn on_block_imported(&mut self, hash: B::Hash, header: &B::Header) { From 7fdd20ca2abeb3f2841ba503b5453cd7fc3a99ef Mon Sep 17 00:00:00 2001 From: Svyatoslav Nikolsky Date: Wed, 8 May 2019 08:48:34 +0300 Subject: [PATCH 4/4] remove traces of BLOCK_ANNOUNCE_REPUTATION_CHANGE --- core/network/src/protocol.rs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/core/network/src/protocol.rs b/core/network/src/protocol.rs index e62bea42540ba..a907a3052d133 100644 --- a/core/network/src/protocol.rs +++ b/core/network/src/protocol.rs @@ -72,10 +72,6 @@ const UNEXPECTED_STATUS_REPUTATION_CHANGE: i32 = -(1 << 20); const PEER_BEHIND_US_LIGHT_REPUTATION_CHANGE: i32 = -(1 << 8); /// Reputation change when a peer sends us an extrinsic that we didn't know about. const NEW_EXTRINSIC_REPUTATION_CHANGE: i32 = 1 << 7; -/// Reputation change when a peer sends us a block. We don't know whether this block is valid or -/// already known to us. Since this has a small cost, we decrease the reputation of the node, and -/// will increase it back later if the import is successful. -const BLOCK_ANNOUNCE_REPUTATION_CHANGE: i32 = -(1 << 2); /// We sent an RPC query to the given node, but it failed. const RPC_FAILED_REPUTATION_CHANGE: i32 = -(1 << 12); @@ -991,7 +987,6 @@ impl, H: ExHashT> Protocol { hash, &header, ); - //self.network_chan.send(NetworkMsg::ReportPeer(who, BLOCK_ANNOUNCE_REPUTATION_CHANGE)); } fn on_block_imported(&mut self, hash: B::Hash, header: &B::Header) {