Skip to content

Commit

Permalink
Merge pull request #83 from OriginTrail/feature/polkadot-v1.9.0
Browse files Browse the repository at this point in the history
Devnet Polkadot dependency update to v1.9.0
  • Loading branch information
NZT48 authored Jul 24, 2024
2 parents 05896ae + eac54b0 commit 8613065
Show file tree
Hide file tree
Showing 33 changed files with 6,600 additions and 5,097 deletions.
9,520 changes: 5,439 additions & 4,081 deletions Cargo.lock

Large diffs are not rendered by default.

180 changes: 180 additions & 0 deletions Cargo.toml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ To run a full network with multiple NeuroWeb nodes (collators and non-collators)
#### Run A Relay Chain

To start a relay chain we recommend reading and following instructions in [Cumulus Workshop](https://docs.substrate.io/tutorials/build-a-parachain/prepare-a-local-relay-chain/).
NeuroWeb is currently compatible with Polkadot v0.9.40 version.
NeuroWeb is currently compatible with Polkadot v1.1.0 version.

#### Parachain Nodes (Collators)

Expand Down
129 changes: 68 additions & 61 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "neuroweb-node"
version = "1.3.0"
version = "1.4.0"
authors = ["TraceLabs"]
description = "NeuroWeb - Cumulus FRAME-based Substrate Node"
license = "GPL-3.0-only"
Expand All @@ -14,78 +14,85 @@ name = "neuroweb"
path = "src/main.rs"

[dependencies]
clap = { version = "4.1.8", features = ["derive"] }
futures = "0.3"
log = "0.4.17"
codec = { package = "parity-scale-codec", version = "3.0.0" }
serde = { version = "1.0.152", features = ["derive"] }
jsonrpsee = { version = "0.16.2", features = ["server"] }
clap = { workspace = true }
futures = { workspace = true }
log = { workspace = true }
codec = { workspace = true }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true, features = ["arbitrary_precision"] }
jsonrpsee = { workspace = true }

# Local
neuroweb-runtime = { path = "../runtime" }
neuroweb-runtime = { workspace = true }

# Substrate
frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sc-basic-authorship = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sc-chain-spec = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sc-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sc-executor = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sc-network = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sc-network-sync = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sc-rpc-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sc-service = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sc-sysinfo = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sp-block-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sp-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sp-offchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
try-runtime-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
frame-benchmarking = { workspace = true }
frame-benchmarking-cli = { workspace = true }
pallet-transaction-payment-rpc = { workspace = true }
sc-basic-authorship = { workspace = true }
sc-chain-spec = { workspace = true }
sc-cli = { workspace = true }
sc-client-api = { workspace = true }
sc-consensus = { workspace = true }
sc-consensus-aura = { workspace = true }
sc-executor = { workspace = true }
sc-keystore = { workspace = true }
sc-network = { workspace = true }
sc-network-sync = { workspace = true }
sc-rpc = { workspace = true }
sc-rpc-api = { workspace = true }
sc-service = { workspace = true }
sc-sysinfo = { workspace = true }
sc-telemetry = { workspace = true }
sc-tracing = { workspace = true }
sc-transaction-pool = { workspace = true }
sc-transaction-pool-api = { workspace = true }
sp-api = { workspace = true }
sp-block-builder = { workspace = true }
sp-blockchain = { workspace = true }
sp-consensus = { workspace = true }
sp-consensus-aura = { workspace = true }
sp-core = { workspace = true }
sp-io = { workspace = true }
sp-inherents = { workspace = true }
sp-keystore = { workspace = true }
sp-offchain = { workspace = true }
sp-runtime = { workspace = true }
sp-timestamp = { workspace = true }
substrate-frame-rpc-system = { workspace = true }
substrate-prometheus-endpoint = { workspace = true }
try-runtime-cli = { workspace = true }

# Polkadot
polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.40" }
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.40" }
xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.40" }
polkadot-cli = { workspace = true }
polkadot-primitives = { workspace = true }
polkadot-service = { workspace = true }
xcm = { workspace = true }

# Cumulus
cumulus-client-cli = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.40" }
cumulus-client-consensus-aura = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.40" }
cumulus-client-consensus-common = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.40" }
cumulus-client-service = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.40" }
cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.40" }
cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.40" }
cumulus-relay-chain-interface = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.40" }
cumulus-client-cli = { workspace = true }
cumulus-client-consensus-aura = { workspace = true }
cumulus-client-consensus-common = { workspace = true }
cumulus-client-consensus-proposer = { workspace = true }
cumulus-client-collator = { workspace = true }
cumulus-client-service = { workspace = true }
cumulus-primitives-core = { workspace = true }
cumulus-primitives-parachain-inherent = { workspace = true }
cumulus-relay-chain-interface = { workspace = true }
cumulus-test-relay-sproof-builder = { workspace = true }

# Frontier
fp-evm = { git = "https://github.com/OriginTrail/frontier", branch = "polkadot-v0.9.40" }
fp-rpc = { git = "https://github.com/OriginTrail/frontier", branch = "polkadot-v0.9.40" }
fc-db = { git = "https://github.com/OriginTrail/frontier", branch = "polkadot-v0.9.40" }
fc-rpc = { git = "https://github.com/OriginTrail/frontier", branch = "polkadot-v0.9.40" }
fc-rpc-core = { git = "https://github.com/OriginTrail/frontier", branch = "polkadot-v0.9.40" }
fc-storage = { git = "https://github.com/OriginTrail/frontier", branch = "polkadot-v0.9.40" }
fc-mapping-sync = { git = "https://github.com/OriginTrail/frontier", branch = "polkadot-v0.9.40" }
fp-evm = { workspace = true }
fp-rpc = { workspace = true }
fc-api = { workspace = true }
fc-db = { workspace = true }
fc-rpc = { workspace = true }
fc-rpc-core = { workspace = true }
fc-storage = { workspace = true }
fc-mapping-sync = { workspace = true }

[build-dependencies]
substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
substrate-build-script-utils = { workspace = true }

[features]
default = ["fc-rpc/rpc-binary-search-estimate"]
Expand Down
112 changes: 48 additions & 64 deletions node/src/chain_spec.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use cumulus_primitives_core::ParaId;
use neuroweb_runtime::{AccountId, AuraId,
EVMConfig, EthereumConfig, Signature, EXISTENTIAL_DEPOSIT};
EVMConfig, Signature, EXISTENTIAL_DEPOSIT};
use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};
use sc_service::ChainType;
use serde::{Deserialize, Serialize};
Expand All @@ -10,7 +10,7 @@ use std::{collections::BTreeMap, str::FromStr};

/// Specialized `ChainSpec` for the normal parachain runtime.
pub type ChainSpec =
sc_service::GenericChainSpec<neuroweb_runtime::GenesisConfig, Extensions>;
sc_service::GenericChainSpec<neuroweb_runtime::RuntimeGenesisConfig, Extensions>;

/// The default XCM version to set in genesis config.
const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION;
Expand Down Expand Up @@ -65,19 +65,22 @@ pub fn template_session_keys(keys: AuraId) -> neuroweb_runtime::SessionKeys {

pub fn development_config() -> ChainSpec {
let mut properties = sc_chain_spec::Properties::new();
properties.insert("tokenSymbol".into(), "OTP".into());
properties.insert("tokenSymbol".into(), "NEURO".into());
properties.insert("tokenDecimals".into(), 12.into());
properties.insert("ss58Format".into(), 101.into());

ChainSpec::from_genesis(
// Name
"Development",
// ID
"dev",
ChainType::Development,
move || {
testnet_genesis(
// initial collators.
ChainSpec::builder(
neuroweb_runtime::WASM_BINARY.expect("WASM binary was not build, please build it!"),
Extensions {
relay_chain: "rococo-local".into(), // You MUST set this to the correct network!
para_id: 2048,
},
)
.with_name("Development")
.with_id("dev")
.with_chain_type(ChainType::Development)
.with_properties(properties)
.with_genesis_config(testnet_genesis(
vec![
(
get_account_id_from_seed::<sr25519::Public>("Alice"),
Expand All @@ -103,36 +106,29 @@ pub fn development_config() -> ChainSpec {
get_account_id_from_seed::<sr25519::Public>("Eve//stash"),
get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),
],
2000.into(),
)
},
Vec::new(),
None,
None,
None,
None,
Extensions {
relay_chain: "rococo-local".into(), // You MUST set this to the correct network!
para_id: 2000,
},
)
2048.into(),
))
.build()
}

pub fn local_testnet_config() -> ChainSpec {
let mut properties = sc_chain_spec::Properties::new();
properties.insert("tokenSymbol".into(), "OTP".into());
properties.insert("tokenSymbol".into(), "NEURO".into());
properties.insert("tokenDecimals".into(), 12.into());
properties.insert("ss58Format".into(), 101.into());

ChainSpec::from_genesis(
// Name
"OriginTrail Parachain Testnet",
// ID
"origintrail_parachain_testnet",
ChainType::Local,
move || {
testnet_genesis(
// initial collators.
ChainSpec::builder(
neuroweb_runtime::WASM_BINARY.expect("WASM binary was not build, please build it!"),
Extensions {
relay_chain: "rococo-local".into(), // You MUST set this to the correct network!
para_id: 2048,
},
)
.with_name("NeuroWeb Testnet")
.with_id("neuroweb_testnet")
.with_chain_type(ChainType::Local)
.with_properties(properties)
.with_genesis_config(testnet_genesis(
vec![
(
get_account_id_from_seed::<sr25519::Public>("Alice"),
Expand All @@ -158,43 +154,26 @@ pub fn local_testnet_config() -> ChainSpec {
get_account_id_from_seed::<sr25519::Public>("Eve//stash"),
get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),
],
2000.into(),
)
},
// Bootnodes
Vec::new(),
// Telemetry
None,
// Protocol ID
Some("origintrail-parachain"),
// Fork ID
None,
// Properties
Some(properties),
// Extensions
Extensions {
relay_chain: "rococo-local".into(), // You MUST set this to the correct network!
para_id: 2000,
},
)
2048.into(),
))
.build()
}

fn testnet_genesis(
invulnerables: Vec<(AccountId, AuraId)>,
_root_key: AccountId,
endowed_accounts: Vec<AccountId>,
id: ParaId,
) -> neuroweb_runtime::GenesisConfig {
neuroweb_runtime::GenesisConfig {
system: neuroweb_runtime::SystemConfig {
code: neuroweb_runtime::WASM_BINARY
.expect("WASM binary was not build, please build it!")
.to_vec(),
},
) -> serde_json::Value {
let config = neuroweb_runtime::RuntimeGenesisConfig {
system: Default::default(),
balances: neuroweb_runtime::BalancesConfig {
balances: endowed_accounts.iter().cloned().map(|k| (k, 1 << 60)).collect(),
},
parachain_info: neuroweb_runtime::ParachainInfoConfig { parachain_id: id },
parachain_info: neuroweb_runtime::ParachainInfoConfig {
parachain_id: id,
..Default::default()
},
collator_selection: neuroweb_runtime::CollatorSelectionConfig {
invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(),
candidacy_bond: EXISTENTIAL_DEPOSIT * 16,
Expand All @@ -219,6 +198,7 @@ fn testnet_genesis(
parachain_system: Default::default(),
polkadot_xcm: neuroweb_runtime::PolkadotXcmConfig {
safe_xcm_version: Some(SAFE_XCM_VERSION),
..Default::default()
},
// sudo: SudoConfig {
// // Assign network admin rights.
Expand Down Expand Up @@ -259,10 +239,14 @@ fn testnet_genesis(
);
map
},
..Default::default()
},
ethereum: EthereumConfig {},
ethereum: Default::default(),
base_fee: Default::default(),
council: Default::default(),
democracy: Default::default(),
}
transaction_payment: Default::default(),
};

serde_json::to_value(&config).expect("Could not build genesis config.")
}
19 changes: 12 additions & 7 deletions node/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub enum Subcommand {
PurgeChain(cumulus_client_cli::PurgeChainCmd),

/// Export the genesis state of the parachain.
ExportGenesisState(cumulus_client_cli::ExportGenesisStateCommand),
ExportGenesisState(cumulus_client_cli::ExportGenesisHeadCommand),

/// Export the genesis wasm of the parachain.
ExportGenesisWasm(cumulus_client_cli::ExportGenesisWasmCommand),
Expand Down Expand Up @@ -70,6 +70,14 @@ pub struct Cli {
/// Relay chain arguments
#[arg(raw = true)]
pub relay_chain_args: Vec<String>,

/// Proposer's maximum block size limit in bytes
#[clap(long, default_value = sc_basic_authorship::DEFAULT_BLOCK_SIZE_LIMIT.to_string())]
pub proposer_block_size_limit: usize,

/// Proposer's soft deadline in percents of block size
#[clap(long, default_value = "50")]
pub proposer_soft_deadline_percent: u8,
}

#[derive(Debug)]
Expand All @@ -92,14 +100,11 @@ impl RelayChainCli {
) -> Self {
let extension = crate::chain_spec::Extensions::try_get(&*para_config.chain_spec);
let chain_id = extension.map(|e| e.relay_chain.clone());
let base_path = para_config
.base_path
.as_ref()
.map(|x| x.path().join("polkadot"));
let base_path = para_config.base_path.path().join("polkadot");
Self {
base_path,
chain_id,
base: clap::Parser::parse_from(relay_chain_args),
chain_id,
base_path: Some(base_path),
}
}
}
Loading

0 comments on commit 8613065

Please sign in to comment.