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(up-parachain): enable optional verbose output #79

Merged
merged 4 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Cargo.lock

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

15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,17 +133,18 @@ Some of the options available are:
For more information about the options,
check [cargo-contract documentation](https://github.com/paritytech/cargo-contract/blob/master/crates/extrinsics/README.md#instantiate)


Interacting with the Smart Contract:

1. Read-only Operations: For operations that only require reading from the blockchain state. This approach does not require to submit an extrinsic (skip the flag `x/--execute`).
Example using the get() message:
1. Read-only Operations: For operations that only require reading from the blockchain state. This approach does not
require to submit an extrinsic (skip the flag `x/--execute`).
Example using the get() message:

```sh
pop call contract -p ./my_contract --contract $INSTANTIATED_CONTRACT_ADDRESS --message get --suri //Alice
```

2. State-modifying Operations: For operations that change a storage value, thus altering the blockchain state. Include the `x/--execute` flag to submit an extrinsic on-chain.
2. State-modifying Operations: For operations that change a storage value, thus altering the blockchain state. Include
the `x/--execute` flag to submit an extrinsic on-chain.

Example executing the `flip()` message:

Expand Down Expand Up @@ -204,3 +205,9 @@ pop up parachain -f ./tests/zombienet.toml -p https://github.com/r0gue-io/pop-no

> :information_source: Pop CLI will automatically source the necessary polkadot binaries. Currently, these will be built
> if on a non-linux system.

## Acknowledgements

Pop CLI would not be possible without these awesome crates!
evilrobot-01 marked this conversation as resolved.
Show resolved Hide resolved

- Local network deployment powered by [zombienet-sdk](https://github.com/paritytech/zombienet-sdk)
2 changes: 1 addition & 1 deletion src/commands/up/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub(crate) struct UpArgs {
#[derive(Subcommand)]
pub(crate) enum UpCommands {
#[cfg(feature = "parachain")]
/// Deploy a parachain to a network.
/// Deploy a parachain to a local network.
#[clap(alias = "p")]
Parachain(parachain::ZombienetCommand),
#[cfg(feature = "contract")]
Expand Down
18 changes: 14 additions & 4 deletions src/commands/up/parachain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ use zombienet_sdk::NetworkNode;

#[derive(Args)]
pub(crate) struct ZombienetCommand {
/// The configuration file to be used. Only Zombienet configuration files are currently
/// supported.
/// The Zombienet configuration file to be used.
#[arg(short, long)]
file: String,
/// The version of Polkadot to be used for the relay chain, as per the release tag (e.g.
Expand All @@ -21,6 +20,9 @@ pub(crate) struct ZombienetCommand {
/// The url of the git repository of a parachain to be used, with branch/release tag specified as #fragment (e.g. 'https://github.com/org/repository#tag'). A specific binary name can also be optionally specified via query string parameter (e.g. 'https://github.com/org/repository?binaryname#tag'), defaulting to the name of the repository when not specified.
#[arg(short, long)]
parachain: Option<Vec<String>>,
/// Whether the output should be verbose.
#[arg(short, long, action)]
AlexD10S marked this conversation as resolved.
Show resolved Hide resolved
verbose: bool,
}
impl ZombienetCommand {
pub(crate) async fn execute(&self) -> anyhow::Result<()> {
Expand Down Expand Up @@ -71,12 +73,20 @@ impl ZombienetCommand {

let output = |node: &NetworkNode| -> String {
let name = node.name();
format!(
let mut output = format!(
"\n{bar} {name}:
{bar} portal: https://polkadot.js.org/apps/?rpc={}#/explorer
{bar} logs: tail -f {base_dir}/{name}/{name}.log",
node.ws_uri(),
)
);
if self.verbose {
output += &format!(
"\n{bar} command: {} {}",
node.spec().command(),
node.args().join(" ")
);
}
output
};
// Add relay info
let mut validators = network.relaychain().nodes();
Expand Down
Loading