Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

effort towards getting chainspecbuilder into omni-node fix 5567 #7619

Open
wants to merge 27 commits into
base: master
Choose a base branch
from

Conversation

seemantaggarwal
Copy link
Contributor

Adding chain-spec-builder as a subcommand into Polkadot omni node

@seemantaggarwal seemantaggarwal self-assigned this Feb 19, 2025
@seemantaggarwal seemantaggarwal added I5-enhancement An additional feature request. T9-cumulus This PR/Issue is related to cumulus. labels Feb 19, 2025
Copy link
Contributor

@iulianbarbu iulianbarbu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a polkadot-omni-node README we can update so that when referencing building a chain spec, we specify the chain-spec-builder subcommand.

@@ -24,6 +24,7 @@ futures = { workspace = true }
log = { workspace = true, default-features = true }
serde = { features = ["derive"], workspace = true, default-features = true }
serde_json = { workspace = true, default-features = true }
chain-spec-builder = { workspace = true , package = "staging-chain-spec-builder" }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to mention the package? Thought chain-spec-builder = { workspace = true } should do it.

@@ -56,7 +56,7 @@ pub enum ChainSpecBuilderCmd {
}

/// Create a new chain spec by interacting with the provided runtime wasm blob.
#[derive(Parser, Debug)]
#[derive(Parser, Clone, Debug)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: same comment as for ChainSpecBuilder.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree I can remove this one, I added it as precautionary

@seemantaggarwal
Copy link
Contributor Author

[ ./target/release/polkadot-omni-node --help
The command-line arguments provided first will be passed to the parachain node, 
and the arguments provided after -- will be passed to the relay chain node. 

Example: 

polkadot-omni-node [parachain-args] -- [relay-chain-args]

Usage: polkadot-omni-node [OPTIONS] [-- <RELAY_CHAIN_ARGS>...]
       polkadot-omni-node <COMMAND>

Commands:
  key                  Key management CLI utilities
  build-spec           Build a chain specification
  check-block          Validate blocks
  export-blocks        Export blocks
  export-state         Export the state of a given block into a chain spec
  import-blocks        Import blocks
  revert               Revert the chain to a previous state
  chain-spec-builder   Subcommand for generating and managing chain specifications
  purge-chain          Remove the whole chain
  export-genesis-head  Export the genesis state of the parachain
  export-genesis-wasm  Export the genesis wasm of the parachain
  benchmark            Sub-commands concerned with benchmarking. The pallet benchmarking moved to the `pallet` sub-command
  help                 Print this message or the help of

I will add the prdoc and resolve conflicts now, for reference tagging @iulianbarbu @skunert

@seemantaggarwal
Copy link
Contributor Author

./target/debug/polkadot-omni-node chain-spec-builder --help 
Subcommand for generating and managing chain specifications

Usage: polkadot-omni-node chain-spec-builder [OPTIONS] <COMMAND>

Commands:
  create               Create a new chain spec by interacting with the provided runtime wasm blob
  verify               Verifies the provided input chain spec
  update-code          Updates the code in the provided input chain spec
  convert-to-raw       Converts the given chain spec into the raw format
  list-presets         Lists available presets
  display-preset       Displays given preset
  add-code-substitute  Add a code substitute in the chain spec
  help                 Print this message or the help of the given subcommand(s)

Options:
  -c, --chain-spec-path <CHAIN_SPEC_PATH>  The path where the chain spec should be saved [default: ./chain_spec.json]
  -h, --help                               Print help
  -V, --version                            Print version

After suggested changes, updated command @iulianbarbu

@paritytech-workflow-stopper
Copy link

All GitHub workflows were cancelled due to failure one of the required jobs.
Failed workflow url: https://github.com/paritytech/polkadot-sdk/actions/runs/13463334319
Failed job name: fmt

Comment on lines +152 to +157
if let Err(err) = cmd.run() {
eprintln!("Error executing chain-spec-builder: {}", err);
return Err(sc_cli::Error::Application(err.into()));
}

Ok(())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like this won't look better?

Suggested change
if let Err(err) = cmd.run() {
eprintln!("Error executing chain-spec-builder: {}", err);
return Err(sc_cli::Error::Application(err.into()));
}
Ok(())
cmd.run()
.map_err(|err| {
eprintln!("Error executing chain-spec-builder: {}", err)
Error::Application(err.into())
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I5-enhancement An additional feature request. T9-cumulus This PR/Issue is related to cumulus.
Projects
Status: Milestone 1
Development

Successfully merging this pull request may close these issues.

3 participants