Commit Graph

80 Commits

Author SHA1 Message Date
edgerunnergit 19454bf56e
Show error instead of panic on passphrase mismatch during solana-keygen (#35072)
* Show error instead of panic on passphrase mismatch

* Format code
2024-02-06 15:32:06 -05:00
samkim-crypto 6a9a89064b
[clap-v3-utils] Deprecate signer source validation (#33802)
* make `SignerSource` implement `Clone`

* add `SignerSourceParserBuilder`

* deprecate `is_keypair`

* deprecate `is_keypair_or_ask_keyword`

* deprecate `is_prompt_signer_source`

* deprecate `is_pubkey_or_keypair`, `is_valid_pubkey`, and `is_valid_signer`

* deprecate `is_pubkey`

* bump deprecation version to 1.17.2

* temporarily allow deprecation for build

* Apply suggestions from code review

Co-authored-by: Tyera <teulberg@gmail.com>

* fix typo `SignerSourceParseBuilder` --> `SignerSourceParserBuilder`

* add `allow_` prefix to `SignerSourceParserBuilder` fields

* remove `SignerSourceParserBuilder::new()` and replace it with `Default`

* Update keygen/src/keygen.rs

Co-authored-by: Trent Nelson <trent.a.b.nelson@gmail.com>

* update deprecated version to `1.18.0`

---------

Co-authored-by: Tyera <teulberg@gmail.com>
Co-authored-by: Trent Nelson <trent.a.b.nelson@gmail.com>
2024-01-06 08:19:54 +09:00
samkim-crypto ec36369e47
[clap-v3-utils] Deprecate input validators and add parsers to replace them (#33276)
* add tests for validating `Pubkey` and `Hash`

* add pubkey signature parser

* add parsers for straightforward validators

* add parser for token amounts

* add parser for derivation and seeds

* resolve warnings from deprecations in clap-v3-utils

* remove some deprecated functions from `solana_keygen`

* refactor signer related input parsers into a submodule

* fix deprecation notice for utl

* refactor parsers in `input_validators` to `input_parsers`

* cargo fmt

* Apply suggestions from code review

Co-authored-by: Trent Nelson <trent.a.b.nelson@gmail.com>

* Update clap-v3-utils/src/input_parsers/mod.rs

Co-authored-by: Trent Nelson <trent.a.b.nelson@gmail.com>

* mionr fixes to build

* add deprecation notice for old `input_parsers::signer` functions

* update `UiTokenAmount` to `Amount`

* refactor to-be-deprecated functions back to `input_parsers/mod.rs

* fmt

---------

Co-authored-by: Trent Nelson <trent.a.b.nelson@gmail.com>
2023-09-28 07:03:41 -07:00
Alexander Meißner 9e703f85de
Upgrades Rust to 1.72.0 & nightly-2023-08-25 (#32961)
* allow pedantic invalid cast lint

* allow lint with false-positive triggered by `test-case` crate

* nightly `fmt` correction

* adapt to rust layout changes

* remove dubious test

* Use transmute instead of pointer cast and de/ref when check_aligned is false.

* Renames clippy::integer_arithmetic to clippy::arithmetic_side_effects.

* bump rust nightly to 2023-08-25

* Upgrades Rust to 1.72.0

---------

Co-authored-by: Trent Nelson <trent@solana.com>
2023-09-01 07:26:13 +00:00
Trent Nelson b8dc5daedb
preliminaries for bumping nightly to 2023-08-25 (#33047)
* remove unnecessary hashes around raw string literals

* remove unncessary literal `unwrap()`s

* remove panicking `unwrap()`

* remove unnecessary `unwrap()`

* use `[]` instead of `vec![]` where applicable

* remove (more) unnecessary explicit `into_iter()` calls

* remove redundant pattern matching

* don't cast to same type and constness

* do not `cfg(any(...` a single item

* remove needless pass by `&mut`

* prefer `or_default()` to `or_insert_with(T::default())`

* `filter_map()` better written as `filter()`

* incorrect `PartialOrd` impl on `Ord` type

* replace "slow zero-filled `Vec` initializations"

* remove redundant local bindings

* add required lifetime to associated constant
2023-08-29 23:05:35 +00:00
Alexander Meißner 67d6d688cc
Refactor - Demotes `Arc` to `Rc`. (#32982)
Demotes `Arc` to `Rc`.
2023-08-25 00:54:06 +02:00
samkim-crypto 618d8cf2a6
[clap-v3-utils, keygen] Refactor mnemonics, derivation path, and argument parsing clap logic in keygen (#30977)
* move mnemonic clap logic from keygen to clap-v3-utils

* move derivation path clap logic from keygen to clap-v3-utils

* move keygen clap logic from keygen to clap-v3-utils

* resolve error from rebase

* resolve conflict from rebase

* reorganize derivation_path and mnemonic as modules inside keygen
2023-05-13 14:30:03 +09:00
Jarry Xiao e14f77790b
Improve keygen grind algo by 10% (#30365)
* Improve algo by 10%

* Fix fmt

* remove trailing whitespace

* Update keygen/src/keygen.rs

Co-authored-by: Trent Nelson <trent.a.b.nelson@gmail.com>

* Fix pubkey! macro usage

* Apply suggestions from code review

Co-authored-by: Kevin Ji <1146876+kevinji@users.noreply.github.com>
Co-authored-by: Trent Nelson <trent.a.b.nelson@gmail.com>

---------

Co-authored-by: mvines <mvines@gmail.com>
Co-authored-by: Trent Nelson <trent.a.b.nelson@gmail.com>
Co-authored-by: Tyera Eulberg <tyera@solana.com>
Co-authored-by: Tyera <teulberg@gmail.com>
Co-authored-by: Kevin Ji <1146876+kevinji@users.noreply.github.com>
2023-04-05 22:36:13 -06:00
samkim-crypto 0ff8a09041
[keygen] refactor argument parsing logic into separate `app(...)` function and add tests (#31015)
* refactor argument parsing and processing for testing

* add tests for command verify

* add tests for command pubkey

* add tests for command new

* add tests for command grind

* clippy

* be explicit about types

* use `try_get_matches` and tempfile

* clippy

* call `Error::exit` on error from `try_get_matches`
2023-04-06 07:43:52 +09:00
behzad nouri 9524c9dbff patches errors from clippy::uninlined_format_args
https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
2022-12-06 19:32:15 +00:00
behzad nouri 9a57c64f21
patches clippy errors from new rust nightly release (#27996) 2022-09-22 22:23:03 +00:00
DimAn 6899af26b0
keygen: add the ability to use derivation path for new & grind commands (#21614)
* keygen: add --use-derivation-path for new & grind

* keygen: add prompt:// uri scheme to new and grind

* fmt

* migrate to clap-v3-utils

* Revert "migrate to clap-v3-utils"

This reverts commit 77f33262ce6c4e95ac1cc62cca32749516f7f357.

* Revert "fmt"

This reverts commit 038cd4ce9628c57dec1f5a4716e2c5baacbe57b3.

* Revert "keygen: add prompt:// uri scheme to new and grind"

This reverts commit 029ea61409a1a16ba2c45483ade2c01f84f25fac.

* - remove `use` from arg
- fix issue from first commit with default value for derivation path
- refactor arg definition and acquiring
2022-09-07 14:31:40 -04:00
DimAn e52157b98b
keygen: fix debug build after migration to clap-v3-utils (#24686) 2022-04-26 21:21:07 +02:00
kirill lykov a22101489c
Clap v3 update: keygen (#24479)
* update clap to v3: keygen

* use clap-v3-utils

* update Cargo.lock

* address PR comments

* get rid of unnecessary generic for clap validator
2022-04-22 12:40:53 +02:00
Peter Johnson e92a81b741
typo: lanaguage -> language (#22009) 2021-12-19 22:33:21 -07:00
Michael Vines b8837c04ec Reformat imports to a consistent style for imports
rustfmt.toml configuration:
  imports_granularity = "One"
  group_imports = "One"
2021-12-03 09:19:13 -08:00
Alexander Meißner 6514096a67 chore: cargo +nightly clippy --fix -Z unstable-options 2021-06-18 10:42:46 -07:00
Tyera Eulberg 22c356d24c
Don't require non-existent param for keygen new (#17896) 2021-06-11 19:25:03 +00:00
steviez 6cba53421e
Disallow bad combination of arguments in keygen grind (#17251)
* Use constant for outfile sentinel value

* Require --use-mnemonic flag when --no-outfile flag passed to keygen grind
2021-05-18 10:35:07 -05:00
Tyera Eulberg b437b0a49d
Add bip32 support to solana-keygen recover (#17180)
* Fix spelling

* Add validator for  SignerSources

* Add helper to generate Keypair from supporting SignerSources

* Add bip32 support to solana-keygen recover

* Make SignerSourceKind const strs, use for Debug impl and URI schemes
2021-05-12 19:33:11 +00:00
Tyera Eulberg a5ec3a0547
SignerSource: rename input scheme to `prompt`, default to bip44 solana base key (#17154)
* Rename ask to prompt

* Default to Solana bip44 base if no derivation-path

* Add SignerSource legacy field, support legacy ASK

* Update docs

* Fix docs: validator current doesn't support uri SignerSources
2021-05-10 19:28:47 -06:00
Tyera Eulberg 694c674aa6
Implement Bip32 for seed-phrase/passphrase signing (#16942)
* Add Keypair helpers for bip32 derivation

* Plumb bip32 for SignerSourceKind::Ask

* Support full-path querystring

* Use as_ref

* Add public wrappers for from_uri cases

* Support master root derivations (and fix too-deep print

* Add ask:// HD documentation

* Update ASK elsewhere in docs
2021-05-03 19:58:56 -06:00
bji e50f598449
Implement mnemonic support for solana-keygen grind (solana-labs#9325) (#16108)
* Implement mnemonic support for solana-keygen grind (solana-labs#9325)

* Updated to include feedback from review.

* Renaming as per review feedback

* Fixed an incorrectly transcribed underscore

* Properly re-use string constants.
2021-03-27 23:47:50 -06:00
Jack May b53cb8eb2d
Deprecate Instruction::new (#15695) 2021-03-04 05:46:48 +00:00
Trent Nelson 7f7370c306 Re-allow clippy::integer_arithmetic at crate-level 2021-02-17 13:55:08 -07:00
Trent Nelson 53423c99aa keygen: Improve messaging around BIP39 passphrase usage 2021-02-02 17:30:13 -07:00
Jon Cinque b948ede624
keygen: Add num-threads argument for grind (#14884)
* keygen: Add num-threads argument

* Review feedback
2021-01-27 21:18:12 +01:00
Michael Vines 7143aaa89b Clippy 2020-12-14 08:03:29 -08:00
Michael Vines e872715fd6 Switch to dirs-next 2020-10-31 18:56:20 +00:00
guanqun 4451042c76
keygen: add more mnemonic language support (#12944) 2020-10-17 10:51:53 +08:00
Greg Fitzgerald 1c498369b5
Remove fee-payer guesswork from Message and Transaction (#10776)
* Make Message::new_with_payer the default constructor

* Remove Transaction::new_[un]signed_instructions

These guess the fee-payer instead of stating it explicitly
2020-06-24 14:52:38 -06:00
Michael Vines 2521f75c18
Advertise node software version in gossip (#9981)
* Advertise node version in gossip

* Remove solana_clap_utils::version! macro
2020-05-11 15:02:01 -07:00
Michael Vines b4b4d6b00d
Write non-error output to stdout (#9960)
automerge
2020-05-11 08:39:10 -07:00
Michael Vines c11abf88b7
Clean up `use` to keep rust 1.43.0 from complaining (#9740) 2020-04-27 16:54:11 -07:00
Greg Fitzgerald 7e48e5859d
Delete dead code (#9670)
automerge
2020-04-22 18:17:23 -07:00
Tyera Eulberg 679e7863cb
Tame wallet manager better (#9567)
automerge
2020-04-18 11:54:21 -07:00
Tyera Eulberg a9c38fb0df
Consider config in check_for_usb (#9555) 2020-04-17 11:37:13 -06:00
Michael Vines 16b2d41dd6 Improve error message on `solana-keygen new` filesystem permission errors 2020-04-16 10:28:49 -07:00
Tyera Eulberg ec4745d174
Tame overeager wallet manager (#9262)
* Add helper fn to check for usb cli args

* Use helper fn to prevent wallet_manager connecting unnecessarily

* Review improvements
2020-04-02 15:47:17 -06:00
Michael Vines 1fd695d337
Use all cores (#8908) 2020-03-24 10:33:53 -07:00
prographo 55907b2167 code layout changes only for ci tests 2020-03-17 10:18:04 -07:00
prographo a03eff51af code layout changes only 2020-03-17 10:18:04 -07:00
prographo 10175618d2 solana-keygen grind: do not ignore case (as default) 2020-03-17 10:18:04 -07:00
Greg Fitzgerald 563da2bb18
Cleanup CLI types (#8888) 2020-03-16 12:27:09 -06:00
Greg Fitzgerald eab4fe50a3
Use types for CLI value names (#8878)
* Use types for CLI value names

* keygen too

* More cleanup

* nonce keypair -> pubkey
2020-03-16 09:24:59 -06:00
Trent Nelson fbf2dd1672
CLI: Error message cleanup (#8804)
automerge
2020-03-12 23:20:49 -07:00
Jack May 6eb4973780
Don't use move semantics if not needed (#8793) 2020-03-11 14:37:23 -07:00
Michael Vines 756ba07b16 Move cli-config default out of cli/ into cli-config/ 2020-03-09 15:43:14 -07:00
Tyera Eulberg 35db70a56c
Use legit solana message in verify (#8513) 2020-02-27 19:23:28 -07:00
Tyera Eulberg 12a9b5f35e
CLI: collect and deduplicate signers (#8398)
* Rename (keypair util is not a thing)

* Add method to generate_unique_signers

* Cli: refactor signer handling and remote-wallet init

* Fixup unit tests

* Fixup intergation tests

* Update keypair path print statement

* Remove &None

* Use deterministic key in test

* Retain storage-account as index

* Make signer index-handling less brittle

* Cache pubkey on RemoteKeypair::new

* Make signer_of consistent + return pubkey

* Remove &matches double references

* Nonce authorities need special handling
2020-02-24 17:03:30 -07:00