hopper-core 0.1.0

Core engine for the Hopper zero-copy state framework. Account memory architecture, ABI types, validation graphs, phased execution, zero-copy collections, layout evolution, and cross-program interfaces.
Documentation
[package]

name = "hopper-core"

version = "0.1.0"

edition = "2021"

license = "Apache-2.0"

authors = ["BluefootLabs <contact@bluefootlabs.com>", "MoonManQuark"]

description = "Core engine for the Hopper zero-copy state framework. Account memory architecture, ABI types, validation graphs, phased execution, zero-copy collections, layout evolution, and cross-program interfaces."

repository = "https://github.com/BluefootLabs/Hopper-Solana-Zero-copy-State-Framework"

homepage = "https://hopperzero.dev"

documentation = "https://docs.rs/crate/hopper-core/0.1.0"

readme = "README.md"

keywords = ["solana", "zero-copy", "state", "framework", "no-std"]

categories = ["no-std", "embedded"]



[lib]

name = "hopper_core"



[dependencies]

hopper-runtime = { workspace = true, default-features = false }

# Optional: const-SHA256 is used for the canonical layout_id fingerprint and

# for Anchor-compat discriminators. Under the `spartan` profile the crate

# compiles without pulling sha2, substituting a pure-core FNV-1a fallback for

# layout_id generation (Anchor-compat helpers are compiled out entirely).

sha2-const-stable = { workspace = true, optional = true }



[dev-dependencies]

sha2-const-stable = { workspace = true }

# The audit-regression tests in `frame` need direct access to the

# native substrate's `RuntimeAccount` layout so they can fabricate

# accounts without spinning up the full BPF entrypoint. Only pulled in

# as a dev-dep; the main library never names `hopper-native`.

hopper-native = { workspace = true }



[features]

default = ["programs", "hopper-native-backend", "advanced", "cpi", "collections", "sha2-layout-id", "anchor-compat"]

programs = []

log = []

hopper-native-backend = ["hopper-runtime/hopper-native-backend"]

legacy-pinocchio-compat = ["hopper-runtime/legacy-pinocchio-compat"]

solana-program-backend = ["hopper-runtime/solana-program-backend"]

cpi = ["hopper-runtime/cpi"]



# SHA-256 backed layout_id generation. ON by default. Pulls `sha2-const-stable`

# as a hard build dep. Spartan programs turn this off; `hopper_layout!` then

# hashes via a const FNV-1a-64 implementation that lives entirely in

# `hopper-core`. The fingerprint space is still 8 bytes and collision-resistant

# for realistic program sizes, but it is NOT byte-equal to an SHA-256-derived

# layout_id, so off-chain tooling must be rebuilt with the same feature set.

sha2-layout-id = ["dep:sha2-const-stable"]



# Anchor discriminator compat helpers (`anchor_discriminator`,

# `anchor_account_discriminator`). These require SHA-256 by definition (the

# Anchor ABI specifies SHA-256), so they implicitly enable `sha2-layout-id`.

# Drop them to shave the last bit of Anchor-adjacent surface.

anchor-compat = ["sha2-layout-id"]



# Advanced subsystems (opt-in, not hot-path).

# These modules are valuable but sit outside the core access model.

# Programs that only need load/load_mut/segment_ref/segment_mut can

# disable `advanced` for a leaner compile surface.

advanced = ["frame", "receipt", "policy", "graph", "migrate", "virtual-state", "diff", "explain"]

frame = []

receipt = ["diff"]

policy = []

graph = []

migrate = []

virtual-state = []

diff = []

explain = []



# Zero-copy collections (FixedVec, RingBuffer, SlotMap, BitSet, Journal,

# Slab, PackedMap, SortedVec). Default on. Turn off for programs that

# only touch raw fields and segments, to drop ~800 lines of compile-time

# surface. Not part of `advanced` because collections are useful in

# hot-path code while advanced subsystems are not.

collections = []



# Spartan profile: the "Pinocchio-parity" build. Turning this on via

# `default-features = false, features = ["spartan"]` leaves only the raw

# access primitives (load / load_mut / segment_ref / segment_mut), the

# runtime backend the caller picked, and nothing else; no advanced

# subsystems, no collections, no Anchor compat, no third-party deps.

# The build target is "zero deps outside of hopper-runtime itself".

spartan = ["programs"]



[lints.rust]

unexpected_cfgs = { level = "allow", check-cfg = [

    'cfg(target_os, values("solana"))',

    'cfg(feature, values("frame", "receipt", "policy", "graph", "migrate", "virtual-state", "diff", "explain", "advanced", "cpi", "collections", "sha2-layout-id", "anchor-compat", "spartan"))',

] }