CLI: Fix create-nonce-account with seed (#8929)

* CLI: Fix `create-nonce-account --seed ...`

* CLI: Add test another for `create-nonce-account --seed...`

Explicitly demonstrates a partner workflow with the following
requirements:
1) Nonce account address derived from an offline nonce
authority address
2) Fully online account creation
3) Account creation in a single signing session

* alphabetize
This commit is contained in:
Trent Nelson
2020-03-19 10:36:53 -06:00
committed by GitHub
parent f78a90bce2
commit ff4ba54553
3 changed files with 142 additions and 11 deletions

View File

@ -41,6 +41,7 @@ use solana_sdk::{
pubkey::Pubkey,
signature::{Keypair, Signature, Signer, SignerError},
system_instruction::{self, create_address_with_seed, SystemError, MAX_ADDRESS_SEED_LEN},
system_program,
transaction::{Transaction, TransactionError},
};
use solana_stake_program::{
@ -1066,9 +1067,10 @@ pub fn parse_create_address_with_seed(
};
let program_id = match matches.value_of("program_id").unwrap() {
"NONCE" => system_program::id(),
"STAKE" => solana_stake_program::id(),
"VOTE" => solana_vote_program::id(),
"STORAGE" => solana_storage_program::id(),
"VOTE" => solana_vote_program::id(),
_ => pubkey_of(matches, "program_id").unwrap(),
};
@ -2345,7 +2347,7 @@ pub fn app<'ab, 'v>(name: &str, about: &'ab str, version: &'v str) -> App<'ab, '
.required(true)
.help(
"The program_id that the address will ultimately be used for, \n\
or one of STAKE, VOTE, and STORAGE keywords",
or one of NONCE, STAKE, STORAGE, and VOTE keywords",
),
)
.arg(
@ -2767,6 +2769,7 @@ mod tests {
("STAKE", solana_stake_program::id()),
("VOTE", solana_vote_program::id()),
("STORAGE", solana_storage_program::id()),
("NONCE", system_program::id()),
] {
let test_create_address_with_seed = test_commands.clone().get_matches_from(vec![
"test",