Skip to content

Commit

Permalink
feat(up parachain): faster binary sourcing (#199)
Browse files Browse the repository at this point in the history
* feat: archive sourcing

* fix: correct pop-node repo

* feat: source code archive sourcing

* refactor: convert http error codes into errors

* test: add network config files

* refactor: use test networks file path

* refactor: improve ux

* test: update tests after refactor

* test: update polkadot version

* refactor: improve implementation and test coverage

* refactor: remove file after rebase

* test: remove legacy integration test

* test: add additional network configurations for manual testing

* docs: restore parachain parameter

* refactor: improve ux when config file missing

* fix: only set latest when no version specified

Ensures that user is not prompted to update to latest when they have explicitly specified a version to use.

* chore: remove test network config

* chore: update test network config

* docs: add link to network config examples
  • Loading branch information
evilrobot-01 authored Jun 21, 2024
1 parent 130e1b2 commit baacdd3
Show file tree
Hide file tree
Showing 21 changed files with 3,710 additions and 1,707 deletions.
9 changes: 9 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@ repository = "https://github.com/r0gue-io/pop-cli"
[workspace.dependencies]
anyhow = "1.0"
assert_cmd = "2.0.14"
predicates = "3.1.0"
dirs = "5.0"
duct = "0.13"
env_logger = "0.11.1"
flate2 = "1.0.30"
duct = "0.13"
git2 = { version = "0.18", features = ["vendored-openssl"] }
glob = "0.3.1"
log = "0.4.20"
mockito = "1.4.0"
predicates = "3.1.0"
tar = "0.4.40"
tempfile = "3.10"
thiserror = "1.0.58"
Expand Down
19 changes: 12 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,18 +108,20 @@ pop build parachain --release
You can spawn a local network using [zombienet](https://github.com/paritytech/zombienet-sdk) as follows:

```shell
pop up parachain -f ./tests/zombienet.toml -p https://github.com/r0gue-io/pop-node
pop up parachain -f ./tests/networks/pop.toml -p https://github.com/r0gue-io/pop-node
```

> :information_source: Pop CLI will automatically source the necessary polkadot binaries. Currently, these will be built
> if on a non-linux system.
> :information_source: Pop CLI will automatically source the necessary `polkadot` binaries.
Various examples of network configuration files are available [here](./tests/networks).

### Run a command after the network has been spun up

The following will spin up the network locally according the the zombienet file and once the network is up, it will run the command specified in `--cmd`:
The following will spin up the network locally according the the zombienet file and once the network is up, it will run
the command specified in `--cmd`:

```shell
pop up parachain -f ./tests/zombienet.toml -p https://github.com/r0gue-io/pop-node --cmd ./path/to/my/script
pop up parachain -f ./tests/networks/pop.toml --cmd ./path/to/my/script
```

### Contracts
Expand All @@ -144,11 +146,13 @@ Build the Smart Contract:
# Build an existing Smart Contract
pop build contract -p ./my_contract
```
By default the contract is compiled with `debug` functionality included.

By default the contract is compiled with `debug` functionality included.

This enables the contract to output debug messages, but increases the contract size and the amount of gas used.

For production builds, use the --release flag: `--release`:

```sh
pop build contract -p ./my_contract --release
```
Expand All @@ -159,7 +163,8 @@ Deploy and instantiate the Smart Contract:
pop up contract -p ./my_contract --constructor new --args "false" --suri //Alice
```

> :information_source: If you don't specify a live chain, `pop` will automatically spawn a local node for testing purposes.
> :information_source: If you don't specify a live chain, `pop` will automatically spawn a local node for testing
> purposes.
Some of the options available are:

Expand Down
1 change: 1 addition & 0 deletions crates/pop-cli/src/commands/install/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ async fn run_external_script(script_url: &str) -> anyhow::Result<()> {
.send()
.await
.context("Network Error: Failed to fetch script from Github")?
.error_for_status()?
.text()
.await?;
fs::write(scripts_path.as_path(), script).await?;
Expand Down
9 changes: 2 additions & 7 deletions crates/pop-cli/src/commands/new/parachain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,13 +321,8 @@ async fn choose_release(template: &Template) -> Result<Option<String>> {
}

async fn get_latest_3_releases(repo: &GitHub) -> Result<Vec<Release>> {
let mut latest_3_releases: Vec<Release> = repo
.get_latest_releases()
.await?
.into_iter()
.filter(|r| !r.prerelease)
.take(3)
.collect();
let mut latest_3_releases: Vec<Release> =
repo.releases().await?.into_iter().filter(|r| !r.prerelease).take(3).collect();
repo.get_repo_license().await?;
// Get the commit sha for the releases
for release in latest_3_releases.iter_mut() {
Expand Down
Loading

0 comments on commit baacdd3

Please sign in to comment.