Skip to content
This repository has been archived by the owner on Jul 4, 2022. It is now read-only.

Commit

Permalink
Merge pull request #9 from plugblockchain/update/merge-upstream
Browse files Browse the repository at this point in the history
Merge remote-tracking branch 'upstream/master' into develop
  • Loading branch information
jordy25519 authored Oct 24, 2019
2 parents e57ff01 + 75ab501 commit 3d533cf
Show file tree
Hide file tree
Showing 349 changed files with 17,953 additions and 11,711 deletions.
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ build-rust-doc-release:
<<: *build-only
script:
- rm -f ./crate-docs/index.html # use it as an indicator if the job succeeds
- BUILD_DUMMY_WASM_BINARY=1 time cargo +nightly doc --release --all --verbose
- BUILD_DUMMY_WASM_BINARY=1 RUSTDOCFLAGS="--html-in-header $(pwd)/rustdoc-header.html" time cargo +nightly doc --release --all --verbose
- cp -R ./target/doc ./crate-docs
- echo "<meta http-equiv=refresh content=0;url=substrate_service/index.html>" > ./crate-docs/index.html
- sccache -s
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTING.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Merging pull requests once CI is successful:
- it is an urgent fix with no large change to logic, then it may be merged after a non-author contributor has approved the review once CI is complete.

. Once a PR is ready for review please add the https://github.com/paritytech/substrate/pulls?q=is%3Apr+is%3Aopen+label%3AA0-pleasereview[`pleasereview`] label. Generally PRs should sit with this label for 48 hours in order to garner feedback. It may be merged before if all relevant parties had a look at it.
. If the first review is not an approval, swap `A0-pleasereview` to any label `[A3, A7]` to indicate that the PR has received some feedback, but needs further work. For example. https://github.com/paritytech/substrate/labels/A3-inprogress[`A3-inprogress`] is a general indicator that the PR is work in progress and https://github.com/paritytech/substrate/labels/A4-gotissues[`A4-gotissues`] means that it has significant problems that need fixing. Once the work is done, change the label back to `A0-pleasereview`. You might end up swapping a few times back and forth to climb up the A label group. Once a PR is https://github.com/paritytech/substrate/labels/A8-looksgood[`A8-looksgood`], it is ready to merge.
. PRs that break the external API must be tagged with https://github.com/paritytech/substrate/labels/B2-breaksapi[`breaksapi`], when it changes the SRML or consensus of running system with https://github.com/paritytech/substrate/labels/B3-breaksconsensus[`breaksconsensus`]
. No PR should be merged until all reviews' comments are addressed.

Expand Down
693 changes: 458 additions & 235 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ members = [
"core/consensus/pow",
"core/executor",
"core/executor/runtime-test",
"core/externalities",
"core/finality-grandpa",
"core/finality-grandpa/primitives",
"core/inherents",
Expand All @@ -52,6 +53,7 @@ members = [
"core/service/test",
"core/session",
"core/sr-api-macros",
"core/sr-arithmetic",
"core/sr-io",
"core/sr-primitives",
"core/sr-staking-primitives",
Expand Down Expand Up @@ -97,14 +99,18 @@ members = [
"srml/membership",
"srml/metadata",
"srml/offences",
"srml/randomness-collective-flip",
"srml/scored-pool",
"srml/session",
"srml/staking",
"srml/staking/reward-curve",
"srml/sudo",
"srml/system",
"srml/system/rpc",
"srml/timestamp",
"srml/treasury",
"srml/transaction-payment",
"srml/utility",
"node/cli",
"node/executor",
"node/primitives",
Expand Down
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,21 @@ FROM phusion/baseimage:0.10.2 as builder
LABEL maintainer="[email protected]"
LABEL description="This is the build stage for Substrate. Here we create the binary."

ENV DEBIAN_FRONTEND=noninteractive

ARG PROFILE=release
WORKDIR /substrate

COPY . /substrate

RUN apt-get update && \
apt-get dist-upgrade -y && \
apt-get dist-upgrade -y -o Dpkg::Options::="--force-confold" && \
apt-get install -y cmake pkg-config libssl-dev git clang

RUN curl https://sh.rustup.rs -sSf | sh -s -- -y && \
export PATH="$PATH:$HOME/.cargo/bin" && \
rustup toolchain install nightly && \
rustup target add wasm32-unknown-unknown --toolchain nightly && \
cargo install --git https://github.com/alexcrichton/wasm-gc && \
rustup default nightly && \
rustup default stable && \
cargo build "--$PROFILE"
Expand Down
526 changes: 526 additions & 0 deletions README.adoc

Large diffs are not rendered by default.

9 changes: 1 addition & 8 deletions core/application-crypto/src/ed25519.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,7 @@ impl RuntimePublic for Public {
#[cfg(test)]
mod tests {
use sr_primitives::{generic::BlockId, traits::ProvideRuntimeApi};
use primitives::{
testing::{
KeyStore,
ED25519,
},
crypto::Pair,
traits::BareCryptoStore as _,
};
use primitives::{testing::{KeyStore, ED25519}, crypto::Pair};
use test_client::{
TestClientBuilder, DefaultTestClientBuilderExt, TestClientBuilderExt,
runtime::{TestAPI, app_crypto::ed25519::{AppPair, AppPublic}},
Expand Down
16 changes: 11 additions & 5 deletions core/application-crypto/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#![cfg_attr(not(feature = "std"), no_std)]

#[doc(hidden)]
pub use primitives::{self, crypto::{CryptoType, Public, Derive, IsWrappedBy, Wraps}};
pub use primitives::{self, crypto::{CryptoType, Public, Derive, IsWrappedBy, Wraps}, RuntimeDebug};
#[doc(hidden)]
#[cfg(feature = "std")]
pub use primitives::crypto::{SecretStringError, DeriveJunction, Ss58Codec, Pair};
Expand Down Expand Up @@ -139,10 +139,12 @@ macro_rules! app_crypto {
$crate::wrap!{
/// A generic `AppPublic` wrapper type over $public crypto; this has no specific App.
#[derive(
Clone, Default, Eq, PartialEq, Ord, PartialOrd, $crate::codec::Encode,
Clone, Default, Eq, PartialEq, Ord, PartialOrd,
$crate::codec::Encode,
$crate::codec::Decode,
$crate::RuntimeDebug,
)]
#[cfg_attr(feature = "std", derive(Debug, Hash))]
#[cfg_attr(feature = "std", derive(Hash))]
pub struct Public($public);
}

Expand Down Expand Up @@ -239,8 +241,12 @@ macro_rules! app_crypto {

$crate::wrap! {
/// A generic `AppPublic` wrapper type over $public crypto; this has no specific App.
#[derive(Clone, Default, Eq, PartialEq, $crate::codec::Encode, $crate::codec::Decode)]
#[cfg_attr(feature = "std", derive(Debug, Hash))]
#[derive(Clone, Default, Eq, PartialEq,
$crate::codec::Encode,
$crate::codec::Decode,
$crate::RuntimeDebug,
)]
#[cfg_attr(feature = "std", derive(Hash))]
pub struct Signature($sig);
}

Expand Down
9 changes: 1 addition & 8 deletions core/application-crypto/src/sr25519.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,7 @@ impl RuntimePublic for Public {
#[cfg(test)]
mod tests {
use sr_primitives::{generic::BlockId, traits::ProvideRuntimeApi};
use primitives::{
testing::{
KeyStore,
SR25519,
},
crypto::Pair,
traits::BareCryptoStore as _,
};
use primitives::{testing::{KeyStore, SR25519}, crypto::Pair};
use test_client::{
TestClientBuilder, DefaultTestClientBuilderExt, TestClientBuilderExt,
runtime::{TestAPI, app_crypto::sr25519::{AppPair, AppPublic}},
Expand Down
30 changes: 17 additions & 13 deletions core/application-crypto/src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@
// You should have received a copy of the GNU General Public License
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.

use primitives::crypto::{KeyTypeId, CryptoType, IsWrappedBy, Public};
#[cfg(feature = "std")]
use primitives::crypto::Pair;

use codec::Codec;
use primitives::crypto::{KeyTypeId, CryptoType, IsWrappedBy, Public};
use rstd::fmt::Debug;

/// An application-specific key.
pub trait AppKey: 'static + Send + Sync + Sized + CryptoType + Clone {
Expand All @@ -38,23 +40,25 @@ pub trait AppKey: 'static + Send + Sync + Sized + CryptoType + Clone {
const ID: KeyTypeId;
}

/// Type which implements Debug and Hash in std, not when no-std (std variant).
/// Type which implements Hash in std, not when no-std (std variant).
#[cfg(feature = "std")]
pub trait MaybeDebugHash: std::fmt::Debug + std::hash::Hash {}
pub trait MaybeHash: std::hash::Hash {}
#[cfg(feature = "std")]
impl<T: std::fmt::Debug + std::hash::Hash> MaybeDebugHash for T {}
impl<T: std::hash::Hash> MaybeHash for T {}

/// Type which implements Debug and Hash in std, not when no-std (no-std variant).
/// Type which implements Hash in std, not when no-std (no-std variant).
#[cfg(not(feature = "std"))]
pub trait MaybeDebugHash {}
pub trait MaybeHash {}
#[cfg(not(feature = "std"))]
impl<T> MaybeDebugHash for T {}
impl<T> MaybeHash for T {}

/// A application's public key.
pub trait AppPublic: AppKey + Public + Ord + PartialOrd + Eq + PartialEq + MaybeDebugHash + codec::Codec {
pub trait AppPublic:
AppKey + Public + Ord + PartialOrd + Eq + PartialEq + Debug + MaybeHash + codec::Codec
{
/// The wrapped type which is just a plain instance of `Public`.
type Generic:
IsWrappedBy<Self> + Public + Ord + PartialOrd + Eq + PartialEq + MaybeDebugHash + codec::Codec;
IsWrappedBy<Self> + Public + Ord + PartialOrd + Eq + PartialEq + Debug + MaybeHash + codec::Codec;
}

/// A application's key pair.
Expand All @@ -65,15 +69,15 @@ pub trait AppPair: AppKey + Pair<Public=<Self as AppKey>::Public> {
}

/// A application's signature.
pub trait AppSignature: AppKey + Eq + PartialEq + MaybeDebugHash {
pub trait AppSignature: AppKey + Eq + PartialEq + Debug + MaybeHash {
/// The wrapped type which is just a plain instance of `Signature`.
type Generic: IsWrappedBy<Self> + Eq + PartialEq + MaybeDebugHash;
type Generic: IsWrappedBy<Self> + Eq + PartialEq + Debug + MaybeHash;
}

/// A runtime interface for a public key.
pub trait RuntimePublic: Sized {
/// The signature that will be generated when signing with the corresponding private key.
type Signature: Codec + MaybeDebugHash + Eq + PartialEq + Clone;
type Signature: Codec + Debug + MaybeHash + Eq + PartialEq + Clone;

/// Returns all public keys for the given key type in the keystore.
fn all(key_type: KeyTypeId) -> crate::Vec<Self>;
Expand Down Expand Up @@ -101,7 +105,7 @@ pub trait RuntimeAppPublic: Sized {
const ID: KeyTypeId;

/// The signature that will be generated when signing with the corresponding private key.
type Signature: Codec + MaybeDebugHash + Eq + PartialEq + Clone;
type Signature: Codec + Debug + MaybeHash + Eq + PartialEq + Clone;

/// Returns all public keys for this application in the keystore.
fn all() -> crate::Vec<Self>;
Expand Down
2 changes: 1 addition & 1 deletion core/authority-discovery/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ log = "0.4.8"
network = { package = "substrate-network", path = "../../core/network" }
primitives = { package = "substrate-primitives", path = "../primitives" }
prost = "0.5.0"
serde_json = "1.0.40"
serde_json = "1.0.41"
sr-primitives = { path = "../../core/sr-primitives" }
tokio-timer = "0.2.11"

Expand Down
9 changes: 5 additions & 4 deletions core/authority-discovery/primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@

use client::decl_runtime_apis;
use rstd::vec::Vec;
use sr_primitives::RuntimeDebug;

#[derive(codec::Encode, codec::Decode, Eq, PartialEq, Clone)]
#[cfg_attr(feature = "std", derive(Debug, Hash))]
#[derive(codec::Encode, codec::Decode, Eq, PartialEq, Clone, RuntimeDebug)]
#[cfg_attr(feature = "std", derive(Hash))]
pub struct Signature(pub Vec<u8>);
#[derive(codec::Encode, codec::Decode, Eq, PartialEq, Clone)]
#[cfg_attr(feature = "std", derive(Debug, Hash))]
#[derive(codec::Encode, codec::Decode, Eq, PartialEq, Clone, RuntimeDebug)]
#[cfg_attr(feature = "std", derive(Hash))]
pub struct AuthorityId(pub Vec<u8>);

decl_runtime_apis! {
Expand Down
2 changes: 1 addition & 1 deletion core/chain-spec/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ impl-trait-for-tuples = "0.1.2"
network = { package = "substrate-network", path = "../../core/network" }
primitives = { package = "substrate-primitives", path = "../primitives" }
serde = { version = "1.0.101", features = ["derive"] }
serde_json = "1.0.40"
serde_json = "1.0.41"
sr-primitives = { path = "../../core/sr-primitives" }
tel = { package = "substrate-telemetry", path = "../../core/telemetry" }

Expand Down
11 changes: 6 additions & 5 deletions core/chain-spec/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use std::borrow::Cow;
use std::collections::HashMap;
use std::fs::File;
use std::path::PathBuf;
use std::rc::Rc;
use serde::{Serialize, Deserialize};
use primitives::storage::{StorageKey, StorageData};
use sr_primitives::{BuildStorage, StorageOverlay, ChildrenStorageOverlay};
Expand All @@ -31,15 +32,15 @@ use tel::TelemetryEndpoints;
enum GenesisSource<G> {
File(PathBuf),
Binary(Cow<'static, [u8]>),
Factory(fn() -> G),
Factory(Rc<dyn Fn() -> G>),
}

impl<G> Clone for GenesisSource<G> {
fn clone(&self) -> Self {
match *self {
GenesisSource::File(ref path) => GenesisSource::File(path.clone()),
GenesisSource::Binary(ref d) => GenesisSource::Binary(d.clone()),
GenesisSource::Factory(f) => GenesisSource::Factory(f),
GenesisSource::Factory(ref f) => GenesisSource::Factory(f.clone()),
}
}
}
Expand Down Expand Up @@ -187,10 +188,10 @@ impl<G, E> ChainSpec<G, E> {
}

/// Create hardcoded spec.
pub fn from_genesis(
pub fn from_genesis<F: Fn() -> G + 'static>(
name: &str,
id: &str,
constructor: fn() -> G,
constructor: F,
boot_nodes: Vec<String>,
telemetry_endpoints: Option<TelemetryEndpoints>,
protocol_id: Option<&str>,
Expand All @@ -211,7 +212,7 @@ impl<G, E> ChainSpec<G, E> {

ChainSpec {
spec,
genesis: GenesisSource::Factory(constructor),
genesis: GenesisSource::Factory(Rc::new(constructor)),
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions core/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ description = "Substrate CLI interface."
edition = "2018"

[dependencies]
clap = "~2.32.0"
clap = "2.33.0"
derive_more = "0.15.0"
env_logger = "0.6.2"
env_logger = "0.7.0"
log = "0.4.8"
atty = "0.2.13"
regex = "1.3.1"
Expand All @@ -21,7 +21,7 @@ futures = "0.1.29"
futures03 = { package = "futures-preview", version = "=0.3.0-alpha.19", features = ["compat"] }
fdlimit = "0.1.1"
exit-future = "0.1.4"
serde_json = "1.0.40"
serde_json = "1.0.41"
panic-handler = { package = "substrate-panic-handler", path = "../../core/panic-handler" }
client = { package = "substrate-client", path = "../../core/client" }
header-metadata = { package = "substrate-header-metadata", path = "../../core/client/header-metadata" }
Expand All @@ -33,7 +33,7 @@ state-machine = { package = "substrate-state-machine", path = "../../core/state-
substrate-telemetry = { path = "../../core/telemetry" }
keyring = { package = "substrate-keyring", path = "../keyring" }
names = "0.11.0"
structopt = "0.2.0"
structopt = "0.3.3"
rpassword = "4.0.1"

[dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion core/cli/src/execution_strategy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#![allow(missing_docs)]

use structopt::clap::{arg_enum, _clap_count_exprs};
use structopt::clap::arg_enum;

arg_enum! {
/// How to execute blocks
Expand Down
13 changes: 8 additions & 5 deletions core/cli/src/informant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use futures03::{StreamExt as _, TryStreamExt as _};
use log::{info, warn};
use sr_primitives::traits::Header;
use service::AbstractService;
use std::time::Duration;

mod display;

Expand All @@ -31,11 +32,13 @@ pub fn build(service: &impl AbstractService) -> impl Future<Item = (), Error = (

let mut display = display::InformantDisplay::new();

let display_notifications = service.network_status().for_each(move |(net_status, _)| {
let info = client.info();
display.display(&info, net_status);
Ok(())
});
let display_notifications = service
.network_status(Duration::from_millis(5000))
.for_each(move |(net_status, _)| {
let info = client.info();
display.display(&info, net_status);
Ok(())
});

let client = service.client();
let mut last_best = {
Expand Down
Loading

0 comments on commit 3d533cf

Please sign in to comment.