Durable Nonce - Authorized Noncer (#7417)

* Durable Nonce: Add authorized noncer to initialize instruction

* CLI: Adapt to nonce authority

* Durable Nonce: Introduce Authorize instruction

* Specify who needs to sign  ix

* 'authorized-noncer' -> 'nonce-authority'

* Document signing authority for all instructions
This commit is contained in:
Trent Nelson
2019-12-17 09:34:21 -05:00
committed by GitHub
parent 7c92bf15e2
commit 0ea2843ec9
7 changed files with 575 additions and 125 deletions

View File

@@ -61,7 +61,7 @@ mod tests {
let tx = Transaction::new_signed_instructions(
&[&from_keypair, &nonce_keypair],
vec![
nonce_instruction::nonce(&nonce_pubkey),
nonce_instruction::nonce(&nonce_pubkey, &nonce_pubkey),
system_instruction::transfer(&from_pubkey, &nonce_pubkey, 42),
],
Hash::default(),
@@ -99,7 +99,7 @@ mod tests {
&[&from_keypair, &nonce_keypair],
vec![
system_instruction::transfer(&from_pubkey, &nonce_pubkey, 42),
nonce_instruction::nonce(&nonce_pubkey),
nonce_instruction::nonce(&nonce_pubkey, &nonce_pubkey),
],
Hash::default(),
);
@@ -115,7 +115,7 @@ mod tests {
let tx = Transaction::new_signed_instructions(
&[&from_keypair, &nonce_keypair],
vec![
nonce_instruction::withdraw(&nonce_pubkey, &from_pubkey, 42),
nonce_instruction::withdraw(&nonce_pubkey, &nonce_pubkey, &from_pubkey, 42),
system_instruction::transfer(&from_pubkey, &nonce_pubkey, 42),
],
Hash::default(),
@@ -160,8 +160,9 @@ mod tests {
// New is in Uninitialzed state
assert_eq!(state, NonceState::Uninitialized);
let recent_blockhashes = create_test_recent_blockhashes(0);
let authorized = nonce_account.unsigned_key().clone();
nonce_account
.initialize(&recent_blockhashes, &Rent::free())
.initialize(&authorized, &recent_blockhashes, &Rent::free())
.unwrap();
assert!(verify_nonce(&nonce_account.account, &recent_blockhashes[0]));
});
@@ -183,8 +184,9 @@ mod tests {
// New is in Uninitialzed state
assert_eq!(state, NonceState::Uninitialized);
let recent_blockhashes = create_test_recent_blockhashes(0);
let authorized = nonce_account.unsigned_key().clone();
nonce_account
.initialize(&recent_blockhashes, &Rent::free())
.initialize(&authorized, &recent_blockhashes, &Rent::free())
.unwrap();
assert!(!verify_nonce(
&nonce_account.account,