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>
This commit is contained in:
Michal Kucharczyk
2023-11-05 15:19:23 +01:00
committed by GitHub
parent c46a7dbb61
commit 8ba7a6aba8
90 changed files with 4833 additions and 3059 deletions
Generated
+29
View File
@@ -965,6 +965,7 @@ dependencies = [
"sp-block-builder",
"sp-consensus-aura",
"sp-core",
"sp-genesis-builder",
"sp-inherents",
"sp-offchain",
"sp-runtime",
@@ -4222,6 +4223,7 @@ dependencies = [
"sp-api",
"sp-block-builder",
"sp-core",
"sp-genesis-builder",
"sp-inherents",
"sp-io",
"sp-offchain",
@@ -4288,6 +4290,7 @@ dependencies = [
"sc-transaction-pool",
"sc-transaction-pool-api",
"serde",
"serde_json",
"sp-api",
"sp-arithmetic",
"sp-authority-discovery",
@@ -6738,7 +6741,9 @@ dependencies = [
"polkadot-service",
"rococo-runtime",
"rococo-runtime-constants",
"sc-chain-spec",
"sc-consensus-grandpa",
"serde_json",
"sp-authority-discovery",
"sp-consensus-babe",
"sp-consensus-beefy",
@@ -7159,6 +7164,7 @@ dependencies = [
"parity-scale-codec",
"primitive-types",
"scale-info",
"serde_json",
"sp-api",
"sp-authority-discovery",
"sp-block-builder",
@@ -8199,6 +8205,7 @@ dependencies = [
"sc-telemetry",
"sc-transaction-pool",
"sc-transaction-pool-api",
"serde_json",
"sp-api",
"sp-block-builder",
"sp-blockchain",
@@ -8215,6 +8222,7 @@ name = "minimal-runtime"
version = "0.1.0"
dependencies = [
"frame",
"frame-support",
"pallet-balances",
"pallet-sudo",
"pallet-timestamp",
@@ -8222,6 +8230,7 @@ dependencies = [
"pallet-transaction-payment-rpc-runtime-api",
"parity-scale-codec",
"scale-info",
"sp-genesis-builder",
"substrate-wasm-builder",
]
@@ -8679,6 +8688,7 @@ dependencies = [
"sc-telemetry",
"sc-transaction-pool",
"sc-transaction-pool-api",
"serde_json",
"sp-api",
"sp-block-builder",
"sp-blockchain",
@@ -8730,6 +8740,7 @@ dependencies = [
"pallet-transaction-payment-rpc-runtime-api",
"parity-scale-codec",
"scale-info",
"serde_json",
"sp-api",
"sp-block-builder",
"sp-consensus-aura",
@@ -11168,6 +11179,7 @@ dependencies = [
"sc-transaction-pool",
"sc-transaction-pool-api",
"serde",
"serde_json",
"sp-api",
"sp-block-builder",
"sp-blockchain",
@@ -12743,6 +12755,7 @@ dependencies = [
"sp-runtime",
"sp-session",
"sp-timestamp",
"sp-tracing 10.0.0",
"sp-transaction-pool",
"staging-xcm",
"substrate-build-script-utils",
@@ -14783,7 +14796,11 @@ dependencies = [
name = "sc-chain-spec"
version = "4.0.0-dev"
dependencies = [
"array-bytes 6.1.0",
"docify",
"log",
"memmap2",
"parity-scale-codec",
"sc-chain-spec-derive",
"sc-client-api",
"sc-executor",
@@ -14791,10 +14808,16 @@ dependencies = [
"sc-telemetry",
"serde",
"serde_json",
"sp-application-crypto",
"sp-blockchain",
"sp-consensus-babe",
"sp-core",
"sp-genesis-builder",
"sp-io",
"sp-keyring",
"sp-runtime",
"sp-state-machine",
"substrate-test-runtime",
]
[[package]]
@@ -17986,11 +18009,15 @@ version = "2.0.0"
dependencies = [
"ansi_term",
"clap 4.4.6",
"kitchensink-runtime",
"log",
"rand 0.8.5",
"sc-chain-spec",
"sc-keystore",
"serde_json",
"sp-core",
"sp-keystore",
"sp-tracing 10.0.0",
"staging-node-cli",
]
@@ -18110,6 +18137,7 @@ dependencies = [
"parity-scale-codec",
"sc-executor",
"scale-info",
"serde_json",
"sp-application-crypto",
"sp-consensus-babe",
"sp-core",
@@ -18339,6 +18367,7 @@ name = "substrate"
version = "1.0.0"
dependencies = [
"frame-support",
"sc-chain-spec",
"sc-cli",
"sc-consensus-aura",
"sc-consensus-babe",