fix account index (#21041)

This commit is contained in:
Jack May
2021-10-28 09:03:47 -07:00
committed by GitHub
parent 7a41b2c5d1
commit 53358ab1aa
3 changed files with 53 additions and 4 deletions

View File

@ -386,6 +386,21 @@ fn process_instruction(
))
);
}
msg!("Test accounts re-ordering");
{
let instruction = create_instruction(
*accounts[INVOKED_PROGRAM_INDEX].key,
&[(accounts[FROM_INDEX].key, true, true)],
vec![RETURN_OK],
);
// put the relavant account at the end of a larger account list
let mut reordered_accounts = accounts.to_vec();
let ai = reordered_accounts.remove(FROM_INDEX);
reordered_accounts.push(accounts[0].clone());
reordered_accounts.push(ai);
invoke(&instruction, &reordered_accounts)?;
}
}
TEST_PRIVILEGE_ESCALATION_SIGNER => {
msg!("Test privilege escalation signer");