Remove WithSigner (#10325)

automerge
This commit is contained in:
Greg Fitzgerald
2020-05-30 00:17:44 -06:00
committed by GitHub
parent 55a64712b9
commit 19d11800bf
7 changed files with 103 additions and 99 deletions

View File

@@ -8,7 +8,7 @@ use serde_derive::{Deserialize, Serialize};
use solana_sdk::{
account::{get_signers, KeyedAccount},
clock::{Epoch, UnixTimestamp},
instruction::{AccountMeta, Instruction, InstructionError, WithSigner},
instruction::{AccountMeta, Instruction, InstructionError},
program_utils::{limited_deserialize, next_keyed_account, DecodeError},
pubkey::Pubkey,
system_instruction,
@@ -184,8 +184,8 @@ fn _split(
let account_metas = vec![
AccountMeta::new(*stake_pubkey, false),
AccountMeta::new(*split_stake_pubkey, false),
]
.with_signer(authorized_pubkey);
AccountMeta::new_readonly(*authorized_pubkey, true),
];
Instruction::new(id(), &StakeInstruction::Split(lamports), account_metas)
}
@@ -293,8 +293,8 @@ pub fn authorize(
let account_metas = vec![
AccountMeta::new(*stake_pubkey, false),
AccountMeta::new_readonly(sysvar::clock::id(), false),
]
.with_signer(authorized_pubkey);
AccountMeta::new_readonly(*authorized_pubkey, true),
];
Instruction::new(
id(),
@@ -314,8 +314,8 @@ pub fn delegate_stake(
AccountMeta::new_readonly(sysvar::clock::id(), false),
AccountMeta::new_readonly(sysvar::stake_history::id(), false),
AccountMeta::new_readonly(crate::config::id(), false),
]
.with_signer(authorized_pubkey);
AccountMeta::new_readonly(*authorized_pubkey, true),
];
Instruction::new(id(), &StakeInstruction::DelegateStake, account_metas)
}
@@ -331,11 +331,11 @@ pub fn withdraw(
AccountMeta::new(*to_pubkey, false),
AccountMeta::new_readonly(sysvar::clock::id(), false),
AccountMeta::new_readonly(sysvar::stake_history::id(), false),
]
.with_signer(withdrawer_pubkey);
AccountMeta::new_readonly(*withdrawer_pubkey, true),
];
if let Some(custodian_pubkey) = custodian_pubkey {
account_metas = account_metas.with_signer(custodian_pubkey)
account_metas.push(AccountMeta::new_readonly(*custodian_pubkey, true));
}
Instruction::new(id(), &StakeInstruction::Withdraw(lamports), account_metas)
@@ -345,8 +345,8 @@ pub fn deactivate_stake(stake_pubkey: &Pubkey, authorized_pubkey: &Pubkey) -> In
let account_metas = vec![
AccountMeta::new(*stake_pubkey, false),
AccountMeta::new_readonly(sysvar::clock::id(), false),
]
.with_signer(authorized_pubkey);
AccountMeta::new_readonly(*authorized_pubkey, true),
];
Instruction::new(id(), &StakeInstruction::Deactivate, account_metas)
}
@@ -355,7 +355,10 @@ pub fn set_lockup(
lockup: &LockupArgs,
custodian_pubkey: &Pubkey,
) -> Instruction {
let account_metas = vec![AccountMeta::new(*stake_pubkey, false)].with_signer(custodian_pubkey);
let account_metas = vec![
AccountMeta::new(*stake_pubkey, false),
AccountMeta::new_readonly(*custodian_pubkey, true),
];
Instruction::new(id(), &StakeInstruction::SetLockup(*lockup), account_metas)
}