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

Allow running a faucet from linera net up #3115

Merged
merged 7 commits into from
Jan 14, 2025
Merged

Conversation

ma2bd
Copy link
Contributor

@ma2bd ma2bd commented Jan 13, 2025

Motivation

First step in addressing #2890

Proposal

  • Make a function of find_owned_chains out of the code in ClientWrapper::drop()
  • Add an option --with-faucet-chain N to linera net up as well as --faucet-port and --faucet-amount
  • Add a simple test

The only caveat is that N cannot be a chain-id (since we wouldn't know what to write) so we use the index amongst root chains (typically 1 for the first non-admin initial chain).

Test Plan

CI

@ma2bd ma2bd requested review from afck, Twey and jvff January 13, 2025 00:33
@ma2bd ma2bd marked this pull request as draft January 13, 2025 02:22
@ma2bd ma2bd marked this pull request as ready for review January 13, 2025 03:31
linera-service/src/cli_wrappers/wallet.rs Outdated Show resolved Hide resolved
linera-service/src/cli_wrappers/wallet.rs Outdated Show resolved Hide resolved
Comment on lines 323 to 328
let chain_ids = client
.find_owned_chains()
.expect("Cannot retrieve chains from linera wallet");
let chain_id = chain_ids.get(faucet_chain as usize).expect(
"Was expecting a number `faucet_chain` in the range `0..=num_other_initial_chains`",
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not ChainID::root(faucet_chain)? That's closer to what the documentation says (the Nth root chain), so it would still be true if we changed the order in which chains appeared in the wallet.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🤦 Yes of course

@ma2bd ma2bd merged commit 29c7584 into linera-io:main Jan 14, 2025
22 checks passed
@ma2bd ma2bd deleted the net_up_faucet branch January 14, 2025 06:29
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