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

Convert chainspec to raw #4057

Merged
merged 2 commits into from
Apr 10, 2024
Merged

Convert chainspec to raw #4057

merged 2 commits into from
Apr 10, 2024

Conversation

BulatSaif
Copy link
Contributor

The plain people-kusama and coretime-kusama chainspecs were uploaded at #3961. Only binaries with compatible runtime versions can run with plain chainspec. For example:

One of the latest master builds fails:

docker run paritypr/polkadot-parachain-debug:master-216509db --chain coretime-kusama
...
Error: Service(Client(Storage("wasm call error Other: Exported method GenesisBuilder_get_preset is not found"))

Master build from 5 days ago:

docker run paritypr/polkadot-parachain-debug:master-68cdb126 --chain coretime-kusama
...
2024-04-08 16:51:02 [Parachain] 🔨 Initializing Genesis block/state (state: 0xc418…889c, header-hash: 0x638c…d050)
2024-04-08 16:51:03 [Relaychain] 🔨 Initializing Genesis block/state (state: 0xb000…ef6b, header-hash: 0xb0a8…dafe)
2024-04-08 16:51:03 [Relaychain] 👴 Loading GRANDPA authority set from genesis on what appears to be first startup.
2024-04-08 16:51:03 [Relaychain] 👶 Creating empty BABE epoch changes on what appears to be first startup.
2024-04-08 16:51:03 [Relaychain] 🏷 Local node identity is: 12D3KooWQEp2uPow3FnngGmy9dYQ3qxY1GkmumS5MqBWEQscwTyy
2024-04-08 16:51:03 [Relaychain] 📦 Highest known block at #0
...

Changes:

  1. Rename:
coretime-kusama.json -> coretime-kusama-genesis.json
people-kusama.json -> people-kusama-genesis.json
  1. Generate raw chainspec:
docker run --rm -v $(pwd):/dir paritypr/polkadot-parachain-debug:master-68cdb126 build-spec --raw --chain /dir/people-kusama-genesis.json > people-kusama.json 
docker run --rm -v $(pwd):/dir paritypr/polkadot-parachain-debug:master-68cdb126 build-spec --raw --chain /dir/coretime-kusama-genesis.json > coretime-kusama.json

Tests:

New chainspec can run on the latest master build:

docker run -it --rm -v $(pwd):/dir paritypr/polkadot-parachain-debug:master-216509db --chain /dir/coretime-kusama.json
...
2024-04-09 16:44:39 [Relaychain] ⚙️ Syncing, target=#22665488 (8 peers), best: #2371 (0x19f8…5f3a), finalized #2048 (0xede6…f879), ⬇ 388.6kiB/s ⬆ 87.0kiB/s
2024-04-09 16:44:39 [Parachain] 💤 Idle (6 peers), best: #0 (0x638c…d050), finalized #0 (0x638c…d050), ⬇ 6.3kiB/s ⬆ 2.8kiB/s

Plain chainspec will fail:

docker run -it --rm -v $(pwd):/dir paritypr/polkadot-parachain-debug:master-216509db --chain /dir/coretime-kusama-genesis.json
... 
Error: Service(Client(Storage("wasm call error Other: Exported method GenesisBuilder_get_preset is not found")))

@BulatSaif BulatSaif added A1-insubstantial Pull request requires no code review (e.g., a sub-repository hash update). R0-silent Changes should not be mentioned in any release notes I4-refactor Code needs refactoring. D0-easy Can be fixed primarily by duplicating and adapting code by an intermediate coder. labels Apr 9, 2024
@bkchr
Copy link
Member

bkchr commented Apr 9, 2024

Ahh, I didn't pay too much attention to this. @michalkucharczyk your changes to the GenesisBuilder should have bumped the version of the runtime api trait and then you should have handled this gracefully. Aka check which runtime api version is present and then call the correct method.

Converting the chain specs here to raw is probably the easiest and best way forward, but we should prevent further breaking changes in the future.

@bkchr bkchr removed A1-insubstantial Pull request requires no code review (e.g., a sub-repository hash update). I4-refactor Code needs refactoring. D0-easy Can be fixed primarily by duplicating and adapting code by an intermediate coder. labels Apr 9, 2024
@michalkucharczyk
Copy link
Contributor

Ahh, I didn't pay too much attention to this. @michalkucharczyk your changes to the GenesisBuilder should have bumped the version of the runtime api trait and then you should have handled this gracefully. Aka check which runtime api version is present and then call the correct method.

To justify myself: the breaking change was explicitly highlighted in #2714. There was also question raised on how we should handle this (aka can we break compatibility with v1).

@BulatSaif BulatSaif added this pull request to the merge queue Apr 10, 2024
Merged via the queue into master with commit d96a975 Apr 10, 2024
130 of 134 checks passed
@BulatSaif BulatSaif deleted the bs/fix-chainspec branch April 10, 2024 08:51
TomaszWaszczyk pushed a commit to TomaszWaszczyk/polkadot-sdk that referenced this pull request May 27, 2024
The plain `people-kusama` and `coretime-kusama` chainspecs were uploaded
at paritytech#3961. Only binaries
with compatible runtime versions can run with plain chainspec. For
example:

One of the latest master builds fails:

```
docker run paritypr/polkadot-parachain-debug:master-216509db --chain coretime-kusama
...
Error: Service(Client(Storage("wasm call error Other: Exported method GenesisBuilder_get_preset is not found"))
```

Master build from 5 days ago:

```
docker run paritypr/polkadot-parachain-debug:master-68cdb126 --chain coretime-kusama
...
2024-04-08 16:51:02 [Parachain] 🔨 Initializing Genesis block/state (state: 0xc418…889c, header-hash: 0x638c…d050)
2024-04-08 16:51:03 [Relaychain] 🔨 Initializing Genesis block/state (state: 0xb000…ef6b, header-hash: 0xb0a8…dafe)
2024-04-08 16:51:03 [Relaychain] 👴 Loading GRANDPA authority set from genesis on what appears to be first startup.
2024-04-08 16:51:03 [Relaychain] 👶 Creating empty BABE epoch changes on what appears to be first startup.
2024-04-08 16:51:03 [Relaychain] 🏷 Local node identity is: 12D3KooWQEp2uPow3FnngGmy9dYQ3qxY1GkmumS5MqBWEQscwTyy
2024-04-08 16:51:03 [Relaychain] 📦 Highest known block at #0
...
```

## Changes:

1. Rename:
```
coretime-kusama.json -> coretime-kusama-genesis.json
people-kusama.json -> people-kusama-genesis.json
```

2. Generate raw chainspec:

```
docker run --rm -v $(pwd):/dir paritypr/polkadot-parachain-debug:master-68cdb126 build-spec --raw --chain /dir/people-kusama-genesis.json > people-kusama.json 
docker run --rm -v $(pwd):/dir paritypr/polkadot-parachain-debug:master-68cdb126 build-spec --raw --chain /dir/coretime-kusama-genesis.json > coretime-kusama.json
```

## Tests:

New chainspec can run on the latest master build:

```
docker run -it --rm -v $(pwd):/dir paritypr/polkadot-parachain-debug:master-216509db --chain /dir/coretime-kusama.json
...
2024-04-09 16:44:39 [Relaychain] ⚙️ Syncing, target=#22665488 (8 peers), best: paritytech#2371 (0x19f8…5f3a), finalized paritytech#2048 (0xede6…f879), ⬇ 388.6kiB/s ⬆ 87.0kiB/s
2024-04-09 16:44:39 [Parachain] 💤 Idle (6 peers), best: #0 (0x638c…d050), finalized #0 (0x638c…d050), ⬇ 6.3kiB/s ⬆ 2.8kiB/s
```

Plain chainspec will fail:

```
docker run -it --rm -v $(pwd):/dir paritypr/polkadot-parachain-debug:master-216509db --chain /dir/coretime-kusama-genesis.json
... 
Error: Service(Client(Storage("wasm call error Other: Exported method GenesisBuilder_get_preset is not found")))
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
R0-silent Changes should not be mentioned in any release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants