Skip to content
Snippets Groups Projects
Unverified Commit b667c279 authored by Michal Kucharczyk's avatar Michal Kucharczyk Committed by GitHub
Browse files

`chain-spec-builder`: info about patch/full files added (#6373)


There was no good example of what is patch and full genesis config file.
Some explanation and example were added to the `chain-spec-builder` doc.

---------

Co-authored-by: default avatarGitHub Action <action@github.com>
Co-authored-by: default avatarIulian Barbu <14218860+iulianbarbu@users.noreply.github.com>
parent c5444f38
Branches
No related merge requests found
Pipeline #504388 waiting for manual action with stages
in 30 minutes and 56 seconds
title: '`chain-spec-builder`: info about patch/full files added'
doc:
- audience: Runtime User
description: There was no good example of what is patch and full genesis config
file. Some explanation and example were added to the `chain-spec-builder` doc.
crates:
- name: staging-chain-spec-builder
bump: patch
......@@ -73,6 +73,8 @@ storage (`-s`) version of chain spec:
<!-- docify::embed!("tests/test.rs", cmd_create_with_patch_raw)-->
Refer to [*patch file*](#patch-file) for some details on the patch file format.
_Note:_ [`GenesisBuilder::get_preset`](https://docs.rs/sp-genesis-builder/latest/sp_genesis_builder/trait.GenesisBuilder.html#method.get_preset)
and
[`GenesisBuilder::build_state`](https://docs.rs/sp-genesis-builder/latest/sp_genesis_builder/trait.GenesisBuilder.html#method.build_state)
......@@ -84,6 +86,8 @@ Build the chain spec using provided full genesis config json file. No defaults w
<!-- docify::embed!("tests/test.rs", cmd_create_full_raw)-->
Refer to [*full config file*](#full-genesis-config-file) for some details on the full file format.
_Note_: [`GenesisBuilder::build_state`](https://docs.rs/sp-genesis-builder/latest/sp_genesis_builder/trait.GenesisBuilder.html#method.build_state)
runtime function is called.
......@@ -91,10 +95,50 @@ runtime function is called.
<!-- docify::embed!("tests/test.rs", cmd_create_with_patch_plain)-->
Refer to [*patch file*](#patch-file) for some details on the patch file format.
### Generate human readable chain spec using provided full genesis config
<!-- docify::embed!("tests/test.rs", cmd_create_full_plain)-->
Refer to [*full config file*](#full-genesis-config-file) for some details on the full file format.
## Patch and full genesis config files
This section provides details on the files that can be used with `create patch` or `create full` subcommands.
### Patch file
The patch file for genesis config contains the key-value pairs valid for given runtime, that needs to be customized,
e.g:
```ignore
{
"balances": {
"balances": [
[
"5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty",
1000000000000000
],
[
"5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y",
1000000000000000
],
[
"5CcjiSgG2KLuKAsqkE2Nak1S2FbAcMr5SxRASUuwR3zSNV2b",
5000000000000000
]
]
},
"sudo": {
"key": "5Ff3iXP75ruzroPWRP2FYBHWnmGGBSb63857BgnzCoXNxfPo"
}
}
```
The rest of genesis config keys will be initialized with default values.
### Full genesis config file
The full genesis config file must contain values for *all* the keys present in the genesis config for given runtime. The
format of the file is similar to patch format. Example is not provided here as it heavily depends on the runtime.
### Extra tools
The `chain-spec-builder` provides also some extra utilities: [`VerifyCmd`](https://docs.rs/staging-chain-spec-builder/latest/staging_chain_spec_builder/struct.VerifyCmd.html),
......
......@@ -99,6 +99,8 @@ bash!(
)
```
Refer to [*patch file*](#patch-file) for some details on the patch file format.
_Note:_ [`GenesisBuilder::get_preset`](https://docs.rs/sp-genesis-builder/latest/sp_genesis_builder/trait.GenesisBuilder.html#method.get_preset)
and
[`GenesisBuilder::build_state`](https://docs.rs/sp-genesis-builder/latest/sp_genesis_builder/trait.GenesisBuilder.html#method.build_state)
......@@ -114,6 +116,8 @@ bash!(
)
```
Refer to [*full config file*](#full-genesis-config-file) for some details on the full file format.
_Note_: [`GenesisBuilder::build_state`](https://docs.rs/sp-genesis-builder/latest/sp_genesis_builder/trait.GenesisBuilder.html#method.build_state)
runtime function is called.
......@@ -125,6 +129,8 @@ bash!(
)
```
Refer to [*patch file*](#patch-file) for some details on the patch file format.
### Generate human readable chain spec using provided full genesis config
```rust,ignore
......@@ -133,6 +139,44 @@ bash!(
)
```
Refer to [*full config file*](#full-genesis-config-file) for some details on the full file format.
## Patch and full genesis config files
This section provides details on the files that can be used with `create patch` or `create full` subcommands.
### Patch file
The patch file for genesis config contains the key-value pairs valid for given runtime, that needs to be customized,
e.g:
```ignore
{
"balances": {
"balances": [
[
"5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty",
1000000000000000
],
[
"5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y",
1000000000000000
],
[
"5CcjiSgG2KLuKAsqkE2Nak1S2FbAcMr5SxRASUuwR3zSNV2b",
5000000000000000
]
]
},
"sudo": {
"key": "5Ff3iXP75ruzroPWRP2FYBHWnmGGBSb63857BgnzCoXNxfPo"
}
}
```
The rest of genesis config keys will be initialized with default values.
### Full genesis config file
The full genesis config file must contain values for *all* the keys present in the genesis config for given runtime. The
format of the file is similar to patch format. Example is not provided here as it heavily depends on the runtime.
### Extra tools
The `chain-spec-builder` provides also some extra utilities: [`VerifyCmd`](https://docs.rs/staging-chain-spec-builder/latest/staging_chain_spec_builder/struct.VerifyCmd.html),
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment