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

Add development chain-spec file for minimal/parachain templates for Omni Node compatibility #6529

Open
wants to merge 94 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 85 commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
3743b9f
Add development chain spec config
EleisonC Nov 16, 2024
1e833b4
Add path chain_spec_path
EleisonC Nov 16, 2024
3345130
Add path chain_spec_path
EleisonC Nov 16, 2024
97a1cc2
Add development chain spec for parachain template
EleisonC Nov 18, 2024
80669c1
Update chain spec path
EleisonC Nov 18, 2024
7a060c5
Merge branch 'master' into add-dev-chain-spec
EleisonC Nov 18, 2024
91e0ba8
Merge branch 'add-dev-chain-spec' of https://github.com/EleisonC/polk…
EleisonC Nov 18, 2024
d97247d
Revert "Update chain spec path"
EleisonC Nov 18, 2024
301ab59
update chain_spec_path
EleisonC Nov 18, 2024
541b524
Merge branch 'master' into add-dev-chain-spec
EleisonC Nov 18, 2024
02e431e
Merge branch 'master' into add-dev-chain-spec
EleisonC Nov 21, 2024
0146534
remove chain spec path not required
EleisonC Nov 21, 2024
14a32f1
Add runtime test for minimal dev chain spec
EleisonC Nov 27, 2024
2c318e3
Merge branch 'master' into add-dev-chain-spec
EleisonC Nov 27, 2024
cd66bbe
Update templates/minimal/node/tests/validate_dev_chain_spec.rs
EleisonC Nov 28, 2024
419a9d8
Update templates/minimal/node/tests/validate_dev_chain_spec.rs
EleisonC Nov 28, 2024
6197599
Add new spec file Change tests dir to runtime.
EleisonC Nov 29, 2024
92c47be
Merge branch 'master' into add-dev-chain-spec
EleisonC Nov 29, 2024
46b99d7
Merge branch 'master' into add-dev-chain-spec
EleisonC Nov 29, 2024
172f411
added modified dev chain spec. build minimal/runtime without --release
EleisonC Nov 30, 2024
4971b76
Merge remote-tracking branch 'origin/add-dev-chain-spec' into add-dev…
EleisonC Nov 30, 2024
8342ccf
Merge branch 'master' into add-dev-chain-spec
EleisonC Nov 30, 2024
94d1885
Merge remote-tracking branch 'origin/add-dev-chain-spec' into add-dev…
EleisonC Nov 30, 2024
d98b6f6
match test chain spec builder to exisitng one
EleisonC Dec 1, 2024
f748e0b
add new dev chain spec
EleisonC Dec 1, 2024
04904b2
remove unused code
EleisonC Dec 1, 2024
64303ef
Merge branch 'master' into add-dev-chain-spec
EleisonC Dec 3, 2024
8564533
Merge branch 'master' into add-dev-chain-spec
EleisonC Dec 5, 2024
5af21e6
add dev chain spec srtool-runtime
EleisonC Dec 5, 2024
a6ae597
automate spec chain validation for minimal template
EleisonC Dec 9, 2024
1d0b042
Merge branch 'master' into add-dev-chain-spec
EleisonC Dec 9, 2024
d98a9c2
parachain template spec chain verification
EleisonC Dec 9, 2024
94e4d62
Merge branch 'add-dev-chain-spec' of https://github.com/EleisonC/polk…
EleisonC Dec 9, 2024
99c2084
Merge branch 'master' into add-dev-chain-spec
EleisonC Dec 9, 2024
d0a31f5
update the template/minimal/ readme.md file
EleisonC Dec 9, 2024
82b5708
update the verification workflows
EleisonC Dec 10, 2024
cb3839e
refactor remove unused crates & crate-fts
EleisonC Dec 10, 2024
d783e47
refactor remove test
EleisonC Dec 10, 2024
bd09d21
refactor minimal readme.md
EleisonC Dec 10, 2024
9b34aef
refactor minimal & parachain readme.md files
EleisonC Dec 10, 2024
9d62db2
refactor dev spec verification files
EleisonC Dec 10, 2024
960fc22
Merge branch 'master' into add-dev-chain-spec
EleisonC Dec 10, 2024
0b84817
add custom workflow minimal/parachain templates
EleisonC Dec 13, 2024
0e948e8
Merge branch 'master' into add-dev-chain-spec
EleisonC Dec 13, 2024
860d655
remove seprate workflows
EleisonC Dec 13, 2024
a2804ae
Merge branch 'add-dev-chain-spec' of https://github.com/EleisonC/polk…
EleisonC Dec 13, 2024
dbad177
add fix for missing dep
EleisonC Dec 13, 2024
b2c44a8
fix download artifact version
EleisonC Dec 13, 2024
6b7bf34
Update .github/workflows/veriy-minimal-parachain-dev-spec-chains.yml
EleisonC Dec 13, 2024
402a0fe
Update .github/workflows/veriy-minimal-parachain-dev-spec-chains.yml
EleisonC Dec 13, 2024
84d46da
Update .github/workflows/veriy-minimal-parachain-dev-spec-chains.yml
EleisonC Dec 13, 2024
09eac57
implement feedback
EleisonC Dec 13, 2024
fda6b31
Merge branch 'master' into add-dev-chain-spec
EleisonC Dec 13, 2024
2af2180
fix linter issues readme
EleisonC Dec 13, 2024
4f385c8
add fix for workflow
EleisonC Dec 13, 2024
ef4c303
add fix for workflow
EleisonC Dec 13, 2024
a35001e
remove actions write
EleisonC Dec 13, 2024
8d7a25b
minor fix
EleisonC Dec 13, 2024
546ba56
timeout increase
EleisonC Dec 14, 2024
d04e9f6
Merge branch 'master' into add-dev-chain-spec
EleisonC Dec 18, 2024
11053f9
Merge branch 'master' into add-dev-chain-spec
EleisonC Dec 19, 2024
142f249
upload new parachain dev spec
EleisonC Dec 19, 2024
318609b
concurency Prioritize CI Workflow Execution for Faster Feedback
EleisonC Dec 19, 2024
b66e6b4
Merge branch 'master' into add-dev-chain-spec
EleisonC Dec 19, 2024
278324c
Merge branch 'master' into add-dev-chain-spec
EleisonC Dec 19, 2024
f0a3f18
Merge branch 'master' into add-dev-chain-spec
EleisonC Dec 19, 2024
63ffef7
fix dev chain spec diff
EleisonC Dec 20, 2024
da812f5
Merge branch 'add-dev-chain-spec' of https://github.com/EleisonC/polk…
EleisonC Dec 20, 2024
eb4c8aa
Merge branch 'master' into add-dev-chain-spec
EleisonC Jan 6, 2025
da09ab4
Merge branch 'master' into add-dev-chain-spec
EleisonC Jan 7, 2025
e21561e
intergrate chain spec creation into sync templates workflow
EleisonC Jan 7, 2025
6a01d91
remove chain spec verification workflow
EleisonC Jan 7, 2025
d30ac61
Merge branch 'master' into add-dev-chain-spec
EleisonC Jan 8, 2025
76a55d2
update minimal readme
EleisonC Jan 16, 2025
1330a45
update parachain readme
EleisonC Jan 16, 2025
503477d
Merge branch 'master' into add-dev-chain-spec
EleisonC Jan 16, 2025
fad8110
Update .github/workflows/misc-sync-templates.yml
EleisonC Jan 18, 2025
3748999
Update templates/minimal/README.md
EleisonC Jan 18, 2025
7c2988c
changes
EleisonC Jan 18, 2025
f6da52d
changes parachain readme
EleisonC Jan 18, 2025
e2bd3db
add --locked for consistent deps
EleisonC Jan 18, 2025
e96a0f9
Update README.md
EleisonC Jan 18, 2025
6741c08
update readme's
EleisonC Jan 20, 2025
b5fd47c
Merge branch 'master' into add-dev-chain-spec
EleisonC Jan 20, 2025
ea2bc5b
Merge branch 'master' into add-dev-chain-spec
EleisonC Jan 21, 2025
e9f1dcd
fix upload artifact path
EleisonC Jan 21, 2025
de771ff
update
EleisonC Jan 21, 2025
b5f28c4
Merge branch 'master' into add-dev-chain-spec
EleisonC Jan 21, 2025
39f471b
Merge branch 'master' into add-dev-chain-spec
EleisonC Jan 21, 2025
217eecd
refactor
EleisonC Jan 22, 2025
cb09b40
Update .github/workflows/misc-sync-templates.yml
EleisonC Jan 22, 2025
47afc32
refactor readme
EleisonC Jan 22, 2025
e16b013
refactor readme
EleisonC Jan 22, 2025
f4964f7
Merge branch 'master' into add-dev-chain-spec
EleisonC Jan 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions .github/workflows/misc-sync-templates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,66 @@ on:
default: false

jobs:
prepare-chain-spec-artifacts:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- template: minimal
package_name: 'minimal-template-runtime'
runtime_path: './templates/minimal/runtime'
runtime_wasm_path: minimal-template-runtime/minimal_template_runtime.compact.compressed.wasm
relay_chain: 'dev'
- template: parachain
package_name: 'parachain-template-runtime'
runtime_path: './templates/parachain/runtime'
runtime_wasm_path: 'minimal-template-runtime/minimal_template_runtime.compact.compressed.wasm'
EleisonC marked this conversation as resolved.
Show resolved Hide resolved
relay_chain: 'rococo-local'
steps:
- uses: actions/checkout@v4
with:
ref: "${{ github.event.inputs.stable_release_branch }}"

- name: Setup build environment
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler
cargo install --git https://github.com/chevdor/srtool-cli --locked
cargo install --path substrate/bin/utils/chain-spec-builder --locked
srtool pull

- name: Build runtime and generate chain spec
run: |
# Prepare directories
sudo mkdir -p ${{ matrix.runtime_path }}/target
sudo chmod -R 777 ${{ matrix.runtime_path }}/target

# Build runtime
srtool build --package ${{ matrix.package_name }} --runtime-dir ${{ matrix.runtime_path }} --root

# Generate chain spec
# Note that para-id is set to 1000 for both minimal/parachain templates.
# `parachain-runtime` is hardcoded to use this parachain id.
# `minimal` template isn't using it, but when started with Omni Node, this para id is required (any number can do it, so setting it to 1000 for convenience).
chain-spec-builder -c dev_chain_spec.json create \
--relay-chain "${{ matrix.relay_chain }}" \
--para-id 1000 \
--runtime "${{ matrix.runtime_path }}/target/srtool/release/wbuild/${{ matrix.runtime_wasm_path }}" \
named-preset development
EleisonC marked this conversation as resolved.
Show resolved Hide resolved

- name: Prepare upload directory
run: |
mkdir -p artifacts-${{ matrix.template }}
cp dev_chain_spec.json artifacts-${{ matrix.package_name }}/dev_chain_spec.json
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you are using matrix.package_name instead of matrix.template, I think this is a mismatch.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the catch. I have addressed it


- name: Upload template directory
uses: actions/upload-artifact@v4
with:
name: artifacts-${{ matrix.template }}
path: artifacts-${{ matrix.template }}/dev_chain_spec.json

sync-templates:
needs: prepare-chain-spec-artifacts
runs-on: ubuntu-latest
environment: master
strategy:
Expand All @@ -37,6 +96,18 @@ jobs:
env:
template-path: "polkadot-sdk-${{ matrix.template }}-template"
steps:
# 0. download dev chain spec
- uses: actions/checkout@v4
with:
path: polkadot-sdk
ref: "${{ github.event.inputs.stable_release_branch }}"

- name: Download template artifacts
uses: actions/download-artifact@v4
with:
name: artifacts-${{ matrix.template }}
path: templates/${{ matrix.template }}/
if: matrix.template != 'solochain'
iulianbarbu marked this conversation as resolved.
Show resolved Hide resolved

# 1. Prerequisites.

Expand Down
13 changes: 12 additions & 1 deletion templates/minimal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,17 @@
- 🤏 This template is a minimal (in terms of complexity and the number of components)
template for building a blockchain node.
iulianbarbu marked this conversation as resolved.
Show resolved Hide resolved


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

Suggested change

- 🔧 Its runtime is configured with a single custom pallet as a starting point, and a handful of ready-made pallets
such as a [Balances pallet](https://paritytech.github.io/polkadot-sdk/master/pallet_balances/index.html).


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

Suggested change

- 👤 The template has no consensus configured - it is best for experimenting with a single node network.


- For the most up-to-date chain specification, refer to [staging-chain-spec-builder](https://crates.io/crates/staging-chain-spec-builder)
iulianbarbu marked this conversation as resolved.
Show resolved Hide resolved


## Template Structure

A Polkadot SDK based project such as this one consists of:
Expand All @@ -61,7 +67,7 @@ compiled unless building the entire workspace).
- 🛠️ Depending on your operating system and Rust version, there might be additional
packages required to compile this template - please take note of the Rust compiler output.

Fetch minimal template code:
Fetch minimal template code.

```sh
git clone https://github.com/paritytech/polkadot-sdk-minimal-template.git minimal-template
Expand Down Expand Up @@ -147,6 +153,11 @@ docker run --rm polkadot-sdk-minimal-template
We can install `zombienet` as described [here](https://paritytech.github.io/zombienet/install.html#installation),
and `zombienet-omni-node.toml` contains the network specification we want to start.

To simplify the process of starting the minimal template with zombienet and Omni Node, we've added a pre-configured
development chain spec (dev_chain_spec.json) to the minimal template. The zombienet-omni-node.toml file of this template
points to it, but you can update it to an updated path to the new chain spec generated on your machine, as shown below.
iulianbarbu marked this conversation as resolved.
Show resolved Hide resolved


#### Update `zombienet-omni-node.toml` with a valid chain spec path

Before starting the network with zombienet we must update the network specification
Expand Down
85 changes: 85 additions & 0 deletions templates/minimal/dev_chain_spec.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions templates/minimal/zombienet-omni-node.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[relaychain]
default_command = "polkadot-omni-node"
chain = "dev"
chain_spec_path = "<path/to/chain_spec.json>"
default_args = ["--dev"]
chain_spec_path = "./dev_chain_spec.json"
default_args = ["--dev-block-time 3000"]

[[relaychain.nodes]]
name = "alice"
Expand Down
9 changes: 9 additions & 0 deletions templates/parachain/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@

- 👉 Learn more about parachains [here](https://wiki.polkadot.network/docs/learn-parachains)

- For the most up-to-date chain specification, refer to [staging-chain-spec-builder](https://crates.io/crates/staging-chain-spec-builder)


## Template Structure

A Polkadot SDK based project such as this one consists of:
Expand Down Expand Up @@ -144,6 +147,12 @@ Download the `polkadot` (and the accompanying `polkadot-prepare-worker` and `pol
export PATH="$PATH:<path/to/binaries>"
```


To simplify the process of using the parachain-template with zombienet and Omni Node, we've added a pre-configured
development chain spec (dev_chain_spec.json) to the parachain template. The zombienet-omni-node.toml file of this
template points to it, but you can update it to an updated chain spec generated on your machine, as shown below:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly the same as for minimal



#### Update `zombienet-omni-node.toml` with a valid chain spec path

```toml
Expand Down
108 changes: 108 additions & 0 deletions templates/parachain/dev_chain_spec.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion templates/parachain/zombienet-omni-node.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ws_port = 9955

[[parachains]]
id = 1000
chain_spec_path = "<path/to/chain_spec.json>"
chain_spec_path = "./dev_chain_spec.json"

[parachains.collator]
name = "charlie"
Expand Down
Loading