open-standards/smart-byte/smart-byte-rs/crates/smart-byte-state/src/lib.rs
Transaction Science f9fbd5a3af
Some checks failed
smart-byte conformance gate / Validate conformance JSON files (pull_request) Successful in 4s
smart-byte conformance gate / Second implementation reproduces every vector (pull_request) Successful in 5s
smart-byte conformance gate / Spec changes require vector-pack updates (pull_request) Successful in 4s
smart-byte conformance gate / VERSIONS.md and README.md must exist (pull_request) Successful in 3s
no-vanity-metrics / Scan committed Markdown for vanity metrics (pull_request) Successful in 4s
standards workspaces build + test / eoc-rs (pull_request) Successful in 1m51s
standards workspaces build + test / jcp-rs (pull_request) Successful in 1m24s
standards workspaces build + test / proof-rs (pull_request) Successful in 1m41s
standards workspaces build + test / sandbox-rs (pull_request) Successful in 2m10s
standards workspaces build + test / smart-byte-rs (pull_request) Successful in 3m38s
standards workspaces build + test / jouleclaw-rs (pull_request) Successful in 7m45s
standards workspaces build + test / aac-rs (pull_request) Successful in 4m3s
standards workspaces build + test / joule-code-rs (pull_request) Successful in 1m51s
standards workspaces build + test / joulecontract-rs (pull_request) Successful in 2m3s
standards workspaces build + test / map-rs (pull_request) Successful in 5m27s
standards workspaces build + test / mesh-rs (pull_request) Successful in 2m19s
standards workspaces build + test / openpay (pull_request) Successful in 10m49s
standards workspaces build + test / arl-rs (pull_request) Successful in 47m4s
standards workspaces build + test / joule-ui-rs (pull_request) Successful in 46m44s
standards workspaces build + test / jouledesk-rs (pull_request) Successful in 42m33s
standards workspaces build + test / joulehook-rs (pull_request) Failing after 18m22s
standards workspaces build + test / sense-rs (pull_request) Successful in 10m25s
standards workspaces build + test / macOS energy backend (jcp-energy) (pull_request) Successful in 4m56s
smart-byte: governance, burns and transfers between clusters, with vectors
smart-byte-state implements cluster_state.md:
- governance: Change and Proposal, electorates, the quorum, the time lock;
- burns: Burn and the retired record;
- exports: ExportStatement and Certificate;
- the import checks.

smart-byte-core: Transition::sign_export and the destination member. The
envelope compares frames within a cluster only.

smart-byte-lockstep: the committing nodes sign each committed frame's export
certificates. The certificates are built from a committing node's report,
never from a node whose state diverged.

state_vectors.json grows to 23 vectors (state-013 to state-023 new,
state-011 extended) and is regenerated in place; v1 is DRAFT. Every new check
has a vector that fails an implementation leaving it out. The README
documents the 14 new error classes, and the regeneration log records the
change.

crosscheck/verify_v1.py implements governance, burns, exports and imports
from the spec text. It reproduces every vector, 117 of them, both plain and
under -O.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-01 11:48:44 -04:00

37 lines
1.5 KiB
Rust
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//! # smart-byte-state
//!
//! The Smart Byte cluster state machine (`smart-byte/spec/cluster_state.md`):
//! the state every node of a cluster holds, the deterministic frame
//! transition that advances it, the state hash a frame commits at, and the
//! checkpoint-and-log persistence that survives a restart.
//!
//! * [`State`] — frame number, issuer registry, controllers' key states and
//! the bytes the cluster holds. Its canonical encoding is the checkpoint
//! and its BLAKE3 digest is the state hash.
//! * [`State::apply_frame`] — the transition (treatise §9.4 steps 4–5): key
//! events, governance, mints, imports, transfers and burns, deduplicated,
//! ordered, and each applied or dropped for a named reason.
//! * [`Certificate`] — what a cluster's nodes sign when a byte leaves for
//! another cluster, and what that cluster imports it on (treatise §11.3.3).
//! * [`Store`] — checkpoint and replay log (treatise §16).
//!
//! The lockstep protocol around it — exchanging inputs and tallying state
//! hashes — is `smart-byte-lockstep`.
#![forbid(unsafe_code)]
pub mod certificate;
pub mod demo;
pub mod frame;
pub mod input;
pub mod state;
pub mod store;
pub use certificate::{Certificate, ExportStatement};
pub use frame::{FrameReport, InputResult};
pub use input::{Approval, Burn, Input, InputClass, InputError, Proposal};
pub use state::{
ByteRecord, Change, ControllerRecord, ExportRecord, Governance, Peer, Pending, RetiredRecord,
State,
};
pub use store::{Store, StoreError};