Include Clock sysvar in AuthorizeWithSeed instruction

This commit is contained in:
Michael Vines 2021-01-25 11:34:54 -08:00
parent 2b50433099
commit 8359f4f5ff
2 changed files with 4 additions and 2 deletions

View File

@ -66,7 +66,7 @@ pub enum StakeInstruction {
/// ///
/// # Account references /// # Account references
/// 0. [WRITE] Stake account to be updated /// 0. [WRITE] Stake account to be updated
/// 1. [] (reserved for future use) Clock sysvar /// 1. [] Clock sysvar
/// 2. [SIGNER] The stake or withdraw authority /// 2. [SIGNER] The stake or withdraw authority
Authorize(Pubkey, StakeAuthorize), Authorize(Pubkey, StakeAuthorize),
@ -138,6 +138,7 @@ pub enum StakeInstruction {
/// # Account references /// # Account references
/// 0. [WRITE] Stake account to be updated /// 0. [WRITE] Stake account to be updated
/// 1. [SIGNER] Base key of stake or withdraw authority /// 1. [SIGNER] Base key of stake or withdraw authority
/// 2. [] Clock sysvar
AuthorizeWithSeed(AuthorizeWithSeedArgs), AuthorizeWithSeed(AuthorizeWithSeedArgs),
} }
@ -368,6 +369,7 @@ pub fn authorize_with_seed(
let account_metas = vec![ let account_metas = vec![
AccountMeta::new(*stake_pubkey, false), AccountMeta::new(*stake_pubkey, false),
AccountMeta::new_readonly(*authority_base, true), AccountMeta::new_readonly(*authority_base, true),
AccountMeta::new_readonly(sysvar::clock::id(), false),
]; ];
let args = AuthorizeWithSeedArgs { let args = AuthorizeWithSeedArgs {

View File

@ -354,7 +354,7 @@ mod test {
); );
let message = Message::new(&[instruction], None); let message = Message::new(&[instruction], None);
assert_eq!( assert_eq!(
parse_stake(&message.instructions[0], &keys[0..2]).unwrap(), parse_stake(&message.instructions[0], &keys[0..3]).unwrap(),
ParsedInstructionEnum { ParsedInstructionEnum {
instruction_type: "authorizeWithSeed".to_string(), instruction_type: "authorizeWithSeed".to_string(),
info: json!({ info: json!({