Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds test coverage for #20669 #20690

Merged
merged 1 commit into from
Oct 18, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion programs/bpf_loader/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1772,6 +1772,21 @@ mod tests {
assert_eq!(elf[i], *byte);
}

// Invoke deployed program
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to add more coverage here but what is this catching that something like the following isn't?

let result = bank_client.send_and_confirm_instruction(&mint_keypair, instruction.clone());

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, my assessment of the problem was wrong. I updated the description of the PR.

To answer your question:
This new part covers the case in which the executor is not cached and needs to be created on invocation.

{
let programdata_account = RefCell::new(post_programdata_account);
let program_account = RefCell::new(post_program_account);
let program_address = program_keypair.pubkey();
let keyed_accounts: Vec<KeyedAccountTuple> = vec![
(false, false, &programdata_address, &programdata_account),
(false, false, &program_address, &program_account),
];
assert_eq!(
Ok(()),
process_instruction(&program_address, &[], &keyed_accounts),
);
}

// Test initialized program account
bank.clear_signatures();
bank.store_account(&buffer_address, &buffer_account);
Expand Down Expand Up @@ -3386,7 +3401,7 @@ mod tests {
];
assert_eq!(
Err(InstructionError::InvalidAccountData),
process_instruction(&program_address, &instruction, &keyed_accounts),
process_instruction(&program_address, &[], &keyed_accounts),
);
}

Expand Down