Expand description
§Hopper Core
Core engine for Hopper, a zero-copy state framework for Solana.
Typed account architecture, phased execution, composable validation,
zero-copy collections, layout evolution with deterministic fingerprints,
policy-aware capabilities, state receipts, and cross-program interfaces.
no_std, no_alloc, no proc macros required.
§Architecture
- Account memory: Fixed, overlay, segmented, and arena layout styles
- Execution:
Frame-based borrowed-state execution with phases - Validation: Named rule groups, instruction-specific rule packs, post-mutation invariant checks, composable pipelines
- Policy: Declare instruction capabilities, auto-resolve validation
requirements via
InstructionPolicy - Receipts: Structured mutation summaries combining snapshots, diffs, field masks, invariant results, and CPI tracking
- Collections: Zero-copy
FixedVec,RingBuffer,SlotMap,BitSet,Journal,Slab,PackedMap - Segments: Typed segment roles (Core, Extension, Journal, Index, Cache, Audit, Shard) for semantic classification
- Fingerprints: Deterministic layout_id from SHA-256, compile-time compatibility assertions, schema diffing
- Evolution: Append-only versioned layouts with migration helpers
- Interfaces: Cross-program read-only views with ABI proof
Built on hopper-native. Compatible with jiminy account layouts.
§Feature flags
hopper-core ships one hot-path core plus opt-in advanced subsystems.
The default feature set is programs, hopper-native-backend, cpi,
collections, and the advanced umbrella (frame, receipt, policy,
graph, migrate, virtual-state, diff, explain). Programs that
only touch raw fields and segments can disable every optional surface:
hopper-core = { version = "0.1", default-features = false,
features = ["programs", "hopper-native-backend", "cpi"] }That lean configuration drops frame, receipt, policy, graph,
migrate, virtual-state, diff, explain, and collections from the
compile surface and leaves only the hot-path access model, validation
primitives, ABI, layout metadata, and CPI. Re-enable features individually
as the program grows.
Re-exports§
pub use field_map::*;
Modules§
- abi
- Alignment-1 little-endian ABI wire types.
- account
- Account memory architecture.
- accounts
- Hopper Account DSL – typed account ergonomics for zero-copy programs.
- check
- Multi-tier validation system.
- collections
- Zero-copy collections for on-chain account data.
- cpi
- Const-generic CPI builder – stack-only, zero-allocation CPI calls.
- diff
- State Diff Engine: field-level change tracking.
- dispatch
- Instruction dispatch – tag-based routing with zero allocation.
- event
- Zero-allocation event emission via
sol_log_data. - field_
map - Runtime-owned field map metadata re-exported through Hopper Core.
- frame
- Borrowed-state execution context.
- invariant
- Invariant engine – post-execution correctness verification.
- math
- Checked arithmetic operations.
- migrate
- Migration helpers – safe version upgrades for on-chain accounts.
- policy
- Policy-Aware Capabilities – tie instruction behavior to validation requirements.
- prelude
- Prelude re-exports for ergonomic usage.
- prelude_
advanced - Advanced subsystem prelude: everything outside the core identity.
- prelude_
core - Narrow, hot-path-only prelude.
- receipt
- State Receipts – structured mutation summaries.
- segment_
map - Compile-time segment mapping for zero-copy account layouts.
- state
- State machine validation.
- sysvar
- Sysvar readers – zero-copy Clock and Rent parsing.
- time
- Time-based validation: deadlines, cooldowns, staleness.
- virtual_
state - Account Virtualization.
Macros§
- hopper_
dispatch - Macro for instruction dispatch.
- hopper_
dispatch_ 8 - 8-byte discriminator dispatch (Anchor/Quasar compatible).
- hopper_
dispatch_ lazy - Lazy dispatch – routes on instruction data before parsing any accounts.
Functions§
- anchor_
account_ discriminator - Compute an Anchor-compatible 8-byte account discriminator at compile time.
- anchor_
discriminator - Compute an Anchor-compatible 8-byte discriminator at compile time.