Skip to content

Commit

Permalink
strip out all ICMP network code and begin gossip refactor for attesta…
Browse files Browse the repository at this point in the history
…tions (paritytech#256)

* strip out all ICMP code and begin gossip refactor

* validate incoming statements

* message_allowed logic

* compiles

* do reporting and neighbor packet validation

* tests compile

* propagate gossip messages

* test message_allowed

* some more tests

* address grumbles
  • Loading branch information
rphmeier authored May 17, 2019
1 parent d29d0bf commit 502205d
Show file tree
Hide file tree
Showing 12 changed files with 737 additions and 490 deletions.
7 changes: 0 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 8 additions & 11 deletions collator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ pub trait RelayChainContext {
type FutureEgress: IntoFuture<Item=ConsolidatedIngress, Error=Self::Error>;

/// Get un-routed egress queues from a parachain to the local parachain.
fn unrouted_egress(&self, id: ParaId) -> Self::FutureEgress;
fn unrouted_egress(&self, _id: ParaId) -> Self::FutureEgress;
}

/// Produce a candidate for the parachain, with given contexts, parent head, and signing key.
Expand Down Expand Up @@ -202,20 +202,17 @@ impl<P: 'static, E: 'static> RelayChainContext for ApiContext<P, E> where
type Error = String;
type FutureEgress = Box<Future<Item=ConsolidatedIngress, Error=String> + Send>;

fn unrouted_egress(&self, id: ParaId) -> Self::FutureEgress {
let session = self.network.instantiate_session(SessionParams {
fn unrouted_egress(&self, _id: ParaId) -> Self::FutureEgress {
// TODO: https://github.com/paritytech/polkadot/issues/253
//
// Fetch ingress and accumulate all unrounted egress
let _session = self.network.instantiate_session(SessionParams {
local_session_key: None,
parent_hash: self.parent_hash,
authorities: self.authorities.clone(),
}).map_err(|e| format!("unable to instantiate validation session: {:?}", e));

let fetch_incoming = session
.and_then(move |session| session.fetch_incoming(id).map_err(|e|
format!("unable to fetch incoming data: {:?}", e)
))
.map(ConsolidatedIngress);

Box::new(fetch_incoming)
Box::new(future::ok(ConsolidatedIngress(Vec::new())))
}
}

Expand Down Expand Up @@ -266,7 +263,7 @@ impl<P, E> Worker for CollationNode<P, E> where
};

let message_validator = polkadot_network::gossip::register_validator(
&*network,
network.clone(),
move |block_hash: &Hash| {
use client::BlockStatus;
use polkadot_network::gossip::Known;
Expand Down
1 change: 0 additions & 1 deletion network/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ sr-primitives = { git = "https://github.com/paritytech/substrate", branch = "pol
futures = "0.1"
tokio = "0.1.7"
log = "0.4"
slice-group-by = "0.2.2"
exit-future = "0.1.4"

[dev-dependencies]
Expand Down
Loading

0 comments on commit 502205d

Please sign in to comment.