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

Add network-jumpstart command to entropy-test-cli #1004

Merged
merged 3 commits into from
Aug 14, 2024

Conversation

HCastano
Copy link
Collaborator

This PR adds a way to trigger a network jumpstart from the test CLI. This is useful for ensuring the
network is in the correct state before registering using the new registration flow.

This PR adds a way to trigger a network jumpstart from the test CLI. This is useful for ensuring the
network is in the correct state before registering using the new registration flow.
@HCastano HCastano requested review from ameba23 and JesseAbram August 13, 2024 22:57
@HCastano HCastano changed the title Add network-jumpstart subcommand to entropy-test-cli Add network-jumpstart command to entropy-test-cli Aug 13, 2024
Copy link
Contributor

@ameba23 ameba23 left a comment

Choose a reason for hiding this comment

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

Great. Feels like we are getting close to be able to try all this out

let _result =
submit_transaction_with_pair(api, rpc, &signer, &jump_start_request, None).await?;

let mut blocks_sub = api.blocks().subscribe_finalized().await?;
Copy link
Contributor

Choose a reason for hiding this comment

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

Ah i didn't know about this, this is so much nicer that polling with a timer.


let mut blocks_sub = api.blocks().subscribe_finalized().await?;

while let Some(block) = blocks_sub.next().await {
Copy link
Contributor

Choose a reason for hiding this comment

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

What happens if the jump start DKG fails? Im guessing we just wont get confirmations and this will hang forever.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah right now it would just sit waiting for the event 😅

JumpstartNetwork {
/// The mnemonic for the signer which will trigger the jumpstart process.
#[arg(short, long)]
mnemonic_option: Option<String>,
Copy link
Contributor

Choose a reason for hiding this comment

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

unrelated to this PR but i still think its insane that this isn't a positional argument

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I actually don't think it should be positional 😉 But we do need to refactor the CLI UX at some point, it's not as consistent or friendly as it can be

// In this case we don't care too much about the result because we're more interested in the
// `FinishedNetworkJumpStart` event, which happens later on.
let jump_start_request = entropy::tx().registry().jump_start_network();
let _result =
Copy link
Contributor

Choose a reason for hiding this comment

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

It says in the doccomment that this fails if the network has already been jumpstarted. I can't see where that would happen. Isn't there also a case where the network is not yet ready to be jumpstarted because of too few validators? Or do we just manually decide when its ready by running this command.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, so what would happen is when we submit the jump_start_network() extrinsic we'd get back one of those errors instead of a success event (StartedNetworkJumpStart), and then we'd bail out of this function

Copy link
Member

@JesseAbram JesseAbram 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 good maybe some like concept of it it has run for X time fail the command so it doesn't hang forever, also maybe an exit case where it checks if the network is already jumpstarted and returns a message saying that

@@ -33,7 +33,7 @@ anyhow ="1.0.86"

# Only for the browser
js-sys={ version="0.3.70", optional=true }
tokio ="1.39"
tokio ={ version="1.39", features=["time"] }
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@ameba23 not sure if adding this feature will be problematic for Wasm compilation. In the docs it seems like it's fine as long as the Wasm environment is in the web, so not wasm32-unknown-unknown.

Copy link
Contributor

Choose a reason for hiding this comment

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

i guess if it turns out to be a problem we can find a way to fix it

@HCastano HCastano merged commit 314f6be into master Aug 14, 2024
8 of 9 checks passed
@HCastano HCastano deleted the hc/add-jumpstart-to-cli branch August 14, 2024 20:43
ameba23 added a commit that referenced this pull request Aug 15, 2024
* master:
  Bump serde_json from 1.0.124 to 1.0.125 in the patch-dependencies group (#1007)
  Signing flow with derived accounts (#990)
  Add `network-jumpstart` command to `entropy-test-cli` (#1004)
  Refactor reshare (#994)
  Migrate circle-ci workflow to github actions (#991)
  Delete old keyshare if not in next_signers (#999)
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.

3 participants