Adds check_number_of_instruction_accounts() to all builtin programs except for the address-lookup-table. (#23984)

This commit is contained in:
Alexander Meißner
2022-03-29 19:06:50 +02:00
committed by GitHub
parent ac8b662413
commit 794645d092
4 changed files with 45 additions and 5 deletions

View File

@ -54,11 +54,15 @@ pub fn process_instruction(
&invoke_context.feature_set,
)
}
VoteInstruction::UpdateValidatorIdentity => vote_state::update_validator_identity(
me,
keyed_account_at_index(keyed_accounts, first_instruction_account + 1)?.unsigned_key(),
&signers,
),
VoteInstruction::UpdateValidatorIdentity => {
instruction_context.check_number_of_instruction_accounts(2)?;
vote_state::update_validator_identity(
me,
keyed_account_at_index(keyed_accounts, first_instruction_account + 1)?
.unsigned_key(),
&signers,
)
}
VoteInstruction::UpdateCommission(commission) => {
vote_state::update_commission(me, commission, &signers)
}
@ -99,6 +103,7 @@ pub fn process_instruction(
}
}
VoteInstruction::Withdraw(lamports) => {
instruction_context.check_number_of_instruction_accounts(2)?;
let to = keyed_account_at_index(keyed_accounts, first_instruction_account + 1)?;
let rent_sysvar = if invoke_context
.feature_set
@ -132,6 +137,7 @@ pub fn process_instruction(
.feature_set
.is_active(&feature_set::vote_stake_checked_instructions::id())
{
instruction_context.check_number_of_instruction_accounts(4)?;
let voter_pubkey =
&keyed_account_at_index(keyed_accounts, first_instruction_account + 3)?
.signer_key()