From 7ed513c24f064168a7ac3eb1cd20fa8eb24f28f8 Mon Sep 17 00:00:00 2001 From: Michael Vines Date: Mon, 25 Jan 2021 11:34:54 -0800 Subject: [PATCH] Include Clock sysvar in AuthorizeWithSeed instruction (cherry picked from commit 8359f4f5ffcbba650e52dafb67d0a542eb7883b4) --- programs/stake/src/stake_instruction.rs | 4 +++- transaction-status/src/parse_stake.rs | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/programs/stake/src/stake_instruction.rs b/programs/stake/src/stake_instruction.rs index 4327c88e97..f21f21350b 100644 --- a/programs/stake/src/stake_instruction.rs +++ b/programs/stake/src/stake_instruction.rs @@ -66,7 +66,7 @@ pub enum StakeInstruction { /// /// # Account references /// 0. [WRITE] Stake account to be updated - /// 1. [] (reserved for future use) Clock sysvar + /// 1. [] Clock sysvar /// 2. [SIGNER] The stake or withdraw authority Authorize(Pubkey, StakeAuthorize), @@ -138,6 +138,7 @@ pub enum StakeInstruction { /// # Account references /// 0. [WRITE] Stake account to be updated /// 1. [SIGNER] Base key of stake or withdraw authority + /// 2. [] Clock sysvar AuthorizeWithSeed(AuthorizeWithSeedArgs), } @@ -368,6 +369,7 @@ pub fn authorize_with_seed( let account_metas = vec![ AccountMeta::new(*stake_pubkey, false), AccountMeta::new_readonly(*authority_base, true), + AccountMeta::new_readonly(sysvar::clock::id(), false), ]; let args = AuthorizeWithSeedArgs { diff --git a/transaction-status/src/parse_stake.rs b/transaction-status/src/parse_stake.rs index 7a3cf10715..fa60ce018c 100644 --- a/transaction-status/src/parse_stake.rs +++ b/transaction-status/src/parse_stake.rs @@ -354,7 +354,7 @@ mod test { ); let message = Message::new(&[instruction], None); assert_eq!( - parse_stake(&message.instructions[0], &keys[0..2]).unwrap(), + parse_stake(&message.instructions[0], &keys[0..3]).unwrap(), ParsedInstructionEnum { instruction_type: "authorizeWithSeed".to_string(), info: json!({