eth-state-diff 0.1.0

Minimal-allocation delta encoding for Ethereum consensus state, optimized for archival storage and zstd compression.
Documentation
  • Coverage
  • 69.88%
    181 out of 259 items documented0 out of 68 items with examples
  • Size
  • Source code size: 79.71 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 4.26 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 16s Average build duration of successful builds.
  • all releases: 15s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • galadd
eth-state-diff-0.1.0 has been yanked.

eth_state_diff

Crates.io Docs.rs

eth_state_diff computes and applies compact binary deltas between Ethereum consensus-layer states. It is designed for archival storage, fast-sync, and historical state reconstruction, replacing full snapshots with highly compressible encodings.

Design Philosophy

This library targets the disk layer. It operates strictly on contiguous, flat SSZ byte buffers (&[u8], &mut Vec) rather than complex in-memory tree structures. This allows the delta algorithms to saturate memory bandwidth and avoids serialization overhead during reconstruction.

Features

  • Domain-specific encoders: Mode-corrected zigzag varints for dense balance updates, sparse delta-varints for participation flags, and field-level SSZ patches for validators.
  • Hardware-optimized: Linear scans over flat arrays designed to maximize CPU prefetching and memory bus utilization.
  • Zero-copy deserialization: Native rkyv support for instant access to archived delta data without allocation.
  • Entropy-optimal: Output payloads are structured to compress to extreme degrees using standard tools like zstd (e.g., ~900KB for 32 epochs of mainnet state).
  • Minimal allocations during apply: Reconstruction modifies target buffers in-place, requiring heap allocations only for newly appended validators.
  • Generic integration: Simple traits (DiffSource and DiffTarget) allow integration with any consensus client that can provide or consume raw SSZ byte slices.

License

Licensed under either of

at your option.