Skip to main content

csv_adapter_core/
lib.rs

1//! CSV Core — Client-Side Validation for Cross-Chain Rights
2//!
3//! This crate provides the foundational types and traits for the CSV protocol:
4//!
5//! - **[`Right`]** — A verifiable, single-use digital right that can be
6//!   transferred cross-chain
7//! - **[`struct@Hash`]** — A 32-byte cryptographic hash (SHA-256 based)
8//! - **[`Commitment`]** — A binding between a right's state and its anchor
9//!   on a blockchain
10//! - **[`SealRef`]** / **[`AnchorRef`]** — References to consumed seals
11//!   and published anchors
12//! - **[`InclusionProof`]** / **[`FinalityProof`]** / **[`ProofBundle`]** —
13//!   Cryptographic proofs that a right was locked on the source chain
14//! - **[`AnchorLayer`]** — The core trait each blockchain adapter implements
15//! - **[`SignatureScheme`]** — Supported signing algorithms (secp256k1, ed25519)
16//!
17//! ## Stability
18//!
19//! The types re-exported from this module are considered **stable API**.
20//! They will not change without a semver-major version bump. Internal modules
21//! (state machine, VM, MPC) may evolve as the protocol matures.
22
23#![cfg_attr(not(feature = "std"), no_std)]
24#![warn(missing_docs)]
25#![warn(rustdoc::broken_intra_doc_links)]
26
27extern crate alloc;
28
29// Core types
30pub mod commitment;
31pub mod hash;
32pub mod right;
33pub mod seal;
34pub mod tagged_hash;
35
36// Production hardening
37pub mod hardening;
38
39// State machine types (Phase 1: Consignment Wire Format)
40pub mod consignment;
41pub mod genesis;
42pub mod schema;
43pub mod state;
44pub mod transition;
45
46// MPC Tree (Phase 2)
47pub mod mpc;
48
49// Deterministic VM (Phase 3)
50pub mod vm;
51
52// DAG and proof types
53pub mod dag;
54pub mod proof;
55pub mod proof_verify;
56pub mod signature;
57
58// Error handling and traits
59pub mod error;
60pub mod traits;
61
62// Cross-cutting (Phase 10)
63pub mod monitor;
64pub mod store;
65
66// Client-side validation (Sprint 2)
67pub mod client;
68pub mod commitment_chain;
69pub mod seal_registry;
70pub mod state_store;
71pub mod validator;
72
73// Cross-chain transfer (Sprint 4 - NORTH STAR)
74pub mod cross_chain;
75
76// RGB protocol compatibility (Sprint 5)
77pub mod rgb_compat;
78
79// Tapret verification (Sprint 0.5) - requires bitcoin dependency
80#[cfg(feature = "tapret")]
81pub mod tapret_verify;
82
83// Re-exports: core
84pub use commitment::Commitment;
85pub use hardening::{
86    BoundedQueue, CircuitBreaker, CircuitState, MemoryLimits, TimeoutConfig,
87    DEFAULT_CIRCUIT_MAX_FAILURES, DEFAULT_CIRCUIT_RESET_TIMEOUT, DEFAULT_HEALTH_CHECK_TIMEOUT,
88    DEFAULT_RPC_TIMEOUT, MAX_CACHE_SIZE, MAX_REGISTRY_SIZE, MAX_SEAL_REGISTRY_SIZE,
89};
90pub use hash::Hash;
91pub use right::{OwnershipProof, Right, RightError, RightId};
92pub use seal::{AnchorRef, SealRef};
93
94// Re-exports: state machine (Phase 1)
95pub use consignment::CONSIGNMENT_VERSION;
96pub use consignment::{Anchor as ConsignmentAnchor, Consignment, ConsignmentError, SealAssignment};
97pub use genesis::Genesis;
98pub use schema::SCHEMA_VERSION;
99pub use schema::{
100    GlobalStateType, OwnedStateType, Schema, SchemaError, StateDataType, TransitionDef,
101    TransitionValidationError,
102};
103pub use state::{GlobalState, Metadata, OwnedState, StateAssignment, StateRef, StateTypeId};
104pub use transition::Transition;
105
106// Re-exports: MPC (Phase 2)
107pub use mpc::{MerkleBranchNode, MpcLeaf, MpcProof, MpcTree, ProtocolId};
108
109// Re-exports: VM (Phase 3)
110pub use vm::{execute_transition, DeterministicVM, PassthroughVM, VMError, VMInputs, VMOutputs};
111
112// Re-exports: DAG and proofs
113pub use dag::{DAGNode, DAGSegment};
114pub use proof::{FinalityProof, InclusionProof, ProofBundle};
115pub use proof_verify::verify_proof;
116pub use signature::{parse_signatures_from_bytes, verify_signatures, Signature, SignatureScheme};
117
118// Re-exports: errors and traits
119pub use error::{AdapterError, Result};
120pub use traits::AnchorLayer;
121
122// Re-exports: cross-cutting (Phase 10)
123pub use monitor::{PendingPublication, PublicationTracker, ReorgEvent, ReorgMonitor};
124pub use store::{AnchorRecord, InMemorySealStore, SealRecord, SealStore, StoreError};