FuelLabs / fuel-core

Rust full node implementation of the Fuel v2 protocol.
Other
57.96k stars 2.79k forks source link

Allow --keypair to take a filename containing a single secret key #2266

Open alfiedotwtf opened 1 month ago

alfiedotwtf commented 1 month ago

This has tripped me up before, and now someone on the forum has hit the same user error:

https://forum.fuel.network/t/error-running-a-fuel-core-test-node-on-an-arm64-board/6735

The --keypair command line argument currently accepts either:

For usability, I think --keypair should accept 3 type of values:

On this, I have never actually gotten --keypair <filename> to work. Even when using the fixture from https://github.com/FuelLabs/fuel-vm/blob/master/fuel-crypto/src/tests/mnemonic.rs:

echo "oblige salon price punch saddle immune slogan rare snap desert retire surprise" > keypair.txt
fuel-core run --service-name=testnet-node --keypair keypair.txt ...
Error: InvalidMnemonic

While here, I think two tests (using https://docs.rs/rexpect/latest/rexpect/) should be added:

xgreenx commented 1 month ago

We already support .env file, so you can use it to pass keypair.

But to make it work properly, I think we need to teach binary to work with 12 word mnemonic phrase via the CLI as well.

MitchTurner commented 3 weeks ago

How about adding new args?

Honestly, overloading the --keypair is also, already, confusing to me. Or at least unexpected. So I'd prefer something like --secret-key --secret-key-path and --secret-phrase-path.

But @xgreenx makes a good point as well.