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

cast send help text incorrect and incomplete #2296

Closed
2 tasks done
moodysalem opened this issue Jul 13, 2022 · 8 comments
Closed
2 tasks done

cast send help text incorrect and incomplete #2296

moodysalem opened this issue Jul 13, 2022 · 8 comments
Labels
C-cast Command: cast T-bug Type: bug

Comments

@moodysalem
Copy link

moodysalem commented Jul 13, 2022

Component

Cast

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge 0.2.0 (16b4ef6 2022-07-13T00:15:34.493056Z)

What command(s) is the bug in?

cast send

Operating System

macOS (Apple Silicon)

Describe the bug

re: https://twitter.com/msolomon44/status/1545848902674530305

cast send does not actually require the etherscan api key, but the usage text made me think that it does since it's the only argument described and included in the usage example

moody@MacBook-Pro ~> cast send
error: The following required arguments were not provided:
    <TO>

USAGE:
    cast send --etherscan-api-key <KEY> <TO>
@moodysalem moodysalem added the T-bug Type: bug label Jul 13, 2022
@gakonst gakonst added this to Foundry Jul 13, 2022
@gakonst gakonst moved this to Todo in Foundry Jul 13, 2022
@mattsse
Copy link
Member

mattsse commented Jul 13, 2022

can't reproduce this

cast send                                                                                                                                                                                                                                  
error: The following required arguments were not provided:
    <TO>

USAGE:
    cast send [OPTIONS] <TO> [ARGS]

For more information try --help
cast --version                                                                                                                                                                                                                             
cast 0.2.0 (16b4ef6 2022-07-13T00:07:21.31175Z)

@mds1
Copy link
Collaborator

mds1 commented Jul 13, 2022

Here's my output with cast 0.2.0 (16b4ef6 2022-07-13T00:07:21.31175Z), which it seems is different than both of the above.

I'm on an intel macOS (so no M1), in case this is somehow OS dependent (which would be surprising). I get the same output running cast send within a forge project and within a random directory. My best guess is this has something to do with set env vars? I have ETH_RPC_URL and ETHERSCAN_API_KEY always set in my ~/.zshrc, and a while back I setup a keystore with dapptools, so presumably all 3 of those are being picked up and guiding the help text.

$ cast send
error: The following required arguments were not provided:
    <TO>

USAGE:
    cast send --rpc-url <URL> --etherscan-api-key <KEY> --keystore <PATH> <TO>

For more information try --help

@onbjerg
Copy link
Member

onbjerg commented Jul 14, 2022

I get this:

$ cast send
error: The following required arguments were not provided:
    <TO>

USAGE:
    cast send [OPTIONS] <TO> [ARGS]

For more information try --help

On Manjaro

$ uname -a
Linux dagr 5.16.20-2-MANJARO #1 SMP PREEMPT Thu Apr 14 06:44:39 UTC 2022 x86_64 GNU/Linux

Regardless, all of this is generated by Clap, so it's not really something we have complete control over. My best guess is that we all use different terminal emulators, and maybe Clap can query dimensions for some of them and display more info when the terminal is wide, and less when it is thin?

@onbjerg onbjerg added the C-cast Command: cast label Jul 14, 2022
@mattsse
Copy link
Member

mattsse commented Jul 14, 2022

turns out, the clap env feature is responsible for this: https://docs.rs/clap/latest/clap/#optional-features

env: Turns on the usage of environment variables during parsing.

export ETHERSCAN_API_KEY=...

 cast send
error: The following required arguments were not provided:
    <TO>

USAGE:
    cast send --etherscan-api-key <KEY> <TO>

For more information try --help

so that makes sense, but it looks like the core is is that we have a bunch of additional arguments that are not needed here @onbjerg ?

@onbjerg
Copy link
Member

onbjerg commented Jul 15, 2022

Unsure why it's there, it isn't marked as required anywhere

@onbjerg
Copy link
Member

onbjerg commented Aug 11, 2022

The fix would be to write a custom args type since the one for cast send has a bunch of options we don't need, but the underlying behavior is in clap-rs

@agostbiro
Copy link
Contributor

I can't repro this as of the latest commit in master with cast 0.2.0 (2ffa619 2023-06-12T10:47:29.109702000Z).

After

export ETHERSCAN_API_KEY=...

cast send exits with a connection error if Anvil isn't running:

$ cast send
Error:
error sending request for url (http://localhost:8545/): error trying to connect: tcp connect error: Connection refused (os error 61)

Context:
- Error #0: error trying to connect: tcp connect error: Connection refused (os error 61)
- Error #1: tcp connect error: Connection refused (os error 61)
- Error #2: Connection refused (os error 61)

Or with a wallet error if Anvil is running:

$ cast send

Error:
Error accessing local wallet. Did you set a private key, mnemonic or keystore?
Run `cast send --help` or `forge create --help` and use the corresponding CLI
flag to set your key via:
--private-key, --mnemonic-path, --aws, --interactive, --trezor or --ledger.
Alternatively, if you're using a local node with unlocked accounts,
use the --unlocked flag and either set the `ETH_FROM` environment variable to the address
of the unlocked account you want to use, or provide the --from flag with the address directly.

@Evalir
Copy link
Member

Evalir commented Jun 12, 2023

Yup this should not be the case anymore after we fixed up the cast send command on #4874. Will close

@Evalir Evalir closed this as completed Jun 12, 2023
@github-project-automation github-project-automation bot moved this from Todo to Done in Foundry Jun 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-cast Command: cast T-bug Type: bug
Projects
Archived in project
Development

No branches or pull requests

6 participants