Skip to main content

miden_note_schema/
lib.rs

1//! Host-side access to note storage schemas embedded in Miden packages.
2//!
3//! # Felt layout
4//!
5//! The layout is structural over the resolved WIT type tree. The record
6//! `miden:base/core-types@1.0.0.felt` is one felt. A `u64` uses two felts in low-then-high
7//! `u32` limb order. A `u32`, `u8`, or `bool` uses one range-checked felt. An `option<T>` uses one
8//! tag felt followed by its payload when present. A variant uses one declaration-ordinal tag felt
9//! followed by the selected case payload. Record fields concatenate in declaration order.
10//!
11//! Encoding and decoding use [`miden_field_repr::FeltReader`] and
12//! [`miden_field_repr::FeltWriter`]. Codecs only parse, display, and validate values. They do not
13//! change this layout.
14
15#![deny(missing_docs)]
16
17mod artifact;
18mod builder;
19mod codec;
20#[cfg(feature = "codec-component")]
21mod codec_component;
22mod codec_structure;
23mod error;
24mod schema;
25mod section;
26mod value;
27
28#[cfg(test)]
29mod tests;
30
31pub use artifact::{NotePackageArtifact, NotePackageResolver};
32pub use builder::NoteStorageBuilder;
33pub use codec::{
34    ACCOUNT_ID_FQN, ASSET_AMOUNT_FQN, CodecRegistry, ConsumerTypeCodec, FELT_FQN, StandardLeaf,
35    WORD_FQN,
36};
37#[cfg(feature = "codec-component")]
38pub use codec_component::CodecLimits;
39pub use codec_structure::{
40    NOTE_CODEC_WASM_FEATURES, validate_note_codec_component, validate_note_codec_structure,
41};
42pub use error::{CodecFailure, Error, Result};
43pub use miden_field::Felt;
44pub use miden_protocol::note::NoteStorage;
45pub use schema::{
46    FeltLayout, MAX_NOTE_CODEC_COMPONENT_BYTES, MAX_NOTE_STORAGE_SCHEMA_BYTES,
47    MAX_NOTE_STORAGE_SCHEMA_DEPTH, MAX_NOTE_STORAGE_SCHEMA_FELTS, MAX_NOTE_STORAGE_SCHEMA_NODES,
48    MAX_NOTE_STORAGE_SCHEMA_TYPES, NOTE_CODEC_GUEST_RUSTFLAGS, NoteStorageSchema, PrimitiveType,
49    SchemaCase, SchemaField, SchemaType, SchemaTypeKind,
50};
51pub use value::{DecodedValue, DecodedValueKind};