Skip to main content

Module layout

Module layout 

Source
Expand description

Layout contracts as runtime truth.

LayoutContract is the central trait for Hopper’s state-first architecture. It ties together discriminator, version, and layout fingerprint into a single compile-time contract that the runtime can validate before granting typed access.

This is what makes Hopper different from every other Solana framework: layouts are not just metadata or serialization hints. They are runtime contracts that gate account access, enforce compatibility, and enable schema evolution.

No competitor (Pinocchio, Steel, Quasar) has anything equivalent.

Structs§

HopperHeader
The canonical 16-byte header at the start of every Hopper account.
LayoutInfo
Runtime metadata snapshot of an account’s layout identity.

Constants§

DEFAULT_SCHEMA_EPOCH
Default schema-evolution epoch written by init_header.

Traits§

LayoutContract
A compile-time layout contract binding type identity to wire format.

Functions§

init_header
Initialize an account’s header from a layout contract type.
read_disc
Read the discriminator from account data (byte 0).
read_flags
Read the flags from account data (bytes 2..4) as u16 LE.
read_layout_id
Read the 8-byte layout_id from account data (bytes 4..12).
read_schema_epoch
Read the schema_epoch field from an already-written header.
read_version
Read the version from account data (byte 1).
write_header
Write a complete Hopper header to the beginning of data.
write_header_with_epoch
Write a Hopper header with a caller-specified schema epoch.