Skip to main content

hopper_exact_entrypoint

Macro hopper_exact_entrypoint 

Source
macro_rules! hopper_exact_entrypoint {
    ( $( ( $disc:literal $( if $guard:expr )?, $bound:expr, $helper:path ) ),* $(,)? ) => { ... };
}
Expand description

Declare the count-exact program entrypoint.

Reads the discriminator from the SIMD-0321 r2 instruction-data pointer first, then materializes exactly the matched instruction’s declared account bound before dispatching to the helper #[program] generated for it. arms pairs each one-byte discriminator (optionally with an if <const> guard, which folds the arm away when false) with that bound and that helper. Each helper returns the entry’s own return code, SUCCESS or the mapped error, so the dispatch is the entrypoint’s last call. Accounts past the bound are neither materialized nor walked, and there is no transaction-sized pointer table: the entry cost is the declared accounts only. The Context (segment borrow registry, write gate, parametric args) is built exactly as on the scanning path.

The r2 gate (5xXZc66h4UdB6Yq7FzdBxBiRAFMMScMLwHxk2QZDaNZL) is active on mainnet-beta, devnet, and testnet. A runtime that leaves r2 zero gets ProgramError::InvalidArgument back instead of a scanning fallback, which keeps the dual-path code out of the binary; hopper feature-gate reports the gate for a target cluster.

A transaction that passes more accounts than the matched arm’s bound is refused with ERR_TOO_MANY_ACCOUNTS before any account is walked: the extra accounts would never be materialized, and a handler with #[remaining_accounts(max = N)] must not run on a truncated list.