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

feat: deploy parachain #404

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

feat: deploy parachain #404

wants to merge 11 commits into from

Conversation

AlexD10S
Copy link
Collaborator

@AlexD10S AlexD10S commented Feb 9, 2025

This PR updates pop-cli to support one-command, production-ready parachain deployments.

How to test it
Start the Paseo parachain locally by running:

pop up parachain -f ./tests/networks/paseo.toml

Run pop up in your parachain folder or specify the folder with the path flag

pop up --path ../test-chain --relay-chain-url ws://127.0.0.1:49155

For more information run:

pop up --help 

Copy link

codecov bot commented Feb 9, 2025

Codecov Report

Attention: Patch coverage is 69.40299% with 246 lines in your changes missing coverage. Please review.

Project coverage is 75.18%. Comparing base (87a0ab8) to head (3542b59).

Files with missing lines Patch % Lines
crates/pop-cli/src/commands/up/rollup.rs 67.52% 45 Missing and 56 partials ⚠️
crates/pop-cli/src/commands/build/spec.rs 61.18% 47 Missing and 12 partials ⚠️
crates/pop-cli/src/commands/call/chain.rs 58.13% 12 Missing and 6 partials ⚠️
crates/pop-cli/src/common/wallet.rs 0.00% 17 Missing ⚠️
crates/pop-parachains/src/build/runtime.rs 87.87% 6 Missing and 10 partials ⚠️
crates/pop-parachains/src/call/mod.rs 69.44% 3 Missing and 8 partials ⚠️
crates/pop-cli/src/commands/up/mod.rs 76.47% 0 Missing and 8 partials ⚠️
crates/pop-cli/src/common/chain.rs 75.00% 0 Missing and 6 partials ⚠️
crates/pop-parachains/src/build/mod.rs 88.23% 0 Missing and 4 partials ⚠️
crates/pop-common/src/account_id.rs 81.25% 0 Missing and 3 partials ⚠️
... and 3 more
@@            Coverage Diff             @@
##             main     #404      +/-   ##
==========================================
- Coverage   75.28%   75.18%   -0.10%     
==========================================
  Files          64       68       +4     
  Lines       14188    14892     +704     
  Branches    14188    14892     +704     
==========================================
+ Hits        10681    11197     +516     
- Misses       2145     2237      +92     
- Partials     1362     1458      +96     
Files with missing lines Coverage Δ
crates/pop-cli/src/commands/call/contract.rs 80.38% <ø> (ø)
crates/pop-cli/src/commands/mod.rs 25.00% <100.00%> (ø)
crates/pop-common/src/lib.rs 74.50% <ø> (ø)
crates/pop-contracts/src/call.rs 73.25% <ø> (ø)
crates/pop-contracts/src/utils/mod.rs 81.81% <ø> (-0.69%) ⬇️
crates/pop-parachains/src/call/metadata/mod.rs 93.11% <ø> (-0.04%) ⬇️
crates/pop-cli/src/commands/up/contract.rs 40.95% <0.00%> (ø)
crates/pop-cli/src/commands/up/network.rs 6.81% <0.00%> (ø)
crates/pop-parachains/src/relay.rs 82.60% <0.00%> (-0.91%) ⬇️
crates/pop-common/src/account_id.rs 81.25% <81.25%> (ø)
... and 9 more
🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@AlexD10S AlexD10S force-pushed the feat/deploy-parachain branch from 511e547 to 945a8ac Compare February 14, 2025 12:22
Base automatically changed from refactor/pop-up to main February 17, 2025 12:08
@AlexD10S AlexD10S force-pushed the feat/deploy-parachain branch 2 times, most recently from df55096 to 0a64db8 Compare February 17, 2025 16:34
Copy link
Contributor

@evilrobot-01 evilrobot-01 left a comment

Choose a reason for hiding this comment

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

Comments only as still a draft. Suggestions around rollup are simply based on the fact that we have to start somewhere. I think any new code should use rollup. We can then create a separate PR to add aliases etc and then simply rebase this PR as/when.

Also surprised you are using strings over enums - that should be addressed imo.

A few other general observations:

  • Not sure we need network if we are specifying -f ? Counter argument is if we are using network then we dont need to specify -f, it could just be pop u n ./network.toml. Or if we rename -f to -n, then pop up -n ./network.toml
  • cargo run -- up --help shows a 'smart contract deployment options' section but nothing for rollups?
  • we could still have the subcommands (contract, rollup, network), just optional. These can just be command aliases that map into the existing functions for pop up. Help text could be taken from the subcommand when generating the main help for pop up. I cant say what the technical complexities might be tho.
  • pop up --path ../test-chain --relay-url ws://127.0.0.1:49155 in the readme doesnt work
  • readme should be updated to rollup

@AlexD10S
Copy link
Collaborator Author

AlexD10S commented Mar 1, 2025

  • Not sure we need network if we are specifying -f ? Counter argument is if we are using network then we dont need to specify -f, it could just be pop u n ./network.toml. Or if we rename -f to -n, then pop up -n ./network.toml

In my opinion, this approach makes it much clearer for the user: pop up deploys the project, while the network subcommand is used specifically for launching a local network.

We follow the same pattern with pop build, it builds the project, and for more specific logic like building specs, we use the spec subcommand.
That said, I agree that the -f flag can be avoided.

@AlexD10S AlexD10S force-pushed the feat/deploy-parachain branch 2 times, most recently from 4f594c4 to 75896e8 Compare March 5, 2025 21:47
AlexD10S added 11 commits March 10, 2025 11:13
* feat: deploy a parachain commands

* feat: build specs in pop up

* feat: logic to interact with a chain

* feat: register parachain

* refactor: clean code and improve docs

* test: unit tests for pop up methods

* refactor: small fixes with visibility and removing logs

* feat: return events in submit_signed_extrinsic

* feat: get para_id from event

* test: fix detects_parachain_correctly

* refactor: improve docs and code

* test: fix change_working_directory_works

* fix: clippy warnings

* refactor: move submit_extrinsic_with_wallet in a common file

* refactor: remove unnecesary code

* refactor: UpChainCommand structure

* test: adjust tests to refactored struct

* refactor: renaming prepare_register_parachain_call_data and prepare_rerve_parachain_call_data

* refactor: move events module

* fix: submit_extrinsic_with_wallet under parachain feature

* refactor: remove unnecesary code

* test: increase coverage with reserve_parachain_id_fails_wrong_chain and resolve_genesis_files_fails_wrong_path

* refactor: remove unnecesary clones

* refactor: minor improvements

* test: refactor tests and include comments

* refactor: map errors in submit_extrinsic_with_wallet

* test: fix prepare_register_parachain_call_data_works

* refactor: move configure_chain into a common folder

* refactor: function visibility

* fix: error message and include test for it

* refactor: build specs removing repetitive code

* refactor: use prepare_extrinsic from Call module to prepare a call

* docs: improve comments and messages

* refactor: rename variables and structs

* refactor: relay_chain_url

* refactor: rename prepare_reserve_call_data and prepare_register_call_data

* test: remove unnecesary test

* refactor: remove events module

* refactor: rename parachain to rollup

* chore: improve succesful message

* chore: change intro title to use rollup

* docs: comments for Reserved event

* refactor: improve readability with chain::configure

* refactor: improve message and clean code
* test: detects_project_type_correctly

* feat: parachain deployment in pop up

* fix: parachain feature

* docs: improve comments

* feat: deploy a parachain commands

* feat: build specs in pop up

* feat: logic to interact with a chain

* feat: register parachain

* refactor: clean code and improve docs

* test: unit tests for pop up methods

* refactor: small fixes with visibility and removing logs

* feat: return events in submit_signed_extrinsic

* feat: get para_id from event

* test: fix detects_parachain_correctly

* refactor: improve docs and code

* test: fix change_working_directory_works

* fix: clippy warnings

* refactor: move submit_extrinsic_with_wallet in a common file

* refactor: remove unnecesary code

* refactor: UpChainCommand structure

* test: adjust tests to refactored struct

* refactor: renaming prepare_register_parachain_call_data and prepare_rerve_parachain_call_data

* refactor: move events module

* fix: submit_extrinsic_with_wallet under parachain feature

* refactor: remove unnecesary code

* test: increase coverage with reserve_parachain_id_fails_wrong_chain and resolve_genesis_files_fails_wrong_path

* refactor: remove unnecesary clones

* refactor: minor improvements

* test: refactor tests and include comments

* refactor: map errors in submit_extrinsic_with_wallet

* test: fix prepare_register_parachain_call_data_works

* feat: container_engine to detect container to use

* feat: generate_deterministic_runtime logic

* feat: srtool logic

* feat: build deterministic runtime in build spec command

* feat: update_runtime_code

* test: include tests for updateing code

* refactor: clean unnecesary code

* test: in container_engine

* refactor: docker warning in container_engine

* chore: improve screen messaging

* refactor: use profile picked by the user

* refactor: docs in ContainerEngine and clean prints

* fix: generate_deterministic_runtime parameter

* refactor: rename, improve messages and clean empty lines

* feat: extract package name automatically from runtime dir

* docs: change broken link

* refactor: update srtool_lib crate and remove unnecesary code

* docs: include srtool in Acknowledgements

* refactor: remove unnecesary Error

* test: detects_project_type_correctly

* feat: parachain deployment in pop up

* fix: parachain feature

* docs: improve comments

* feat: replace index.html with summary costs in ui (#430)

* refactor: rename parachain to rollup

* docs: improve deprecation message

* refactor: rename parachain to rollup in up help

* feat: deploy a parachain commands

* feat: build specs in pop up

* feat: logic to interact with a chain

* feat: register parachain

* refactor: clean code and improve docs

* test: unit tests for pop up methods

* refactor: small fixes with visibility and removing logs

* feat: return events in submit_signed_extrinsic

* feat: get para_id from event

* test: fix detects_parachain_correctly

* refactor: improve docs and code

* test: fix change_working_directory_works

* fix: clippy warnings

* refactor: move submit_extrinsic_with_wallet in a common file

* refactor: remove unnecesary code

* refactor: UpChainCommand structure

* test: adjust tests to refactored struct

* refactor: renaming prepare_register_parachain_call_data and prepare_rerve_parachain_call_data

* refactor: move events module

* fix: submit_extrinsic_with_wallet under parachain feature

* refactor: remove unnecesary code

* test: increase coverage with reserve_parachain_id_fails_wrong_chain and resolve_genesis_files_fails_wrong_path

* refactor: remove unnecesary clones

* refactor: minor improvements

* test: refactor tests and include comments

* refactor: map errors in submit_extrinsic_with_wallet

* test: fix prepare_register_parachain_call_data_works

* refactor: move configure_chain into a common folder

* refactor: function visibility

* fix: error message and include test for it

* refactor: build specs removing repetitive code

* refactor: use prepare_extrinsic from Call module to prepare a call

* docs: improve comments and messages

* refactor: rename variables and structs

* refactor: relay_chain_url

* refactor: rename prepare_reserve_call_data and prepare_register_call_data

* test: remove unnecesary test

* refactor: remove events module

* refactor: rename parachain to rollup

* chore: improve succesful message

* chore: change intro title to use rollup

* docs: comments for Reserved event

* chore: always prompt the user to build runtime deterministacally and improve message

* docs: improve and add missing comments

* refactor: clean code to prompt for the package and runtime dir

* docs: improve warning message

* refactor: rename variables and structs

* fix: throw error message when build deterministic runtime fail

* feat: include skip_deterministic_build flag to avoid prompting the user

* docs: improve comments
* test: detects_project_type_correctly

* feat: parachain deployment in pop up

* fix: parachain feature

* docs: improve comments

* feat: deploy a parachain commands

* feat: build specs in pop up

* feat: logic to interact with a chain

* feat: register parachain

* refactor: clean code and improve docs

* test: unit tests for pop up methods

* refactor: small fixes with visibility and removing logs

* feat: return events in submit_signed_extrinsic

* feat: get para_id from event

* test: fix detects_parachain_correctly

* refactor: improve docs and code

* test: fix change_working_directory_works

* fix: clippy warnings

* refactor: move submit_extrinsic_with_wallet in a common file

* refactor: remove unnecesary code

* refactor: UpChainCommand structure

* test: adjust tests to refactored struct

* refactor: renaming prepare_register_parachain_call_data and prepare_rerve_parachain_call_data

* refactor: move events module

* fix: submit_extrinsic_with_wallet under parachain feature

* refactor: remove unnecesary code

* test: increase coverage with reserve_parachain_id_fails_wrong_chain and resolve_genesis_files_fails_wrong_path

* refactor: remove unnecesary clones

* refactor: minor improvements

* test: refactor tests and include comments

* refactor: map errors in submit_extrinsic_with_wallet

* test: fix prepare_register_parachain_call_data_works

* refactor: move configure_chain into a common folder

* refactor: function visibility

* fix: error message and include test for it

* feat: construct_proxy_extrinsic

* feat: prompt for proxy address in the UI

* docs: improve flag description and display command to be executed

* docs: improve prompt to the user message for proxy

* feat: replace index.html with costs for calls with proxy in ui

* refactor: remove display command information (separate PR)

* test: fix resolve_proxy_address_works

* refactor: rename and more clear messages for the user to prompt proxied account

* chore: update index.html with latest changes

* test: fix format

* test: detects_project_type_correctly

* feat: parachain deployment in pop up

* fix: parachain feature

* docs: improve comments

* feat: replace index.html with summary costs in ui (#430)

* refactor: rename parachain to rollup

* docs: improve deprecation message

* refactor: rename parachain to rollup in up help

* feat: deploy a parachain commands

* feat: build specs in pop up

* feat: logic to interact with a chain

* feat: register parachain

* refactor: clean code and improve docs

* test: unit tests for pop up methods

* refactor: small fixes with visibility and removing logs

* feat: return events in submit_signed_extrinsic

* feat: get para_id from event

* test: fix detects_parachain_correctly

* refactor: improve docs and code

* test: fix change_working_directory_works

* fix: clippy warnings

* refactor: move submit_extrinsic_with_wallet in a common file

* refactor: remove unnecesary code

* refactor: UpChainCommand structure

* test: adjust tests to refactored struct

* refactor: renaming prepare_register_parachain_call_data and prepare_rerve_parachain_call_data

* refactor: move events module

* fix: submit_extrinsic_with_wallet under parachain feature

* refactor: remove unnecesary code

* test: increase coverage with reserve_parachain_id_fails_wrong_chain and resolve_genesis_files_fails_wrong_path

* refactor: remove unnecesary clones

* refactor: minor improvements

* test: refactor tests and include comments

* refactor: map errors in submit_extrinsic_with_wallet

* test: fix prepare_register_parachain_call_data_works

* refactor: move configure_chain into a common folder

* refactor: function visibility

* fix: error message and include test for it

* refactor: build specs removing repetitive code

* refactor: use prepare_extrinsic from Call module to prepare a call

* docs: improve comments and messages

* refactor: rename variables and structs

* refactor: relay_chain_url

* refactor: rename prepare_reserve_call_data and prepare_register_call_data

* test: remove unnecesary test

* refactor: remove events module

* refactor: rename parachain to rollup

* chore: improve succesful message

* chore: change intro title to use rollup

* docs: comments for Reserved event

* refactor: clean code to avoid unnecesary clone

* feat: wrap Id by default in the proxy address and improve comment

* refactor: remove ProxyConfig and use Proxy

* refactor: resolve_proxied_address

* fix: change visibility for prompt_for_param

* refactor: more clarity in code variables and comments

* refactor: custom message to prompt for proxy address

* refactor: support only Account Id type for proxied_address

* test: remove unnecesary async in resolve_proxied_address_works
@AlexD10S AlexD10S force-pushed the feat/deploy-parachain branch from 13bb837 to 3542b59 Compare March 10, 2025 10:14
@AlexD10S AlexD10S marked this pull request as ready for review March 10, 2025 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants