Devnet: Validate account name in CLI

Open Beginner friendly
#472 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
76/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
rust
Domain
cli

Research direction

Start in devnet/src/account.rs at the account-creation path around line 153, then trace where the CLI account name is parsed. Reproduce the failure with the command in the issue, add account-name validation and a user-facing error for dots, and verify the command reports that error instead of panicking.

Written by the indexing model from the issue text.

Description

devex devnet

Account creation fails when the account name contains dots (periods), but the system doesn't provide clear feedback about this restriction to users.

For example the command below will fail with a obscure panic on an unwrap here due to the dots. https://github.com/Near-One/mpc/blob/708f3dd179a62c167aa8e694f506a992abec0e12/devnet/src/account.rs#L153

target/debug/devnet mpc bookrock-2.0.1 new \
        --num-participants 5 \
        --num-responding-access-keys 8 \
        --near-per-responding-account 1

....

thread 'main' panicked at src/account.rs:153:22:
called `Result::unwrap()` on an `Err` value: handler error: [Access key for public key ed25519:4WeHrvJRcgqEF7SUi2GmHtibpr69fkgG9hvZKQcGz1MN has never been observed on the node]
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Add some validation in the CLI to validate the account name, and give a user error.

Dominant language
Rust
Stars
44
Forks
42
Avg merge
1d 13h
Merged PRs (30d)
111

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from near/mpc

All issues in near/mpc

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.