-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Cli: Fix create-with-seed #8706
Cli: Fix create-with-seed #8706
Conversation
@garious , after this lands, this works:
|
Can't fix a regression without a test. |
404075f
to
f103fca
Compare
f103fca
to
269ad75
Compare
✔️ |
Codecov Report
@@ Coverage Diff @@
## master #8706 +/- ##
========================================
- Coverage 80.0% 80.0% -0.1%
========================================
Files 260 260
Lines 56399 56460 +61
========================================
+ Hits 45164 45212 +48
- Misses 11235 11248 +13 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
let config_pubkey = config.pubkey()?; | ||
let from_pubkey = from_pubkey.unwrap_or(&config_pubkey); | ||
let address = create_address_with_seed(from_pubkey, seed, program_id)?; | ||
let from_pubkey = if let Some(pubkey) = from_pubkey { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: unwrap_or()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't use ?
in a closure that returns a Pubkey, so the current construction seems simpler to me for the else
case.
* Add failing test * Fix create-address-with-seed regression * Add apis to enable generating a pubkey from all various signers * Enable other signers as --from in create-with-seed (cherry picked from commit eab80d0)
Problem
solana create-with-seed ...
errors our no matter what from or config keypair is provided.Also, users might want to derive keys from any kind of signer, including hardware wallets or seed phrases, and there is currently no support for that.
Summary of Changes
--from
and config keypair setting appropriately to fix subcommandpubkey_of_signer()
method to generate a pubkey from any kind of acceptable signer and use to extend create-with-seed functionality (we may want to use this method in other cli subcommands; will examine and pr separately)Fixes #8696