Convert syscall accounts to credit only accounts (#4915)

This commit is contained in:
Pankaj Garg
2019-07-02 15:17:28 -07:00
committed by GitHub
parent 12ef0c25b5
commit bf319ab06d
2 changed files with 6 additions and 6 deletions

View File

@ -81,7 +81,7 @@ pub fn redeem_vote_credits(stake_pubkey: &Pubkey, vote_pubkey: &Pubkey) -> Instr
AccountMeta::new(*stake_pubkey, false), AccountMeta::new(*stake_pubkey, false),
AccountMeta::new(*vote_pubkey, false), AccountMeta::new(*vote_pubkey, false),
AccountMeta::new(crate::rewards_pools::random_id(), false), AccountMeta::new(crate::rewards_pools::random_id(), false),
AccountMeta::new(syscall::rewards::id(), false), AccountMeta::new_credit_only(syscall::rewards::id(), false),
]; ];
Instruction::new(id(), &StakeInstruction::RedeemVoteCredits, account_metas) Instruction::new(id(), &StakeInstruction::RedeemVoteCredits, account_metas)
} }
@ -90,7 +90,7 @@ pub fn delegate_stake(stake_pubkey: &Pubkey, vote_pubkey: &Pubkey, stake: u64) -
let account_metas = vec![ let account_metas = vec![
AccountMeta::new(*stake_pubkey, true), AccountMeta::new(*stake_pubkey, true),
AccountMeta::new(*vote_pubkey, false), AccountMeta::new(*vote_pubkey, false),
AccountMeta::new(syscall::current::id(), false), AccountMeta::new_credit_only(syscall::current::id(), false),
]; ];
Instruction::new(id(), &StakeInstruction::DelegateStake(stake), account_metas) Instruction::new(id(), &StakeInstruction::DelegateStake(stake), account_metas)
} }
@ -99,7 +99,7 @@ pub fn withdraw(stake_pubkey: &Pubkey, to_pubkey: &Pubkey, lamports: u64) -> Ins
let account_metas = vec![ let account_metas = vec![
AccountMeta::new(*stake_pubkey, true), AccountMeta::new(*stake_pubkey, true),
AccountMeta::new(*to_pubkey, false), AccountMeta::new(*to_pubkey, false),
AccountMeta::new(syscall::current::id(), false), AccountMeta::new_credit_only(syscall::current::id(), false),
]; ];
Instruction::new(id(), &StakeInstruction::Withdraw(lamports), account_metas) Instruction::new(id(), &StakeInstruction::Withdraw(lamports), account_metas)
} }
@ -107,7 +107,7 @@ pub fn withdraw(stake_pubkey: &Pubkey, to_pubkey: &Pubkey, lamports: u64) -> Ins
pub fn deactivate_stake(stake_pubkey: &Pubkey) -> Instruction { pub fn deactivate_stake(stake_pubkey: &Pubkey) -> Instruction {
let account_metas = vec![ let account_metas = vec![
AccountMeta::new(*stake_pubkey, true), AccountMeta::new(*stake_pubkey, true),
AccountMeta::new(syscall::current::id(), false), AccountMeta::new_credit_only(syscall::current::id(), false),
]; ];
Instruction::new(id(), &StakeInstruction::Deactivate, account_metas) Instruction::new(id(), &StakeInstruction::Deactivate, account_metas)
} }

View File

@ -95,9 +95,9 @@ pub fn vote(
authorized_voter_pubkey, authorized_voter_pubkey,
&[ &[
// request slot_hashes syscall account after vote_pubkey // request slot_hashes syscall account after vote_pubkey
AccountMeta::new(syscall::slot_hashes::id(), false), AccountMeta::new_credit_only(syscall::slot_hashes::id(), false),
// request current syscall account after that // request current syscall account after that
AccountMeta::new(syscall::current::id(), false), AccountMeta::new_credit_only(syscall::current::id(), false),
], ],
); );