jiminy-core
Account layout, zero-copy IO, validation, PDA, sysvar access, lifecycle, math, time checks. Everything your pinocchio program needs before it touches a token.
#![no_std] / no_alloc / BPF-safe
[]
= "0.16"
What's in here
account |
16-byte header, AccountReader, AccountWriter, SliceCursor, lifecycle (close/realloc), pod, zero_copy_layout!, segmented_layout!, ZeroCopySlice, segments, list, bitflags |
check |
Owner / signer / key checks, PDA derivation and verification |
instruction |
Transaction introspection via the Instructions sysvar |
math |
Checked arithmetic, BPS helpers, scaling with u128 intermediates |
sysvar |
Clock and Rent readers (syscall-based + account-based) |
state |
State-machine transition validation |
time |
Deadline, cooldown, slot-staleness checks |
abi |
Alignment-1 LE field types (LeU64, LeBool, …) and borrow-splitting refs (FieldRef, FieldMut) |
interface |
Cross-program ABI interfaces (jiminy_interface!) |
event |
Zero-alloc event emission via sol_log_data |
programs |
Well-known program IDs (feature-gated) |
New in 0.16
VerifiedAccount<T>/VerifiedAccountMut<T>: type-safe wrappers returned byload()/load_mut()/load_foreign(). Infallibleget()/get_mut()access after construction.strictfeature: production hardening mode. Disablesvalidate_version_compatible()at compile time.jiminy_interface!version parameter:version = Nto match foreign layouts at any version.- Compile-time alignment assertion in
jiminy_interface!: prevents over-aligned types. init_segments_with_capacity(): capacity-aware segment init for push/remove workflows.- Push overlap protection:
segment_pushchecks next segment offset to prevent overwrites. - Exact size enforcement: Tiers 1 and 2 require
data.len() == expected_size. load_mut()backed byRefMut: eliminates mutable aliasing UB.
New in 0.15
abimodule: 9 alignment-safe LE wire types (LeU64,LeI128,LeBool, etc.).#[repr(transparent)]over[u8; N]. Safe on all targets, zero overhead on SBF.FieldRef/FieldMut: typed views over field byte slices. Borrow-split account data withoutunsafe.split_fields/split_fields_mut: generated byzero_copy_layout!. Decompose account data into independent per-field slices.- Const field offsets:
zero_copy_layout!now emitspub const header: usize = 0, etc. jiminy_interface!macro: read-only ABI interface for foreign program accounts. SameLAYOUT_ID, no crate dependency.segmented_layout!macro: variable-length accounts with multiple dynamic segments.SegmentDescriptor(8 bytes),SegmentSlice,SegmentSliceMut, auto-computed offsets, bounds-checked validation.
zero_copy_layout!macro: declare#[repr(C)]structs that overlay directly onto account bytes. No proc macros.ZeroCopySlice/ZeroCopySliceMut: length-prefixed arrays in account data. Zero-copy iteration, indexing, mutation.pod_read<T>(): alignment-safe owned copy viaread_unaligned. Works everywhere.clock_timestamp(),clock_slot(),clock_epoch(): syscall-based sysvar access. No account slot needed.rent_lamports_per_byte_year(): same, for Rent.
Usage
use *;
let reader = new_checked?;
let owner = reader.pubkey_at?;
let amount = reader.u64_at?;
programs feature is on by default. log feature adds sol_log wrappers.
About
Built by MoonManQuark / Bluefoot Labs.
Donations: solanadevdao.sol (F42ZovBoRJZU4av5MiESVwJWnEx8ZQVFkc1RM29zMxNT)
License
Apache-2.0