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

omni-node: --dev sets manual seal and allows --chain to be set #6646

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

Conversation

iulianbarbu
Copy link
Contributor

@iulianbarbu iulianbarbu commented Nov 26, 2024

Description

This PR changes a few things:

  • --dev flag will not conflict with --chain anymore, but if --chain is not given will set --chain=dev.
  • --dev-block-time is optional and it defaults to 3000ms if not set after setting --dev.
  • to start OmniNode with manual seal it is enough to pass just --dev.

Closes: #6537

Integration

Relevant for node/runtime developers that use OmniNode lib, including polkadot-omni-node binary, although the recommended way for runtime development is to use chopsticks.

Review Notes

  • Decided to focus only on OmniNode & templates docs in relation to it, and leave the parachain-template-node as is (meaning --dev isn't usable and testing a runtime with the parachain-template-node still needs a relay chain here). I am doing this because I think we want either way to phase out parachain-template-node and adding manual seal support for it is wasted effort. We might add support though if the demand is for parachain-template-node.
  • Decided to not infer the block time based on AURA config yet because there is still the option of setting a specific block time by using --dev-block-time. Also, would want first to align & merge on runtime metadata checks we added in Omni Node here: omni-node: add metadata checks for runtime/parachain compatibility #6450 before starting to infer AURA config slot duration via the same way.
  • update the docs to mention --dev now.
  • mention about chopsticks in the context of runtime development

@iulianbarbu iulianbarbu added T9-cumulus This PR/Issue is related to cumulus. T17-Templates This PR/Issue is related to templates labels Nov 26, 2024
@iulianbarbu iulianbarbu self-assigned this Nov 26, 2024
Signed-off-by: Iulian Barbu <[email protected]>
Signed-off-by: Iulian Barbu <[email protected]>
@iulianbarbu iulianbarbu marked this pull request as draft November 26, 2024 10:48
@iulianbarbu iulianbarbu changed the title omni-node: --dev starts manual seal and allows --chain to be set omni-node: --dev sets manual seal and allows --chain to be set Nov 26, 2024
@iulianbarbu iulianbarbu marked this pull request as ready for review November 27, 2024 00:37
Signed-off-by: Iulian Barbu <[email protected]>
@iulianbarbu iulianbarbu requested review from michalkucharczyk and a team November 27, 2024 13:43

### Start `chopsticks` with the chain spec

We'll also need to set `--allow-unresolved-imports=true` because the `parachain-template-runtime` is not built
Copy link
Contributor

Choose a reason for hiding this comment

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

From what I understand it is the otherway round. You tried to use chopsticks earlier with a runtime which was built using --features runtime-benchmarks. This makes the runtime require additional host functions. You are telling chopsticks to ignore these hostfunctions by using this flag.

So if users build their runtimes without --features runtime-benchmarks they should not require this flag.

Copy link
Contributor Author

@iulianbarbu iulianbarbu Nov 27, 2024

Choose a reason for hiding this comment

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

Ah good catch, thanks! Actually just tested and we don't need the --allow-unresolved-imports flag because on normal build the parachain-template-runtime doesn't build with --features runtime-benchmarks. I built the runtime before with the runtime-bnechmarks feature and thought it is the std/non-benchmarks runtime. 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated the readme here: f696909

#[arg(long)]
/// a block each `dev_block_time` ms, as if it was part of a parachain. Default to 3000ms if
/// not set when using `--dev` flag.
#[arg(long, requires = "dev")]
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm why does this require --dev? If I just specify --dev-block-time 500 it could just work like before no? Basically --dev just being a shortcut.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is because using just --dev-block-time <number_ms> isn't equivalent to --dev --dev-block-time <number_ms>. Missing --dev will not set a bunch of flags accordingly: --rpc-cors=all, fore-authoring, --alice and --tmp. Not sure how important they are (as in I haven't explored precisely to what end they serve), but thought about keeping the --dev experience complete.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe I am missing something, but --dev can keep doing this stuff. But I could still be able to specify --dev-block-time on its own like before.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe I am missing something, but --dev can keep doing this stuff. But I could still be able to specify --dev-block-time on its own like before.

Yes, it can still do its stuff, but that stuff wouldn't be activated if we're not setting the --dev flag, right? I mean, we can also set it artificially like below:

cli.run.base.shared_params.dev |= cli.dev_block_time.is_some();

Is this what you think about?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes exactly. I mean this is what I meant by "old behaviour". The check was changed in this PR, before we were checking for dev_block_time already.

So basically my idea is:

  • --dev: Activates manual seal with default 3000ms block time. And all the other flags you mentioned, basically easy dev setup.
  • --dev-block-time 1000: Just manual seal with 1000ms, no extra hidden flags activated.
  • --dev --dev-block-time 1000: The easy dev setup but with 1000ms block times.

Let me know if you think it makes sense.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I am ok with this. Changed it back here: 06bbd5e, and adjusted a few more things to reflect that --dev isn't mandatory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T9-cumulus This PR/Issue is related to cumulus. T17-Templates This PR/Issue is related to templates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve parachains node --dev flag experience
2 participants