Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

chain-spec: support for json config/patch (and GenesisBuilder API) #7508

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

Conversation

michalkucharczyk
Copy link
Contributor

@michalkucharczyk michalkucharczyk commented Jul 17, 2023

This PR is a step towards adding support of RuntimeGenesisConfig into the wasm runtime:

In this PR:

  • all references to RuntimeGenesisConfig in node/service are removed,

  • RococoGenesisExt is removed. It was the hack to allow overwriting EpochDurationInBlocks. Removal of RococGenesisExt prevents from manipulating the state to change the runtime constants, what allows to keep metadata const.

  • 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,

  • rococo-runtime changes:

    • Explicit building of fast-runtime version of rococo-runtime is no longer done.
    • Environment variables which control the time::EpochDurationInBlocks value were added:
      • ROCOCO_FAST_RUNTIME - enables the fast runtime version of runtime with default value of EpochDurationInBlocks set to 10. Value of env does not matter.
      • ROCOCO_EPOCH_DURATION - enables the fast runtime version with provided value of EpochDurationInBlocks (epoch duration will be set to the value of env).

    rococo-runtime building examples:

    • to build runtime for versi_staging_testnet which had EpochDurationInBlocks set to 100:
      ROCOCO_EPOCH_DURATION=100 cargo build -p rococo-runtime
      
    • to build runtime for wococo_development
      ROCOCO_EPOCH_DURATION=10 cargo build -p rococo-runtime
      or
      ROCOCO_FAST_RUNTIME=1 cargo build -p rococo-runtime
      
    • to build versi-staging chain spec:
      ROCOCO_EPOCH_DURATION=100 cargo run -p polkadot -- build-spec --chain versi-staging --raw 
      
    • to build wococo-dev chain spec:
      ROCOCO_EPOCH_DURATION=10 cargo run -p polkadot -- build-spec --chain wococo-dev --raw 
      

Companion for: paritytech/substrate#14562
cumulus companion: paritytech/cumulus#2936

Step towards: paritytech/polkadot-sdk#25

New feature fast-runtime-10m was added.

This adds new rococo-runtime blob with hard-coded epochDuration. This
prevents from manipulating the state to change the runtime constants.

This commit also allows to remove `RococoGenesisExt` hack.
In this commit:
- all references to `RuntimeGenesisConfig` are removed,
- `RococoGenesisExt` is removed. It was the hack to allow overwriting `EpochDurationInBlocks` (1m/10m/60m rococo runtimes are now available),
- all `(kusama|polkadot|versi|rococo|wococo)_(staging|dev)_genesis_config` functions now return the JSON patch for default runtime `GenesisConfig`,
- ChainSpecBuilder is used, `from_gensis` is removed,
@michalkucharczyk michalkucharczyk requested review from bkchr and a team July 20, 2023 11:29
Explicitly building fast-runtime version of rococo runtime is no longer
done.

Environment variables which control the time::EpochDurationInBlocks value were added:
- ROCOCO_FAST_RUNTIME - enables the fast runtime version of runtime with
  default value of EpochDurationInBlocks set to 10. Value of env does
  not matter.
- ROCOCO_EPOCH_DURATION - enables the fast runtime version with provided
  value of EpochDurationInBlocks (epoch duration will be set to the
  value of env).

Examples:
- to build runtime for `versi_staging_testnet_config which had
  EpochDurationInBlocks set to 100:
```
ROCOCO_EPOCH_DURATION=100 cargo build -p rococo
```
- to build runtime for `versi_staging_testnet_config which had
  EpochDurationInBlocks set to 100:
```
ROCOCO_EPOCH_DURATION=100 cargo build -p rococo-runtime
```
- to build runtime for `wococo_development`
```
ROCOCO_EPOCH_DURATION=10 cargo build -p rococo-runtime
or
ROCOCO_FAST_RUNTIME=1 cargo build -p rococo-runtime
```
@michalkucharczyk
Copy link
Contributor Author

bot rebase

@paritytech-processbot
Copy link

Rebased

@michalkucharczyk michalkucharczyk added A3-in_progress Pull request is in progress. No review needed at this stage. C1-low PR touches the given topic and has a low impact on builders. D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit. T2-API This PR/Issue is related to APIs. B1-note_worthy Changes should be noted in the release notes labels Jul 27, 2023
@michalkucharczyk
Copy link
Contributor Author

bot rebase

@paritytech-processbot
Copy link

Rebased

@michalkucharczyk michalkucharczyk marked this pull request as ready for review August 1, 2023 12:16
@michalkucharczyk michalkucharczyk removed the A3-in_progress Pull request is in progress. No review needed at this stage. label Aug 1, 2023
@michalkucharczyk michalkucharczyk added the A0-please_review Pull request needs code review. label Aug 1, 2023
@paritytech-ci paritytech-ci requested review from a team August 1, 2023 12:17
@michalkucharczyk
Copy link
Contributor Author

bot rebase

@paritytech-processbot
Copy link

Rebased

@paritytech-cicd-pr
Copy link

The CI pipeline was cancelled due to failure one of the required jobs.
Job name: test-linux-stable
Logs: https://gitlab.parity.io/parity/mirrors/polkadot/-/jobs/3322577

@michalkucharczyk
Copy link
Contributor Author

@paritytech/devrel , @the-right-joyce

I wanted to give you a heads-up about some changes that have just been made in this PR. I've modified the default EpochDurationInBlocks for several ChainSpecs, namely: versi-local, wococo-local, rococo-local, wococo-dev, versi-dev, rococo-dev (where duration was previously set to 10), and versi-staging (where duration was previously set to 100).

You can find additional details in the PR description.

This change could affect tutorials (and docs maybe?) that rely on timing within these runtimes. Therefore, I request you to please review and update them accordingly, and include information on how to adjust timings based on these changes.

Thank you for your attention.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review. B1-note_worthy Changes should be noted in the release notes C1-low PR touches the given topic and has a low impact on builders. D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit. T2-API This PR/Issue is related to APIs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants