From bf319ab06dccb6607bb44f1912962b8096009f5b Mon Sep 17 00:00:00 2001 From: Pankaj Garg Date: Tue, 2 Jul 2019 15:17:28 -0700 Subject: [PATCH] Convert syscall accounts to credit only accounts (#4915) --- programs/stake_api/src/stake_instruction.rs | 8 ++++---- programs/vote_api/src/vote_instruction.rs | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/programs/stake_api/src/stake_instruction.rs b/programs/stake_api/src/stake_instruction.rs index 8c89c7ce58..7e17d44550 100644 --- a/programs/stake_api/src/stake_instruction.rs +++ b/programs/stake_api/src/stake_instruction.rs @@ -81,7 +81,7 @@ pub fn redeem_vote_credits(stake_pubkey: &Pubkey, vote_pubkey: &Pubkey) -> Instr AccountMeta::new(*stake_pubkey, false), AccountMeta::new(*vote_pubkey, 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) } @@ -90,7 +90,7 @@ pub fn delegate_stake(stake_pubkey: &Pubkey, vote_pubkey: &Pubkey, stake: u64) - let account_metas = vec![ AccountMeta::new(*stake_pubkey, true), 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) } @@ -99,7 +99,7 @@ pub fn withdraw(stake_pubkey: &Pubkey, to_pubkey: &Pubkey, lamports: u64) -> Ins let account_metas = vec![ AccountMeta::new(*stake_pubkey, true), 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) } @@ -107,7 +107,7 @@ pub fn withdraw(stake_pubkey: &Pubkey, to_pubkey: &Pubkey, lamports: u64) -> Ins pub fn deactivate_stake(stake_pubkey: &Pubkey) -> Instruction { let account_metas = vec![ 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) } diff --git a/programs/vote_api/src/vote_instruction.rs b/programs/vote_api/src/vote_instruction.rs index 76662ebf10..209a904234 100644 --- a/programs/vote_api/src/vote_instruction.rs +++ b/programs/vote_api/src/vote_instruction.rs @@ -95,9 +95,9 @@ pub fn vote( authorized_voter_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 - AccountMeta::new(syscall::current::id(), false), + AccountMeta::new_credit_only(syscall::current::id(), false), ], );