Skip to main content

hopper_runtime/
syscall.rs

1//! Small compatibility shims for individual runtime syscalls used directly by
2//! Hopper-owned crates.
3
4/// Emit the current compute-unit counter.
5#[inline(always)]
6pub fn sol_log_compute_units() {
7    #[cfg(all(target_os = "solana", feature = "hopper-native-backend"))]
8    // SAFETY: This block is part of Hopper's audited zero-copy/backend boundary; surrounding checks and caller contracts uphold the required raw-pointer, layout, and aliasing invariants.
9    unsafe {
10        hopper_native::syscalls::sol_log_compute_units_();
11    }
12
13    #[cfg(all(target_os = "solana", feature = "legacy-pinocchio-compat"))]
14    // SAFETY: This block is part of Hopper's audited zero-copy/backend boundary; surrounding checks and caller contracts uphold the required raw-pointer, layout, and aliasing invariants.
15    unsafe {
16        pinocchio::syscalls::sol_log_compute_units_();
17    }
18
19    #[cfg(all(target_os = "solana", feature = "solana-program-backend"))]
20    {
21        ::solana_program::log::sol_log_compute_units();
22    }
23}