Skip to content

Commit

Permalink
Feature check CPI up front (#11652)
Browse files Browse the repository at this point in the history
(cherry picked from commit 4196686)
  • Loading branch information
jackcmay authored and mergify-bot committed Aug 21, 2020
1 parent cdf6ff7 commit 23e2971
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions programs/bpf_loader/src/syscalls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,26 +92,25 @@ pub fn register_syscalls<'a>(
)?;
if invoke_context.is_cross_program_supported() {
vm.register_syscall_ex("sol_create_program_address", syscall_create_program_address)?;
}

// Cross-program invocation syscalls

let invoke_context = Rc::new(RefCell::new(invoke_context));
// Cross-program invocation syscalls

vm.register_syscall_with_context_ex(
"sol_invoke_signed_c",
Box::new(SyscallProcessSolInstructionC {
callers_keyed_accounts,
invoke_context: invoke_context.clone(),
}),
)?;
vm.register_syscall_with_context_ex(
"sol_invoke_signed_rust",
Box::new(SyscallProcessInstructionRust {
callers_keyed_accounts,
invoke_context: invoke_context.clone(),
}),
)?;
let invoke_context = Rc::new(RefCell::new(invoke_context));
vm.register_syscall_with_context_ex(
"sol_invoke_signed_c",
Box::new(SyscallProcessSolInstructionC {
callers_keyed_accounts,
invoke_context: invoke_context.clone(),
}),
)?;
vm.register_syscall_with_context_ex(
"sol_invoke_signed_rust",
Box::new(SyscallProcessInstructionRust {
callers_keyed_accounts,
invoke_context: invoke_context.clone(),
}),
)?;
}

// Memory allocator
let heap = vec![0_u8; DEFAULT_HEAP_SIZE];
Expand Down

0 comments on commit 23e2971

Please sign in to comment.