templates: make node compilation optional #5954
Draft
+27
−8
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Closes #5940
Integration
Node devs that rely on templates' nodes binaries for minimal or parachain would need to follow the updated templates' README.mds again to find how to build the nodes' binaries. Automation that simply run `cargo run
Review Notes
Conditional compilation of virtual workspaces would compile the
members
list as if we passed--workspace
flag tocargo build
, except when adding adefault-members
list which will be used for any cargo command executed in the virtual workspace root. To build the full members list needs passing--workspace
flag.Other options investigated:
node
crate by defining a feature in thenode
crate, but it feels too complex since all code needs to be feature guarded. I haven't tried it but technically speaking it might work. I think though it looks awkward and my opinion is that the alternative is better.node
crate and then not passing the feature to cargo build results in ignoring thenode
crate)--package minimal-template-node
flag to thecargo build
command. This has the disadvantage of not allowing IDEs based on rust analyzer to index/compile the node crate.My conclusion is that any option would require two commands to build the template, one with the node and one without, and both must be included in the README or templates usage documentation. If it comes which ones to pick I am in favor of the
default-members
option, which requires minimal intervention and expresses how cargo commands are executed on top of the workspace members, and what's left out from regular usage.Testing
Testing was conducted but I assume it is not representative because of some knowledge gaps in how to operate correctly a local testnet and what to look for/expect. Need to revise my testing strategy with someone from the team.
manual seal
:polkadot-parachain --chain chain_spec.json --dev_block_time 1000
. What I notice is that the best/finalized blocks number are not progressing, but maybe that's because I am not starting the node as a collator?I think this isn't necessarily true though because of the other test (done with zombienet) where I started the omni-node with parachain_template_runtime as a collator, and the logs look the same.TODO clarify how block authoring/finalization works when starting with manual seal.polkadot-parachain --chain chain_spec.json
. Similar thing as before was noticed in terms of best/finalized blocks, but it should be because of the network topology, when the number of relaychain nodes might not be sufficient and the same for collators. I think starting a local testnet manually isn't required and I can cover this by using justzombienet
.started zombienet based on the network topology present inUnfortunately I did not use zombienet in the right way and I am still looking for how to start omni-node with template runtimes. Would be great to use zombienet to start nodes with manual seal too. I'll leave this checkbox for both, covered through zombienet.cumulus/zombienet/tests/0006-rpc_collator_builds_blocks.toml
, where I added agenesis_wasm_path
pointing to theparachain mininal_template_runtime.wasm
s files, and set therelaychain.chain
topolkadot
. All the nodes started without errors but finding the best blocks/finalized was stuck at block with number #0, the same as for the other tests.TODOs