Skip to main content

hopper_fast_entrypoint

Macro hopper_fast_entrypoint 

Source
macro_rules! hopper_fast_entrypoint {
    ( $process_instruction:expr ) => { ... };
    ( $process_instruction:expr, $maximum:expr ) => { ... };
}
Expand description

Declare a fast two-argument Hopper Native program entrypoint.

Uses the SVM’s second entrypoint register, which provides a direct pointer to instruction data, eliminating the full account-scanning pass that the single-argument entrypoint requires. Saves ~30-40 CU per instruction invocation.

The SVM has provided the second argument since runtime ~1.17.

§Usage

use hopper_native::hopper_fast_entrypoint;

hopper_fast_entrypoint!(process_instruction, 3);

pub fn process_instruction(
    program_id: &Address,
    accounts: &[AccountView],
    instruction_data: &[u8],
) -> ProgramResult {
    Ok(())
}