Skip to content

Commit

Permalink
Adds keyed_accounts parameter to MockInvokeContext constructor.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lichtso committed Feb 18, 2021
1 parent ed973e1 commit c9e3da2
Show file tree
Hide file tree
Showing 9 changed files with 578 additions and 529 deletions.
7 changes: 4 additions & 3 deletions programs/bpf/benches/bpf_loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ fn bench_program_alu(bencher: &mut Bencher) {
.unwrap();
inner_iter.write_u64::<LittleEndian>(0).unwrap();
let loader_id = bpf_loader::id();
let mut invoke_context = MockInvokeContext::default();
let mut invoke_context = MockInvokeContext::new(&[]);

let elf = load_elf("bench_alu").unwrap();
let mut executable =
Expand Down Expand Up @@ -194,8 +194,6 @@ fn bench_program_execute_noop(bencher: &mut Bencher) {
fn bench_instruction_count_tuner(_bencher: &mut Bencher) {
const BUDGET: u64 = 200_000;
let loader_id = bpf_loader::id();
let mut invoke_context = MockInvokeContext::default();
invoke_context.compute_meter.remaining = BUDGET;

let accounts = [RefCell::new(Account::new(
1,
Expand All @@ -210,6 +208,9 @@ fn bench_instruction_count_tuner(_bencher: &mut Bencher) {
.collect();
let instruction_data = vec![0u8];

let mut invoke_context = MockInvokeContext::new(&keyed_accounts);
invoke_context.compute_meter.remaining = BUDGET;

// Serialize account data
let mut serialized = serialize_parameters(
&bpf_loader::id(),
Expand Down
2 changes: 1 addition & 1 deletion programs/bpf/tests/programs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ fn run_program(
let mut data = vec![];
file.read_to_end(&mut data).unwrap();
let loader_id = bpf_loader::id();
let mut invoke_context = MockInvokeContext::default();
let mut invoke_context = MockInvokeContext::new(parameter_accounts);
let parameter_bytes = serialize_parameters(
&bpf_loader::id(),
program_id,
Expand Down
Loading

0 comments on commit c9e3da2

Please sign in to comment.