Expand description
§dig-blockstore
Persistent storage for validated DIG L2 blocks: RocksDB layout, canonical
height→hash indexing, caching, rollback, pruning, and checkpoints — see
docs/resources/SPEC.md for the authoritative architecture.
§Module layout (STR-002)
The subtree under src/ mirrors STR-002
and §16 — Crate boundary in docs/resources/SPEC.md: store, config, types,
constants, cf_options (TYP-003),
errors, encoding, cache, canonical index, compression, async pipeline,
and snapshot I/O.
§Public API surface (STR-003)
Primary types, constants, and key helpers are re-exported at the crate root per
STR-003 and §15 in
docs/resources/SPEC.md. Submodules remain pub so integration tests and advanced callers
can use qualified paths (e.g. store::BlockStore).
§STR-001 dependency smoke
[str001_dependency_smoke] forces every direct Cargo.toml dependency to link,
catching resolution failures early (STR-001).
Re-exports§
pub use config::BlockStoreConfig;pub use constants::CF_ATTESTED;pub use constants::CF_BLOCKS;pub use constants::CF_CANONICAL;pub use constants::CF_CHECKPOINTS;pub use constants::CF_HEADERS;pub use constants::CF_METADATA;pub use constants::DEFAULT_BLOCK_CACHE_CAPACITY;pub use constants::DEFAULT_BLOCK_CACHE_SIZE;pub use constants::DEFAULT_BLOOM_BITS_PER_KEY;pub use constants::DEFAULT_HEADER_CACHE_CAPACITY;pub use constants::DEFAULT_MAX_DECOMPRESSED_BLOCK_BYTES;pub use constants::DEFAULT_MAX_OPEN_FILES;pub use constants::DEFAULT_WRITE_BUFFER_SIZE;pub use constants::DICT_TARGET_SIZE;pub use constants::DICT_TRAINING_THRESHOLD;pub use constants::META_GENESIS_HASH;pub use constants::META_MIN_HEIGHT;pub use constants::META_SCHEMA_VERSION;pub use constants::META_TIP;pub use constants::META_ZSTD_DICT;pub use constants::SCHEMA_VERSION;pub use constants::ZSTD_COMPRESSION_LEVEL;pub use encoding::decode_epoch_key;pub use encoding::decode_height_key;pub use encoding::epoch_key;pub use encoding::hash_key;pub use encoding::height_key;pub use encoding::metadata_key;pub use error::BlockStoreError;pub use error::ERR_ASYNC_JOIN_PREFIX;pub use error::ERR_INIT_GENESIS_ALREADY_INITIALIZED;pub use error::ERR_INIT_GENESIS_READ_ONLY;pub use error::ERR_MUTATION_READ_ONLY;pub use error::ERR_OPEN_READONLY_PATH_MISSING_PREFIX;pub use error::ERR_UPDATE_STATUS_RECORD_NOT_CACHED_PREFIX;pub use snapshot::SnapshotManifest;pub use snapshot::SNAPSHOT_VERSION;pub use store::BlockStore;pub use store::StreamBlocksInRange;pub use types::BlockRecord;pub use types::ChainTip;pub use types::ReorgResult;pub use types::StorageStats;pub use types::StoredCheckpoint;pub use wire::block_from_wire_bytes;pub use wire::block_to_wire_bytes;
Modules§
- cache
- In-memory caching layer (sharded LRU + startup warming).
- canonical
- Canonical height → hash index (RocksDB + mmap fast path).
- cf_
options - RocksDB per–column-family options (
TYP-003). - compression
- Zstd compression and bincode serialization for block bodies and headers.
- config
BlockStoreConfig— paths, cache sizes, RocksDB tuning, pipeline, and pruning hooks.- constants
- Column family names (
CF_*) and metadata keys (META_*) for RocksDB. - encoding
- Key encoding helpers for RocksDB keys (hash, height, epoch, metadata).
- error
BlockStoreerror surface (BlockStoreError).- pipeline
- Async batched write pipeline and canonical range streaming
(
BLK-006,BLK-008). - snapshot
- Snapshot export / import (
SNP-001…SNP-004). - store
BlockStore— RocksDB-backed persistent block and chain state.- types
- Lightweight storage-facing types (records, tip, stats).
- wire
- Chia [
Streamable] wire serialization fordig_block::L2Block(SER-003). Chia Streamable wire helpers for gossip / full-node interop (SER-003).
Structs§
- Attested
Block - L2 block wrapped with attestation state: who signed, aggregate BLS signature, receipts, lifecycle status.
- L2Block
- Complete L2 block: header plus body (spend bundles, slash payloads) and proposer attestation.
- L2Block
Header - DIG L2 block header: identity, Merkle commitments, L1 anchor, metadata, optional L1 proofs, slash proposal commitments, and DFSP data-layer roots.
Enums§
- Block
Status - Lifecycle status of an attested block (SPEC §2.5).