Load executable accounts from invoke context (#14574) (#14575)

(cherry picked from commit 6e8a1ba7de)

Co-authored-by: Jack May <jack@solana.com>
This commit is contained in:
mergify[bot]
2021-01-14 09:39:26 +00:00
committed by GitHub
parent 1b02ec4f6e
commit 771b98a168
5 changed files with 378 additions and 272 deletions

View File

@@ -127,9 +127,9 @@ extern uint64_t entrypoint(const uint8_t *input) {
const SolSignerSeeds signers_seeds[] = {{seeds1, SOL_ARRAY_SIZE(seeds1)},
{seeds2, SOL_ARRAY_SIZE(seeds2)}};
sol_assert(SUCCESS == sol_invoke_signed(
&instruction, accounts, SOL_ARRAY_SIZE(accounts),
signers_seeds, SOL_ARRAY_SIZE(signers_seeds)));
sol_assert(SUCCESS == sol_invoke_signed(&instruction, accounts,
params.ka_num, signers_seeds,
SOL_ARRAY_SIZE(signers_seeds)));
break;
}
@@ -189,8 +189,7 @@ extern uint64_t entrypoint(const uint8_t *input) {
data, SOL_ARRAY_SIZE(data)};
sol_log("Invoke again");
sol_assert(SUCCESS ==
sol_invoke(&instruction, accounts, SOL_ARRAY_SIZE(accounts)));
sol_assert(SUCCESS == sol_invoke(&instruction, accounts, params.ka_num));
} else {
sol_log("Last invoked");
for (int i = 0; i < accounts[INVOKED_ARGUMENT_INDEX].data_len; i++) {

View File

@@ -804,7 +804,7 @@ fn test_program_bpf_invoke() {
.iter()
.map(|ix| message.account_keys[ix.program_id_index as usize].clone())
.collect();
assert_eq!(invoked_programs, vec![argument_keypair.pubkey().clone()]);
assert_eq!(invoked_programs, vec![]);
assert_eq!(
result.unwrap_err(),
TransactionError::InstructionError(0, InstructionError::AccountNotExecutable)