Update to latest Substrate master (#320)

* Make `collator::Network` require `Send + Sync` to make it work

* Update packages

* Update to latest Substrate

* Make it compile and make tests work

* Use `polkadot-master`

* Fix CI

* Remove `build.sh` from readmes

* Delete old stuff

* Bring one back
This commit is contained in:
Bastian Köcher
2019-07-09 16:33:49 +02:00
committed by André Silva
parent d99f721540
commit c0b065837e
28 changed files with 728 additions and 4717 deletions
+11 -19
View File
@@ -33,9 +33,8 @@ use polkadot_primitives::parachain::{
StructuredUnroutedIngress,
};
use substrate_network::{
PeerId, RequestId, Context, Event, message, generic_message,
specialization::NetworkSpecialization as Specialization,
StatusMessage as GenericFullStatus
PeerId, RequestId, Context, StatusMessage as GenericFullStatus,
specialization::{Event, NetworkSpecialization as Specialization},
};
use self::validation::{LiveValidationSessions, RecentValidatorIds, InsertedRecentKey};
use self::collator_pool::{CollatorPool, Role, Action};
@@ -573,24 +572,17 @@ impl Specialization<Block> for PolkadotProtocol {
&mut self,
ctx: &mut dyn Context<Block>,
who: PeerId,
message: &mut Option<message::Message<Block>>
message: Vec<u8>,
) {
match message.take() {
Some(generic_message::Message::ChainSpecific(raw)) => {
match Message::decode(&mut raw.as_slice()) {
Some(msg) => {
ctx.report_peer(who.clone(), benefit::VALID_FORMAT);
self.on_polkadot_message(ctx, who, msg)
},
None => {
trace!(target: "p_net", "Bad message from {}", who);
ctx.report_peer(who, cost::INVALID_FORMAT);
*message = Some(generic_message::Message::ChainSpecific(raw));
}
}
match Message::decode(&mut &message[..]) {
Some(msg) => {
ctx.report_peer(who.clone(), benefit::VALID_FORMAT);
self.on_polkadot_message(ctx, who, msg)
},
None => {
trace!(target: "p_net", "Bad message from {}", who);
ctx.report_peer(who, cost::INVALID_FORMAT);
}
Some(other) => *message = Some(other),
_ => {}
}
}
+3 -4
View File
@@ -29,9 +29,8 @@ use polkadot_primitives::parachain::{
use substrate_primitives::crypto::UncheckedInto;
use parity_codec::Encode;
use substrate_network::{
PeerId, Context, config::Roles,
message::generic::ConsensusMessage,
specialization::NetworkSpecialization, generic_message::Message as GenericMessage
PeerId, Context, config::Roles, message::generic::ConsensusMessage,
specialization::NetworkSpecialization,
};
use futures::Future;
@@ -107,7 +106,7 @@ fn make_validation_session(parent_hash: Hash, local_key: SessionKey) -> SessionP
fn on_message(protocol: &mut PolkadotProtocol, ctx: &mut TestContext, from: PeerId, message: Message) {
let encoded = message.encode();
protocol.on_message(ctx, from, &mut Some(GenericMessage::ChainSpecific(encoded)));
protocol.on_message(ctx, from, encoded);
}
#[test]