pub struct HopperInstructionPolicy {
pub unsafe_memory: bool,
pub skip_token_checks: bool,
pub ctx_args: u8,
}Expand description
Per-instruction policy override.
The #[instruction(N, unsafe_memory, skip_token_checks, ctx_args = K)]
attribute emits pub const <HANDLER>_POLICY: HopperInstructionPolicy = ...;
alongside the handler. All fields default to the inherit-from-program
behaviour (false / 0) so handlers without overrides get the program
policy unchanged.
Fields§
§unsafe_memory: boolOpt this handler out of #[deny(unsafe_code)] even when the
program-level allow_unsafe is false. Used for the one or two
“fast path” handlers in an otherwise-sealed program.
skip_token_checks: boolSkip the program-level token-check promise for this handler. The handler still compiles, but authors must document why the token invariants are upheld through some other mechanism.
ctx_args: u8Count of leading instruction args the dispatcher threads to the
typed context’s bind_with_args(...). 0 means the context
(if any) is bound via bind(ctx)? and no args participate in
constraint evaluation. which is the legacy shape and matches
Anchor’s non-#[instruction] accounts struct. When a context
was declared with #[instruction(name: Type, ...)], the handler
must set ctx_args ≥ the number of declared args so that every
arg referenced by a seed / constraint resolves to a real typed
binding inside bind_with_args.
Implementations§
Trait Implementations§
Source§impl Clone for HopperInstructionPolicy
impl Clone for HopperInstructionPolicy
Source§fn clone(&self) -> HopperInstructionPolicy
fn clone(&self) -> HopperInstructionPolicy
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more