Michal Kucharczyk
f910a15c1c
GenesisConfig presets for runtime (#2714 )
...
The runtime now can provide a number of predefined presets of
`RuntimeGenesisConfig` struct. This presets are intended to be used in
different deployments, e.g.: `local`, `staging`, etc, and should be
included into the corresponding chain-specs.
Having `GenesisConfig` presets in runtime allows to fully decouple node
from runtime types (the problem is described in #1984 ).
**Summary of changes:**
- The `GenesisBuilder` API was adjusted to enable this functionality
(and provide better naming - #150 ):
```rust
fn preset_names() -> Vec<PresetId>;
fn get_preset(id: Option<PresetId>) -> Option<serde_json::Value>;
//`None` means default
fn build_state(value: serde_json::Value);
pub struct PresetId(Vec<u8>);
```
- **Breaking change**: Old `create_default_config` method was removed,
`build_config` was renamed to `build_state`. As a consequence a node
won't be able to interact with genesis config for older runtimes. The
cleanup was made for sake of API simplicity. Also IMO maintaining
compatibility with old API is not so crucial.
- Reference implementation was provided for `substrate-test-runtime` and
`rococo` runtimes. For rococo new
[`genesis_configs_presets`](https://github.com/paritytech/polkadot-sdk/blob/3b41d66b97c5ff0ec4a1989da5ffd8b9f3f588e3/polkadot/runtime/rococo/src/genesis_config_presets.rs#L530 )
module was added and is used in `GenesisBuilder`
[_presets-related_](https://github.com/paritytech/polkadot-sdk/blob/3b41d66b97c5ff0ec4a1989da5ffd8b9f3f588e3/polkadot/runtime/rococo/src/lib.rs#L2462-L2485 )
methods.
- The `chain-spec-builder` util was also improved and allows to
([_doc_](https://github.com/paritytech/polkadot-sdk/blob/3b41d66b97c5ff0ec4a1989da5ffd8b9f3f588e3/substrate/bin/utils/chain-spec-builder/src/lib.rs#L19 )):
- list presets provided by given runtime (`list-presets`),
- display preset or default config provided by the runtime
(`display-preset`),
- build chain-spec using named preset (`create ... named-preset`),
- The `ChainSpecBuilder` is extended with
[`with_genesis_config_preset_name`](https://github.com/paritytech/polkadot-sdk/blob/3b41d66b97c5ff0ec4a1989da5ffd8b9f3f588e3/substrate/client/chain-spec/src/chain_spec.rs#L447 )
method which allows to build chain-spec using named preset provided by
the runtime. Sample usage on the node side
[here](https://github.com/paritytech/polkadot-sdk/blob/2caffaae803e08a3d5b46c860e8016da023ff4ce/polkadot/node/service/src/chain_spec.rs#L404 ).
Implementation of #1984 .
fixes : #150
part of: #25
---------
Co-authored-by: Sebastian Kunert <skunert49@gmail.com >
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com >
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
2024-04-04 18:30:54 +00:00
Michal Kucharczyk
2fd8c51ebc
chain-spec-builder: cleanup (#2174 )
...
This PR removes:
- `New`, `Generate`, `Edit` commands,
- `kitchensink` dependency
from the `chain-spec-builder` util.
New `convert-to-raw`, `update-code` commands were added.
Additionally renames the `runtime` command (which was added in #1256 ) to
`create`.
---------
Co-authored-by: Sebastian Kunert <skunert49@gmail.com >
Co-authored-by: Bastian Köcher <git@kchr.de >
Co-authored-by: command-bot <>
2023-11-21 11:51:23 +01:00
Michal Kucharczyk
8ba7a6aba8
chain-spec: getting ready for native-runtime-free world (#1256 )
...
This PR prepares chains specs for _native-runtime-free_ world.
This PR has following changes:
- `substrate`:
- adds support for:
- JSON based `GenesisConfig` to `ChainSpec` allowing interaction with
runtime `GenesisBuilder` API.
- interacting with arbitrary runtime wasm blob to[
`chain-spec-builder`](https://github.com/paritytech/substrate/blob/3ef576eaeb3f42610e85daecc464961cf1295570/bin/utils/chain-spec-builder/src/lib.rs#L46 )
command line util,
- removes
[`code`](https://github.com/paritytech/substrate/blob/3ef576eaeb3f42610e85daecc464961cf1295570/frame/system/src/lib.rs#L660 )
from `system_pallet`
- adds `code` to the `ChainSpec`
- deprecates
[`ChainSpec::from_genesis`](https://github.com/paritytech/substrate/blob/3ef576eaeb3f42610e85daecc464961cf1295570/client/chain-spec/src/chain_spec.rs#L263 ),
but also changes the signature of this method extending it with `code`
argument.
[`ChainSpec::builder()`](https://github.com/paritytech/substrate/blob/20bee680ed098be7239cf7a6b804cd4de267983e/client/chain-spec/src/chain_spec.rs#L507 )
should be used instead.
- `polkadot`:
- all references to `RuntimeGenesisConfig` in `node/service` are
removed,
- all
`(kusama|polkadot|versi|rococo|wococo)_(staging|dev)_genesis_config`
functions now return the JSON patch for default runtime `GenesisConfig`,
- `ChainSpecBuilder` is used, `ChainSpec::from_genesis` is removed,
- `cumulus`:
- `ChainSpecBuilder` is used, `ChainSpec::from_genesis` is removed,
- _JSON_ patch configuration used instead of `RuntimeGenesisConfig
struct` in all chain specs.
---------
Co-authored-by: command-bot <>
Co-authored-by: Javier Viola <javier@parity.io >
Co-authored-by: Davide Galassi <davxy@datawok.net >
Co-authored-by: Francisco Aguirre <franciscoaguirreperez@gmail.com >
Co-authored-by: Kevin Krone <kevin@parity.io >
Co-authored-by: Bastian Köcher <git@kchr.de >
2023-11-05 15:19:23 +01:00
Lulu
495d24d730
Add ci check for parity-publish and fix current check issues ( #1887 )
...
Co-authored-by: Sergejs Kostjucenko <85877331+sergejparity@users.noreply.github.com >
Co-authored-by: Bastian Köcher <info@kchr.de >
2023-10-31 18:04:31 +00:00
Kian Paimani
817c97d65d
add doc-only substrate entry point crate ( #14581 )
...
* add doc-only substrate entry point crate
* document a few more things
* add more
* fix width
* Update primitives/io/src/lib.rs
Co-authored-by: Gonçalo Pestana <g6pestana@gmail.com >
* add link
* update cargo toml file
* fix sp-io docs
* improve
* small update
* add license
* satisfy license job
* add a line about FRAME
* CI happy now
* make CI more happy
* Let the check run for the whole workspace
* Forward the substrate node again as default run
* update binary names
* upate verison test
* Fix fix fix
* Fix
* rename to substrate-node in more places
* Revert "rename to substrate-node in more places"
This reverts commit 66960f84a1b6f1f7c638b4040e28e9fbabb8adf5.
* fix
* Fix build pipeline
* Fix properly plus add some docs
---------
Co-authored-by: Gonçalo Pestana <g6pestana@gmail.com >
Co-authored-by: Bastian Köcher <info@kchr.de >
2023-07-19 18:36:50 +00:00