// architecture
A trait, some algorithms, and a dictionary.
The crate is deliberately layered. A generic core knows nothing about chains. A Solana preset sits on top and supplies the dictionary. Zstandard does the encoding. Nothing here talks to a validator.
// the layers
Three modules, one direction of dependency.
// src/core/
Chain-agnostic core
The CompressionStrategy trait and a generic pattern engine. No chain knowledge — reusable machinery for any dictionary.
// src/algorithms/
Aggressive algorithms
EnhancedCTW (context tree weighting), MultiPassCompressor, and PracticalMaxCompression, used mostly by the higher presets and the pattern engine.
// src/presets/solana.rs
The Solana production path
SolanaCompressor constructs a Zstandard dictionary from a hardcoded list of Solana byte patterns at initialization and passes it to the encoder/decoder.
// the dictionary
What Zstandard gets to reference.
The dictionary is a hardcoded constant. There is no online training and no per-customer model, which is what keeps decompression deterministic and the binary self-contained.
// backends
Feature-gated codecs.
Backends are Cargo features. The Solana presets require zstd;
the trait layer works with whatever you enable.
| Feature | Default | Notes |
|---|---|---|
| deflate | Yes | DEFLATE via flate2. The default backend for the trait layer. |
| lz4 | No | LZ4 for throughput-first use. Enable explicitly. |
| zstd | No | Required for the Solana dictionary presets. Enable for the headline ratios. |
See it against the alternatives.
The dictionary is the whole difference from vanilla zstd and DEFLATE / gzip.