Skip to content

Conversation

@evilrobot-01
Copy link
Contributor

@evilrobot-01 evilrobot-01 commented Apr 10, 2025

Improvements to the pop up command to enable the launching of networks with supported parachains without the need for network configuration files. A 'supported' parachain is simply one that is added to the Parachain enum within the pop-parachains crate, simply so that we can know how to source the binaries/chain-spec-generators for the chain to launch it as quickly as possible.

Goal

Support as much of the configuration in https://github.com/r0gue-io/pop-node/blob/main/networks/devnet.toml as possible:

  • optional para id specification, defaulting to some known static value
  • port specification, randomly assigned if not specified
  • args: currently statically defined per parachain type, need to consider whether to support custom args for the first iteration
  • genesis state

Example usage:

pop up paseo -p asset-hub,pop -r stable2412-4
pop up kusama --port 8833 --parachain asset-hub:9944 -r stable2412-4
pop up polkadot --port 8833 --parachain asset-hub:9977,pop#3395:9944 -r stable2412-4
pop up westend -p asset-hub

The last arg explicitly specifies the relay binary version to work around current issues with stable2503 and the v1.4.3 release of Paseo. They would ordinarily not be required. Everything 'just works' on Westend.

Notes:

  • Now uses positional path argument for specifying the network config file when using pop up network, eliminating the need for --file/-f.
  • Supported chains: all system chains and Pop.
  • The number of validators is automatically defined based on the specified number of parachains. This could be configurable but not sure its required?
  • The number of collators is not currently configurable but this could be added. I personally dont see the need for more than one on a dev box, at least when building out and testing a solution.

TODOs:

  • fix: consistent ordering of parachains in output in cli output
  • logging: output versions used when --verbose enabled
  • specifying pop should auto-add asset-hub as a dependency, fund sovereign account on AH, notify user if AH not specified
  • westend
  • merging in applicable local binary versions when resolving which binary to use - e.g. stable2503 remains as prerelease, can be used by explicitly specifying but then defaults back to last release when run normally. It could include local binaries in the version list even if they dont appear in the current published release set. A similar poor experience is being prompted to revert back to the fallback version when rate limited on the GH api, despite having a newer version available locally.
  • add local ws endpoint to output for better devex
  • tests

[sc-3612]

@codecov
Copy link

codecov bot commented Apr 10, 2025

Codecov Report

Attention: Patch coverage is 80.19276% with 596 lines in your changes missing coverage. Please review.

Project coverage is 79.34%. Comparing base (30763a9) to head (97c31bf).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
crates/pop-cli/src/commands/up/network.rs 2.84% 375 Missing ⚠️
crates/pop-parachains/src/up/mod.rs 90.09% 4 Missing and 105 partials ⚠️
crates/pop-contracts/src/node.rs 73.17% 13 Missing and 9 partials ⚠️
crates/pop-common/src/sourcing/mod.rs 95.57% 3 Missing and 15 partials ⚠️
crates/pop-cli/src/cli.rs 11.11% 16 Missing ⚠️
crates/pop-parachains/src/relay.rs 0.00% 10 Missing ⚠️
crates/pop-parachains/src/up/parachains.rs 91.02% 0 Missing and 7 partials ⚠️
crates/pop-cli/src/commands/mod.rs 57.14% 6 Missing ⚠️
crates/pop-parachains/src/up/relay.rs 88.46% 0 Missing and 6 partials ⚠️
crates/pop-common/src/polkadot_sdk.rs 97.29% 0 Missing and 5 partials ⚠️
... and 11 more
@@            Coverage Diff             @@
##             main     #523      +/-   ##
==========================================
+ Coverage   78.69%   79.34%   +0.65%     
==========================================
  Files         101      106       +5     
  Lines       23922    25828    +1906     
  Branches    23922    25828    +1906     
==========================================
+ Hits        18825    20494    +1669     
- Misses       2886     3047     +161     
- Partials     2211     2287      +76     
Files with missing lines Coverage Δ
crates/pop-cli/src/common/binary.rs 78.91% <100.00%> (ø)
crates/pop-cli/src/common/try_runtime.rs 92.06% <100.00%> (+0.01%) ⬆️
crates/pop-common/src/lib.rs 81.94% <100.00%> (+7.43%) ⬆️
crates/pop-contracts/src/up.rs 67.00% <ø> (ø)
crates/pop-parachains/src/accounts.rs 100.00% <100.00%> (ø)
crates/pop-parachains/src/errors.rs 100.00% <ø> (ø)
crates/pop-parachains/src/registry/mod.rs 100.00% <100.00%> (ø)
crates/pop-parachains/src/traits.rs 100.00% <100.00%> (ø)
crates/pop-common/src/git.rs 77.63% <75.00%> (+0.11%) ⬆️
crates/pop-common/src/sourcing/binary.rs 92.85% <98.14%> (-0.03%) ⬇️
... and 19 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@evilrobot-01 evilrobot-01 changed the title refactor(up): use positional argument for network config file refactor(up): improved usage Apr 11, 2025
@evilrobot-01 evilrobot-01 added the ready-for-high-level-review The PR needs a high level review label Apr 14, 2025
@evilrobot-01 evilrobot-01 changed the title refactor(up): improved usage feat(up): add support for launching networks without network config files Apr 14, 2025
@evilrobot-01 evilrobot-01 force-pushed the frank/refactor(up) branch 4 times, most recently from e39f4bd to b4847b8 Compare May 9, 2025 19:51
Copy link
Collaborator

@AlexD10S AlexD10S left a comment

Choose a reason for hiding this comment

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

Great job, this is a really useful feature that makes it much easier for developers to spin up complex local environments. It also opens the door to building a more interactive setup guide or UI, which could really help newcomers onboard more smoothly.

I noticed that in the code you’re introducing the term Parachain again for new structs and methods. Do you think this could be refactored or renamed after the inital refactored we started a month ago.

Just a couple of minor nitpicks:

  • The description example: pop up kusama --port 8833 --parachain asset-hub:9977,pop:9944 doesn't seem to work. Running pop up kusama --help shows that pop isn’t listed as a supported parachain:
  -p, --parachain <PARACHAIN>
          The parachain(s) to be included. An optional parachain identifier and/or port can be affixed
          via #id and :port specifiers (e.g. `asset-hub#1000:9944`) [possible values: asset-hub,
          bridge-hub, coretime, people]
  • The #id:port format (e.g., asset-hub#1000:9944) could be a bit confusing for newcomers. I don’t have a better idea to support a list, but longer-term, an interactive guide or wizard could make this much more approachable.

Once this is merged, it would be worth updating the documentation https://learn.onpop.io/appchains.

@evilrobot-01
Copy link
Contributor Author

evilrobot-01 commented May 15, 2025

It also opens the door to building a more interactive setup guide or UI, which could really help newcomers onboard more smoothly.

I'm not sure it warrants a UI tbh, at least not anytime soon. A UI makes sense for some contexts (e.g. call, where there are many possible calls and many parameters), but slapping a UI on something for the sake of it, when it can be improved to be simpler and therefore more powerful has more value. I would personally rather use shell history/auto-completes with simple commands, than be confronted with a complex UI that I need to interact with for a few minutes each time.

I noticed that in the code you’re introducing the term Parachain again for new structs and methods. Do you think this could be refactored or renamed after the inital refactored we started a month ago.

As discussed separately, will refactor to use 'rollup'.

Just a couple of minor nitpicks:
* The description example: pop up kusama --port 8833 --parachain asset-hub:9977,pop:9944 doesn't seem to work. Running pop up kusama --help shows that pop isn’t listed as a supported parachain:

This is intentional. There is no deployment on Kusama, there is no reserved para on Kusama, there is no runtime specifically targeting Kusama. I updated the example commands in the PR description to remove pop from the kusama example.

* The `#id:port` format (e.g., `asset-hub#1000:9944`) could be a bit confusing for newcomers. 

Perhaps, but anyone that has familiarity with urls should know that ports are specified via :port and fragment identifiers via #hash. This general approach is already used in

/// The url of the git repository of a parachain to be used, with branch/release tag/commit specified as #fragment (e.g. <https://github.com/org/repository#ref>).
/// A specific binary name can also be optionally specified via query string parameter (e.g. <https://github.com/org/repository?binaryname#ref>), defaulting to the name of the repository when not specified.
and is just an optional shorthand to define properties succinctly. An alternative might be json, but then you lose the simplicity.

@evilrobot-01 evilrobot-01 marked this pull request as ready for review May 19, 2025 14:04
@evilrobot-01 evilrobot-01 added ready-for-final-review The PR is ready for final review and removed ready-for-high-level-review The PR needs a high level review labels May 19, 2025
Copy link
Collaborator

@AlexD10S AlexD10S left a comment

Choose a reason for hiding this comment

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

Thanks for addressing my points and answering my questions, everything looks good to me. Great work on this! I just left two comments, but they're minor nitpicks.

@evilrobot-01 evilrobot-01 requested a review from AlexD10S May 20, 2025 20:00
Copy link
Contributor

@chungquantin chungquantin left a comment

Choose a reason for hiding this comment

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

PR looks awesome. This feature improves the experience a lot because users don't need a network file to launch a network. I left a few nitpicks / improvements.

The PR is quite big so there might be things overseen, I still need to test the functionality but other than that, I am happy to approve if everything works well.

Edit: I have a few concerns on how the command can be used here:
Based on the example usage:

pop up paseo -p asset-hub,pop -r stable2412-4
pop up kusama --port 8833 --parachain asset-hub:9944 -r stable2412-4
pop up polkadot --port 8833 --parachain asset-hub:9977,pop#3395:9944 -r stable2412-4
pop up westend -p asset-hub

Would it be cleaner to follow the below command design?

pop up --relay kusama:8833 --para asset-hub:9944 -r stable2412-4

Here we can keep it consistent between the relaychain parameter and parachain parameter. And no new commands introduced. (I know it breaks the overall design of the PR but just something to consider imo).

Another point is the -r tag, why not -v tag for the version?

pop up kusama --port 8833 --parachain asset-hub:9944 -v stable2412-4

@evilrobot-01
Copy link
Contributor Author

Edit: I have a few concerns on how the command can be used here: Based on the example usage:

pop up paseo -p asset-hub,pop -r stable2412-4
pop up kusama --port 8833 --parachain asset-hub:9944 -r stable2412-4
pop up polkadot --port 8833 --parachain asset-hub:9977,pop#3395:9944 -r stable2412-4
pop up westend -p asset-hub

Would it be cleaner to follow the below command design?

pop up --relay kusama:8833 --para asset-hub:9944 -r stable2412-4

Here we can keep it consistent between the relaychain parameter and parachain parameter. And no new commands introduced. (I know it breaks the overall design of the PR but just something to consider imo).

Technically it would be pop up network --relay kusama:8833 --para asset-hub:9944 -r stable2412-4, which is considerably more verbose. The goal of this PR was to make it short and simple. You need a relay on every launch, so why define it as an option/arg? What does --relay kusama bring that is better than pop up kusama besides more typing? The only benefit I can see here is specifying the relay port in a consistent manner which is tempting. The next issue however is now the clash with the existing network subcommand which expects a file, as now we are specifying a file and also specifying a relay and chains. In order to not break that existing subcommand, we would therefore need to introduce a new subcommand, which is what we already have with each of the supported relay subcommands.

Another point is the -r tag, why not -v tag for the version?

pop up kusama --port 8833 --parachain asset-hub:9944 -v stable2412-4

if you look at the existing options for pop up network, you will see there are a number of versions than can be specified (relay binary, relay runtime, system parachain binary, system parachain runtime) so there needs to be more than just -v. This is just the nature of Polkadot.

…red archive contents

refactor(sourcing): introduce archivefilespec struct for defining required archive contents
@chungquantin chungquantin self-requested a review May 29, 2025 01:54
Copy link
Contributor

@chungquantin chungquantin left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for applying my feedback. Functionalities work well. Can't wait to see this feature used in production.

Edit: try runtime test is failing, probably due to the runtime used in the tests upgraded. We can fix it in a separate PR to avoid nuances.

@evilrobot-01 evilrobot-01 merged commit 92b9d02 into main May 29, 2025
28 of 29 checks passed
@evilrobot-01 evilrobot-01 deleted the frank/refactor(up) branch May 29, 2025 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-final-review The PR is ready for final review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants