Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
polkadot-sdk
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
parity
Mirrored projects
polkadot-sdk
Commits
568e21e9
Commit
568e21e9
authored
1 month ago
by
Seemant Aggarwal
Browse files
Options
Downloads
Patches
Plain Diff
addressing comments
parent
bc478e4e
No related merge requests found
Pipeline
#517446
waiting for manual action with stages
in 11 minutes and 19 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cumulus/polkadot-omni-node/lib/src/command.rs
+2
-2
2 additions, 2 deletions
cumulus/polkadot-omni-node/lib/src/command.rs
substrate/client/cli/src/commands/export_chain_spec_cmd.rs
+23
-12
23 additions, 12 deletions
substrate/client/cli/src/commands/export_chain_spec_cmd.rs
with
25 additions
and
14 deletions
cumulus/polkadot-omni-node/lib/src/command.rs
+
2
−
2
View file @
568e21e9
...
...
@@ -169,8 +169,8 @@ pub fn run<CliConfig: crate::cli::CliConfig>(cmd_config: RunConfig) -> Result<()
},
Some
(
Subcommand
::
ExportChainSpec
(
cmd
))
=>
{
// Directly load the embedded chain spec using the CLI’s load_spec method.
let
spec
=
cli
.load_spec
(
&
cmd
.
chain
)
.map_err
(|
err
|
format!
(
"{}"
,
err
))
?
;
cmd
.run
(
spec
)
let
spec
=
cli
.load_spec
(
&
cmd
.
shared_params.chain
.clone
()
.unwrap_or_default
(
))
?
;
cmd
.run
(
&*
spec
)
},
Some
(
Subcommand
::
ExportGenesisHead
(
cmd
))
=>
{
...
...
This diff is collapsed.
Click to expand it.
substrate/client/cli/src/commands/export_chain_spec_cmd.rs
+
23
−
12
View file @
568e21e9
...
...
@@ -24,34 +24,45 @@ use std::{
path
::
PathBuf
,
};
use
crate
::
error
::{
Error
,
Result
};
use
crate
::
error
::{
Result
};
use
crate
::
SharedParams
;
/// Export
the embedded
chain-spec to a JSON file.
/// Export
a
chain-spec to a JSON file
in plain or in raw storage format
.
///
/// This command loads the embedded chain-spec (for example, when you pass
/// `--chain /full/path/to/asset-hub-rococo`) and exports it to a JSON file. If `--output`
/// is not provided, the JSON is printed to stdout.
/// Nodes that expose this command usually have embedded runtimes WASM blobs with
/// genesis config presets which can be referenced via `--chain <id>` . The logic for
/// loading the chain spec into memory based on an `id` is specific to each
/// node and is a prerequisite to enable this command.
///
/// Same functionality can be achieved currently via
/// [`crate::commands::build_spec_cmd::BuildSpec`] but we recommend
/// `export-chain-spec` in its stead. `build-spec` is known
/// to be a legacy mix of exporting chain specs to JSON files or
/// converting them to raw, which will be better
/// represented under `export-chain-spec`.
#[derive(Debug,
Clone,
Parser)]
pub
struct
ExportChainSpecCmd
{
/// The chain spec identifier to export.
#[arg(long,
default_value
=
"local"
)]
pub
chain
:
String
,
#[allow(missing_docs)]
#[clap(flatten)]
pub
shared_params
:
SharedParams
,
/// Output
file path. If omitted, prints to stdout.
/// `chain-spec` JSON
file path. If omitted, prints to stdout.
#[arg(long)]
pub
output
:
Option
<
PathBuf
>
,
/// Export in raw genesis storage format.
#[arg(long)]
pub
raw
:
bool
,
}
impl
ExportChainSpecCmd
{
pub
fn
run
(
&
self
,
spec
:
Box
<
dyn
ChainSpec
>
)
->
Result
<
()
>
{
let
json
=
chain_ops
::
build_spec
(
&*
spec
,
self
.raw
)
.map_err
(|
e
|
format!
(
"{}"
,
e
))
?
;
pub
fn
run
(
&
self
,
spec
:
&
Box
<
dyn
ChainSpec
>
)
->
Result
<
()
>
{
let
json
=
chain_ops
::
build_spec
(
spec
.as_ref
()
,
self
.raw
)
?
;
if
let
Some
(
ref
path
)
=
self
.output
{
fs
::
write
(
path
,
json
)
.map_err
(|
e
|
format!
(
"{}"
,
e
))
?
;
e
println!
(
"Exported chain spec to {}"
,
path
.display
());
fs
::
write
(
path
,
json
)
?
;
println!
(
"Exported chain spec to {}"
,
path
.display
());
}
else
{
io
::
stdout
()
.write_all
(
json
.as_bytes
())
.map_err
(|
e
|
format!
(
"{}"
,
e
))
?
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment