Skip to content

Commit

Permalink
Merge pull request #5 from mxinden/prometheus_v0.3
Browse files Browse the repository at this point in the history
Merge current master into prometheus_v0.3
  • Loading branch information
nodebreaker0-0 committed Jan 24, 2020
2 parents 5d3d9a7 + 32c04b4 commit 97faad6
Show file tree
Hide file tree
Showing 59 changed files with 961 additions and 489 deletions.
4 changes: 2 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ test-linux-stable: &test-linux
- awk '/^warning:/,/^$/ { print }' output.log > ${CI_COMMIT_SHORT_SHA}_warnings.log
artifacts:
name: $CI_COMMIT_SHORT_SHA
expire_in: 24 hrs
expire_in: 3 days
paths:
- ${CI_COMMIT_SHORT_SHA}_warnings.log

Expand Down Expand Up @@ -210,7 +210,7 @@ test-linux-stable-int:
artifacts:
name: $CI_COMMIT_SHORT_SHA
when: on_failure
expire_in: 24 hrs
expire_in: 3 days
paths:
- ${CI_COMMIT_SHORT_SHA}_int_failure.log

Expand Down
31 changes: 25 additions & 6 deletions Cargo.lock

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

4 changes: 0 additions & 4 deletions bin/node-template/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ futures = "0.3.1"
ctrlc = { version = "3.1.3", features = ["termination"] }
log = "0.4.8"
tokio = { version = "0.2", features = ["rt-threaded"] }
parking_lot = "0.9.0"
codec = { package = "parity-scale-codec", version = "1.0.0" }
trie-root = "0.15.2"
sp-io = { version = "2.0.0", path = "../../primitives/io" }
sc-cli = { version = "0.8.0", path = "../../client/cli" }
sp-core = { version = "2.0.0", path = "../../primitives/core" }
sc-executor = { version = "0.8", path = "../../client/executor" }
Expand Down
18 changes: 1 addition & 17 deletions bin/node-template/runtime/build.rs
Original file line number Diff line number Diff line change
@@ -1,25 +1,9 @@
// Copyright 2019-2020 Parity Technologies (UK) Ltd.
// This file is part of Substrate.

// Substrate is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// Substrate is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.

use wasm_builder_runner::{build_current_project_with_rustflags, WasmBuilderSource};

fn main() {
build_current_project_with_rustflags(
"wasm_binary.rs",
WasmBuilderSource::Crates("1.0.8"),
WasmBuilderSource::Crates("1.0.9"),
// This instructs LLD to export __heap_base as a global variable, which is used by the
// external memory allocator.
"-Clink-arg=--export=__heap_base",
Expand Down
62 changes: 33 additions & 29 deletions bin/node-template/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,19 @@ impl Alternative {
Alternative::Development => ChainSpec::from_genesis(
"Development",
"dev",
|| testnet_genesis(vec![
get_authority_keys_from_seed("Alice"),
],
get_account_id_from_seed::<sr25519::Public>("Alice"),
vec![
|| testnet_genesis(
vec![
get_authority_keys_from_seed("Alice"),
],
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_account_id_from_seed::<sr25519::Public>("Bob"),
get_account_id_from_seed::<sr25519::Public>("Alice//stash"),
get_account_id_from_seed::<sr25519::Public>("Bob//stash"),
],
true),
vec![
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_account_id_from_seed::<sr25519::Public>("Bob"),
get_account_id_from_seed::<sr25519::Public>("Alice//stash"),
get_account_id_from_seed::<sr25519::Public>("Bob//stash"),
],
true,
),
vec![],
None,
None,
Expand All @@ -76,26 +78,28 @@ impl Alternative {
Alternative::LocalTestnet => ChainSpec::from_genesis(
"Local Testnet",
"local_testnet",
|| testnet_genesis(vec![
get_authority_keys_from_seed("Alice"),
get_authority_keys_from_seed("Bob"),
],
get_account_id_from_seed::<sr25519::Public>("Alice"),
vec![
|| testnet_genesis(
vec![
get_authority_keys_from_seed("Alice"),
get_authority_keys_from_seed("Bob"),
],
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_account_id_from_seed::<sr25519::Public>("Bob"),
get_account_id_from_seed::<sr25519::Public>("Charlie"),
get_account_id_from_seed::<sr25519::Public>("Dave"),
get_account_id_from_seed::<sr25519::Public>("Eve"),
get_account_id_from_seed::<sr25519::Public>("Ferdie"),
get_account_id_from_seed::<sr25519::Public>("Alice//stash"),
get_account_id_from_seed::<sr25519::Public>("Bob//stash"),
get_account_id_from_seed::<sr25519::Public>("Charlie//stash"),
get_account_id_from_seed::<sr25519::Public>("Dave//stash"),
get_account_id_from_seed::<sr25519::Public>("Eve//stash"),
get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),
],
true),
vec![
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_account_id_from_seed::<sr25519::Public>("Bob"),
get_account_id_from_seed::<sr25519::Public>("Charlie"),
get_account_id_from_seed::<sr25519::Public>("Dave"),
get_account_id_from_seed::<sr25519::Public>("Eve"),
get_account_id_from_seed::<sr25519::Public>("Ferdie"),
get_account_id_from_seed::<sr25519::Public>("Alice//stash"),
get_account_id_from_seed::<sr25519::Public>("Bob//stash"),
get_account_id_from_seed::<sr25519::Public>("Charlie//stash"),
get_account_id_from_seed::<sr25519::Public>("Dave//stash"),
get_account_id_from_seed::<sr25519::Public>("Eve//stash"),
get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),
],
true,
),
vec![],
None,
None,
Expand Down
6 changes: 5 additions & 1 deletion bin/node-template/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,18 @@ pub fn run<I, T, E>(args: I, exit: E, version: VersionInfo) -> error::Result<()>
type Config<T> = Configuration<(), T>;
match parse_and_prepare::<NoCustom, NoCustom, _>(&version, "substrate-node", args) {
ParseAndPrepare::Run(cmd) => cmd.run(load_spec, exit,
|exit, _cli_args, _custom_args, config: Config<_>| {
|exit, _cli_args, _custom_args, mut config: Config<_>| {
info!("{}", version.name);
info!(" version {}", config.full_version());
info!(" by {}, 2017, 2018", version.author);
info!("Chain specification: {}", config.chain_spec.name());
info!("Node name: {}", config.name);
info!("Roles: {}", display_role(&config));
let runtime = Runtime::new().map_err(|e| format!("{:?}", e))?;
config.tasks_executor = {
let runtime_handle = runtime.handle().clone();
Some(Box::new(move |fut| { runtime_handle.spawn(fut); }))
};
match config.roles {
ServiceRoles::LIGHT => run_until_exit(
runtime,
Expand Down
2 changes: 0 additions & 2 deletions bin/node-template/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//! Substrate Node Template CLI library.

#![warn(missing_docs)]
#![warn(unused_extern_crates)]

mod chain_spec;
#[macro_use]
Expand Down
14 changes: 12 additions & 2 deletions bin/node/cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ pub fn run<I, T, E>(args: I, exit: E, version: sc_cli::VersionInfo) -> error::Re

match parse_and_prepare::<CustomSubcommands, NoCustom, _>(&version, "substrate-node", args) {
ParseAndPrepare::Run(cmd) => cmd.run(load_spec, exit,
|exit, _cli_args, _custom_args, config: Config<_, _>| {
|exit, _cli_args, _custom_args, mut config: Config<_, _>| {
info!("{}", version.name);
info!(" version {}", config.full_version());
info!(" by Parity Technologies, 2017-2019");
Expand All @@ -108,8 +108,13 @@ pub fn run<I, T, E>(args: I, exit: E, version: sc_cli::VersionInfo) -> error::Re
let runtime = RuntimeBuilder::new()
.thread_name("main-tokio-")
.threaded_scheduler()
.enable_all()
.build()
.map_err(|e| format!("{:?}", e))?;
config.tasks_executor = {
let runtime_handle = runtime.handle().clone();
Some(Box::new(move |fut| { runtime_handle.spawn(fut); }))
};
match config.roles {
ServiceRoles::LIGHT => run_until_exit(
runtime,
Expand Down Expand Up @@ -140,7 +145,12 @@ pub fn run<I, T, E>(args: I, exit: E, version: sc_cli::VersionInfo) -> error::Re
&version,
None,
)?;
sc_cli::fill_import_params(&mut config, &cli_args.import_params, ServiceRoles::FULL)?;
sc_cli::fill_import_params(
&mut config,
&cli_args.import_params,
ServiceRoles::FULL,
cli_args.shared_params.dev,
)?;

match ChainSpec::from(config.chain_spec.id()) {
Some(ref c) if c == &ChainSpec::Development || c == &ChainSpec::LocalTestnet => {},
Expand Down
2 changes: 1 addition & 1 deletion bin/node/runtime/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ fn main() {
"wasm_binary.rs",
WasmBuilderSource::CratesOrPath {
path: "../../../utils/wasm-builder",
version: "1.0.8",
version: "1.0.9",
},
// This instructs LLD to export __heap_base as a global variable, which is used by the
// external memory allocator.
Expand Down
3 changes: 1 addition & 2 deletions bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,14 +236,13 @@ parameter_types! {
}

impl pallet_session::Trait for Runtime {
type OnSessionEnding = Staking;
type SessionManager = Staking;
type SessionHandler = <SessionKeys as OpaqueKeys>::KeyTypeIdProviders;
type ShouldEndSession = Babe;
type Event = Event;
type Keys = SessionKeys;
type ValidatorId = <Self as frame_system::Trait>::AccountId;
type ValidatorIdOf = pallet_staking::StashOf<Self>;
type SelectInitialValidators = Staking;
type DisabledValidatorsThreshold = DisabledValidatorsThreshold;
}

Expand Down
2 changes: 1 addition & 1 deletion client/authority-discovery/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ futures = "0.3.1"
futures-timer = "2.0"
libp2p = { version = "0.14.0-alpha.1", default-features = false, features = ["secp256k1", "libp2p-websocket"] }
log = "0.4.8"
prost = "0.5.0"
prost = "0.6.1"
rand = "0.7.2"
sc-client-api = { version = "2.0.0", path = "../api" }
sc-keystore = { version = "2.0.0", path = "../keystore" }
Expand Down
10 changes: 5 additions & 5 deletions client/authority-discovery/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,18 +315,18 @@ where

let remote_addresses: Vec<Multiaddr> = values.into_iter()
.map(|(_k, v)| {
let schema::SignedAuthorityAddresses {
signature,
addresses,
} = schema::SignedAuthorityAddresses::decode(v).map_err(Error::DecodingProto)?;
let schema::SignedAuthorityAddresses { signature, addresses } =
schema::SignedAuthorityAddresses::decode(v.as_slice())
.map_err(Error::DecodingProto)?;

let signature = AuthoritySignature::decode(&mut &signature[..])
.map_err(Error::EncodingDecodingScale)?;

if !AuthorityPair::verify(&signature, &addresses, authority_id) {
return Err(Error::VerifyingDhtPayload);
}

let addresses: Vec<libp2p::Multiaddr> = schema::AuthorityAddresses::decode(addresses)
let addresses = schema::AuthorityAddresses::decode(addresses.as_slice())
.map(|a| a.addresses)
.map_err(Error::DecodingProto)?
.into_iter()
Expand Down
24 changes: 23 additions & 1 deletion client/cli/src/execution_strategy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use structopt::clap::arg_enum;

arg_enum! {
/// How to execute blocks
#[derive(Debug, Clone, Copy)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ExecutionStrategy {
// Execute with native build (if available, WebAssembly otherwise).
Native,
Expand All @@ -33,3 +33,25 @@ arg_enum! {
}
}

impl ExecutionStrategy {
/// Returns the variant as `'&static str`.
pub fn as_str(&self) -> &'static str {
match self {
Self::Native => "Native",
Self::Wasm => "Wasm",
Self::Both => "Both",
Self::NativeElseWasm => "NativeElseWasm",
}
}
}

/// Default value for the `--execution-syncing` parameter.
pub const DEFAULT_EXECUTION_SYNCING: ExecutionStrategy = ExecutionStrategy::NativeElseWasm;
/// Default value for the `--execution-import-block` parameter.
pub const DEFAULT_EXECUTION_IMPORT_BLOCK: ExecutionStrategy = ExecutionStrategy::NativeElseWasm;
/// Default value for the `--execution-block-construction` parameter.
pub const DEFAULT_EXECUTION_BLOCK_CONSTRUCTION: ExecutionStrategy = ExecutionStrategy::Wasm;
/// Default value for the `--execution-offchain-worker` parameter.
pub const DEFAULT_EXECUTION_OFFCHAIN_WORKER: ExecutionStrategy = ExecutionStrategy::Native;
/// Default value for the `--execution-other` parameter.
pub const DEFAULT_EXECUTION_OTHER: ExecutionStrategy = ExecutionStrategy::Native;
Loading

0 comments on commit 97faad6

Please sign in to comment.