Storage system for the Signet project with hot/cold architecture.
| Crate | Purpose |
|---|---|
signet-storage-types |
Shared primitive types (adapted from Reth) |
signet-cold |
Append-only cold storage for historical blockchain data |
signet-hot |
Trait-based hot storage abstractions |
signet-hot-mdbx |
MDBX implementation of hot storage |
Hot storage (signet-hot, signet-hot-mdbx): Fast key-value access for
frequently used data. Trait-based design allows different backends.
Cold storage (signet-cold): Append-only storage for historical data
indexed by block. Uses task-based async pattern with handles.
ColdStorage: Backend interface for cold storageHotKv,HotKvRead,HotKvWrite: Hot storage abstractionsHistoryRead,HistoryWrite: Higher-level table operations
Common pattern across crates:
in-memory: In-memory backend for testingtest-utils: Test utilities and conformance tests
cargo +nightly fmtcargo clippy -p <crate> --all-features --all-targetscargo clippy -p <crate> --no-default-features --all-targetscargo t -p <crate>
- NEVER use
cargo checkorcargo build. - ALWAYS run clippy with both
--all-featuresand--no-default-features. - ALWAYS run
cargo +nightly fmt. - Run tests per-crate (
-p <crate>) before running repo-wide. - For
signet-cold-sql: ALWAYS run./scripts/test-postgres.shto verify the PostgreSQL backend against the conformance suite.
A Claude hook in .claude/settings.json runs .claude/hooks/pre-push.sh
before every git push. The push is blocked if any check fails. The checks:
cargo +nightly fmt -- --checkcargo clippy --workspace --all-targets --all-features -- -D warningscargo clippy --workspace --all-targets --no-default-features -- -D warningsRUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps
Clippy and doc warnings are hard failures.
- ALWAYS prefer building crate docs and reading them over grep/find/GitHub.
- Match local patterns over personal preferences.
- Functional combinators over imperative control flow. Avoid nesting.
- Small, focused functions and types. Concise rustdoc and comments.
- NEVER add incomplete code or
TODOs for core logic. TODOis acceptable only for perf improvements or non-critical features.- New signet crates MUST use
signet-prefix.
- No glob imports. No blank lines between imports.
- Group imports from the same crate into one
usestatement.
- Default private.
pub(crate)for internal use.pubonly for public API. - NEVER use
pub(super).
thiserrorfor libraries,eyrefor applications. NEVERanyhow.- Propagate with
?. Convert withmap_err.
// NEVER:
if let Some(a) = option { Thing::do(a); } else { return; }
// Preferred:
option.map(Thing::do);
// Or:
let Some(a) = option else { return; };
Thing::do(a);- Builder pattern if >4 fields or multiple fields of same type. ASK if unclear.
- Use
tracing. Spans for bounded work items, not long-lived tasks. skip(self)in instrumented methods; add needed fields manually.- Levels: TRACE (rare/verbose), DEBUG (low-level), INFO (default), WARN (ignorable errors), ERROR (fatal).
- Propagate spans through task boundaries with
Instrument.
tokioconventions. No blocking in async.- Long-lived tasks: return a spawnable future, don't run directly.
- Short-lived spawned tasks: propagate spans with
Instrument.
- ALWAYS include
// SAFETY:comments.
mod testsat bottom of file. Integration tests intests/.- Fail fast:
unwrap()directly, never returnResultfrom tests. - No unnecessary setup. No checking before unwrapping.
- Doc all public items with concise examples.
- Hide scaffolding with
#lines. Include implementation guides for traits. - Consult other
lib.rsfiles for common linter directives.
- PRs on fresh branches off
main. Descriptive branch names. - Claude Code comments MUST start with
**[Claude Code]**.