Skip to content

Commit

Permalink
Update the parachain template (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
1 parent 555bd14 commit 5bec209
Show file tree
Hide file tree
Showing 16 changed files with 2,749 additions and 2,199 deletions.
3,263 changes: 1,859 additions & 1,404 deletions Cargo.lock

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,13 @@ default_constructed_unit_structs = { level = "allow", priority = 2 } # stylistic
polkavm = "0.9.3"
polkavm-linker = "0.9.2"
polkavm-derive = "0.9.1"
log = { version = "0.4.20", default-features = false }
log = { version = "0.4.21", default-features = false }
quote = { version = "1.0.33" }
serde = { version = "1.0.197", default-features = false }
serde-big-array = { version = "0.3.2" }
serde_derive = { version = "1.0.117" }
serde_json = { version = "1.0.114", default-features = false }
serde_yaml = { version = "0.9" }
syn = { version = "2.0.50" }
syn = { version = "2.0.53" }
thiserror = { version = "1.0.48" }
tracing-subscriber = { version = "0.3.18" }
87 changes: 44 additions & 43 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "parachain-template-node"
description = "A parachain node template built with Substrate and Cumulus, part of Polkadot Sdk. (polkadot v1.9.0)"
description = "A parachain node template built with Substrate and Cumulus, part of Polkadot Sdk. (polkadot v1.12.0)"
version = "0.1.0"
license = "MIT-0"
authors.workspace = true
Expand All @@ -17,58 +17,59 @@ workspace = true
# name = "parachain-template-node"

[dependencies]
clap = { version = "4.5.1", features = ["derive"] }
clap = { version = "4.5.3", features = ["derive"] }
log = { workspace = true, default-features = true }
codec = { package = "parity-scale-codec", version = "3.0.0" }
serde = { features = ["derive"], workspace = true, default-features = true }
jsonrpsee = { version = "0.22", features = ["server"] }
futures = "0.3.28"
serde_json = { workspace = true, default-features = true }
docify = "0.2.8"
parachain-template-runtime = { version = "0.1.0", path = "../runtime" }
frame-benchmarking = { version = "31.0.0" }
frame-benchmarking-cli = { version = "35.0.1" }
pallet-transaction-payment-rpc = { version = "33.0.0" }
sc-basic-authorship = { version = "0.37.0" }
sc-chain-spec = { version = "30.0.1" }
sc-cli = { version = "0.39.0" }
sc-client-api = { version = "31.0.0" }
sc-offchain = { version = "32.0.0" }
sc-consensus = { version = "0.36.0" }
sc-executor = { version = "0.35.0" }
sc-network = { version = "0.37.0" }
sc-network-sync = { version = "0.36.0" }
sc-rpc = { version = "32.0.0" }
sc-service = { version = "0.38.0" }
sc-sysinfo = { version = "30.0.0" }
sc-telemetry = { version = "17.0.0" }
sc-tracing = { version = "31.0.0" }
sc-transaction-pool = { version = "31.0.0" }
sc-transaction-pool-api = { version = "31.0.0" }
sp-api = { version = "29.0.0" }
sp-block-builder = { version = "29.0.0" }
sp-blockchain = { version = "31.0.0" }
sp-consensus-aura = { version = "0.35.0" }
sp-core = { version = "31.0.0" }
sp-keystore = { version = "0.37.0" }
sp-io = { version = "33.0.0" }
sp-runtime = { version = "34.0.0" }
sp-timestamp = { version = "29.0.0" }
substrate-frame-rpc-system = { version = "31.0.0" }
frame-benchmarking = { version = "34.0.0" }
frame-benchmarking-cli = { version = "38.0.0" }
pallet-transaction-payment-rpc = { version = "36.0.0" }
sc-basic-authorship = { version = "0.40.0" }
sc-chain-spec = { version = "33.0.0" }
sc-cli = { version = "0.42.0" }
sc-client-api = { version = "34.0.0" }
sc-offchain = { version = "35.0.0" }
sc-consensus = { version = "0.39.1" }
sc-executor = { version = "0.38.0" }
sc-network = { version = "0.40.0" }
sc-network-sync = { version = "0.39.0" }
sc-rpc = { version = "35.0.0" }
sc-service = { version = "0.41.0" }
sc-sysinfo = { version = "33.0.0" }
sc-telemetry = { version = "20.0.0" }
sc-tracing = { version = "34.0.0" }
sc-transaction-pool = { version = "34.0.0" }
sc-transaction-pool-api = { version = "34.0.0" }
sp-api = { version = "32.0.0" }
sp-block-builder = { version = "32.0.0" }
sp-blockchain = { version = "34.0.0" }
sp-consensus-aura = { version = "0.38.0" }
sp-core = { version = "33.0.1" }
sp-keystore = { version = "0.39.0" }
sp-io = { version = "36.0.0" }
sp-runtime = { version = "37.0.0" }
sp-timestamp = { version = "32.0.0" }
substrate-frame-rpc-system = { version = "34.0.0" }
substrate-prometheus-endpoint = { version = "0.17.0" }

# Polkadot
polkadot-cli = { version = "10.0.0", features = ["rococo-native"] }
polkadot-primitives = { version = "10.0.0" }
xcm = { version = "10.0.0", package = "staging-xcm", default-features = false }
cumulus-client-cli = { version = "0.10.0" }
cumulus-client-collator = { version = "0.10.0" }
cumulus-client-consensus-aura = { version = "0.10.0" }
cumulus-client-consensus-common = { version = "0.10.0" }
cumulus-client-consensus-proposer = { version = "0.10.0" }
cumulus-client-service = { version = "0.10.0" }
cumulus-primitives-core = { version = "0.10.0" }
cumulus-primitives-parachain-inherent = { version = "0.10.0" }
cumulus-relay-chain-interface = { version = "0.10.0" }
polkadot-cli = { version = "13.0.0", features = ["rococo-native"] }
polkadot-primitives = { version = "13.0.0" }
xcm = { version = "13.0.1", package = "staging-xcm", default-features = false }
cumulus-client-cli = { version = "0.13.0" }
cumulus-client-collator = { version = "0.13.0" }
cumulus-client-consensus-aura = { version = "0.13.0" }
cumulus-client-consensus-common = { version = "0.13.0" }
cumulus-client-consensus-proposer = { version = "0.13.0" }
cumulus-client-service = { version = "0.13.0" }
cumulus-primitives-core = { version = "0.13.0" }
cumulus-primitives-parachain-inherent = { version = "0.13.0" }
cumulus-relay-chain-interface = { version = "0.13.0" }
color-print = "0.3.4"

[build-dependencies]
Expand Down
3 changes: 2 additions & 1 deletion node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Pu

/// The extensions for the [`ChainSpec`].
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, ChainSpecGroup, ChainSpecExtension)]
#[serde(deny_unknown_fields)]
pub struct Extensions {
/// The relay chain of the Parachain.
#[serde(alias = "relayChain", alias = "RelayChain")]
pub relay_chain: String,
/// The id of the Parachain.
#[serde(alias = "paraId", alias = "ParaId")]
pub para_id: u32,
}

Expand Down
5 changes: 0 additions & 5 deletions node/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@ pub enum Subcommand {
/// The pallet benchmarking moved to the `pallet` sub-command.
#[command(subcommand)]
Benchmark(frame_benchmarking_cli::BenchmarkCmd),

/// Try-runtime has migrated to a standalone
/// [CLI](<https://github.com/paritytech/try-runtime-cli>). The subcommand exists as a stub and
/// deprecation notice. It will be removed entirely some time after January 2024.
TryRuntime,
}

const AFTER_HELP_EXAMPLE: &str = color_print::cstr!(
Expand Down
10 changes: 1 addition & 9 deletions node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ use sc_cli::{
NetworkParams, Result, SharedParams, SubstrateCli,
};
use sc_service::config::{BasePath, PrometheusConfig};
use sp_runtime::traits::AccountIdConversion;

use crate::{
chain_spec,
Expand Down Expand Up @@ -184,7 +183,7 @@ pub fn run() -> Result<()> {
match cmd {
BenchmarkCmd::Pallet(cmd) =>
if cfg!(feature = "runtime-benchmarks") {
runner.sync_run(|config| cmd.run::<sp_runtime::traits::HashingFor<Block>, ReclaimHostFunctions>(config))
runner.sync_run(|config| cmd.run_with_spec::<sp_runtime::traits::HashingFor<Block>, ReclaimHostFunctions>(Some(config.chain_spec)))
} else {
Err("Benchmarking wasn't enabled when building the node. \
You can enable it with `--features runtime-benchmarks`."
Expand Down Expand Up @@ -217,7 +216,6 @@ pub fn run() -> Result<()> {
_ => Err("Benchmarking sub-command unsupported".into()),
}
},
Some(Subcommand::TryRuntime) => Err("The `try-runtime` subcommand has been migrated to a standalone CLI (https://github.com/paritytech/try-runtime-cli). It is no longer being maintained here and will be removed entirely some time after January 2024. Please remove this subcommand from your runtime and use the standalone CLI.".into()),
None => {
let runner = cli.create_runner(&cli.run.normalize())?;
let collator_options = cli.run.collator_options();
Expand All @@ -241,17 +239,11 @@ pub fn run() -> Result<()> {

let id = ParaId::from(para_id);

let parachain_account =
AccountIdConversion::<polkadot_primitives::AccountId>::into_account_truncating(
&id,
);

let tokio_handle = config.tokio_handle.clone();
let polkadot_config =
SubstrateCli::create_configuration(&polkadot_cli, &polkadot_cli, tokio_handle)
.map_err(|err| format!("Relay chain argument error: {}", err))?;

info!("Parachain Account: {parachain_account}");
info!("Is collating: {}", if config.role.is_authority() { "yes" } else { "no" });

crate::service::start_parachain_node(
Expand Down
Loading

0 comments on commit 5bec209

Please sign in to comment.