Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
c3af86c
Move DummySpecialization to sc-network (#4680)
tomaka Jan 20, 2020
561bd72
keep nominations after getting kicked with zero slash (#4681)
rphmeier Jan 20, 2020
a90c72e
deprecate chain_status field of network handshake (#4675)
rphmeier Jan 20, 2020
a083572
client/finality-grandpa/communication: Add doc comment for PeerReport…
mxinden Jan 20, 2020
0995bb3
ci: increase retention for logs of tests to 144 hours (#4677)
gabreal Jan 20, 2020
1f9d09d
Pallet session new API (#4609)
gui1117 Jan 20, 2020
5cd952b
Only support ECDSA compressed public keys (#4667)
bkchr Jan 20, 2020
cfbb24c
Call enable_all() when building tokio runtime (#4690)
tomaka Jan 20, 2020
cb9c181
Make debug builds more usable (#4683)
bkchr Jan 21, 2020
f52ea97
grandpa: reduce allocations when verifying multiple messages (#4693)
andresilva Jan 21, 2020
6ee1244
Pass an executor through the Configuration (#4688)
tomaka Jan 21, 2020
1472014
contracts: New contract events + unconfusions (#4685)
Robbepop Jan 21, 2020
ef97057
fix docs deadlinks (#4698)
NikVolf Jan 21, 2020
4b2f70f
remove license preamble from node-template (#4699)
NikVolf Jan 21, 2020
cf020ad
grandpa: filter some telemetry events on larger voter sets (#4700)
andresilva Jan 21, 2020
ef578cd
Support `u128`/`i128` in runtime interface (#4703)
bkchr Jan 22, 2020
2cc1772
client/authority-discovery/Cargo.toml: Update dependency (#4706)
mxinden Jan 22, 2020
6c3b86d
More cleanups in node-template (#4705)
NikVolf Jan 22, 2020
32c04b4
Merge branch 'paritytech/master' into prometheus_v0.3
mxinden Jan 23, 2020
ea9278a
utils/prometheus: Make crate spawn onto global executor
mxinden Jan 23, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Move DummySpecialization to sc-network (paritytech#4680)
  • Loading branch information
tomaka authored and gavofyork committed Jan 20, 2020
commit c3af86cee45d98dd5f97fb2de419ba4e25ac14b7
26 changes: 26 additions & 0 deletions client/network/src/protocol/specialization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,32 @@ pub trait NetworkSpecialization<B: BlockT>: Send + Sync + 'static {
fn on_block_imported(&mut self, _ctx: &mut dyn Context<B>, _hash: B::Hash, _header: &B::Header) { }
}

/// A specialization that does nothing.
#[derive(Clone)]
pub struct DummySpecialization;

impl<B: BlockT> NetworkSpecialization<B> for DummySpecialization {
fn status(&self) -> Vec<u8> {
vec![]
}

fn on_connect(
&mut self,
_ctx: &mut dyn Context<B>,
_peer_id: PeerId,
_status: crate::message::Status<B>
) {}

fn on_disconnect(&mut self, _ctx: &mut dyn Context<B>, _peer_id: PeerId) {}

fn on_message(
&mut self,
_ctx: &mut dyn Context<B>,
_peer_id: PeerId,
_message: Vec<u8>,
) {}
}

/// Construct a simple protocol that is composed of several sub protocols.
/// Each "sub protocol" needs to implement `Specialization` and needs to provide a `new()` function.
/// For more fine grained implementations, this macro is not usable.
Expand Down
27 changes: 1 addition & 26 deletions client/network/test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ use substrate_test_runtime_client::{self, AccountKeyring};

pub use substrate_test_runtime_client::runtime::{Block, Extrinsic, Hash, Transfer};
pub use substrate_test_runtime_client::{TestClient, TestClientBuilder, TestClientBuilderExt};
pub use sc_network::specialization::DummySpecialization;

type AuthorityId = sp_consensus_babe::AuthorityId;

Expand Down Expand Up @@ -101,32 +102,6 @@ impl<B: BlockT> Verifier<B> for PassThroughVerifier {
}
}

/// The test specialization.
#[derive(Clone)]
pub struct DummySpecialization;

impl NetworkSpecialization<Block> for DummySpecialization {
fn status(&self) -> Vec<u8> {
vec![]
}

fn on_connect(
&mut self,
_ctx: &mut dyn Context<Block>,
_peer_id: PeerId,
_status: sc_network::message::Status<Block>
) {}

fn on_disconnect(&mut self, _ctx: &mut dyn Context<Block>, _peer_id: PeerId) {}

fn on_message(
&mut self,
_ctx: &mut dyn Context<Block>,
_peer_id: PeerId,
_message: Vec<u8>,
) {}
}

pub type PeersFullClient =
sc_client::Client<substrate_test_runtime_client::Backend, substrate_test_runtime_client::Executor, Block, substrate_test_runtime_client::runtime::RuntimeApi>;
pub type PeersLightClient =
Expand Down