Skip to main content

Crate hopper_runtime

Crate hopper_runtime 

Source
Expand description

Hopper Runtime – canonical semantic runtime surface.

Hopper Runtime owns the public rules, validation, typed loading, CPI semantics, and execution context that authored Hopper code targets. Hopper Native owns the raw execution boundary. Pinocchio and solana-program remain compatibility backends isolated behind compat/.

Re-exports§

pub use account::AccountView;
pub use account::RemainingAccounts;
pub use account_wrappers::Account;
pub use account_wrappers::InitAccount;
pub use account_wrappers::Program;
pub use account_wrappers::ProgramId;
pub use account_wrappers::Signer as HopperSigner;
pub use account_wrappers::SystemId;
pub use address::Address;
pub use audit::AccountAudit;
pub use audit::DuplicateAccount;
pub use borrow::Ref;
pub use borrow::RefMut;
pub use policy::HopperInstructionPolicy;
pub use policy::HopperProgramPolicy;
pub use ref_only::HopperRefOnly;
pub use context::Context;
pub use cpi::invoke;
pub use cpi::invoke_signed;
pub use error::ProgramError;
pub use field_map::FieldInfo;
pub use field_map::FieldMap;
pub use foreign::ForeignLens;
pub use foreign::ForeignManifest;
pub use interop::TransparentAddress;
pub use migrate::apply_pending_migrations;
pub use migrate::LayoutMigration;
pub use migrate::MigrationEdge;
pub use tail::read_tail;
pub use tail::read_tail_len;
pub use tail::tail_payload;
pub use tail::write_tail;
pub use tail::TailCodec;
pub use instruction::CpiAccount;
pub use instruction::InstructionAccount;
pub use instruction::InstructionView;
pub use instruction::Seed;
pub use instruction::Signer;
pub use layout::HopperHeader;
pub use layout::LayoutContract;
pub use layout::LayoutInfo;
pub use result::ProgramResult;
pub use zerocopy::AccountLayout;
pub use zerocopy::WireLayout;
pub use zerocopy::ZeroCopy;
pub use segment::Segment;
pub use segment::TypedSegment;
pub use segment_borrow::AccessKind;
pub use segment_borrow::SegmentBorrow;
pub use segment_borrow::SegmentBorrowGuard;
pub use segment_borrow::SegmentBorrowRegistry;
pub use segment_lease::SegRef;
pub use segment_lease::SegRefMut;
pub use segment_lease::SegmentLease;

Modules§

account
Hopper-owned account view for Solana programs.
account_wrappers
Anchor-grade typed account wrappers for #[hopper::context].
address
Hopper-owned address type for Solana programs.
audit
borrow
Hopper-owned borrow guards for account data.
context
Execution context for Hopper programs.
cpi
Cross-program invocation for Hopper programs.
cpi_event
Self-CPI event emission primitives.
crank
Crank marker type emitted by the #[hopper::crank] attribute.
dyn_cpi
Stack-allocated variable-length CPI builder.
error
Hopper-owned program error type for Solana on-chain programs.
field_map
Field-level layout descriptors for inspectable state contracts.
foreign
Manifest-backed foreign-account lenses.
instruction
Hopper-owned CPI instruction types.
interop
Cross-framework type interop for Hopper.
layout
Layout contracts as runtime truth.
log
Backend-neutral logging helpers.
migrate
Schema-epoch in-place migration runtime.
option_byte
Zero-copy, tag-validated optional values for instruction args.
pda
Hopper-owned PDA ergonomics on top of the active backend substrate.
pod
Pod, the canonical runtime-layer “safe to interpret from raw bytes” marker.
policy
Program-level safety policy.
ref_only
Compile-proven borrow-guard constraint.
remaining
Remaining-accounts accessor with strict and passthrough modes.
rent
Rent-exemption helpers.
result
Canonical result type for Hopper programs.
segment
Runtime-local segment primitive.
segment_borrow
Segment-level borrow registry for fine-grained access control.
segment_lease
RAII-leased typed segment guards.
syscall
Small compatibility shims for individual runtime syscalls used directly by Hopper-owned crates.
syscalls
Minimal syscall shims exposed through Hopper Runtime.
system
TEMPORARY: backend facade for System Program CPI builders.
tail
Hybrid serialization tail for #[hopper::state(dynamic_tail = T)].
token
TEMPORARY: backend facade for SPL Token CPI builders.
token_2022_ext
Zero-copy Token-2022 extension TLV readers.
utils
Small utilities for Hopper program authors.
zerocopy
Unified zero-copy trait family.

Macros§

address
Compile-time base58 address literal.
err
Return an error immediately. Parallel to Anchor’s err!.
error
Alias for err!. Anchor compatibility shim so ported code needs no rename. Functionally identical.
fast_entrypoint
Backward-compatible alias for the fast Hopper entrypoint macro.
hopper_emit_cpi
Emit a Hopper event via self-CPI for reliable indexing.
hopper_entrypoint
Declare the explicit Hopper runtime entrypoint bridge.
hopper_fast_entrypoint
Declare the fast two-argument Hopper entrypoint.
hopper_lazy_entrypoint
Declare the Hopper lazy entrypoint.
hopper_log
Cheap structured logging for hot handlers.
hopper_unsafe_region
Auditable raw-pointer boundary.
layout_migrations
Compose a layout’s LayoutMigration::MIGRATIONS chain from a list of #[hopper::migrate]-emitted edge constants.
lazy_entrypoint
Backward-compatible alias for the lazy Hopper entrypoint macro.
msg
Backend-neutral logging macro.
no_allocator
nostd_panic_handler
program_entrypoint
Declare the canonical Hopper program entrypoint.
require
Early-return with an error if the condition is false.
require_eq
Assert two values are equal, returning an error on mismatch.
require_gt
Assert left > right strictly.
require_gte
Assert left >= right, returning the supplied error on underrun. Useful for lamport / balance checks.
require_keys_eq
Assert two public keys (or any byte slices convertible via [AsRef<[u8; 32]>]) are equal. Narrower than require_eq! but matches the ergonomic spelling ecosystem migrators coming from Anchor / Jiminy are familiar with.
require_keys_neq
Assert two public keys are not equal. Used for pinning distinct accounts (authority != user, source != destination). Same coercion and error semantics as require_keys_eq!.
require_lt
Assert left < right strictly. Anchor-parity sibling of require_gt!. Default error is ProgramError::InvalidArgument because a failed ordering check most often flags a bad user input.
require_lte
Assert left <= right. Anchor-parity sibling of require_gte!.
require_neq
Assert two values are not equal. Early-returns with the supplied error on match (or ProgramError::InvalidArgument in the short form). Symmetric with require_eq!.
seeds
Convenience macro for building an array of Seed from expressions.

Constants§

MAX_TX_ACCOUNTS
SUCCESS

Traits§

Pod
Marker for types that can be safely overlaid on raw account bytes.