parachain-template: genesis config presets added#4739
parachain-template: genesis config presets added#4739michalkucharczyk merged 10 commits intomasterfrom
Conversation
kianenigma
left a comment
There was a problem hiding this comment.
Would we make different choices if we know we want this code in all 3 runtimes? maybe reusing parts of it?
We need indeed want this code to also be in the solochain and minimal runtime as well :)
| pub const PRESET_LOCAL_TESTNET: &str = "local_testnet"; | ||
|
|
||
| /// Preset configuration name for a development environment. | ||
| pub const PRESET_DEVELOPMENT: &str = "development"; |
There was a problem hiding this comment.
One annoying little detail about this is that if you don't put chian_type: Dev in the chain-spec, PJS apps won't show the accounts to you. There is a CLI flag for that two, but seem annoying to repeat development many times.
./chain-spec-builder --chain-type development --preset development etc etc
We either create a ticket in PJS apps to change this (prob better), or we think about how we can improve it on our side. Maybe a chain-spec-builder --dev that does both? combined with running the chain in --dev it sounds like a good dev ex to me.
# compile wasm
# ./chain-spec-builder --runtime wasm --dev > spec.json
# ./omni-node --chain spec.json --dev
There was a problem hiding this comment.
chain-spec-builder --dev
This would assume that presets' naming is somehow standardized. Every runtime shall provide something in order to make flags in some other tool work correctly. This is probably OK, question is we want to go in that direction.
There was a problem hiding this comment.
To me it sounds reasonable that these are separate flags. You could have multiple runtime presets for development, all of them with chainType "Dev".
I was thinking how one could do the pjs route. I think currently pjs calls the system_chainType RPC which gets its data directly from the chain spec. If we don't want to use the chain-spec property for this, we would need another easy way to tell that we are a dev chain.
There was a problem hiding this comment.
We can keep separate flags, --dev can be convenient shortcut.
There was a problem hiding this comment.
yeah, let's keep all things configurable in the super-user mode, but one --dev that makes some assumptions is a good nice to have.
To which part are you referring to? This could be moved to common crate, but at the moment template runtimes are not having common base (e.g. every runtime type is different). This could be done in some follow-up step. |
|
We are eager to have this merged to improve the parachain developer experience. This will allow customizing chainspecs for launching networks in a generic and easy way without requiring the node binary just the chain-spec-builder + runtime file. |
|
@skunert @kianenigma what is your opinion - could we merge it and improve it further in follow-up PRs? |
|
The CI pipeline was cancelled due to failure one of the required jobs. |
skunert
left a comment
There was a problem hiding this comment.
From my side looks good, I think we can merge this.
|
Oh, I also did something similar to this as a part of #5117, and in fact wanted to extract it into a separate PR! But great to see it already exist, review will follow now. |
| ), | ||
| ], | ||
| vec. Useful for starting nodes based on minimal/solochain when doing development or for testing omni node with less happy code paths. It is reusing the presets defined for the nodes chain specs. ## Integration Specifically useful for development/testing if generating chain-specs for `minimal` or `solochain` runtimes from `templates` directories. ## Review Notes Added `genesis_config_presets` modules for both minimal/solochain. I reused the presets defined in each node `chain_spec` module correspondingly. ### PRDOC Not sure who uses templates, maybe node devs and runtime devs at start of their learning journey, but happy to get some guidance on how to write the prdoc if needed. ### Thinking out loud I saw concerns around sharing functionality for such genesis config presets between the template chains. I think there might be a case for doing that, on the lines of this comment: #4739 (comment). I would add that `parachains-common::genesis_config_heleper` contains a few methods from those mentioned, but I am unsure if using it as a dependency for templates is correct. Feels like the comment suggests there should be a `commons` crate concerning just `templates`, which I agree with to some degree, if we assume `cumulus` needs might be driven in certain directions that are not relevant to `templates` and vice versa. However I am not so certain about this, so would welcome some thoughts, since I am seeing `parachains-common` being used already in a few runtime implementations: https://crates.io/crates/parachains-common/reverse_dependencies?page=3, so might be a good candidate already for the `common` logic. --------- Signed-off-by: Iulian Barbu <iulian.barbu@parity.io>
Gensis config presets moved from
parachain-template-nodebinary intoparachain-template-runtimeruntime.cc: @PierreBesson