From e5535d390b58cfbdd45f113cd8dd5e2377e9cf5f Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Tue, 12 Dec 2023 16:06:04 +0400 Subject: [PATCH 1/6] fix example demonstrating how to specify output path --- substrate/bin/utils/chain-spec-builder/src/lib.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/substrate/bin/utils/chain-spec-builder/src/lib.rs b/substrate/bin/utils/chain-spec-builder/src/lib.rs index 60ec0f1a656b..c2639cdafc59 100644 --- a/substrate/bin/utils/chain-spec-builder/src/lib.rs +++ b/substrate/bin/utils/chain-spec-builder/src/lib.rs @@ -33,9 +33,9 @@ //! Query the default genesis config from the provided `runtime.wasm` and use it in the chain //! spec. Tool can also store runtime's default genesis config in given file: //! ```text -//! chain-spec-builder create -r runtime.wasm default /dev/stdout +//! chain-spec-builder --chain_spec_path /dev/stdout create -r runtime.wasm default //! ``` -//! +//! //! _Note:_ [`GenesisBuilder::create_default_config`][sp-genesis-builder-create] runtime function is called. //! //! @@ -46,7 +46,7 @@ //! ```text //! chain-spec-builder create -s -r runtime.wasm patch patch.json //! ``` -//! +//! //! _Note:_ [`GenesisBuilder::build_config`][sp-genesis-builder-build] runtime function is called. //! //! ##### Generate raw storage chain spec using full genesis config. @@ -55,19 +55,19 @@ //! ```text //! chain-spec-builder create -s -r runtime.wasm full full-genesis-config.json //! ``` -//! +//! //! _Note_: [`GenesisBuilder::build_config`][sp-genesis-builder-build] runtime function is called. //! //! ##### Generate human readable chain spec using provided genesis config patch. //! ```text //! chain-spec-builder create -r runtime.wasm patch patch.json //! ``` -//! +//! //! ##### Generate human readable chain spec using provided full genesis config. //! ```text //! chain-spec-builder create -r runtime.wasm full full-genesis-config.json //! ``` -//! +//! //! ##### Extra tools. //! The `chain-spec-builder` provides also some extra utilities: [`VerifyCmd`], [`ConvertToRawCmd`], [`UpdateCodeCmd`]. //! From bc4bc7128210c8f662b8033121fd09828668a021 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Fri, 15 Dec 2023 01:42:38 +1100 Subject: [PATCH 2/6] Update substrate/bin/utils/chain-spec-builder/src/lib.rs Co-authored-by: Michal Kucharczyk <1728078+michalkucharczyk@users.noreply.github.com> --- substrate/bin/utils/chain-spec-builder/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/bin/utils/chain-spec-builder/src/lib.rs b/substrate/bin/utils/chain-spec-builder/src/lib.rs index c2639cdafc59..7a9c7ce94df2 100644 --- a/substrate/bin/utils/chain-spec-builder/src/lib.rs +++ b/substrate/bin/utils/chain-spec-builder/src/lib.rs @@ -31,7 +31,7 @@ //! ##### Get default config from runtime. //! //! Query the default genesis config from the provided `runtime.wasm` and use it in the chain -//! spec. Tool can also store runtime's default genesis config in given file: +//! spec. Tool can also store runtime's default genesis config in the given file (which is `/dev/stdout` in the following example): //! ```text //! chain-spec-builder --chain_spec_path /dev/stdout create -r runtime.wasm default //! ``` From d0da7592b9e7483c4665475e176e7a319decd999 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Fri, 15 Dec 2023 01:42:48 +1100 Subject: [PATCH 3/6] Update substrate/bin/utils/chain-spec-builder/src/lib.rs Co-authored-by: Michal Kucharczyk <1728078+michalkucharczyk@users.noreply.github.com> --- substrate/bin/utils/chain-spec-builder/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/bin/utils/chain-spec-builder/src/lib.rs b/substrate/bin/utils/chain-spec-builder/src/lib.rs index 7a9c7ce94df2..0c82b4e1879b 100644 --- a/substrate/bin/utils/chain-spec-builder/src/lib.rs +++ b/substrate/bin/utils/chain-spec-builder/src/lib.rs @@ -33,7 +33,7 @@ //! Query the default genesis config from the provided `runtime.wasm` and use it in the chain //! spec. Tool can also store runtime's default genesis config in the given file (which is `/dev/stdout` in the following example): //! ```text -//! chain-spec-builder --chain_spec_path /dev/stdout create -r runtime.wasm default +//! chain-spec-builder create -r runtime.wasm default /dev/stdout //! ``` //! //! _Note:_ [`GenesisBuilder::create_default_config`][sp-genesis-builder-create] runtime function is called. From 0ce38a7ddcd160ff94b933ebe4ab7bb85b9f3058 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Thu, 14 Dec 2023 18:46:51 +0400 Subject: [PATCH 4/6] add chain spec out path to example --- .../bin/utils/chain-spec-builder/src/lib.rs | 31 ++++++++++--------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/substrate/bin/utils/chain-spec-builder/src/lib.rs b/substrate/bin/utils/chain-spec-builder/src/lib.rs index 0c82b4e1879b..92efa8442328 100644 --- a/substrate/bin/utils/chain-spec-builder/src/lib.rs +++ b/substrate/bin/utils/chain-spec-builder/src/lib.rs @@ -30,21 +30,23 @@ //! ## Typical use-cases. //! ##### Get default config from runtime. //! -//! Query the default genesis config from the provided `runtime.wasm` and use it in the chain -//! spec. Tool can also store runtime's default genesis config in the given file (which is `/dev/stdout` in the following example): -//! ```text -//! chain-spec-builder create -r runtime.wasm default /dev/stdout +//! Query the default genesis config from the provided `runtime.wasm` and use it in the chain +//! spec. The tool allows specifying where to write the chain spec, and optionally also where the +//! write the default genesis state config (which is `/dev/stdout` in the following example): +//! ```text +//! chain-spec-builder --chain_spec_path ./my_chain_spec.json create -r runtime.wasm default /dev/stdout //! ``` //! -//! _Note:_ [`GenesisBuilder::create_default_config`][sp-genesis-builder-create] runtime function is called. +//! _Note:_ [`GenesisBuilder::create_default_config`][sp-genesis-builder-create] runtime function is +//! called. //! //! //! ##### Generate raw storage chain spec using genesis config patch. //! //! Patch the runtime's default genesis config with provided `patch.json` and generate raw //! storage (`-s`) version of chain spec: -//! ```text -//! chain-spec-builder create -s -r runtime.wasm patch patch.json +//!/ +/! chain-spec-builder create -s -r runtime.wasm patch patch.json //! ``` //! //! _Note:_ [`GenesisBuilder::build_config`][sp-genesis-builder-build] runtime function is called. @@ -52,24 +54,25 @@ //! ##### Generate raw storage chain spec using full genesis config. //! //! Build the chain spec using provided full genesis config json file. No defaults will be used: -//! ```text -//! chain-spec-builder create -s -r runtime.wasm full full-genesis-config.json +//!/ +/! chain-spec-builder create -s -r runtime.wasm full full-genesis-config.json //! ``` //! //! _Note_: [`GenesisBuilder::build_config`][sp-genesis-builder-build] runtime function is called. //! //! ##### Generate human readable chain spec using provided genesis config patch. -//! ```text -//! chain-spec-builder create -r runtime.wasm patch patch.json +//!/ +/! chain-spec-builder create -r runtime.wasm patch patch.json //! ``` //! //! ##### Generate human readable chain spec using provided full genesis config. -//! ```text -//! chain-spec-builder create -r runtime.wasm full full-genesis-config.json +//!/ +/! chain-spec-builder create -r runtime.wasm full full-genesis-config.json //! ``` //! //! ##### Extra tools. -//! The `chain-spec-builder` provides also some extra utilities: [`VerifyCmd`], [`ConvertToRawCmd`], [`UpdateCodeCmd`]. +//! The `chain-spec-builder` provides also some extra utilities: [`VerifyCmd`], [`ConvertToRawCmd`], +//! [`UpdateCodeCmd`]. //! //! [`sc-chain-spec`]: ../sc_chain_spec/index.html //! [`node-cli`]: ../node_cli/index.html From 36257acc24facea6faef33f8e43bed1660d39c80 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Thu, 14 Dec 2023 19:03:57 +0400 Subject: [PATCH 5/6] fix formatting --- substrate/bin/utils/chain-spec-builder/src/lib.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/substrate/bin/utils/chain-spec-builder/src/lib.rs b/substrate/bin/utils/chain-spec-builder/src/lib.rs index 92efa8442328..d0cac1d8bbd4 100644 --- a/substrate/bin/utils/chain-spec-builder/src/lib.rs +++ b/substrate/bin/utils/chain-spec-builder/src/lib.rs @@ -45,8 +45,9 @@ //! //! Patch the runtime's default genesis config with provided `patch.json` and generate raw //! storage (`-s`) version of chain spec: -//!/ -/! chain-spec-builder create -s -r runtime.wasm patch patch.json +//! +//! ```bash +//! chain-spec-builder create -s -r runtime.wasm patch patch.json //! ``` //! //! _Note:_ [`GenesisBuilder::build_config`][sp-genesis-builder-build] runtime function is called. From b6dd88cb5e2a0c3047a9e0e8242656c263e87acb Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Thu, 14 Dec 2023 19:05:29 +0400 Subject: [PATCH 6/6] fix --- substrate/bin/utils/chain-spec-builder/src/lib.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/substrate/bin/utils/chain-spec-builder/src/lib.rs b/substrate/bin/utils/chain-spec-builder/src/lib.rs index d0cac1d8bbd4..8c78030c8854 100644 --- a/substrate/bin/utils/chain-spec-builder/src/lib.rs +++ b/substrate/bin/utils/chain-spec-builder/src/lib.rs @@ -55,20 +55,22 @@ //! ##### Generate raw storage chain spec using full genesis config. //! //! Build the chain spec using provided full genesis config json file. No defaults will be used: -//!/ -/! chain-spec-builder create -s -r runtime.wasm full full-genesis-config.json +//! +//! ```bash +//! chain-spec-builder create -s -r runtime.wasm full full-genesis-config.json //! ``` //! //! _Note_: [`GenesisBuilder::build_config`][sp-genesis-builder-build] runtime function is called. //! //! ##### Generate human readable chain spec using provided genesis config patch. -//!/ -/! chain-spec-builder create -r runtime.wasm patch patch.json +//! ```bash +//! chain-spec-builder create -r runtime.wasm patch patch.json //! ``` //! //! ##### Generate human readable chain spec using provided full genesis config. -//!/ -/! chain-spec-builder create -r runtime.wasm full full-genesis-config.json +//! +//! ```bash +//! chain-spec-builder create -r runtime.wasm full full-genesis-config.json //! ``` //! //! ##### Extra tools.