diff --git a/.editorconfig b/.editorconfig
index 426f9ad31..a17bbf975 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -3,21 +3,28 @@ root = true
[*.rs]
charset=utf-8
end_of_line=lf
-indent_size=space
+indent_size=4
indent_style=space
insert_final_newline=true
max_line_length=100
-tab_width=4
+trim_trailing_whitespace=true
+
+[*.toml]
+end_of_line=lf
+indent_size=2
+indent_style=space
+trim_trailing_whitespace=true
+
+[*.md]
+insert_final_newline=true
trim_trailing_whitespace=true
[*.yml]
end_of_line=lf
indent_size=2
indent_style=space
-tab_width=8
[*.sh]
end_of_line=lf
indent_size=2
indent_style=space
-tab_width=8
diff --git a/.github/resources/frame-weight-template.hbs b/.github/resources/frame-weight-template.hbs
index 225191459..621c2c491 100644
--- a/.github/resources/frame-weight-template.hbs
+++ b/.github/resources/frame-weight-template.hbs
@@ -1,16 +1,16 @@
// Copyright 2020-2022 Manta Network.
// This file is part of Manta.
-
+//
// Manta 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.
-
+//
// Manta 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 Manta. If not, see .
@@ -34,76 +34,76 @@ use sp_std::marker::PhantomData;
/// Weight functions needed for {{pallet}}.
pub trait WeightInfo {
- {{#each benchmarks as |benchmark|}}
- fn {{benchmark.name~}}
- (
- {{~#each benchmark.components as |c| ~}}
- {{c.name}}: u32, {{/each~}}
- ) -> Weight;
- {{/each}}
+ {{#each benchmarks as |benchmark|}}
+ fn {{benchmark.name~}}
+ (
+ {{~#each benchmark.components as |c| ~}}
+ {{c.name}}: u32, {{/each~}}
+ ) -> Weight;
+ {{/each}}
}
/// Weights for {{pallet}} using the Substrate node and recommended hardware.
pub struct SubstrateWeight(PhantomData);
impl {{pallet}}::WeightInfo for SubstrateWeight {
- {{#each benchmarks as |benchmark|}}
- {{#each benchmark.comments as |comment|}}
- // {{comment}}
- {{/each}}
- fn {{benchmark.name~}}
- (
- {{~#each benchmark.components as |c| ~}}
- {{~#if (not c.is_used)}}_{{/if}}{{c.name}}: u32, {{/each~}}
- ) -> Weight {
- ({{underscore benchmark.base_weight}} as Weight)
- {{#each benchmark.component_weight as |cw|}}
- // Standard Error: {{underscore cw.error}}
- .saturating_add(({{underscore cw.slope}} as Weight).saturating_mul({{cw.name}} as Weight))
- {{/each}}
- {{#if (ne benchmark.base_reads "0")}}
- .saturating_add(T::DbWeight::get().reads({{benchmark.base_reads}} as Weight))
- {{/if}}
- {{#each benchmark.component_reads as |cr|}}
- .saturating_add(T::DbWeight::get().reads(({{cr.slope}} as Weight).saturating_mul({{cr.name}} as Weight)))
- {{/each}}
- {{#if (ne benchmark.base_writes "0")}}
- .saturating_add(T::DbWeight::get().writes({{benchmark.base_writes}} as Weight))
- {{/if}}
- {{#each benchmark.component_writes as |cw|}}
- .saturating_add(T::DbWeight::get().writes(({{cw.slope}} as Weight).saturating_mul({{cw.name}} as Weight)))
- {{/each}}
- }
- {{/each}}
+ {{#each benchmarks as |benchmark|}}
+ {{#each benchmark.comments as |comment|}}
+ // {{comment}}
+ {{/each}}
+ fn {{benchmark.name~}}
+ (
+ {{~#each benchmark.components as |c| ~}}
+ {{~#if (not c.is_used)}}_{{/if}}{{c.name}}: u32, {{/each~}}
+ ) -> Weight {
+ ({{underscore benchmark.base_weight}} as Weight)
+ {{#each benchmark.component_weight as |cw|}}
+ // Standard Error: {{underscore cw.error}}
+ .saturating_add(({{underscore cw.slope}} as Weight).saturating_mul({{cw.name}} as Weight))
+ {{/each}}
+ {{#if (ne benchmark.base_reads "0")}}
+ .saturating_add(T::DbWeight::get().reads({{benchmark.base_reads}} as Weight))
+ {{/if}}
+ {{#each benchmark.component_reads as |cr|}}
+ .saturating_add(T::DbWeight::get().reads(({{cr.slope}} as Weight).saturating_mul({{cr.name}} as Weight)))
+ {{/each}}
+ {{#if (ne benchmark.base_writes "0")}}
+ .saturating_add(T::DbWeight::get().writes({{benchmark.base_writes}} as Weight))
+ {{/if}}
+ {{#each benchmark.component_writes as |cw|}}
+ .saturating_add(T::DbWeight::get().writes(({{cw.slope}} as Weight).saturating_mul({{cw.name}} as Weight)))
+ {{/each}}
+ }
+ {{/each}}
}
// For backwards compatibility and tests
impl WeightInfo for () {
- {{#each benchmarks as |benchmark|}}
- {{#each benchmark.comments as |comment|}}
- // {{comment}}
- {{/each}}
- fn {{benchmark.name~}}
- (
- {{~#each benchmark.components as |c| ~}}
- {{~#if (not c.is_used)}}_{{/if}}{{c.name}}: u32, {{/each~}}
- ) -> Weight {
- ({{underscore benchmark.base_weight}} as Weight)
- {{#each benchmark.component_weight as |cw|}}
- // Standard Error: {{underscore cw.error}}
- .saturating_add(({{underscore cw.slope}} as Weight).saturating_mul({{cw.name}} as Weight))
- {{/each}}
- {{#if (ne benchmark.base_reads "0")}}
- .saturating_add(RocksDbWeight::get().reads({{benchmark.base_reads}} as Weight))
- {{/if}}
- {{#each benchmark.component_reads as |cr|}}
- .saturating_add(RocksDbWeight::get().reads(({{cr.slope}} as Weight).saturating_mul({{cr.name}} as Weight)))
- {{/each}}
- {{#if (ne benchmark.base_writes "0")}}
- .saturating_add(RocksDbWeight::get().writes({{benchmark.base_writes}} as Weight))
- {{/if}}
- {{#each benchmark.component_writes as |cw|}}
- .saturating_add(RocksDbWeight::get().writes(({{cw.slope}} as Weight).saturating_mul({{cw.name}} as Weight)))
- {{/each}}
- }
- {{/each}}
+ {{#each benchmarks as |benchmark|}}
+ {{#each benchmark.comments as |comment|}}
+ // {{comment}}
+ {{/each}}
+ fn {{benchmark.name~}}
+ (
+ {{~#each benchmark.components as |c| ~}}
+ {{~#if (not c.is_used)}}_{{/if}}{{c.name}}: u32, {{/each~}}
+ ) -> Weight {
+ ({{underscore benchmark.base_weight}} as Weight)
+ {{#each benchmark.component_weight as |cw|}}
+ // Standard Error: {{underscore cw.error}}
+ .saturating_add(({{underscore cw.slope}} as Weight).saturating_mul({{cw.name}} as Weight))
+ {{/each}}
+ {{#if (ne benchmark.base_reads "0")}}
+ .saturating_add(RocksDbWeight::get().reads({{benchmark.base_reads}} as Weight))
+ {{/if}}
+ {{#each benchmark.component_reads as |cr|}}
+ .saturating_add(RocksDbWeight::get().reads(({{cr.slope}} as Weight).saturating_mul({{cr.name}} as Weight)))
+ {{/each}}
+ {{#if (ne benchmark.base_writes "0")}}
+ .saturating_add(RocksDbWeight::get().writes({{benchmark.base_writes}} as Weight))
+ {{/if}}
+ {{#each benchmark.component_writes as |cw|}}
+ .saturating_add(RocksDbWeight::get().writes(({{cw.slope}} as Weight).saturating_mul({{cw.name}} as Weight)))
+ {{/each}}
+ }
+ {{/each}}
}
diff --git a/.github/workflows/check_build.yml b/.github/workflows/check_build.yml
index e38e54069..d08fd078d 100644
--- a/.github/workflows/check_build.yml
+++ b/.github/workflows/check_build.yml
@@ -83,16 +83,16 @@ jobs:
run: |
curl -s https://sh.rustup.rs -sSf | sh -s -- -y
source ${HOME}/.cargo/env
- rustup toolchain install stable
rustup toolchain install nightly
- rustup default stable
rustup target add wasm32-unknown-unknown --toolchain nightly
+ rustup default nightly
rustup update
+ cargo install taplo-cli
-
name: Run yamllint
uses: actionshub/yamllint@main
-
- name: Check Clippy & Formatting
+ name: Check Formatting
env:
RUST_BACKTRACE: full
RUSTC_WRAPPER: sccache
@@ -100,8 +100,9 @@ jobs:
SCCACHE_DIR: /home/runner/.cache/sccache
run: |
source ${HOME}/.cargo/env
- SKIP_WASM_BUILD=1 cargo clippy
- SKIP_WASM_BUILD=1 cargo fmt
+ cargo fmt --all -- --check
+ $HOME/.cargo/bin/taplo fmt --check
+ $HOME/.cargo/bin/taplo lint
-
name: Check Build
env:
@@ -111,8 +112,8 @@ jobs:
SCCACHE_DIR: /home/runner/.cache/sccache
run: |
source ${HOME}/.cargo/env
- cargo check --no-default-features
- cargo check --all-features
+ SKIP_WASM_BUILD=1 cargo check --no-default-features
+ SKIP_WASM_BUILD=1 cargo clippy --all-targets --all-features -- -D warnings
-
name: stop sccache server
run: sccache --stop-server || true
diff --git a/.rustfmt.toml b/.rustfmt.toml
index e36335f0e..9437df19b 100644
--- a/.rustfmt.toml
+++ b/.rustfmt.toml
@@ -1,2 +1,3 @@
-hard_tabs=true
-imports_granularity="Crate"
\ No newline at end of file
+edition = '2021' # Needed for direct invocation of rustfmt ourside of cargo fmt
+imports_granularity = "Crate"
+license_template_path = "FILE_TEMPLATE"
diff --git a/.taplo.toml b/.taplo.toml
new file mode 100644
index 000000000..5f3f5e1a0
--- /dev/null
+++ b/.taplo.toml
@@ -0,0 +1,4 @@
+[formatting]
+array_auto_collapse = false
+array_auto_expand = false
+reorder_keys = true
diff --git a/Cargo.toml b/Cargo.toml
index 41e0d28fe..909e8c318 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,18 +1,18 @@
[workspace]
-resolver = "2"
members = [
- 'node',
- 'pallets/*',
- 'runtime/manta',
- 'runtime/calamari',
- 'runtime/dolphin',
- 'runtime/common',
- 'primitives',
+ 'node',
+ 'pallets/*',
+ 'runtime/manta',
+ 'runtime/calamari',
+ 'runtime/dolphin',
+ 'runtime/common',
+ 'primitives',
]
+resolver = "2"
[profile.production]
-inherits = "release"
codegen-units = 1
+inherits = "release"
lto = true
[profile.release]
diff --git a/file_header.txt b/FILE_TEMPLATE
similarity index 100%
rename from file_header.txt
rename to FILE_TEMPLATE
diff --git a/node/Cargo.toml b/node/Cargo.toml
index dfbc753d0..b44813736 100644
--- a/node/Cargo.toml
+++ b/node/Cargo.toml
@@ -1,28 +1,28 @@
[package]
authors = ['Manta Network']
build = 'build.rs'
+default-run = "manta"
description = 'Manta Parachain Node.'
edition = '2021'
-rust-version = '1.57'
homepage = 'https://manta.network'
license = 'GPL-3.0'
name = 'manta'
repository = 'https://github.com/Manta-Network/Manta/'
+rust-version = '1.57'
version = '3.2.0'
-default-run = "manta"
[package.metadata.docs.rs]
targets = ['x86_64-unknown-linux-gnu']
[dependencies]
+async-trait = "0.1.52"
+cfg-if = "1.0.0"
clap = { version = "3.1", features = ["derive"] }
-log = "0.4.16"
codec = { package = 'parity-scale-codec', version = '3.0.0' }
-cfg-if = "1.0.0"
-serde = { version = "1.0.137", features = ["derive"] }
-hex-literal = "0.3.4"
-async-trait = "0.1.52"
futures = "0.3.21"
+hex-literal = "0.3.4"
+log = "0.4.16"
+serde = { version = "1.0.137", features = ["derive"] }
# Substrate frames
frame-benchmarking = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.18" }
@@ -30,8 +30,8 @@ frame-benchmarking-cli = { git = 'https://github.com/paritytech/substrate.git',
try-runtime-cli = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.18", optional = true }
# RPC related dependencies
-jsonrpc-core = "18.0.0"
frame-rpc-system = { package = "substrate-frame-rpc-system", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.18" }
+jsonrpc-core = "18.0.0"
pallet-transaction-payment-rpc = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.18" }
sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.18" }
@@ -39,29 +39,29 @@ sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate.git",
sc-basic-authorship = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.18" }
sc-chain-spec = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.18" }
sc-cli = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.18" }
+sc-client-api = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.18" }
sc-consensus = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.18" }
sc-executor = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.18" }
-sc-client-api = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.18" }
sc-keystore = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.18" }
sc-network = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.18" }
sc-rpc = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.18" }
sc-rpc-api = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.18" }
sc-service = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.18" }
sc-telemetry = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.18" }
-sc-transaction-pool = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.18" }
sc-tracing = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.18" }
+sc-transaction-pool = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.18" }
# Substrate primitives
sp-api = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.18" }
sp-block-builder = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.18" }
+sp-blockchain = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.18" }
sp-consensus = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.18" }
sp-consensus-aura = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.18" }
-sp-blockchain = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.18" }
sp-core = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.18" }
sp-inherents = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.18" }
+sp-io = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.18" }
sp-keystore = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.18" }
sp-offchain = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.18" }
-sp-io = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.18" }
sp-runtime = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.18" }
sp-session = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.18" }
sp-timestamp = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.18" }
@@ -70,16 +70,16 @@ substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate
# Cumulus dependencies
cumulus-client-cli = { git = 'https://github.com/paritytech/cumulus.git', branch = "polkadot-v0.9.18" }
-cumulus-client-consensus-common = { git = 'https://github.com/paritytech/cumulus.git', branch = "polkadot-v0.9.18" }
cumulus-client-consensus-aura = { git = 'https://github.com/paritytech/cumulus.git', branch = "polkadot-v0.9.18" }
+cumulus-client-consensus-common = { git = 'https://github.com/paritytech/cumulus.git', branch = "polkadot-v0.9.18" }
cumulus-client-consensus-relay-chain = { git = 'https://github.com/paritytech/cumulus.git', branch = "polkadot-v0.9.18" }
cumulus-client-network = { git = 'https://github.com/paritytech/cumulus.git', branch = "polkadot-v0.9.18" }
+cumulus-client-service = { git = 'https://github.com/paritytech/cumulus.git', branch = "polkadot-v0.9.18" }
cumulus-primitives-core = { git = 'https://github.com/paritytech/cumulus.git', branch = "polkadot-v0.9.18" }
cumulus-primitives-parachain-inherent = { git = 'https://github.com/paritytech/cumulus.git', branch = "polkadot-v0.9.18" }
-cumulus-client-service = { git = 'https://github.com/paritytech/cumulus.git', branch = "polkadot-v0.9.18" }
+cumulus-relay-chain-inprocess-interface = { git = 'https://github.com/paritytech/cumulus.git', branch = "polkadot-v0.9.18" }
cumulus-relay-chain-interface = { git = 'https://github.com/paritytech/cumulus.git', branch = "polkadot-v0.9.18" }
cumulus-relay-chain-rpc-interface = { git = 'https://github.com/paritytech/cumulus.git', branch = "polkadot-v0.9.18" }
-cumulus-relay-chain-inprocess-interface = { git = 'https://github.com/paritytech/cumulus.git', branch = "polkadot-v0.9.18" }
# Polkadot dependencies
polkadot-cli = { git = 'https://github.com/paritytech/polkadot.git', branch = "release-v0.9.18" }
@@ -99,17 +99,17 @@ pallet-manta-pay = { path = '../pallets/manta-pay', features = ["rpc", "runtime"
substrate-build-script-utils = { git = 'https://github.com/paritytech/substrate.git', branch = "polkadot-v0.9.18" }
[features]
+fast-runtime = [
+ "manta-runtime/fast-runtime",
+ "calamari-runtime/fast-runtime",
+]
runtime-benchmarks = [
- 'calamari-runtime/runtime-benchmarks',
- 'polkadot-service/runtime-benchmarks',
- 'manta-runtime/runtime-benchmarks',
+ 'calamari-runtime/runtime-benchmarks',
+ 'polkadot-service/runtime-benchmarks',
+ 'manta-runtime/runtime-benchmarks',
]
try-runtime = [
- 'calamari-runtime/try-runtime',
- 'manta-runtime/try-runtime',
- 'try-runtime-cli',
-]
-fast-runtime = [
- "manta-runtime/fast-runtime",
- "calamari-runtime/fast-runtime",
+ 'calamari-runtime/try-runtime',
+ 'manta-runtime/try-runtime',
+ 'try-runtime-cli',
]
diff --git a/node/build.rs b/node/build.rs
index 33194c881..19c83f571 100644
--- a/node/build.rs
+++ b/node/build.rs
@@ -17,7 +17,7 @@
use substrate_build_script_utils::{generate_cargo_keys, rerun_if_git_head_changed};
fn main() {
- generate_cargo_keys();
+ generate_cargo_keys();
- rerun_if_git_head_changed();
+ rerun_if_git_head_changed();
}
diff --git a/node/src/chain_specs/calamari.rs b/node/src/chain_specs/calamari.rs
index de414f7e4..597ea4891 100644
--- a/node/src/chain_specs/calamari.rs
+++ b/node/src/chain_specs/calamari.rs
@@ -21,7 +21,7 @@ use manta_primitives::helpers::{get_account_id_from_seed, get_collator_keys_from
/// Specialized `ChainSpec` for the normal parachain runtime.
pub type CalamariChainSpec =
- sc_service::GenericChainSpec;
+ sc_service::GenericChainSpec;
const CALAMARI_PROTOCOL_ID: &str = "calamari"; // for p2p network configuration
const KUSAMA_RELAYCHAIN_LOCAL_NET: &str = "kusama-local";
@@ -34,200 +34,200 @@ const SAFE_XCM_VERSION: u32 = 2;
///
/// The input must be a tuple of individual keys (a single arg for now since we have just one key).
pub fn calamari_session_keys(keys: AuraId) -> calamari_runtime::opaque::SessionKeys {
- calamari_runtime::opaque::SessionKeys { aura: keys }
+ calamari_runtime::opaque::SessionKeys { aura: keys }
}
// calamari chain specs
pub fn calamari_properties() -> Properties {
- let mut p = Properties::new();
- p.insert("ss58format".into(), constants::CALAMARI_SS58PREFIX.into());
- p.insert("tokenDecimals".into(), constants::CALAMARI_DECIMAL.into());
- p.insert(
- "tokenSymbol".into(),
- constants::CALAMARI_TOKEN_SYMBOL.into(),
- );
- p
+ let mut p = Properties::new();
+ p.insert("ss58format".into(), constants::CALAMARI_SS58PREFIX.into());
+ p.insert("tokenDecimals".into(), constants::CALAMARI_DECIMAL.into());
+ p.insert(
+ "tokenSymbol".into(),
+ constants::CALAMARI_TOKEN_SYMBOL.into(),
+ );
+ p
}
pub fn calamari_development_config() -> CalamariChainSpec {
- let properties = calamari_properties();
+ let properties = calamari_properties();
- CalamariChainSpec::from_genesis(
- // Name
- "Calamari Parachain Development",
- // ID
- "calamari_dev",
- ChainType::Local,
- move || {
- calamari_dev_genesis(
- // initial collators.
- vec![(
- get_account_id_from_seed::("Alice"),
- get_collator_keys_from_seed("Alice"),
- )],
- vec![
- get_account_id_from_seed::("Alice"),
- get_account_id_from_seed::("Bob"),
- get_account_id_from_seed::("Alice//stash"),
- get_account_id_from_seed::("Bob//stash"),
- ],
- )
- },
- vec![],
- None,
- Some(CALAMARI_PROTOCOL_ID),
- None,
- Some(properties),
- Extensions {
- relay_chain: KUSAMA_RELAYCHAIN_DEV_NET.into(),
- para_id: CALAMARI_PARACHAIN_ID,
- },
- )
+ CalamariChainSpec::from_genesis(
+ // Name
+ "Calamari Parachain Development",
+ // ID
+ "calamari_dev",
+ ChainType::Local,
+ move || {
+ calamari_dev_genesis(
+ // initial collators.
+ vec![(
+ get_account_id_from_seed::("Alice"),
+ get_collator_keys_from_seed("Alice"),
+ )],
+ vec![
+ get_account_id_from_seed::("Alice"),
+ get_account_id_from_seed::("Bob"),
+ get_account_id_from_seed::("Alice//stash"),
+ get_account_id_from_seed::("Bob//stash"),
+ ],
+ )
+ },
+ vec![],
+ None,
+ Some(CALAMARI_PROTOCOL_ID),
+ None,
+ Some(properties),
+ Extensions {
+ relay_chain: KUSAMA_RELAYCHAIN_DEV_NET.into(),
+ para_id: CALAMARI_PARACHAIN_ID,
+ },
+ )
}
pub fn calamari_local_config() -> CalamariChainSpec {
- let properties = calamari_properties();
+ let properties = calamari_properties();
- CalamariChainSpec::from_genesis(
- // Name
- "Calamari Parachain Local",
- // ID
- "calamari_local",
- ChainType::Local,
- move || {
- calamari_dev_genesis(
- // initial collators.
- vec![
- (
- get_account_id_from_seed::("Alice"),
- get_collator_keys_from_seed("Alice"),
- ),
- (
- get_account_id_from_seed::("Bob"),
- get_collator_keys_from_seed("Bob"),
- ),
- (
- get_account_id_from_seed::("Charlie"),
- get_collator_keys_from_seed("Charlie"),
- ),
- (
- get_account_id_from_seed::("Dave"),
- get_collator_keys_from_seed("Dave"),
- ),
- (
- get_account_id_from_seed::("Eve"),
- get_collator_keys_from_seed("Eve"),
- ),
- ],
- vec![
- get_account_id_from_seed::("Alice"),
- get_account_id_from_seed::("Bob"),
- get_account_id_from_seed::("Charlie"),
- get_account_id_from_seed::("Dave"),
- get_account_id_from_seed::("Eve"),
- get_account_id_from_seed::("Alice//stash"),
- get_account_id_from_seed::("Bob//stash"),
- get_account_id_from_seed::("Charlie//stash"),
- get_account_id_from_seed::("Dave//stash"),
- get_account_id_from_seed::("Eve//stash"),
- ],
- )
- },
- vec![],
- None,
- Some(CALAMARI_PROTOCOL_ID),
- None,
- Some(properties),
- Extensions {
- relay_chain: KUSAMA_RELAYCHAIN_LOCAL_NET.into(),
- para_id: CALAMARI_PARACHAIN_ID,
- },
- )
+ CalamariChainSpec::from_genesis(
+ // Name
+ "Calamari Parachain Local",
+ // ID
+ "calamari_local",
+ ChainType::Local,
+ move || {
+ calamari_dev_genesis(
+ // initial collators.
+ vec![
+ (
+ get_account_id_from_seed::("Alice"),
+ get_collator_keys_from_seed("Alice"),
+ ),
+ (
+ get_account_id_from_seed::("Bob"),
+ get_collator_keys_from_seed("Bob"),
+ ),
+ (
+ get_account_id_from_seed::("Charlie"),
+ get_collator_keys_from_seed("Charlie"),
+ ),
+ (
+ get_account_id_from_seed::("Dave"),
+ get_collator_keys_from_seed("Dave"),
+ ),
+ (
+ get_account_id_from_seed::("Eve"),
+ get_collator_keys_from_seed("Eve"),
+ ),
+ ],
+ vec![
+ get_account_id_from_seed::("Alice"),
+ get_account_id_from_seed::("Bob"),
+ get_account_id_from_seed::("Charlie"),
+ get_account_id_from_seed::("Dave"),
+ get_account_id_from_seed::("Eve"),
+ get_account_id_from_seed::("Alice//stash"),
+ get_account_id_from_seed::("Bob//stash"),
+ get_account_id_from_seed::("Charlie//stash"),
+ get_account_id_from_seed::("Dave//stash"),
+ get_account_id_from_seed::("Eve//stash"),
+ ],
+ )
+ },
+ vec![],
+ None,
+ Some(CALAMARI_PROTOCOL_ID),
+ None,
+ Some(properties),
+ Extensions {
+ relay_chain: KUSAMA_RELAYCHAIN_LOCAL_NET.into(),
+ para_id: CALAMARI_PARACHAIN_ID,
+ },
+ )
}
fn calamari_dev_genesis(
- invulnerables: Vec<(AccountId, AuraId)>,
- endowed_accounts: Vec,
+ invulnerables: Vec<(AccountId, AuraId)>,
+ endowed_accounts: Vec,
) -> calamari_runtime::GenesisConfig {
- calamari_runtime::GenesisConfig {
- system: calamari_runtime::SystemConfig {
- code: calamari_runtime::WASM_BINARY
- .expect("WASM binary was not build, please build it!")
- .to_vec(),
- },
- balances: calamari_runtime::BalancesConfig {
- balances: endowed_accounts[..endowed_accounts.len() / 2]
- .iter()
- .map(|k| {
- (
- k.clone(),
- 100 * CALAMARI_ENDOWMENT / ((endowed_accounts.len() / 2) as Balance),
- )
- })
- .collect(),
- },
- // no need to pass anything to aura, in fact it will panic if we do. Session will take care
- // of this.
- aura: Default::default(),
- parachain_info: calamari_runtime::ParachainInfoConfig {
- parachain_id: CALAMARI_PARACHAIN_ID.into(),
- },
- collator_selection: calamari_runtime::CollatorSelectionConfig {
- invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(),
- candidacy_bond: KMA * 1000, // How many tokens will be reserved as collator
- ..Default::default()
- },
- session: calamari_runtime::SessionConfig {
- keys: invulnerables
- .iter()
- .cloned()
- .map(|(acc, aura)| {
- (
- acc.clone(), // account id
- acc, // validator id
- calamari_session_keys(aura), // session keys
- )
- })
- .collect(),
- },
- democracy: DemocracyConfig::default(),
- council: CouncilConfig {
- members: endowed_accounts.iter().take(1).cloned().collect(),
- phantom: Default::default(),
- },
- technical_committee: TechnicalCommitteeConfig {
- members: endowed_accounts.iter().take(1).cloned().collect(),
- phantom: Default::default(),
- },
- council_membership: Default::default(),
- technical_membership: Default::default(),
- asset_manager: Default::default(),
- aura_ext: Default::default(),
- parachain_system: Default::default(),
- polkadot_xcm: calamari_runtime::PolkadotXcmConfig {
- safe_xcm_version: Some(SAFE_XCM_VERSION),
- },
- }
+ calamari_runtime::GenesisConfig {
+ system: calamari_runtime::SystemConfig {
+ code: calamari_runtime::WASM_BINARY
+ .expect("WASM binary was not build, please build it!")
+ .to_vec(),
+ },
+ balances: calamari_runtime::BalancesConfig {
+ balances: endowed_accounts[..endowed_accounts.len() / 2]
+ .iter()
+ .map(|k| {
+ (
+ k.clone(),
+ 100 * CALAMARI_ENDOWMENT / ((endowed_accounts.len() / 2) as Balance),
+ )
+ })
+ .collect(),
+ },
+ // no need to pass anything to aura, in fact it will panic if we do. Session will take care
+ // of this.
+ aura: Default::default(),
+ parachain_info: calamari_runtime::ParachainInfoConfig {
+ parachain_id: CALAMARI_PARACHAIN_ID.into(),
+ },
+ collator_selection: calamari_runtime::CollatorSelectionConfig {
+ invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(),
+ candidacy_bond: KMA * 1000, // How many tokens will be reserved as collator
+ ..Default::default()
+ },
+ session: calamari_runtime::SessionConfig {
+ keys: invulnerables
+ .iter()
+ .cloned()
+ .map(|(acc, aura)| {
+ (
+ acc.clone(), // account id
+ acc, // validator id
+ calamari_session_keys(aura), // session keys
+ )
+ })
+ .collect(),
+ },
+ democracy: DemocracyConfig::default(),
+ council: CouncilConfig {
+ members: endowed_accounts.iter().take(1).cloned().collect(),
+ phantom: Default::default(),
+ },
+ technical_committee: TechnicalCommitteeConfig {
+ members: endowed_accounts.iter().take(1).cloned().collect(),
+ phantom: Default::default(),
+ },
+ council_membership: Default::default(),
+ technical_membership: Default::default(),
+ asset_manager: Default::default(),
+ aura_ext: Default::default(),
+ parachain_system: Default::default(),
+ polkadot_xcm: calamari_runtime::PolkadotXcmConfig {
+ safe_xcm_version: Some(SAFE_XCM_VERSION),
+ },
+ }
}
pub fn calamari_testnet_config() -> Result {
- let mut spec = CalamariChainSpec::from_json_bytes(
- &include_bytes!("../../../genesis/calamari-testnet-genesis.json")[..],
- )?;
- spec.extensions_mut().para_id = CALAMARI_PARACHAIN_ID;
- Ok(spec)
+ let mut spec = CalamariChainSpec::from_json_bytes(
+ &include_bytes!("../../../genesis/calamari-testnet-genesis.json")[..],
+ )?;
+ spec.extensions_mut().para_id = CALAMARI_PARACHAIN_ID;
+ Ok(spec)
}
// Calamari testnet for ci jobs
pub fn calamari_testnet_ci_config() -> Result {
- CalamariChainSpec::from_json_bytes(
- &include_bytes!("../../../genesis/calamari-testnet-ci-genesis.json")[..],
- )
+ CalamariChainSpec::from_json_bytes(
+ &include_bytes!("../../../genesis/calamari-testnet-ci-genesis.json")[..],
+ )
}
// Calamari mainnet
pub fn calamari_config() -> Result {
- CalamariChainSpec::from_json_bytes(
- &include_bytes!("../../../genesis/calamari-genesis.json")[..],
- )
+ CalamariChainSpec::from_json_bytes(
+ &include_bytes!("../../../genesis/calamari-genesis.json")[..],
+ )
}
diff --git a/node/src/chain_specs/dolphin.rs b/node/src/chain_specs/dolphin.rs
index 7b13b3279..c3f612631 100644
--- a/node/src/chain_specs/dolphin.rs
+++ b/node/src/chain_specs/dolphin.rs
@@ -33,189 +33,189 @@ const SAFE_XCM_VERSION: u32 = 2;
///
/// The input must be a tuple of individual keys (a single arg for now since we have just one key).
pub fn dolphin_session_keys(keys: AuraId) -> dolphin_runtime::opaque::SessionKeys {
- dolphin_runtime::opaque::SessionKeys { aura: keys }
+ dolphin_runtime::opaque::SessionKeys { aura: keys }
}
// dolphin chain specs
pub fn dolphin_properties() -> Properties {
- let mut p = Properties::new();
- p.insert("ss58format".into(), constants::CALAMARI_SS58PREFIX.into());
- p.insert("tokenDecimals".into(), constants::DOLPHIN_DECIMAL.into());
- p.insert("tokenSymbol".into(), constants::DOLPHIN_TOKEN_SYMBOL.into());
- p
+ let mut p = Properties::new();
+ p.insert("ss58format".into(), constants::CALAMARI_SS58PREFIX.into());
+ p.insert("tokenDecimals".into(), constants::DOLPHIN_DECIMAL.into());
+ p.insert("tokenSymbol".into(), constants::DOLPHIN_TOKEN_SYMBOL.into());
+ p
}
pub fn dolphin_development_config() -> DolphinChainSpec {
- let properties = dolphin_properties();
+ let properties = dolphin_properties();
- DolphinChainSpec::from_genesis(
- // Name
- "Dolphin Parachain Development",
- // ID
- "dolphin_dev",
- ChainType::Local,
- move || {
- dolphin_dev_genesis(
- // initial collators.
- vec![(
- get_account_id_from_seed::("Alice"),
- get_collator_keys_from_seed("Alice"),
- )],
- get_account_id_from_seed::("Alice"),
- vec![
- get_account_id_from_seed::("Alice"),
- get_account_id_from_seed::("Bob"),
- get_account_id_from_seed::("Alice//stash"),
- get_account_id_from_seed::("Bob//stash"),
- ],
- )
- },
- vec![],
- None,
- Some(DOLPHIN_PROTOCOL_ID),
- None,
- Some(properties),
- Extensions {
- relay_chain: "".into(),
- para_id: DOLPHIN_PARACHAIN_ID,
- },
- )
+ DolphinChainSpec::from_genesis(
+ // Name
+ "Dolphin Parachain Development",
+ // ID
+ "dolphin_dev",
+ ChainType::Local,
+ move || {
+ dolphin_dev_genesis(
+ // initial collators.
+ vec![(
+ get_account_id_from_seed::("Alice"),
+ get_collator_keys_from_seed("Alice"),
+ )],
+ get_account_id_from_seed::("Alice"),
+ vec![
+ get_account_id_from_seed::("Alice"),
+ get_account_id_from_seed::("Bob"),
+ get_account_id_from_seed::("Alice//stash"),
+ get_account_id_from_seed::("Bob//stash"),
+ ],
+ )
+ },
+ vec![],
+ None,
+ Some(DOLPHIN_PROTOCOL_ID),
+ None,
+ Some(properties),
+ Extensions {
+ relay_chain: "".into(),
+ para_id: DOLPHIN_PARACHAIN_ID,
+ },
+ )
}
pub fn dolphin_local_config() -> DolphinChainSpec {
- let properties = dolphin_properties();
+ let properties = dolphin_properties();
- DolphinChainSpec::from_genesis(
- // Name
- "Dolphin Parachain Local",
- // ID
- "dolphin_local",
- ChainType::Local,
- move || {
- dolphin_dev_genesis(
- // initial collators.
- vec![
- (
- get_account_id_from_seed::("Alice"),
- get_collator_keys_from_seed("Alice"),
- ),
- (
- get_account_id_from_seed::("Bob"),
- get_collator_keys_from_seed("Bob"),
- ),
- (
- get_account_id_from_seed::("Charlie"),
- get_collator_keys_from_seed("Charlie"),
- ),
- (
- get_account_id_from_seed::("Dave"),
- get_collator_keys_from_seed("Dave"),
- ),
- (
- get_account_id_from_seed::("Eve"),
- get_collator_keys_from_seed("Eve"),
- ),
- ],
- get_account_id_from_seed::("Alice"),
- vec![
- get_account_id_from_seed::("Alice"),
- get_account_id_from_seed::("Bob"),
- get_account_id_from_seed::("Charlie"),
- get_account_id_from_seed::("Dave"),
- get_account_id_from_seed::("Eve"),
- get_account_id_from_seed::("Alice//stash"),
- get_account_id_from_seed::("Bob//stash"),
- get_account_id_from_seed::("Charlie//stash"),
- get_account_id_from_seed::("Dave//stash"),
- get_account_id_from_seed::("Eve//stash"),
- ],
- )
- },
- vec![],
- None,
- Some(DOLPHIN_PROTOCOL_ID),
- None,
- Some(properties),
- Extensions {
- relay_chain: "".into(),
- para_id: DOLPHIN_PARACHAIN_ID,
- },
- )
+ DolphinChainSpec::from_genesis(
+ // Name
+ "Dolphin Parachain Local",
+ // ID
+ "dolphin_local",
+ ChainType::Local,
+ move || {
+ dolphin_dev_genesis(
+ // initial collators.
+ vec![
+ (
+ get_account_id_from_seed::("Alice"),
+ get_collator_keys_from_seed("Alice"),
+ ),
+ (
+ get_account_id_from_seed::("Bob"),
+ get_collator_keys_from_seed("Bob"),
+ ),
+ (
+ get_account_id_from_seed::("Charlie"),
+ get_collator_keys_from_seed("Charlie"),
+ ),
+ (
+ get_account_id_from_seed::("Dave"),
+ get_collator_keys_from_seed("Dave"),
+ ),
+ (
+ get_account_id_from_seed::("Eve"),
+ get_collator_keys_from_seed("Eve"),
+ ),
+ ],
+ get_account_id_from_seed::("Alice"),
+ vec![
+ get_account_id_from_seed::("Alice"),
+ get_account_id_from_seed::("Bob"),
+ get_account_id_from_seed::("Charlie"),
+ get_account_id_from_seed::("Dave"),
+ get_account_id_from_seed::("Eve"),
+ get_account_id_from_seed::("Alice//stash"),
+ get_account_id_from_seed::("Bob//stash"),
+ get_account_id_from_seed::("Charlie//stash"),
+ get_account_id_from_seed::("Dave//stash"),
+ get_account_id_from_seed::("Eve//stash"),
+ ],
+ )
+ },
+ vec![],
+ None,
+ Some(DOLPHIN_PROTOCOL_ID),
+ None,
+ Some(properties),
+ Extensions {
+ relay_chain: "".into(),
+ para_id: DOLPHIN_PARACHAIN_ID,
+ },
+ )
}
fn dolphin_dev_genesis(
- invulnerables: Vec<(AccountId, AuraId)>,
- root_key: AccountId,
- endowed_accounts: Vec,
+ invulnerables: Vec<(AccountId, AuraId)>,
+ root_key: AccountId,
+ endowed_accounts: Vec,
) -> dolphin_runtime::GenesisConfig {
- dolphin_runtime::GenesisConfig {
- system: dolphin_runtime::SystemConfig {
- code: dolphin_runtime::WASM_BINARY
- .expect("WASM binary was not build, please build it!")
- .to_vec(),
- },
- balances: dolphin_runtime::BalancesConfig {
- balances: endowed_accounts[..endowed_accounts.len() / 2]
- .iter()
- .map(|k| {
- (
- k.clone(),
- 100 * DOLPHIN_ENDOWMENT / ((endowed_accounts.len() / 2) as Balance),
- )
- })
- .collect(),
- },
- // no need to pass anything to aura, in fact it will panic if we do. Session will take care
- // of this.
- aura: Default::default(),
- sudo: dolphin_runtime::SudoConfig {
- key: Some(root_key),
- },
- parachain_info: dolphin_runtime::ParachainInfoConfig {
- parachain_id: DOLPHIN_PARACHAIN_ID.into(),
- },
- collator_selection: dolphin_runtime::CollatorSelectionConfig {
- invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(),
- candidacy_bond: DOL * 1000, // How many tokens will be reserved as collator
- ..Default::default()
- },
- session: dolphin_runtime::SessionConfig {
- keys: invulnerables
- .iter()
- .cloned()
- .map(|(acc, aura)| {
- (
- acc.clone(), // account id
- acc, // validator id
- dolphin_session_keys(aura), // session keys
- )
- })
- .collect(),
- },
- democracy: DemocracyConfig::default(),
- council: CouncilConfig {
- members: endowed_accounts.iter().take(1).cloned().collect(),
- phantom: Default::default(),
- },
- technical_committee: TechnicalCommitteeConfig {
- members: endowed_accounts.iter().take(1).cloned().collect(),
- phantom: Default::default(),
- },
- asset_manager: Default::default(),
- council_membership: Default::default(),
- technical_membership: Default::default(),
- aura_ext: Default::default(),
- parachain_system: Default::default(),
- polkadot_xcm: dolphin_runtime::PolkadotXcmConfig {
- safe_xcm_version: Some(SAFE_XCM_VERSION),
- },
- }
+ dolphin_runtime::GenesisConfig {
+ system: dolphin_runtime::SystemConfig {
+ code: dolphin_runtime::WASM_BINARY
+ .expect("WASM binary was not build, please build it!")
+ .to_vec(),
+ },
+ balances: dolphin_runtime::BalancesConfig {
+ balances: endowed_accounts[..endowed_accounts.len() / 2]
+ .iter()
+ .map(|k| {
+ (
+ k.clone(),
+ 100 * DOLPHIN_ENDOWMENT / ((endowed_accounts.len() / 2) as Balance),
+ )
+ })
+ .collect(),
+ },
+ // no need to pass anything to aura, in fact it will panic if we do. Session will take care
+ // of this.
+ aura: Default::default(),
+ sudo: dolphin_runtime::SudoConfig {
+ key: Some(root_key),
+ },
+ parachain_info: dolphin_runtime::ParachainInfoConfig {
+ parachain_id: DOLPHIN_PARACHAIN_ID.into(),
+ },
+ collator_selection: dolphin_runtime::CollatorSelectionConfig {
+ invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(),
+ candidacy_bond: DOL * 1000, // How many tokens will be reserved as collator
+ ..Default::default()
+ },
+ session: dolphin_runtime::SessionConfig {
+ keys: invulnerables
+ .iter()
+ .cloned()
+ .map(|(acc, aura)| {
+ (
+ acc.clone(), // account id
+ acc, // validator id
+ dolphin_session_keys(aura), // session keys
+ )
+ })
+ .collect(),
+ },
+ democracy: DemocracyConfig::default(),
+ council: CouncilConfig {
+ members: endowed_accounts.iter().take(1).cloned().collect(),
+ phantom: Default::default(),
+ },
+ technical_committee: TechnicalCommitteeConfig {
+ members: endowed_accounts.iter().take(1).cloned().collect(),
+ phantom: Default::default(),
+ },
+ asset_manager: Default::default(),
+ council_membership: Default::default(),
+ technical_membership: Default::default(),
+ aura_ext: Default::default(),
+ parachain_system: Default::default(),
+ polkadot_xcm: dolphin_runtime::PolkadotXcmConfig {
+ safe_xcm_version: Some(SAFE_XCM_VERSION),
+ },
+ }
}
pub fn dolphin_testnet_config() -> Result {
- let mut spec = DolphinChainSpec::from_json_bytes(
- &include_bytes!("../../../genesis/dolphin-testnet-genesis.json")[..],
- )?;
- spec.extensions_mut().para_id = DOLPHIN_PARACHAIN_ID;
- Ok(spec)
+ let mut spec = DolphinChainSpec::from_json_bytes(
+ &include_bytes!("../../../genesis/dolphin-testnet-genesis.json")[..],
+ )?;
+ spec.extensions_mut().para_id = DOLPHIN_PARACHAIN_ID;
+ Ok(spec)
}
diff --git a/node/src/chain_specs/manta.rs b/node/src/chain_specs/manta.rs
index dbb45c9ca..023fe021a 100644
--- a/node/src/chain_specs/manta.rs
+++ b/node/src/chain_specs/manta.rs
@@ -33,176 +33,176 @@ pub type MantaChainSpec = sc_service::GenericChainSpec manta_runtime::opaque::SessionKeys {
- manta_runtime::opaque::SessionKeys { aura: keys }
+ manta_runtime::opaque::SessionKeys { aura: keys }
}
/// Token
pub fn manta_properties() -> Properties {
- let mut p = Properties::new();
- p.insert("ss58format".into(), constants::MANTA_SS58PREFIX.into());
- p.insert("tokenDecimals".into(), constants::MANTA_DECIMAL.into());
- p.insert("tokenSymbol".into(), constants::MANTA_TOKEN_SYMBOL.into());
- p
+ let mut p = Properties::new();
+ p.insert("ss58format".into(), constants::MANTA_SS58PREFIX.into());
+ p.insert("tokenDecimals".into(), constants::MANTA_DECIMAL.into());
+ p.insert("tokenSymbol".into(), constants::MANTA_TOKEN_SYMBOL.into());
+ p
}
// manta chain spec
pub fn manta_development_config() -> MantaChainSpec {
- let properties = manta_properties();
- MantaChainSpec::from_genesis(
- // Name
- "Manta Parachain Development",
- // ID
- "manta_dev",
- ChainType::Local,
- move || {
- manta_dev_genesis(
- // initial collators.
- vec![(
- get_account_id_from_seed::("Alice"),
- get_collator_keys_from_seed("Alice"),
- )],
- get_account_id_from_seed::("Alice"),
- vec![
- get_account_id_from_seed::("Alice"),
- get_account_id_from_seed::("Bob"),
- get_account_id_from_seed::("Alice//stash"),
- get_account_id_from_seed::("Bob//stash"),
- ],
- )
- },
- vec![],
- None,
- Some(MANTA_PROTOCOL_ID),
- None,
- Some(properties),
- Extensions {
- relay_chain: POLKADOT_RELAYCHAIN_DEV_NET.into(),
- para_id: MANTA_PARACHAIN_ID,
- },
- )
+ let properties = manta_properties();
+ MantaChainSpec::from_genesis(
+ // Name
+ "Manta Parachain Development",
+ // ID
+ "manta_dev",
+ ChainType::Local,
+ move || {
+ manta_dev_genesis(
+ // initial collators.
+ vec![(
+ get_account_id_from_seed::("Alice"),
+ get_collator_keys_from_seed("Alice"),
+ )],
+ get_account_id_from_seed::("Alice"),
+ vec![
+ get_account_id_from_seed::("Alice"),
+ get_account_id_from_seed::("Bob"),
+ get_account_id_from_seed::("Alice//stash"),
+ get_account_id_from_seed::("Bob//stash"),
+ ],
+ )
+ },
+ vec![],
+ None,
+ Some(MANTA_PROTOCOL_ID),
+ None,
+ Some(properties),
+ Extensions {
+ relay_chain: POLKADOT_RELAYCHAIN_DEV_NET.into(),
+ para_id: MANTA_PARACHAIN_ID,
+ },
+ )
}
pub fn manta_local_config() -> MantaChainSpec {
- let properties = manta_properties();
- MantaChainSpec::from_genesis(
- // Name
- "Manta Parachain Local",
- // ID
- "manta_local",
- ChainType::Local,
- move || {
- manta_dev_genesis(
- // initial collators.
- vec![
- (
- get_account_id_from_seed::("Alice"),
- get_collator_keys_from_seed("Alice"),
- ),
- (
- get_account_id_from_seed::("Bob"),
- get_collator_keys_from_seed("Bob"),
- ),
- ],
- get_account_id_from_seed::("Alice"),
- vec![
- get_account_id_from_seed::("Alice"),
- get_account_id_from_seed::("Bob"),
- get_account_id_from_seed::("Charlie"),
- get_account_id_from_seed::("Dave"),
- get_account_id_from_seed::("Eve"),
- get_account_id_from_seed::("Alice//stash"),
- get_account_id_from_seed::("Bob//stash"),
- get_account_id_from_seed::("Charlie//stash"),
- get_account_id_from_seed::("Dave//stash"),
- get_account_id_from_seed::("Eve//stash"),
- ],
- )
- },
- vec![],
- None,
- Some(MANTA_PROTOCOL_ID),
- None,
- Some(properties),
- Extensions {
- relay_chain: POLKADOT_RELAYCHAIN_LOCAL_NET.into(),
- para_id: MANTA_PARACHAIN_ID,
- },
- )
+ let properties = manta_properties();
+ MantaChainSpec::from_genesis(
+ // Name
+ "Manta Parachain Local",
+ // ID
+ "manta_local",
+ ChainType::Local,
+ move || {
+ manta_dev_genesis(
+ // initial collators.
+ vec![
+ (
+ get_account_id_from_seed::("Alice"),
+ get_collator_keys_from_seed("Alice"),
+ ),
+ (
+ get_account_id_from_seed::("Bob"),
+ get_collator_keys_from_seed("Bob"),
+ ),
+ ],
+ get_account_id_from_seed::("Alice"),
+ vec![
+ get_account_id_from_seed::("Alice"),
+ get_account_id_from_seed::("Bob"),
+ get_account_id_from_seed::("Charlie"),
+ get_account_id_from_seed::("Dave"),
+ get_account_id_from_seed::("Eve"),
+ get_account_id_from_seed::("Alice//stash"),
+ get_account_id_from_seed::("Bob//stash"),
+ get_account_id_from_seed::("Charlie//stash"),
+ get_account_id_from_seed::("Dave//stash"),
+ get_account_id_from_seed::("Eve//stash"),
+ ],
+ )
+ },
+ vec![],
+ None,
+ Some(MANTA_PROTOCOL_ID),
+ None,
+ Some(properties),
+ Extensions {
+ relay_chain: POLKADOT_RELAYCHAIN_LOCAL_NET.into(),
+ para_id: MANTA_PARACHAIN_ID,
+ },
+ )
}
fn manta_dev_genesis(
- invulnerables: Vec<(AccountId, AuraId)>,
- root_key: AccountId,
- endowed_accounts: Vec,
+ invulnerables: Vec<(AccountId, AuraId)>,
+ root_key: AccountId,
+ endowed_accounts: Vec,
) -> manta_runtime::GenesisConfig {
- manta_runtime::GenesisConfig {
- system: manta_runtime::SystemConfig {
- code: manta_runtime::WASM_BINARY
- .expect("WASM binary was not build, please build it!")
- .to_vec(),
- },
- balances: manta_runtime::BalancesConfig {
- balances: endowed_accounts[..endowed_accounts.len() / 2]
- .iter()
- .map(|k| {
- (
- k.clone(),
- 10 * MANTA_ENDOWMENT / ((endowed_accounts.len() / 2) as Balance),
- )
- })
- .collect(),
- },
- // no need to pass anything to aura, in fact it will panic if we do. Session will take care
- // of this.
- aura: Default::default(),
- sudo: manta_runtime::SudoConfig {
- key: Some(root_key),
- },
- parachain_info: manta_runtime::ParachainInfoConfig {
- parachain_id: MANTA_PARACHAIN_ID.into(),
- },
- collator_selection: manta_runtime::CollatorSelectionConfig {
- invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(),
- candidacy_bond: MANTA * 10000, // How many tokens will be reserved as collator
- ..Default::default()
- },
- session: manta_runtime::SessionConfig {
- keys: invulnerables
- .iter()
- .cloned()
- .map(|(acc, aura)| {
- (
- acc.clone(), // account id
- acc, // validator id
- manta_session_keys(aura), // session keys
- )
- })
- .collect(),
- },
- aura_ext: Default::default(),
- parachain_system: Default::default(),
- polkadot_xcm: manta_runtime::PolkadotXcmConfig {
- safe_xcm_version: Some(SAFE_XCM_VERSION),
- },
- }
+ manta_runtime::GenesisConfig {
+ system: manta_runtime::SystemConfig {
+ code: manta_runtime::WASM_BINARY
+ .expect("WASM binary was not build, please build it!")
+ .to_vec(),
+ },
+ balances: manta_runtime::BalancesConfig {
+ balances: endowed_accounts[..endowed_accounts.len() / 2]
+ .iter()
+ .map(|k| {
+ (
+ k.clone(),
+ 10 * MANTA_ENDOWMENT / ((endowed_accounts.len() / 2) as Balance),
+ )
+ })
+ .collect(),
+ },
+ // no need to pass anything to aura, in fact it will panic if we do. Session will take care
+ // of this.
+ aura: Default::default(),
+ sudo: manta_runtime::SudoConfig {
+ key: Some(root_key),
+ },
+ parachain_info: manta_runtime::ParachainInfoConfig {
+ parachain_id: MANTA_PARACHAIN_ID.into(),
+ },
+ collator_selection: manta_runtime::CollatorSelectionConfig {
+ invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(),
+ candidacy_bond: MANTA * 10000, // How many tokens will be reserved as collator
+ ..Default::default()
+ },
+ session: manta_runtime::SessionConfig {
+ keys: invulnerables
+ .iter()
+ .cloned()
+ .map(|(acc, aura)| {
+ (
+ acc.clone(), // account id
+ acc, // validator id
+ manta_session_keys(aura), // session keys
+ )
+ })
+ .collect(),
+ },
+ aura_ext: Default::default(),
+ parachain_system: Default::default(),
+ polkadot_xcm: manta_runtime::PolkadotXcmConfig {
+ safe_xcm_version: Some(SAFE_XCM_VERSION),
+ },
+ }
}
pub fn manta_testnet_config() -> Result {
- let mut spec = MantaChainSpec::from_json_bytes(
- &include_bytes!("../../../genesis/manta-testnet-genesis.json")[..],
- )?;
- spec.extensions_mut().para_id = MANTA_PARACHAIN_ID;
- Ok(spec)
+ let mut spec = MantaChainSpec::from_json_bytes(
+ &include_bytes!("../../../genesis/manta-testnet-genesis.json")[..],
+ )?;
+ spec.extensions_mut().para_id = MANTA_PARACHAIN_ID;
+ Ok(spec)
}
pub fn manta_config() -> Result {
- MantaChainSpec::from_json_bytes(&include_bytes!("../../../genesis/manta-genesis.json")[..])
+ MantaChainSpec::from_json_bytes(&include_bytes!("../../../genesis/manta-genesis.json")[..])
}
pub fn manta_testnet_ci_config() -> Result {
- let mut spec = MantaChainSpec::from_json_bytes(
- &include_bytes!("../../../genesis/manta-testnet-ci-genesis.json")[..],
- )?;
- spec.extensions_mut().para_id = MANTA_PARACHAIN_ID;
- Ok(spec)
+ let mut spec = MantaChainSpec::from_json_bytes(
+ &include_bytes!("../../../genesis/manta-testnet-ci-genesis.json")[..],
+ )?;
+ spec.extensions_mut().para_id = MANTA_PARACHAIN_ID;
+ Ok(spec)
}
diff --git a/node/src/chain_specs/mod.rs b/node/src/chain_specs/mod.rs
index 82c823853..f6be23319 100644
--- a/node/src/chain_specs/mod.rs
+++ b/node/src/chain_specs/mod.rs
@@ -15,10 +15,12 @@
// along with Manta. If not, see .
#![allow(dead_code)]
+// Tolerate clippy warning originating in ChainSpecGroup, which is a dependency
+#![allow(clippy::derive_partial_eq_without_eq)]
use manta_primitives::{
- constants,
- types::{AccountId, AuraId, Balance},
+ constants,
+ types::{AccountId, AuraId, Balance},
};
use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};
use sc_service::{ChainType, Properties};
@@ -46,18 +48,20 @@ const STAGING_TELEMETRY_URL: &str = "wss://api.telemetry.manta.systems/submit/";
pub type ChainSpec = sc_service::GenericChainSpec;
/// The extensions for the [`ChainSpec`].
-#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, ChainSpecGroup, ChainSpecExtension)]
+#[derive(
+ Debug, Clone, PartialEq, Eq, Serialize, Deserialize, ChainSpecGroup, ChainSpecExtension,
+)]
#[serde(deny_unknown_fields)]
pub struct Extensions {
- /// The relay chain of the Parachain.
- pub relay_chain: String,
- /// The id of the Parachain.
- pub para_id: u32,
+ /// The relay chain of the Parachain.
+ pub relay_chain: String,
+ /// The id of the Parachain.
+ pub para_id: u32,
}
impl Extensions {
- /// Try to get the extension from the given `ChainSpec`.
- pub fn try_get(chain_spec: &dyn sc_service::ChainSpec) -> Option<&Self> {
- sc_chain_spec::get_extension(chain_spec.extensions())
- }
+ /// Try to get the extension from the given `ChainSpec`.
+ pub fn try_get(chain_spec: &dyn sc_service::ChainSpec) -> Option<&Self> {
+ sc_chain_spec::get_extension(chain_spec.extensions())
+ }
}
diff --git a/node/src/cli.rs b/node/src/cli.rs
index 5d73e5964..97a4b19d0 100644
--- a/node/src/cli.rs
+++ b/node/src/cli.rs
@@ -21,133 +21,133 @@ use std::path::PathBuf;
/// Sub-commands supported by the collator.
#[derive(Debug, clap::Subcommand)]
pub enum Subcommand {
- /// Export the genesis state of the parachain.
- #[clap(name = "export-genesis-state")]
- ExportGenesisState(ExportGenesisStateCommand),
+ /// Export the genesis state of the parachain.
+ #[clap(name = "export-genesis-state")]
+ ExportGenesisState(ExportGenesisStateCommand),
- /// Export the genesis wasm of the parachain.
- #[clap(name = "export-genesis-wasm")]
- ExportGenesisWasm(ExportGenesisWasmCommand),
+ /// Export the genesis wasm of the parachain.
+ #[clap(name = "export-genesis-wasm")]
+ ExportGenesisWasm(ExportGenesisWasmCommand),
- /// Build a chain specification.
- BuildSpec(sc_cli::BuildSpecCmd),
+ /// Build a chain specification.
+ BuildSpec(sc_cli::BuildSpecCmd),
- /// Validate blocks.
- CheckBlock(sc_cli::CheckBlockCmd),
+ /// Validate blocks.
+ CheckBlock(sc_cli::CheckBlockCmd),
- /// Export blocks.
- ExportBlocks(sc_cli::ExportBlocksCmd),
+ /// Export blocks.
+ ExportBlocks(sc_cli::ExportBlocksCmd),
- /// Export the state of a given block into a chain spec.
- ExportState(sc_cli::ExportStateCmd),
+ /// Export the state of a given block into a chain spec.
+ ExportState(sc_cli::ExportStateCmd),
- /// Import blocks.
- ImportBlocks(sc_cli::ImportBlocksCmd),
+ /// Import blocks.
+ ImportBlocks(sc_cli::ImportBlocksCmd),
- /// Remove the whole chain.
- PurgeChain(cumulus_client_cli::PurgeChainCmd),
+ /// Remove the whole chain.
+ PurgeChain(cumulus_client_cli::PurgeChainCmd),
- /// Revert the chain to a previous state.
- Revert(sc_cli::RevertCmd),
+ /// Revert the chain to a previous state.
+ Revert(sc_cli::RevertCmd),
- /// The custom benchmark subcommmand benchmarking runtime pallets.
- #[clap(name = "benchmark", about = "Benchmark runtime pallets.")]
- Benchmark(frame_benchmarking_cli::BenchmarkCmd),
+ /// The custom benchmark subcommmand benchmarking runtime pallets.
+ #[clap(name = "benchmark", about = "Benchmark runtime pallets.")]
+ Benchmark(frame_benchmarking_cli::BenchmarkCmd),
- /// Try some command against runtime state.
- #[cfg(feature = "try-runtime")]
- TryRuntime(try_runtime_cli::TryRuntimeCmd),
+ /// Try some command against runtime state.
+ #[cfg(feature = "try-runtime")]
+ TryRuntime(try_runtime_cli::TryRuntimeCmd),
- /// Try some command against runtime state. Note: `try-runtime` feature must
- /// be enabled.
- #[cfg(not(feature = "try-runtime"))]
- TryRuntime,
+ /// Try some command against runtime state. Note: `try-runtime` feature must
+ /// be enabled.
+ #[cfg(not(feature = "try-runtime"))]
+ TryRuntime,
}
/// Command for exporting the genesis state of the parachain
#[derive(Debug, Parser)]
pub struct ExportGenesisStateCommand {
- /// Output file name or stdout if unspecified.
- #[clap(parse(from_os_str))]
- pub output: Option,
-
- /// Id of the parachain this state is for.
- ///
- /// Default: 2084
- #[clap(long)]
- pub parachain_id: Option,
-
- /// Write output in binary. Default is to write in hex.
- #[clap(short, long)]
- pub raw: bool,
-
- /// The name of the chain for that the genesis state should be exported.
- #[clap(long)]
- pub chain: Option,
+ /// Output file name or stdout if unspecified.
+ #[clap(parse(from_os_str))]
+ pub output: Option,
+
+ /// Id of the parachain this state is for.
+ ///
+ /// Default: 2084
+ #[clap(long)]
+ pub parachain_id: Option,
+
+ /// Write output in binary. Default is to write in hex.
+ #[clap(short, long)]
+ pub raw: bool,
+
+ /// The name of the chain for that the genesis state should be exported.
+ #[clap(long)]
+ pub chain: Option,
}
/// Command for exporting the genesis wasm file.
#[derive(Debug, Parser)]
pub struct ExportGenesisWasmCommand {
- /// Output file name or stdout if unspecified.
- #[clap(parse(from_os_str))]
- pub output: Option,
+ /// Output file name or stdout if unspecified.
+ #[clap(parse(from_os_str))]
+ pub output: Option,
- /// Write output in binary. Default is to write in hex.
- #[clap(short, long)]
- pub raw: bool,
+ /// Write output in binary. Default is to write in hex.
+ #[clap(short, long)]
+ pub raw: bool,
- /// The name of the chain for that the genesis wasm file should be exported.
- #[clap(long)]
- pub chain: Option,
+ /// The name of the chain for that the genesis wasm file should be exported.
+ #[clap(long)]
+ pub chain: Option,
}
#[derive(Debug, Parser)]
#[clap(
- propagate_version = true,
- args_conflicts_with_subcommands = true,
- subcommand_negates_reqs = true
+ propagate_version = true,
+ args_conflicts_with_subcommands = true,
+ subcommand_negates_reqs = true
)]
pub struct Cli {
- #[clap(subcommand)]
- pub subcommand: Option,
+ #[clap(subcommand)]
+ pub subcommand: Option,
- #[clap(flatten)]
- pub run: cumulus_client_cli::RunCmd,
+ #[clap(flatten)]
+ pub run: cumulus_client_cli::RunCmd,
- /// Relaychain arguments
- #[clap(raw = true)]
- pub relaychain_args: Vec,
+ /// Relaychain arguments
+ #[clap(raw = true)]
+ pub relaychain_args: Vec,
}
#[derive(Debug)]
pub struct RelayChainCli {
- /// The actual relay chain cli object.
- pub base: polkadot_cli::RunCmd,
+ /// The actual relay chain cli object.
+ pub base: polkadot_cli::RunCmd,
- /// Optional chain id that should be passed to the relay chain.
- pub chain_id: Option,
+ /// Optional chain id that should be passed to the relay chain.
+ pub chain_id: Option,
- /// The base path that should be used by the relay chain.
- pub base_path: Option,
+ /// The base path that should be used by the relay chain.
+ pub base_path: Option,
}
impl RelayChainCli {
- /// Parse the relay chain CLI parameters using the para chain `Configuration`.
- pub fn new<'a>(
- para_config: &sc_service::Configuration,
- relay_chain_args: impl Iterator- ,
- ) -> Self {
- let extension = chain_specs::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"));
- Self {
- base_path,
- chain_id,
- base: polkadot_cli::RunCmd::parse_from(relay_chain_args),
- }
- }
+ /// Parse the relay chain CLI parameters using the para chain `Configuration`.
+ pub fn new<'a>(
+ para_config: &sc_service::Configuration,
+ relay_chain_args: impl Iterator
- ,
+ ) -> Self {
+ let extension = chain_specs::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"));
+ Self {
+ base_path,
+ chain_id,
+ base: polkadot_cli::RunCmd::parse_from(relay_chain_args),
+ }
+ }
}
diff --git a/node/src/command.rs b/node/src/command.rs
index f37f3aab9..d74dde599 100644
--- a/node/src/command.rs
+++ b/node/src/command.rs
@@ -1,4 +1,4 @@
-// Copyright 2019-2022 Manta Network.
+// Copyright 2020-2022 Manta Network.
// This file is part of Manta.
//
// Manta is free software: you can redistribute it and/or modify
@@ -15,10 +15,10 @@
// along with Manta. If not, see .
use crate::{
- chain_specs,
- cli::{Cli, RelayChainCli, Subcommand},
- rpc::{self, Builder},
- service::{new_partial, CalamariRuntimeExecutor, DolphinRuntimeExecutor, MantaRuntimeExecutor},
+ chain_specs,
+ cli::{Cli, RelayChainCli, Subcommand},
+ rpc::{self, Builder},
+ service::{new_partial, CalamariRuntimeExecutor, DolphinRuntimeExecutor, MantaRuntimeExecutor},
};
use codec::Encode;
use cumulus_client_service::genesis::generate_genesis_block;
@@ -27,8 +27,8 @@ use log::info;
use manta_primitives::types::{AuraId, Header};
use polkadot_parachain::primitives::AccountIdConversion;
use sc_cli::{
- ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams,
- NetworkParams, Result, RuntimeVersion, SharedParams, SubstrateCli,
+ ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams,
+ NetworkParams, Result, RuntimeVersion, SharedParams, SubstrateCli,
};
use sc_service::config::{BasePath, PrometheusConfig};
use sp_core::hexdisplay::HexDisplay;
@@ -42,579 +42,579 @@ pub const CALAMARI_PARACHAIN_ID: u32 = 2084;
pub const DOLPHIN_PARACHAIN_ID: u32 = 2084;
trait IdentifyChain {
- fn is_manta(&self) -> bool;
- fn is_calamari(&self) -> bool;
- fn is_dolphin(&self) -> bool;
+ fn is_manta(&self) -> bool;
+ fn is_calamari(&self) -> bool;
+ fn is_dolphin(&self) -> bool;
}
impl IdentifyChain for dyn sc_service::ChainSpec {
- fn is_manta(&self) -> bool {
- self.id().starts_with("manta")
- }
- fn is_calamari(&self) -> bool {
- self.id().starts_with("calamari")
- }
- fn is_dolphin(&self) -> bool {
- self.id().starts_with("dolphin")
- }
+ fn is_manta(&self) -> bool {
+ self.id().starts_with("manta")
+ }
+ fn is_calamari(&self) -> bool {
+ self.id().starts_with("calamari")
+ }
+ fn is_dolphin(&self) -> bool {
+ self.id().starts_with("dolphin")
+ }
}
impl IdentifyChain for T {
- fn is_manta(&self) -> bool {
- ::is_manta(self)
- }
- fn is_calamari(&self) -> bool {
- ::is_calamari(self)
- }
- fn is_dolphin(&self) -> bool {
- ::is_dolphin(self)
- }
+ fn is_manta(&self) -> bool {
+ ::is_manta(self)
+ }
+ fn is_calamari(&self) -> bool {
+ ::is_calamari(self)
+ }
+ fn is_dolphin(&self) -> bool {
+ ::is_dolphin(self)
+ }
}
fn load_spec(id: &str) -> std::result::Result, String> {
- match id {
- // manta chainspec
- "manta-dev" => Ok(Box::new(chain_specs::manta_development_config())),
- "manta-local" => Ok(Box::new(chain_specs::manta_local_config())),
- "manta-testnet" => Ok(Box::new(chain_specs::manta_testnet_config()?)),
- "manta-testnet-ci" => Ok(Box::new(chain_specs::manta_testnet_ci_config()?)),
- "manta" => Ok(Box::new(chain_specs::manta_config()?)),
- // calamari chainspec
- "calamari-dev" => Ok(Box::new(chain_specs::calamari_development_config())),
- "calamari-local" => Ok(Box::new(chain_specs::calamari_local_config())),
- "calamari-testnet" => Ok(Box::new(chain_specs::calamari_testnet_config()?)),
- "calamari-testnet-ci" => Ok(Box::new(chain_specs::calamari_testnet_ci_config()?)),
- "calamari" => Ok(Box::new(chain_specs::calamari_config()?)),
- // dolphin chainspec
- "dolphin-dev" => Ok(Box::new(chain_specs::dolphin_development_config())),
- "dolphin-local" => Ok(Box::new(chain_specs::dolphin_local_config())),
- "dolphin-testnet" => Ok(Box::new(chain_specs::dolphin_testnet_config()?)),
- path => {
- let chain_spec = chain_specs::ChainSpec::from_json_file(path.into())?;
- if chain_spec.is_manta() {
- Ok(Box::new(chain_specs::MantaChainSpec::from_json_file(
- path.into(),
- )?))
- } else if chain_spec.is_calamari() {
- Ok(Box::new(chain_specs::CalamariChainSpec::from_json_file(
- path.into(),
- )?))
- } else if chain_spec.is_dolphin() {
- Ok(Box::new(chain_specs::DolphinChainSpec::from_json_file(
- path.into(),
- )?))
- } else {
- Err("Please input a file name starting with manta, calamari, or dolphin.".into())
- }
- }
- }
+ match id {
+ // manta chainspec
+ "manta-dev" => Ok(Box::new(chain_specs::manta_development_config())),
+ "manta-local" => Ok(Box::new(chain_specs::manta_local_config())),
+ "manta-testnet" => Ok(Box::new(chain_specs::manta_testnet_config()?)),
+ "manta-testnet-ci" => Ok(Box::new(chain_specs::manta_testnet_ci_config()?)),
+ "manta" => Ok(Box::new(chain_specs::manta_config()?)),
+ // calamari chainspec
+ "calamari-dev" => Ok(Box::new(chain_specs::calamari_development_config())),
+ "calamari-local" => Ok(Box::new(chain_specs::calamari_local_config())),
+ "calamari-testnet" => Ok(Box::new(chain_specs::calamari_testnet_config()?)),
+ "calamari-testnet-ci" => Ok(Box::new(chain_specs::calamari_testnet_ci_config()?)),
+ "calamari" => Ok(Box::new(chain_specs::calamari_config()?)),
+ // dolphin chainspec
+ "dolphin-dev" => Ok(Box::new(chain_specs::dolphin_development_config())),
+ "dolphin-local" => Ok(Box::new(chain_specs::dolphin_local_config())),
+ "dolphin-testnet" => Ok(Box::new(chain_specs::dolphin_testnet_config()?)),
+ path => {
+ let chain_spec = chain_specs::ChainSpec::from_json_file(path.into())?;
+ if chain_spec.is_manta() {
+ Ok(Box::new(chain_specs::MantaChainSpec::from_json_file(
+ path.into(),
+ )?))
+ } else if chain_spec.is_calamari() {
+ Ok(Box::new(chain_specs::CalamariChainSpec::from_json_file(
+ path.into(),
+ )?))
+ } else if chain_spec.is_dolphin() {
+ Ok(Box::new(chain_specs::DolphinChainSpec::from_json_file(
+ path.into(),
+ )?))
+ } else {
+ Err("Please input a file name starting with manta, calamari, or dolphin.".into())
+ }
+ }
+ }
}
impl SubstrateCli for Cli {
- fn impl_name() -> String {
- "Manta/Calamari/Dolphin Collator".into()
- }
-
- fn impl_version() -> String {
- env!("SUBSTRATE_CLI_IMPL_VERSION").into()
- }
-
- fn description() -> String {
- format!(
- "Manta/Calamari/Dolphin Collator\n\nThe command-line arguments provided first will be \
- passed to the parachain node, while the arguments provided after -- will be passed \
- to the relaychain node.\n\n\
- {} [parachain-args] -- [relaychain-args]",
- Self::executable_name()
- )
- }
-
- fn author() -> String {
- env!("CARGO_PKG_AUTHORS").into()
- }
-
- fn support_url() -> String {
- "https://github.com/Manta-Network/Manta/issues/new".into()
- }
-
- fn copyright_start_year() -> i32 {
- 2020
- }
-
- fn load_spec(&self, id: &str) -> std::result::Result, String> {
- load_spec(id)
- }
-
- fn native_runtime_version(chain_spec: &Box) -> &'static RuntimeVersion {
- if chain_spec.is_manta() {
- &manta_runtime::VERSION
- } else if chain_spec.is_calamari() {
- &calamari_runtime::VERSION
- } else if chain_spec.is_dolphin() {
- &dolphin_runtime::VERSION
- } else {
- panic!("invalid chain spec! should be one of manta, calamari, or dolphin chain specs")
- }
- }
+ fn impl_name() -> String {
+ "Manta/Calamari/Dolphin Collator".into()
+ }
+
+ fn impl_version() -> String {
+ env!("SUBSTRATE_CLI_IMPL_VERSION").into()
+ }
+
+ fn description() -> String {
+ format!(
+ "Manta/Calamari/Dolphin Collator\n\nThe command-line arguments provided first will be \
+ passed to the parachain node, while the arguments provided after -- will be passed \
+ to the relaychain node.\n\n\
+ {} [parachain-args] -- [relaychain-args]",
+ Self::executable_name()
+ )
+ }
+
+ fn author() -> String {
+ env!("CARGO_PKG_AUTHORS").into()
+ }
+
+ fn support_url() -> String {
+ "https://github.com/Manta-Network/Manta/issues/new".into()
+ }
+
+ fn copyright_start_year() -> i32 {
+ 2020
+ }
+
+ fn load_spec(&self, id: &str) -> std::result::Result, String> {
+ load_spec(id)
+ }
+
+ fn native_runtime_version(chain_spec: &Box) -> &'static RuntimeVersion {
+ if chain_spec.is_manta() {
+ &manta_runtime::VERSION
+ } else if chain_spec.is_calamari() {
+ &calamari_runtime::VERSION
+ } else if chain_spec.is_dolphin() {
+ &dolphin_runtime::VERSION
+ } else {
+ panic!("invalid chain spec! should be one of manta, calamari, or dolphin chain specs")
+ }
+ }
}
impl SubstrateCli for RelayChainCli {
- fn impl_name() -> String {
- "Manta/Calamari/Dolphin Collator".into()
- }
-
- fn impl_version() -> String {
- env!("SUBSTRATE_CLI_IMPL_VERSION").into()
- }
-
- fn description() -> String {
- format!(
- "Manta/Calamari/Dolphin collator\n\nThe command-line arguments provided first will be \
- passed to the parachain node, while the arguments provided after -- will be passed \
- to the relaychain node.\n\n\
- {} [parachain-args] -- [relaychain-args]",
- Self::executable_name()
- )
- }
-
- fn author() -> String {
- env!("CARGO_PKG_AUTHORS").into()
- }
-
- fn support_url() -> String {
- "https://github.com/Manta-Network/Manta/issues/new".into()
- }
-
- fn copyright_start_year() -> i32 {
- 2020
- }
-
- fn load_spec(&self, id: &str) -> std::result::Result, String> {
- polkadot_cli::Cli::from_iter([RelayChainCli::executable_name()].iter()).load_spec(id)
- }
-
- fn native_runtime_version(chain_spec: &Box) -> &'static RuntimeVersion {
- polkadot_cli::Cli::native_runtime_version(chain_spec)
- }
+ fn impl_name() -> String {
+ "Manta/Calamari/Dolphin Collator".into()
+ }
+
+ fn impl_version() -> String {
+ env!("SUBSTRATE_CLI_IMPL_VERSION").into()
+ }
+
+ fn description() -> String {
+ format!(
+ "Manta/Calamari/Dolphin collator\n\nThe command-line arguments provided first will be \
+ passed to the parachain node, while the arguments provided after -- will be passed \
+ to the relaychain node.\n\n\
+ {} [parachain-args] -- [relaychain-args]",
+ Self::executable_name()
+ )
+ }
+
+ fn author() -> String {
+ env!("CARGO_PKG_AUTHORS").into()
+ }
+
+ fn support_url() -> String {
+ "https://github.com/Manta-Network/Manta/issues/new".into()
+ }
+
+ fn copyright_start_year() -> i32 {
+ 2020
+ }
+
+ fn load_spec(&self, id: &str) -> std::result::Result, String> {
+ polkadot_cli::Cli::from_iter([RelayChainCli::executable_name()].iter()).load_spec(id)
+ }
+
+ fn native_runtime_version(chain_spec: &Box) -> &'static RuntimeVersion {
+ polkadot_cli::Cli::native_runtime_version(chain_spec)
+ }
}
#[allow(clippy::borrowed_box)]
fn extract_genesis_wasm(chain_spec: &Box) -> Result> {
- let mut storage = chain_spec.build_storage()?;
- storage
- .top
- .remove(sp_core::storage::well_known_keys::CODE)
- .ok_or_else(|| "Could not find wasm file in genesis state!".into())
+ let mut storage = chain_spec.build_storage()?;
+ storage
+ .top
+ .remove(sp_core::storage::well_known_keys::CODE)
+ .ok_or_else(|| "Could not find wasm file in genesis state!".into())
}
macro_rules! construct_async_run {
- (|$components:ident, $cli:ident, $cmd:ident, $config:ident| $( $code:tt )* ) => {{
- let runner = $cli.create_runner($cmd)?;
- if runner.config().chain_spec.is_manta() {
- runner.async_run(|$config| {
- let $components = new_partial::(
- &$config,
- crate::service::parachain_build_import_queue::<_, _, AuraId>,
- )?;
- let task_manager = $components.task_manager;
- { $( $code )* }.map(|v| (v, task_manager))
- })
- } else if runner.config().chain_spec.is_calamari() {
- runner.async_run(|$config| {
- let $components = new_partial::(
- &$config,
- crate::service::parachain_build_import_queue::<_, _, AuraId>,
- )?;
- let task_manager = $components.task_manager;
- { $( $code )* }.map(|v| (v, task_manager))
- })
- } else if runner.config().chain_spec.is_dolphin() {
- runner.async_run(|$config| {
- let $components = new_partial::(
- &$config,
- crate::service::parachain_build_import_queue::<_, _, AuraId>,
- )?;
- let task_manager = $components.task_manager;
- { $( $code )* }.map(|v| (v, task_manager))
- })
- } else {
- panic!("wrong chain spec, must be one of manta, calamari, or dolphin chain specs");
- }
- }}
+ (|$components:ident, $cli:ident, $cmd:ident, $config:ident| $( $code:tt )* ) => {{
+ let runner = $cli.create_runner($cmd)?;
+ if runner.config().chain_spec.is_manta() {
+ runner.async_run(|$config| {
+ let $components = new_partial::(
+ &$config,
+ crate::service::parachain_build_import_queue::<_, _, AuraId>,
+ )?;
+ let task_manager = $components.task_manager;
+ { $( $code )* }.map(|v| (v, task_manager))
+ })
+ } else if runner.config().chain_spec.is_calamari() {
+ runner.async_run(|$config| {
+ let $components = new_partial::(
+ &$config,
+ crate::service::parachain_build_import_queue::<_, _, AuraId>,
+ )?;
+ let task_manager = $components.task_manager;
+ { $( $code )* }.map(|v| (v, task_manager))
+ })
+ } else if runner.config().chain_spec.is_dolphin() {
+ runner.async_run(|$config| {
+ let $components = new_partial::(
+ &$config,
+ crate::service::parachain_build_import_queue::<_, _, AuraId>,
+ )?;
+ let task_manager = $components.task_manager;
+ { $( $code )* }.map(|v| (v, task_manager))
+ })
+ } else {
+ panic!("wrong chain spec, must be one of manta, calamari, or dolphin chain specs");
+ }
+ }}
}
/// Parse command line arguments into service configuration.
pub fn run_with(cli: Cli) -> Result<()> {
- match &cli.subcommand {
- Some(Subcommand::BuildSpec(cmd)) => {
- let runner = cli.create_runner(cmd)?;
- runner.sync_run(|config| cmd.run(config.chain_spec, config.network))
- }
- Some(Subcommand::CheckBlock(cmd)) => {
- construct_async_run!(|components, cli, cmd, config| {
- Ok(cmd.run(components.client, components.import_queue))
- })
- }
- Some(Subcommand::ExportBlocks(cmd)) => {
- construct_async_run!(|components, cli, cmd, config| {
- Ok(cmd.run(components.client, config.database))
- })
- }
- Some(Subcommand::ExportState(cmd)) => {
- construct_async_run!(|components, cli, cmd, config| {
- Ok(cmd.run(components.client, config.chain_spec))
- })
- }
- Some(Subcommand::ImportBlocks(cmd)) => {
- construct_async_run!(|components, cli, cmd, config| {
- Ok(cmd.run(components.client, components.import_queue))
- })
- }
- Some(Subcommand::PurgeChain(cmd)) => {
- let runner = cli.create_runner(cmd)?;
-
- runner.sync_run(|config| {
- let polkadot_cli = RelayChainCli::new(
- &config,
- [RelayChainCli::executable_name()]
- .iter()
- .chain(cli.relaychain_args.iter()),
- );
-
- let polkadot_config = SubstrateCli::create_configuration(
- &polkadot_cli,
- &polkadot_cli,
- config.tokio_handle.clone(),
- )
- .map_err(|err| format!("Relay chain argument error: {}", err))?;
-
- cmd.run(config, polkadot_config)
- })
- }
- Some(Subcommand::Revert(cmd)) => construct_async_run!(|components, cli, cmd, config| {
- Ok(cmd.run(components.client, components.backend))
- }),
- Some(Subcommand::ExportGenesisState(params)) => {
- let mut builder = sc_cli::LoggerBuilder::new("");
- builder.with_profiling(sc_tracing::TracingReceiver::Log, "");
- let _ = builder.init();
-
- let spec = load_spec(¶ms.chain.clone().unwrap_or_default())?;
- let state_version = Cli::native_runtime_version(&spec).state_version();
-
- let block: crate::service::Block = generate_genesis_block(&spec, state_version)?;
- let raw_header = block.header().encode();
- let output_buf = if params.raw {
- raw_header
- } else {
- format!("0x{:?}", HexDisplay::from(&block.header().encode())).into_bytes()
- };
-
- if let Some(output) = ¶ms.output {
- std::fs::write(output, output_buf)?;
- } else {
- std::io::stdout().write_all(&output_buf)?;
- }
-
- Ok(())
- }
- Some(Subcommand::ExportGenesisWasm(params)) => {
- let mut builder = sc_cli::LoggerBuilder::new("");
- builder.with_profiling(sc_tracing::TracingReceiver::Log, "");
- let _ = builder.init();
-
- let raw_wasm_blob =
- extract_genesis_wasm(&cli.load_spec(¶ms.chain.clone().unwrap_or_default())?)?;
- let output_buf = if params.raw {
- raw_wasm_blob
- } else {
- format!("0x{:?}", HexDisplay::from(&raw_wasm_blob)).into_bytes()
- };
-
- if let Some(output) = ¶ms.output {
- std::fs::write(output, output_buf)?;
- } else {
- std::io::stdout().write_all(&output_buf)?;
- }
-
- Ok(())
- }
- Some(Subcommand::Benchmark(cmd)) => {
- let runner = cli.create_runner(cmd)?;
- if runner.config().chain_spec.is_manta() {
- runner.sync_run(|config| cmd.run::(config))
- } else if runner.config().chain_spec.is_calamari() {
- runner.sync_run(|config| cmd.run::(config))
- } else if runner.config().chain_spec.is_dolphin() {
- runner.sync_run(|config| cmd.run::(config))
- } else {
- Err("Benchmarking wasn't enabled when building the node. \
- You can enable it with `--features runtime-benchmarks`."
- .into())
- }
- }
- #[cfg(feature = "try-runtime")]
- Some(Subcommand::TryRuntime(cmd)) => {
- // grab the task manager.
- let runner = cli.create_runner(cmd)?;
- let registry = &runner
- .config()
- .prometheus_config
- .as_ref()
- .map(|cfg| &cfg.registry);
- let task_manager =
- sc_service::TaskManager::new(runner.config().tokio_handle.clone(), *registry)
- .map_err(|e| format!("Error: {:?}", e))?;
-
- if runner.config().chain_spec.is_manta() {
- runner.async_run(|config| {
- Ok((cmd.run::(config), task_manager))
- })
- } else if runner.config().chain_spec.is_calamari() {
- runner.async_run(|config| {
- Ok((
- cmd.run::(config),
- task_manager,
- ))
- })
- } else {
- Err("Chain doesn't support try-runtime".into())
- }
- }
- #[cfg(not(feature = "try-runtime"))]
- Some(Subcommand::TryRuntime) => Err("Try-runtime wasn't enabled when building the node. \
- You can enable it with `--features try-runtime`."
- .into()),
- None => {
- let runner = cli.create_runner(&cli.run.normalize())?;
- let collator_options = cli.run.collator_options();
-
- runner.run_node_until_exit(|config| async move {
- let para_id = crate::chain_specs::Extensions::try_get(&*config.chain_spec)
- .map(|e| e.para_id)
- .ok_or("Could not find parachain extension in chain-spec.")?;
-
- let polkadot_cli = RelayChainCli::new(
- &config,
- [RelayChainCli::executable_name()]
- .iter()
- .chain(cli.relaychain_args.iter()),
- );
-
- let id = ParaId::from(para_id);
-
- let parachain_account =
- AccountIdConversion::::into_account(&id);
-
- let state_version =
- RelayChainCli::native_runtime_version(&config.chain_spec).state_version();
-
- let block: crate::service::Block =
- generate_genesis_block(&config.chain_spec, state_version)
- .map_err(|e| format!("{:?}", e))?;
- let genesis_state = format!("0x{:?}", HexDisplay::from(&block.header().encode()));
-
- 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 id: {:?}", id);
- info!("Parachain Account: {}", parachain_account);
- info!("Parachain genesis state: {}", genesis_state);
- info!(
- "Is collating: {}",
- if config.role.is_authority() {
- "yes"
- } else {
- "no"
- }
- );
-
- if config.chain_spec.is_manta() {
- crate::service::start_parachain_node::<
- manta_runtime::RuntimeApi,
- MantaRuntimeExecutor,
- AuraId,
- _,
- >(config, polkadot_config, collator_options, id, |c, p| {
- Box::new(Builder::new(c, p))
- })
- .await
- .map(|r| r.0)
- .map_err(Into::into)
- } else if config.chain_spec.is_calamari() {
- crate::service::start_parachain_node::<
- calamari_runtime::RuntimeApi,
- CalamariRuntimeExecutor,
- AuraId,
- _,
- >(config, polkadot_config, collator_options, id, |c, p| {
- Box::new(Builder::new(c, p))
- })
- .await
- .map(|r| r.0)
- .map_err(Into::into)
- } else if config.chain_spec.is_dolphin() {
- crate::service::start_parachain_node::<
- dolphin_runtime::RuntimeApi,
- DolphinRuntimeExecutor,
- AuraId,
- _,
- >(config, polkadot_config, collator_options, id, |c, p| {
- Box::new(Builder::<_, _, rpc::Dolphin>::new(c, p))
- })
- .await
- .map(|r| r.0)
- .map_err(Into::into)
- } else {
- Err("chain spec error: must be one of manta or calamari chain specs".into())
- }
- })
- }
- }
+ match &cli.subcommand {
+ Some(Subcommand::BuildSpec(cmd)) => {
+ let runner = cli.create_runner(cmd)?;
+ runner.sync_run(|config| cmd.run(config.chain_spec, config.network))
+ }
+ Some(Subcommand::CheckBlock(cmd)) => {
+ construct_async_run!(|components, cli, cmd, config| {
+ Ok(cmd.run(components.client, components.import_queue))
+ })
+ }
+ Some(Subcommand::ExportBlocks(cmd)) => {
+ construct_async_run!(|components, cli, cmd, config| {
+ Ok(cmd.run(components.client, config.database))
+ })
+ }
+ Some(Subcommand::ExportState(cmd)) => {
+ construct_async_run!(|components, cli, cmd, config| {
+ Ok(cmd.run(components.client, config.chain_spec))
+ })
+ }
+ Some(Subcommand::ImportBlocks(cmd)) => {
+ construct_async_run!(|components, cli, cmd, config| {
+ Ok(cmd.run(components.client, components.import_queue))
+ })
+ }
+ Some(Subcommand::PurgeChain(cmd)) => {
+ let runner = cli.create_runner(cmd)?;
+
+ runner.sync_run(|config| {
+ let polkadot_cli = RelayChainCli::new(
+ &config,
+ [RelayChainCli::executable_name()]
+ .iter()
+ .chain(cli.relaychain_args.iter()),
+ );
+
+ let polkadot_config = SubstrateCli::create_configuration(
+ &polkadot_cli,
+ &polkadot_cli,
+ config.tokio_handle.clone(),
+ )
+ .map_err(|err| format!("Relay chain argument error: {}", err))?;
+
+ cmd.run(config, polkadot_config)
+ })
+ }
+ Some(Subcommand::Revert(cmd)) => construct_async_run!(|components, cli, cmd, config| {
+ Ok(cmd.run(components.client, components.backend))
+ }),
+ Some(Subcommand::ExportGenesisState(params)) => {
+ let mut builder = sc_cli::LoggerBuilder::new("");
+ builder.with_profiling(sc_tracing::TracingReceiver::Log, "");
+ let _ = builder.init();
+
+ let spec = load_spec(¶ms.chain.clone().unwrap_or_default())?;
+ let state_version = Cli::native_runtime_version(&spec).state_version();
+
+ let block: crate::service::Block = generate_genesis_block(&spec, state_version)?;
+ let raw_header = block.header().encode();
+ let output_buf = if params.raw {
+ raw_header
+ } else {
+ format!("0x{:?}", HexDisplay::from(&block.header().encode())).into_bytes()
+ };
+
+ if let Some(output) = ¶ms.output {
+ std::fs::write(output, output_buf)?;
+ } else {
+ std::io::stdout().write_all(&output_buf)?;
+ }
+
+ Ok(())
+ }
+ Some(Subcommand::ExportGenesisWasm(params)) => {
+ let mut builder = sc_cli::LoggerBuilder::new("");
+ builder.with_profiling(sc_tracing::TracingReceiver::Log, "");
+ let _ = builder.init();
+
+ let raw_wasm_blob =
+ extract_genesis_wasm(&cli.load_spec(¶ms.chain.clone().unwrap_or_default())?)?;
+ let output_buf = if params.raw {
+ raw_wasm_blob
+ } else {
+ format!("0x{:?}", HexDisplay::from(&raw_wasm_blob)).into_bytes()
+ };
+
+ if let Some(output) = ¶ms.output {
+ std::fs::write(output, output_buf)?;
+ } else {
+ std::io::stdout().write_all(&output_buf)?;
+ }
+
+ Ok(())
+ }
+ Some(Subcommand::Benchmark(cmd)) => {
+ let runner = cli.create_runner(cmd)?;
+ if runner.config().chain_spec.is_manta() {
+ runner.sync_run(|config| cmd.run::(config))
+ } else if runner.config().chain_spec.is_calamari() {
+ runner.sync_run(|config| cmd.run::(config))
+ } else if runner.config().chain_spec.is_dolphin() {
+ runner.sync_run(|config| cmd.run::(config))
+ } else {
+ Err("Benchmarking wasn't enabled when building the node. \
+ You can enable it with `--features runtime-benchmarks`."
+ .into())
+ }
+ }
+ #[cfg(feature = "try-runtime")]
+ Some(Subcommand::TryRuntime(cmd)) => {
+ // grab the task manager.
+ let runner = cli.create_runner(cmd)?;
+ let registry = &runner
+ .config()
+ .prometheus_config
+ .as_ref()
+ .map(|cfg| &cfg.registry);
+ let task_manager =
+ sc_service::TaskManager::new(runner.config().tokio_handle.clone(), *registry)
+ .map_err(|e| format!("Error: {:?}", e))?;
+
+ if runner.config().chain_spec.is_manta() {
+ runner.async_run(|config| {
+ Ok((cmd.run::(config), task_manager))
+ })
+ } else if runner.config().chain_spec.is_calamari() {
+ runner.async_run(|config| {
+ Ok((
+ cmd.run::(config),
+ task_manager,
+ ))
+ })
+ } else {
+ Err("Chain doesn't support try-runtime".into())
+ }
+ }
+ #[cfg(not(feature = "try-runtime"))]
+ Some(Subcommand::TryRuntime) => Err("Try-runtime wasn't enabled when building the node. \
+ You can enable it with `--features try-runtime`."
+ .into()),
+ None => {
+ let runner = cli.create_runner(&cli.run.normalize())?;
+ let collator_options = cli.run.collator_options();
+
+ runner.run_node_until_exit(|config| async move {
+ let para_id = crate::chain_specs::Extensions::try_get(&*config.chain_spec)
+ .map(|e| e.para_id)
+ .ok_or("Could not find parachain extension in chain-spec.")?;
+
+ let polkadot_cli = RelayChainCli::new(
+ &config,
+ [RelayChainCli::executable_name()]
+ .iter()
+ .chain(cli.relaychain_args.iter()),
+ );
+
+ let id = ParaId::from(para_id);
+
+ let parachain_account =
+ AccountIdConversion::::into_account(&id);
+
+ let state_version =
+ RelayChainCli::native_runtime_version(&config.chain_spec).state_version();
+
+ let block: crate::service::Block =
+ generate_genesis_block(&config.chain_spec, state_version)
+ .map_err(|e| format!("{:?}", e))?;
+ let genesis_state = format!("0x{:?}", HexDisplay::from(&block.header().encode()));
+
+ 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 id: {:?}", id);
+ info!("Parachain Account: {}", parachain_account);
+ info!("Parachain genesis state: {}", genesis_state);
+ info!(
+ "Is collating: {}",
+ if config.role.is_authority() {
+ "yes"
+ } else {
+ "no"
+ }
+ );
+
+ if config.chain_spec.is_manta() {
+ crate::service::start_parachain_node::<
+ manta_runtime::RuntimeApi,
+ MantaRuntimeExecutor,
+ AuraId,
+ _,
+ >(config, polkadot_config, collator_options, id, |c, p| {
+ Box::new(Builder::new(c, p))
+ })
+ .await
+ .map(|r| r.0)
+ .map_err(Into::into)
+ } else if config.chain_spec.is_calamari() {
+ crate::service::start_parachain_node::<
+ calamari_runtime::RuntimeApi,
+ CalamariRuntimeExecutor,
+ AuraId,
+ _,
+ >(config, polkadot_config, collator_options, id, |c, p| {
+ Box::new(Builder::new(c, p))
+ })
+ .await
+ .map(|r| r.0)
+ .map_err(Into::into)
+ } else if config.chain_spec.is_dolphin() {
+ crate::service::start_parachain_node::<
+ dolphin_runtime::RuntimeApi,
+ DolphinRuntimeExecutor,
+ AuraId,
+ _,
+ >(config, polkadot_config, collator_options, id, |c, p| {
+ Box::new(Builder::<_, _, rpc::Dolphin>::new(c, p))
+ })
+ .await
+ .map(|r| r.0)
+ .map_err(Into::into)
+ } else {
+ Err("chain spec error: must be one of manta or calamari chain specs".into())
+ }
+ })
+ }
+ }
}
/// Parse command line arguments into service configuration.
pub fn run() -> Result<()> {
- run_with(Cli::from_args())
+ run_with(Cli::from_args())
}
impl DefaultConfigurationValues for RelayChainCli {
- fn p2p_listen_port() -> u16 {
- 30334
- }
+ fn p2p_listen_port() -> u16 {
+ 30334
+ }
- fn rpc_ws_listen_port() -> u16 {
- 9945
- }
+ fn rpc_ws_listen_port() -> u16 {
+ 9945
+ }
- fn rpc_http_listen_port() -> u16 {
- 9934
- }
+ fn rpc_http_listen_port() -> u16 {
+ 9934
+ }
- fn prometheus_listen_port() -> u16 {
- 9616
- }
+ fn prometheus_listen_port() -> u16 {
+ 9616
+ }
}
impl CliConfiguration for RelayChainCli {
- fn shared_params(&self) -> &SharedParams {
- self.base.base.shared_params()
- }
-
- fn import_params(&self) -> Option<&ImportParams> {
- self.base.base.import_params()
- }
-
- fn network_params(&self) -> Option<&NetworkParams> {
- self.base.base.network_params()
- }
-
- fn keystore_params(&self) -> Option<&KeystoreParams> {
- self.base.base.keystore_params()
- }
-
- fn base_path(&self) -> Result