Skip to content

Commit

Permalink
Upgrade to latest substrate
Browse files Browse the repository at this point in the history
* Introduce Simple Staking Payout(paritytech/substrate#5406)
* ipci-runtime: version 1 -> 2
* robonomics-runtime: version 70 -> 80
* Additional Prometheus metrics
* Fix node building for latest substrate
* Version bump
  • Loading branch information
akru committed Apr 5, 2020
1 parent 0d656e4 commit 8155877
Show file tree
Hide file tree
Showing 12 changed files with 440 additions and 311 deletions.
577 changes: 352 additions & 225 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bin/node/cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "node-cli"
version = "0.16.0"
version = "0.16.1"
authors = ["Airalab <[email protected]>"]
description = "Robonomics node implementation in Rust & Substrate."
build = "build.rs"
Expand Down
5 changes: 4 additions & 1 deletion bin/node/cli/res/ipci.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
"name": "IPCI",
"id": "ipci",
"bootNodes": [
"/ip4/95.216.202.55/tcp/30363/p2p/QmPrm3QaNv4Ls2DdAmsS1AoEbbYGrtqiyjxAVdc6mjEY5N"
"/ip4/95.216.202.55/tcp/30363/p2p/QmPrm3QaNv4Ls2DdAmsS1AoEbbYGrtqiyjxAVdc6mjEY5N",
"/ip4/142.93.161.226/tcp/30333/p2p/QmUrsaZBJNi3DBYVgmqg2CJyMQZBCGN41ci5BZAEK2Luyw",
"/ip4/134.209.183.170/tcp/30333/p2p/QmYPR5pXTc16Y5cTbzrTzTU8Rp2xEn2Jp834ngmfMQUtBe",
"/ip4/128.199.253.99/tcp/30333/p2p/QmdTLAYKYSEhYnVSaxQHonGpzW724oNitGzHzjBt5wYcgK"
],
"telemetryEndpoints": [
[
Expand Down
85 changes: 47 additions & 38 deletions bin/node/cli/res/robonomics_testnet.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bin/node/cli/src/browser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ async fn start_inner(chain_spec: String, log_level: String) -> Result<Client, Bo
info!(" by Airalab, 2018-2020");
info!("Chain specification: {}", config.expect_chain_spec().name());
info!("Node name: {}", config.name);
info!("Roles: {:?}", config.roles);
info!("Role: {:?}", config.role);

// Create the service. This is the most heavy initialization step.
if config.expect_chain_spec().is_ipci() {
Expand Down
36 changes: 16 additions & 20 deletions bin/node/cli/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,39 +215,38 @@ fn robonomics_testnet_genesis() -> GenesisConfig {
use sp_core::crypto::UncheckedInto;
let initial_authorities = vec![(
// akru.me
// akru
hex!["58cdc7ef880c80e8475170f206381d2cb13a87c209452fc6d8a1e14186d61b28"].into(),
hex!["58cdc7ef880c80e8475170f206381d2cb13a87c209452fc6d8a1e14186d61b28"].into(),
hex!["36cced69f5f1f07856ff0daac944c52e286e10184e52be76ca9377bd0406d90b"].unchecked_into(),
hex!["daf0535a46d8187446471bf619ea9104bda443366c526bf6f2cd4e9a1fcf5dd7"].unchecked_into(),
hex!["80de51e4432ed5e37b6438f499f3ec017f9577a37e68cb32d6c6a07540c36909"].unchecked_into(),
hex!["80de51e4432ed5e37b6438f499f3ec017f9577a37e68cb32d6c6a07540c36909"].unchecked_into(),
), (
// pad1a
hex!["acfe268b8276a4ed8924aef1441eb05334522f6c6c7487c12d71b0fb2ab28d37"].into(),
hex!["0239825db490fce751ee12d6cf67a59e1278f52fd82d5a9033f773924a709348"].into(),
hex!["304d073f2c918bff832e6f61949e1b7ac38fb8d57da1157f30d10e1406cc9137"].unchecked_into(),
hex!["85ddf5a932937c65694146577b50375668055ff435400310ca5344edf0f50b83"].unchecked_into(),
hex!["64063c2394c0a8250e5dc03286ead10e2efcda342467fbcbdf5f03d0e39aae19"].unchecked_into(),
hex!["926165922b8174c8446503a9bdc6581f4a658393169ea890c291fa2ad6b0b345"].unchecked_into(),
)];
let sudo_key: AccountId =
// 5Cakru1BpXPiezeD2LRZh3pJamHcbX9yZ13KLBxuqdTpgnYF
hex!["16eb796bee0c857db3d646ee7070252707aec0c7d82b2eda856632f6a2306a58"].into();
// pad1a
hex!["aa88ea58465ffbcf716c3d57fab7c29b6d7c7243133b024e61556b92512a4765"].into();
make_genesis(
initial_authorities,
Default::default(),
vec![(sudo_key.clone(), 1 * robonomics_runtime::constants::currency::XRT)],
sudo_key,
robonomics_runtime::WASM_BINARY.to_vec(),
)
}
/// Robonomics testnet config.
pub fn robonomics_testnet_config() -> ChainSpec {
let boot_nodes = vec![
// validator-01
"/ip4/51.15.132.76/tcp/30363/p2p/QmRg7aTH3ZBbcxmXfMn4CgEEBcnJzeC6UewFco7Dxh2M84".into(),
// validator-02
"/ip4/188.127.249.219/tcp/30363/p2p/QmYp26uKLyDesPzCS5Y3w44NUKZmDz87F3ywJkhHhh9SUf".into(),
// validator-03
"/ip4/167.71.148.38/tcp/30363/p2p/Qmep2VYsMfiBQnTMHVk6AddygMysiK379VP48hKZCoWtWT".into(),
// akru
"/ip4/95.216.202.55/tcp/30363/p2p/QmPrm3QaNv4Ls2DdAmsS1AoEbbYGrtqiyjxAVdc6mjEY5N".into(),
];
let boot_nodes = vec![];
ChainSpec::from_genesis(
"Robonomics",
"robonomics_testnet",
Expand All @@ -273,7 +272,7 @@ fn ipci_genesis() -> GenesisConfig {
use sp_core::crypto::UncheckedInto;
let initial_authorities = vec![(
// akru.me
// akru
hex!["58cdc7ef880c80e8475170f206381d2cb13a87c209452fc6d8a1e14186d61b28"].into(),
hex!["58cdc7ef880c80e8475170f206381d2cb13a87c209452fc6d8a1e14186d61b28"].into(),
hex!["36cced69f5f1f07856ff0daac944c52e286e10184e52be76ca9377bd0406d90b"].unchecked_into(),
Expand All @@ -283,7 +282,7 @@ fn ipci_genesis() -> GenesisConfig {
)];
let sudo_key: AccountId =
// 5Cakru1BpXPiezeD2LRZh3pJamHcbX9yZ13KLBxuqdTpgnYF
// akru
hex!["16eb796bee0c857db3d646ee7070252707aec0c7d82b2eda856632f6a2306a58"].into();
make_genesis(
Expand All @@ -296,10 +295,7 @@ fn ipci_genesis() -> GenesisConfig {
/// IPCI config.
pub fn ipci_config() -> ChainSpec {
let boot_nodes = vec![
// akru
"/ip4/95.216.202.55/tcp/30363/p2p/QmPrm3QaNv4Ls2DdAmsS1AoEbbYGrtqiyjxAVdc6mjEY5N".into(),
];
let boot_nodes = vec![];
ChainSpec::from_genesis(
"IPCI",
"ipci",
Expand Down
16 changes: 8 additions & 8 deletions bin/node/cli/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
///////////////////////////////////////////////////////////////////////////////

use log::info;
use sc_service::Roles;
use sc_service::Role;
use sc_cli::VersionInfo;
use crate::{
Cli, Subcommand, IsIpci, load_spec,
Expand Down Expand Up @@ -47,19 +47,19 @@ pub fn run(version: VersionInfo) -> sc_cli::Result<()> {
info!(" by {}, {}~", version.author, version.copyright_start_year);
info!("Chain specification: {}", config.expect_chain_spec().name());
info!("Node name: {}", config.name);
info!("Roles: {}", config.display_role());
info!("Role: {}", config.display_role());

if config.expect_chain_spec().is_ipci() {
info!("Native runtime: {}", IpciExecutor::native_version().runtime_version);
match config.roles {
Roles::LIGHT => sc_cli::run_service_until_exit(config, new_ipci_light),
_ => sc_cli::run_service_until_exit(config, new_ipci_full),
match config.role {
Role::Light => sc_cli::run_service_until_exit(config, new_ipci_light),
_ => sc_cli::run_service_until_exit(config, new_ipci_full),
}
} else {
info!("Native runtime: {}", RobonomicsExecutor::native_version().runtime_version);
match config.roles {
Roles::LIGHT => sc_cli::run_service_until_exit(config, new_robonomics_light),
_ => sc_cli::run_service_until_exit(config, new_robonomics_full),
match config.role {
Role::Light => sc_cli::run_service_until_exit(config, new_robonomics_light),
_ => sc_cli::run_service_until_exit(config, new_robonomics_full),
}
}
},
Expand Down
16 changes: 5 additions & 11 deletions bin/node/cli/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,15 +293,9 @@ pub fn new_full<Runtime, Dispatch, Extrinsic>(
<Runtime::RuntimeApi as sp_api::ApiExt<Block>>::StateBackend: sp_api::StateBackend<BlakeTwo256>,
{
let name = config.name.clone();
let is_authority = config.roles.is_authority();
let role = config.role.clone();
let disable_grandpa = config.disable_grandpa;
let force_authoring = config.force_authoring;
let sentry_nodes = config.network.sentry_nodes.clone();

// sentry nodes announce themselves as authorities to the network
// and should run the same protocols authorities do, but it should
// never actively participate in any consensus process.
let participates_in_consensus = is_authority && !config.sentry_mode;

let (builder, mut import_setup, inherent_data_providers) =
new_full_start!(config, Runtime, Dispatch);
Expand All @@ -317,7 +311,7 @@ pub fn new_full<Runtime, Dispatch, Extrinsic>(
let (block_import, grandpa_link, babe_link) = import_setup.take()
.expect("Link Half and Block Import are present for Full Services or setup failed before. qed");

if participates_in_consensus {
if let sc_service::config::Role::Authority { sentry_nodes } = &role {
let proposer = sc_basic_authorship::ProposerFactory::new(
service.client(),
service.transaction_pool(),
Expand Down Expand Up @@ -354,7 +348,7 @@ pub fn new_full<Runtime, Dispatch, Extrinsic>(
let authority_discovery = sc_authority_discovery::AuthorityDiscovery::new(
service.client(),
network,
sentry_nodes,
sentry_nodes.clone(),
service.keystore(),
dht_event_stream,
service.prometheus_registry(),
Expand All @@ -365,7 +359,7 @@ pub fn new_full<Runtime, Dispatch, Extrinsic>(

// if the node isn't actively participating in consensus then it doesn't
// need a keystore, regardless of which protocol we use below.
let keystore = if participates_in_consensus {
let keystore = if role.is_authority() {
Some(service.keystore())
} else {
None
Expand All @@ -378,7 +372,7 @@ pub fn new_full<Runtime, Dispatch, Extrinsic>(
name: Some(name),
observer_enabled: true,
keystore,
is_authority,
is_authority: role.is_network_authority(),
};

if disable_grandpa {
Expand Down
2 changes: 1 addition & 1 deletion bin/node/ipci-runtime/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ipci-runtime"
version = "0.16.0"
version = "0.16.1"
authors = ["Airalab <[email protected]>"]
edition = "2018"
build = "build.rs"
Expand Down
4 changes: 2 additions & 2 deletions bin/node/ipci-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
// and set impl_version to equal spec_version. If only runtime
// implementation changes and behavior does not, then leave spec_version as
// is and increment impl_version.
spec_version: 1,
impl_version: 1,
spec_version: 2,
impl_version: 2,
apis: RUNTIME_API_VERSIONS,
};

Expand Down
2 changes: 1 addition & 1 deletion bin/node/robonomics-runtime/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "robonomics-runtime"
version = "0.16.0"
version = "0.16.1"
authors = ["Airalab <[email protected]>"]
edition = "2018"
build = "build.rs"
Expand Down
4 changes: 2 additions & 2 deletions bin/node/robonomics-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
// and set impl_version to equal spec_version. If only runtime
// implementation changes and behavior does not, then leave spec_version as
// is and increment impl_version.
spec_version: 71,
impl_version: 71,
spec_version: 80,
impl_version: 80,
apis: RUNTIME_API_VERSIONS,
};

Expand Down

0 comments on commit 8155877

Please sign in to comment.