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

[CLI] Direct users to dev docs for testnet faucet, improve messaging #15545

Merged
merged 1 commit into from
Dec 11, 2024

Conversation

banool
Copy link
Contributor

@banool banool commented Dec 9, 2024

Description

We are no longer running a directly accessible faucet for testnet, users must use the minting page at the dev docs: https://aptos.dev/network/faucet. This PR updates the CLI to indicate that. I also improve some of the messaging, e.g. to make it clear that for some networks, creating the account in the CLI doesn't necessarily create the account on chain.

How Has This Been Tested?

New profile on testnet:

cargo run -p aptos -- init --profile testnet01
Configuring for profile testnet01
Choose network from [devnet, testnet, mainnet, local, custom | defaults to devnet]
testnet
Enter your private key as a hex literal (0x...) [Current: Redacted | No input: Generate new key (or keep one if present)]

No key given, keeping existing key...
Account 0xb05362ae4b7b8daed912ccd62b61767eedc5cbb8643aaa7b9e044f346361411f does not exist, you can mint testnet APT using the faucet at https://aptos.dev/network/faucet?address=0xb05362ae4b7b8daed912ccd62b61767eedc5cbb8643aaa7b9e044f346361411f

---
Aptos CLI is now set up for account 0xb05362ae4b7b8daed912ccd62b61767eedc5cbb8643aaa7b9e044f346361411f as profile testnet01!
---

The account has not been created on chain yet. To create the account and get APT on testnet you must visit https://aptos.dev/network/faucet?address=0xb05362ae4b7b8daed912ccd62b61767eedc5cbb8643aaa7b9e044f346361411f
Press [Enter] to go there now >
{
  "Result": "Success"
}

With --assume-yes set:

cargo run -p aptos -- init --profile testnet01 --assume-yes --network testnet
Configuring for profile testnet01
Configuring for network Testnet
Enter your private key as a hex literal (0x...) [Current: None | No input: Generate new key (or keep one if present)]

No key given, generating key...
Account 0x2b389604b9210663fe811654663f65128ad1d80a10c952636ddadc7fdfca7f0b does not exist, you can mint testnet APT using the faucet at https://aptos.dev/network/faucet?address=0x2b389604b9210663fe811654663f65128ad1d80a10c952636ddadc7fdfca7f0b

---
Aptos CLI is now set up for account 0x2b389604b9210663fe811654663f65128ad1d80a10c952636ddadc7fdfca7f0b as profile testnet01!
---

The account has not been created on chain yet. To create the account and get APT on testnet you must visit https://aptos.dev/network/faucet?address=0x2b389604b9210663fe811654663f65128ad1d80a10c952636ddadc7fdfca7f0b

New profile on devnet:

cargo run -p aptos -- init --profile devnet01
Enter your private key as a hex literal (0x...) [Current: None | No input: Generate new key (or keep one if present)]

No key given, generating key...
Account 0x0eca1d17e43d0682680671f2bd0f5da5ce70b53b113e3d6d04ff0277c75a6f14 doesn't exist, creating it and funding it with 100000000 Octas
Account 0x0eca1d17e43d0682680671f2bd0f5da5ce70b53b113e3d6d04ff0277c75a6f14 funded successfully

---
Aptos CLI is now set up for account 0x0eca1d17e43d0682680671f2bd0f5da5ce70b53b113e3d6d04ff0277c75a6f14 as profile devnet01!
---

See the account here: https://explorer.aptoslabs.com/account/0x0eca1d17e43d0682680671f2bd0f5da5ce70b53b113e3d6d04ff0277c75a6f14?network=devnet
{
  "Result": "Success"
}

With --faucet-url set for devnet:

cargo run -p aptos -- init --profile testnet01 --assume-yes --network testnet --faucet-url https://faucet.aptoslabs.com/testnet
Configuring for profile devnet04
Configuring for network Custom
Using command line argument for rest URL https://api.devnet.aptoslabs.com/
Using command line argument for faucet URL https://faucet.devnet.aptoslabs.com/
Enter your private key as a hex literal (0x...) [Current: None | No input: Generate new key (or keep one if present)]

No key given, generating key...
Account 0x9f5205aec1f7d568cca85b063ecf0fb8ff9c5064525cdbc510401d2e772c4e1d doesn't exist, creating it and funding it with 100000000 Octas
Account 0x9f5205aec1f7d568cca85b063ecf0fb8ff9c5064525cdbc510401d2e772c4e1d funded successfully

---
Aptos CLI is now set up for account 0x9f5205aec1f7d568cca85b063ecf0fb8ff9c5064525cdbc510401d2e772c4e1d as profile devnet04!
---

See the account here: https://explorer.aptoslabs.com/account/0x9f5205aec1f7d568cca85b063ecf0fb8ff9c5064525cdbc510401d2e772c4e1d?network=custom
{
  "Result": "Success"
}

New profile on mainnet:

cargo run -p aptos -- init --profile mainnet01
Choose network from [devnet, testnet, mainnet, local, custom | defaults to devnet]
mainnet
Enter your private key as a hex literal (0x...) [Current: None | No input: Generate new key (or keep one if present)]

No key given, generating key...
Account 0x26ac49920c0928090892609c070c152c6ec4d5ad8b0e6025c4b56b0cf269a395 does not exist, you will need to create and fund the account by transferring funds from another account

---
Aptos CLI is now set up for account 0x26ac49920c0928090892609c070c152c6ec4d5ad8b0e6025c4b56b0cf269a395 as profile mainnet01!
---

The account has not been created on chain yet, you will need to create and fund the account by transferring funds from another account
{
  "Result": "Success"
}

Fund account on testnet:

cargo run -p aptos -- account fund-with-faucet --profile testnet01 --network testnet
{
  "Error": "Invalid arguments: To get testnet APT you must visit https://aptos.dev/network/faucet. If you are confident you want to use a faucet programatically, set --faucet-url or add a faucet URL to .aptos/config.yaml for the current profile"
}

With --faucet-url set:

cargo run -p aptos -- account fund-with-faucet --profile testnet01 --faucet-url https://blah.example.com/fund --account 0x1 --amount 10
{
  "Error": "API error: Faucet issue: FaucetClientError { inner: Inner { kind: Request, source: Some(reqwest::Error { kind: Request, url: Url { scheme: \"https\", cannot_be_a_base: false, username: \"\", password: None, host: Some(Domain(\"blah.example.com\")), port: None, path: \"/mint\", query: Some(\"auth_key=0x1&amount=10&return_txns=true\"), fragment: None }, source: hyper::Error(Connect, ConnectError(\"dns error\", Custom { kind: Uncategorized, error: \"failed to lookup address information: nodename nor servname provided, or not known\" })) }) } }: error sending request for url (https://blah.example.com/mint?auth_key=0x1&amount=10&return_txns=true): error trying to connect: dns error: failed to lookup address information: nodename nor servname provided, or not known: error trying to connect: dns error: failed to lookup address information: nodename nor servname provided, or not known: dns error: failed to lookup address information: nodename nor servname provided, or not known: failed to lookup address information: nodename nor servname provided, or not known"
}

Fund account on devnet:

cargo run -p aptos -- account fund-with-faucet --profile devnet01 --account 0x1 --amount 10
{
  "Result": "Added 10 Octas to account 0x1"
}

Fund account on mainnet:

cargo run -p aptos -- account fund-with-faucet --profile mainnet01 --account 0x1 --amount 10
{
  "Error": "Invalid arguments: There is no faucet for mainnet. Please create and fund the account by transferring funds from another account. If you are confident you want to use a faucet, set --faucet-url or add a faucet URL to .aptos/config.yaml for the current profile"
}

Key Areas to Review

See if you can pick up any combination of args I might've missed in my testing.

Type of Change

  • New feature
  • Bug fix
  • Breaking change
  • Performance improvement
  • Refactoring
  • Dependency update
  • Documentation update
  • Tests

Which Components or Systems Does This Change Impact?

  • Validator Node
  • Full Node (API, Indexer, etc.)
  • Move/Aptos Virtual Machine
  • Aptos Framework
  • Aptos CLI/SDK
  • Developer Infrastructure
  • Move Compiler
  • Other (specify)

Checklist

  • I have read and followed the CONTRIBUTING doc
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I identified and added all stakeholders and component owners affected by this change as reviewers
  • I tested both happy and unhappy path of the functionality
  • I have made corresponding changes to the documentation

@banool banool requested a review from gregnazario as a code owner December 9, 2024 20:37
Copy link

trunk-io bot commented Dec 9, 2024

⏱️ 1h 59m total CI duration on this PR
Slowest 15 Jobs Cumulative Duration Recent Runs
execution-performance / single-node-performance 24m 🟩
rust-move-tests 13m 🟩
rust-move-tests 13m 🟩
rust-move-tests 13m 🟩
rust-cargo-deny 11m 🟩🟩🟩🟩 (+2 more)
check-dynamic-deps 10m 🟩🟩🟩🟩🟩 (+2 more)
rust-doc-tests 5m 🟩
rust-move-tests 4m
test-target-determinator 4m 🟩
execution-performance / test-target-determinator 4m 🟩
check 4m 🟩
general-lints 3m 🟩🟩🟩🟩🟩 (+2 more)
semgrep/ci 3m 🟩🟩🟩🟩🟩 (+2 more)
rust-move-tests 2m
fetch-last-released-docker-image-tag 2m 🟩

🚨 1 job on the last run was significantly faster/slower than expected

Job Duration vs 7d avg Delta
execution-performance / single-node-performance 24m 16m +51%

settingsfeedbackdocs ⋅ learn more about trunk.io

@banool banool force-pushed the banool/cli-testnet-faucet branch from 3afb78b to 4533f81 Compare December 9, 2024 20:40
return Err(CliError::CommandArgumentError("There is no faucet for mainnet. Please create and fund the account by transferring funds from another account. If you are confident you want to use a faucet, set --faucet-url or add a faucet URL to .aptos/config.yaml for the current profile".to_string()));
},
Some(Network::Testnet) => {
return Err(CliError::CommandArgumentError("To get testnet APT you must visit https://learn.aptoslabs.com/faucet. If you are confident you want to use a faucet programatically, set --faucet-url or add a faucet URL to .aptos/config.yaml for the current profile".to_string()));
Copy link

Choose a reason for hiding this comment

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

There is a typo in the error message - programatically should be spelled programmatically

Spotted by Graphite Reviewer

Is this helpful? React 👍 or 👎 to let us know.

@banool banool force-pushed the banool/cli-testnet-faucet branch 3 times, most recently from c22d89e to 3461ad3 Compare December 9, 2024 20:48
Comment on lines +385 to +389
eprint!("Press [Enter] to go there now > ");
read_line("Confirmation")?;
open::that(&mint_site_url).map_err(|err| {
CliError::UnexpectedError(format!("Failed to open minting site: {}", err))
})?;
Copy link
Contributor

Choose a reason for hiding this comment

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

hmm interesting, let's try it out and see if people don't like it

@banool banool marked this pull request as draft December 10, 2024 19:53
@banool banool changed the title [CLI] Direct users to Aptos Learn for testnet faucet, improve messaging [CLI] Direct users to dev docs for testnet faucet, improve messaging Dec 11, 2024
@banool banool force-pushed the banool/cli-testnet-faucet branch from 3461ad3 to 6087ac3 Compare December 11, 2024 10:13
@banool banool marked this pull request as ready for review December 11, 2024 16:24
@banool banool enabled auto-merge (squash) December 11, 2024 17:48

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

Copy link
Contributor

✅ Forge suite realistic_env_max_load success on 6087ac35011c969e3696b27975edf8dbf0e678c4

two traffics test: inner traffic : committed: 14694.48 txn/s, latency: 2704.41 ms, (p50: 2700 ms, p70: 2700, p90: 3000 ms, p99: 3300 ms), latency samples: 5587180
two traffics test : committed: 99.99 txn/s, latency: 1389.13 ms, (p50: 1400 ms, p70: 1400, p90: 1500 ms, p99: 1700 ms), latency samples: 1680
Latency breakdown for phase 0: ["MempoolToBlockCreation: max: 1.592, avg: 1.515", "ConsensusProposalToOrdered: max: 0.317, avg: 0.292", "ConsensusOrderedToCommit: max: 0.366, avg: 0.358", "ConsensusProposalToCommit: max: 0.657, avg: 0.650"]
Max non-epoch-change gap was: 1 rounds at version 46181 (avg 0.00) [limit 4], 1.90s no progress at version 46181 (avg 0.20s) [limit 15].
Max epoch-change gap was: 0 rounds at version 0 (avg 0.00) [limit 4], 0.65s no progress at version 2290746 (avg 0.65s) [limit 16].
Test Ok

Copy link
Contributor

✅ Forge suite compat success on 3c6e693a27339e73520f41030dce8fc9cd504967 ==> 6087ac35011c969e3696b27975edf8dbf0e678c4

Compatibility test results for 3c6e693a27339e73520f41030dce8fc9cd504967 ==> 6087ac35011c969e3696b27975edf8dbf0e678c4 (PR)
1. Check liveness of validators at old version: 3c6e693a27339e73520f41030dce8fc9cd504967
compatibility::simple-validator-upgrade::liveness-check : committed: 16773.10 txn/s, latency: 2021.55 ms, (p50: 2100 ms, p70: 2100, p90: 2400 ms, p99: 3600 ms), latency samples: 539920
2. Upgrading first Validator to new version: 6087ac35011c969e3696b27975edf8dbf0e678c4
compatibility::simple-validator-upgrade::single-validator-upgrading : committed: 7096.78 txn/s, latency: 4023.53 ms, (p50: 4500 ms, p70: 4600, p90: 4800 ms, p99: 5400 ms), latency samples: 139720
compatibility::simple-validator-upgrade::single-validator-upgrade : committed: 7585.83 txn/s, latency: 4293.77 ms, (p50: 4600 ms, p70: 4700, p90: 4900 ms, p99: 5100 ms), latency samples: 253180
3. Upgrading rest of first batch to new version: 6087ac35011c969e3696b27975edf8dbf0e678c4
compatibility::simple-validator-upgrade::half-validator-upgrading : committed: 6135.06 txn/s, latency: 4618.32 ms, (p50: 5200 ms, p70: 5600, p90: 5700 ms, p99: 5800 ms), latency samples: 113080
compatibility::simple-validator-upgrade::half-validator-upgrade : committed: 6299.64 txn/s, latency: 5222.29 ms, (p50: 5600 ms, p70: 5700, p90: 5800 ms, p99: 6100 ms), latency samples: 215220
4. upgrading second batch to new version: 6087ac35011c969e3696b27975edf8dbf0e678c4
compatibility::simple-validator-upgrade::rest-validator-upgrading : committed: 11040.27 txn/s, latency: 2519.98 ms, (p50: 2600 ms, p70: 2800, p90: 3400 ms, p99: 3500 ms), latency samples: 192180
compatibility::simple-validator-upgrade::rest-validator-upgrade : committed: 11397.94 txn/s, latency: 2813.70 ms, (p50: 2700 ms, p70: 3300, p90: 3400 ms, p99: 3500 ms), latency samples: 369620
5. check swarm health
Compatibility test for 3c6e693a27339e73520f41030dce8fc9cd504967 ==> 6087ac35011c969e3696b27975edf8dbf0e678c4 passed
Test Ok

Copy link
Contributor

✅ Forge suite framework_upgrade success on 3c6e693a27339e73520f41030dce8fc9cd504967 ==> 6087ac35011c969e3696b27975edf8dbf0e678c4

Compatibility test results for 3c6e693a27339e73520f41030dce8fc9cd504967 ==> 6087ac35011c969e3696b27975edf8dbf0e678c4 (PR)
Upgrade the nodes to version: 6087ac35011c969e3696b27975edf8dbf0e678c4
framework_upgrade::framework-upgrade::full-framework-upgrade : committed: 1195.47 txn/s, submitted: 1198.14 txn/s, failed submission: 2.67 txn/s, expired: 2.67 txn/s, latency: 2706.20 ms, (p50: 2100 ms, p70: 2400, p90: 4200 ms, p99: 11900 ms), latency samples: 107520
framework_upgrade::framework-upgrade::full-framework-upgrade : committed: 1476.04 txn/s, submitted: 1478.74 txn/s, failed submission: 2.70 txn/s, expired: 2.70 txn/s, latency: 2093.96 ms, (p50: 2100 ms, p70: 2300, p90: 3000 ms, p99: 4100 ms), latency samples: 131160
5. check swarm health
Compatibility test for 3c6e693a27339e73520f41030dce8fc9cd504967 ==> 6087ac35011c969e3696b27975edf8dbf0e678c4 passed
Upgrade the remaining nodes to version: 6087ac35011c969e3696b27975edf8dbf0e678c4
framework_upgrade::framework-upgrade::full-framework-upgrade : committed: 1377.38 txn/s, submitted: 1379.43 txn/s, failed submission: 2.04 txn/s, expired: 2.04 txn/s, latency: 2247.15 ms, (p50: 2100 ms, p70: 2400, p90: 3000 ms, p99: 4500 ms), latency samples: 121340
Test Ok

@banool banool merged commit b668137 into main Dec 11, 2024
88 checks passed
@banool banool deleted the banool/cli-testnet-faucet branch December 11, 2024 18:21
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