A Rust implementation of Constellation-inspired Reed-Solomon erasure coding with randomized fuzzing, boundary recovery proofs, and a parameterized encoder foundation.
This project explores the Reed-Solomon Forward Error Correction (FEC) pipeline used in Solana's broadcast stage and extends it toward the Constellation paper's PSlice/PShred architecture.
Current focus:
Payload
↓
Data Shards
↓
Parity Shards
↓
Reed-Solomon Encoding
↓
Random Packet Loss
↓
Reconstruction
↓
Original Data Recovery
Solana's broadcast stage converts entries into shreds and groups them into FEC sets. Reed-Solomon coding allows the network to tolerate packet loss without retransmission.
This project aims to:
- Understand Agave's
shredder.rs - Explore Reed-Solomon FEC
- Verify correctness through round-trip testing
- Build a Constellation-inspired encoder
- Eventually implement PSlices, PShreds, Merkle proofs, and benchmarks
Supports configurable:
data_shards
parity_shardsExample:
EncoderConfig {
data_shards: 64,
parity_shards: 192,
}Result:
256 total shards
64 data shards
192 coding shards
Each data shard contains random bytes:
rng.fill(&mut shard[..]);This exercises actual GF(2⁸) arithmetic instead of simple repetitive data.
Creates:
64 Data Shards
+
192 Parity Shards
↓
256 Total Shards
using:
rs.encode(&mut shards)Uses:
rs.reconstruct_data(&mut shards)to recover missing data shards.
Lose exactly parity shards:
64 data
192 parity
Lose 192 shards
↓
64 remain
↓
Recovery succeeds
Verifies:
recover_after_192_losses()Lose one shard beyond tolerance:
Lose 193 shards
↓
63 remain
↓
Recovery fails
Verifies:
fail_after_193_losses()Loss positions are randomized:
indices.shuffle(&mut rand::rng());This simulates arbitrary packet loss patterns.
Each test iteration:
Encode
↓
Lose random shards
↓
Recover
↓
Verify original data
Runs multiple iterations to ensure correctness.
Correctness property:
Random Payload
↓
Encode
↓
Random Loss
↓
Decode
↓
Recovered Data == Original Data
This follows the assignment recommendation:
Running the encoder output back through the decoder and verifying the original data is recovered is the only meaningful test of RS correctness.
src/
│
├── encoder.rs
│ EncoderConfig
│ create_encoder()
│ create_encoded_shards()
│
├── tests.rs
│ Positive boundary tests
│ Negative boundary tests
│ Randomized loss testing
│
└── main.rs
- Broadcast stage
- Data shreds
- Coding shreds
- FEC sets
- ReedSolomonCache
- shredder.rs
- Encoder
- Reconstruction
- Boundary proofs
- Random loss fuzzing
- Random payload generation
- Parameterized encoder
Agave understanding
[X] RS correctness
[X] Boundary proofs
[X] Random loss fuzzing
[X] Random payloads
[X] Parameterized encoder
[ ] PSlices
[ ] PShreds
[ ] FECSet abstraction
[ ] Merkle layer
[ ] Criterion benchmarks
[ ] tc netem simulation
Transaction List T
↓
PSlices
PSlices
↓
PShreds
Data PShreds
+
Coding PShreds
↓
FEC Set
Payload
↓
Merkle Tree
↓
Merkle Root
↓
PShreds + Proofs
Inspired by Agave benchmark structure.
Using:
tc netemto simulate attester loss scenarios.
- Solana Agave
shredder.rs - Reed-Solomon Erasure Crate
- Constellation Whitepaper
- Solana Broadcast Stage
- Turbine Block Propagation