Commit 08144080 authored by André Silva's avatar André Silva Committed by Gavin Wood
Browse files

Update to latest substrate master (#491)

* update to latest substrate master

* Fix compilation
parent aa63bc65
This diff is collapsed.
......@@ -16,6 +16,7 @@ substrate-network = { git = "https://github.com/paritytech/substrate", branch =
substrate-primitives = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
sr-primitives = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
futures = "0.1"
futures03 = { package = "futures-preview", version = "0.3.0-alpha.19", features = ["compat"] }
log = "0.4"
exit-future = "0.1.4"
substrate-client = { git = "https://github.com/paritytech/substrate", branch = "polkadot-master" }
......
......@@ -26,8 +26,9 @@ pub mod validation;
pub mod gossip;
use codec::{Decode, Encode};
use futures::sync::{oneshot, mpsc};
use futures::sync::oneshot;
use futures::prelude::*;
use futures03::{channel::mpsc, compat::Compat, StreamExt};
use polkadot_primitives::{Block, Hash, Header};
use polkadot_primitives::parachain::{
Id as ParaId, BlockData, CollatorId, CandidateReceipt, Collation, PoVBlock,
......@@ -108,7 +109,7 @@ impl NetworkService for PolkadotNetworkService {
Err(_) => mpsc::unbounded().1, // return empty channel.
};
GossipMessageStream::new(topic_stream)
GossipMessageStream::new(Box::new(Compat::new(topic_stream.map(Ok))))
}
fn gossip_message(&self, topic: Hash, message: GossipMessage) {
......@@ -151,14 +152,14 @@ impl GossipService for consensus_gossip::ConsensusGossip<Block> {
/// A stream of gossip messages and an optional sender for a topic.
pub struct GossipMessageStream {
topic_stream: mpsc::UnboundedReceiver<TopicNotification>,
topic_stream: Box<dyn Stream<Item = TopicNotification, Error = ()> + Send>,
}
impl GossipMessageStream {
/// Create a new instance with the given topic stream.
pub fn new(topic_stream: mpsc::UnboundedReceiver<TopicNotification>) -> Self {
pub fn new(topic_stream: Box<dyn Stream<Item = TopicNotification, Error = ()> + Send>) -> Self {
Self {
topic_stream
topic_stream,
}
}
}
......
......@@ -148,7 +148,7 @@ impl NetworkService for TestNetwork {
fn gossip_messages_for(&self, topic: Hash) -> GossipMessageStream {
let (tx, rx) = mpsc::unbounded();
let _ = self.gossip.send_listener.unbounded_send((topic, tx));
GossipMessageStream::new(rx)
GossipMessageStream::new(Box::new(rx))
}
fn gossip_message(&self, topic: Hash, message: GossipMessage) {
......
......@@ -54,7 +54,7 @@ pub mod wasm_api;
use rstd::vec::Vec;
use codec::{Encode, Decode, CompactAs};
use substrate_primitives::TypeId;
use substrate_primitives::{RuntimeDebug, TypeId};
/// Validation parameters for evaluating the parachain validity function.
// TODO: balance downloads (https://github.com/paritytech/polkadot/issues/220)
......@@ -79,8 +79,11 @@ pub struct ValidationResult {
}
/// Unique identifier of a parachain.
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Default, Clone, Copy, Encode, Decode, CompactAs)]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize, Debug))]
#[derive(
Clone, CompactAs, Copy, Decode, Default, Encode, Eq,
Hash, Ord, PartialEq, PartialOrd, RuntimeDebug
)]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
pub struct Id(u32);
impl TypeId for Id {
......
......@@ -27,6 +27,7 @@ use serde::{Serialize, Deserialize};
#[cfg(feature = "std")]
use primitives::bytes;
use primitives::RuntimeDebug;
use application_crypto::KeyTypeId;
pub use polkadot_parachain::{
......@@ -102,8 +103,7 @@ pub trait ActiveParas {
}
/// Description of how often/when this parachain is scheduled for progression.
#[derive(Encode, Decode, Clone, PartialEq, Eq)]
#[cfg_attr(feature = "std", derive(Debug))]
#[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug)]
pub enum Scheduling {
/// Scheduled every block.
Always,
......@@ -112,8 +112,7 @@ pub enum Scheduling {
}
/// Information regarding a deployed parachain/thread.
#[derive(Encode, Decode, Clone, PartialEq, Eq)]
#[cfg_attr(feature = "std", derive(Debug))]
#[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug)]
pub struct Info {
/// Scheduling info.
pub scheduling: Scheduling,
......@@ -429,8 +428,7 @@ pub enum ValidityAttestation {
}
/// An attested candidate.
#[derive(Clone, PartialEq, Decode, Encode)]
#[cfg_attr(feature = "std", derive(Debug))]
#[derive(Clone, PartialEq, Decode, Encode, RuntimeDebug)]
pub struct AttestedCandidate {
/// The candidate data.
pub candidate: CandidateReceipt,
......
......@@ -24,6 +24,7 @@ use codec::{Encode, Decode};
use srml_support::{decl_storage, decl_module, ensure, dispatch::Result, traits::Get};
use primitives::{Hash, parachain::{AttestedCandidate, CandidateReceipt, Id as ParaId}};
use sr_primitives::RuntimeDebug;
use sr_staking_primitives::SessionIndex;
use inherents::{ProvideInherent, InherentData, RuntimeString, MakeFatalError, InherentIdentifier};
......@@ -53,8 +54,7 @@ pub struct BlockAttestations<T: Trait> {
}
/// Additional attestations on a parachain block, after it was included.
#[derive(Encode, Decode, Clone, PartialEq)]
#[cfg_attr(feature = "std", derive(Debug))]
#[derive(Encode, Decode, Clone, PartialEq, RuntimeDebug)]
pub struct MoreAttestations;
/// Something which processes rewards for received attestations.
......
......@@ -86,11 +86,10 @@ impl PartialEq for EcdsaSignature {
}
}
#[cfg(feature = "std")]
impl std::fmt::Debug for EcdsaSignature {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{:?}", &self.0[..])
}
impl rstd::fmt::Debug for EcdsaSignature {
fn fmt(&self, f: &mut rstd::fmt::Formatter<'_>) -> rstd::fmt::Result {
write!(f, "EcdsaSignature({:?})", &self.0[..])
}
}
decl_event!(
......
......@@ -40,7 +40,8 @@ use client::{
runtime_api as client_api, impl_runtime_apis,
};
use sr_primitives::{
ApplyResult, generic, Permill, Perbill, impl_opaque_keys, create_runtime_str, key_types,
create_runtime_str, generic, impl_opaque_keys, key_types,
ApplyResult, Permill, Perbill, RuntimeDebug,
transaction_validity::{TransactionValidity, InvalidTransaction, TransactionValidityError},
weights::{Weight, DispatchInfo}, curve::PiecewiseLinear,
traits::{BlakeTwo256, Block as BlockT, StaticLookup, SignedExtension},
......@@ -118,8 +119,7 @@ pub fn native_version() -> NativeVersion {
///
/// RELEASE: This is only relevant for the initial PoA run-in period and may be removed
/// from the release runtime.
#[derive(Default, Encode, Decode, Clone, Eq, PartialEq)]
#[cfg_attr(feature = "std", derive(Debug))]
#[derive(Default, Encode, Decode, Clone, Eq, PartialEq, RuntimeDebug)]
pub struct OnlyStakingAndClaims;
impl SignedExtension for OnlyStakingAndClaims {
type AccountId = AccountId;
......
......@@ -484,7 +484,6 @@ impl<T: Trait> ActiveParas for Module<T> {
pub struct LimitParathreadCommits<T: Trait + Send + Sync>(rstd::marker::PhantomData<T>) where
<T as system::Trait>::Call: IsSubType<Module<T>, T>;
#[cfg(feature = "std")]
impl<T: Trait + Send + Sync> rstd::fmt::Debug for LimitParathreadCommits<T> where
<T as system::Trait>::Call: IsSubType<Module<T>, T>
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment