Skip to content

new crate for shred definitions - #6028

Draft
alexpyattaev wants to merge 4 commits into
anza-xyz:masterfrom
alexpyattaev:shred
Draft

alexpyattaev wants to merge 4 commits into
anza-xyz:masterfrom
alexpyattaev:shred

Conversation

@alexpyattaev

@alexpyattaev alexpyattaev commented Apr 29, 2025 •

Copy link
Copy Markdown

Problem

network packet parsing definition has nothing to do with ledger

Summary of Changes

split off into a separate crate

State diagram

---
config:
  flowchart:
    curve: linear
---
flowchart TB
    style packet stroke: #f00
    style parsed stroke: #ff0
    style nonce stroke: #ff0
    style verified stroke: #0f0
    style rebuilt stroke: #0f0
    style column stroke: #0f0
    packet["Bytes from the wire"] --> fn_parse[/"Shred::parse(bytes)"/]
    fn_parse -->|"shred body"| parsed["AnyShred ‹Parsed›<br/>Prov:Received(Repair)"]
    fn_parse -.->|"repair nonce"| nonce["BlockLocation"]
    nonce -.->batch
    subgraph "Sigverify worker"
    parsed -->|"into_data / into_code"| typed["Shred ‹K, Parsed›"]
    typed -->|"verify(policy, leader)"| verified["Shred ‹K, Verified›"]
    end
    verified -->|"resign(keypair)"| verified
    verified --> batch["insert batch"]
    column("blockstore column") -->|from_blockstore| batch
    batch -->|"recover(data, code)"| rebuilt["Shred‹K, Verified› Provenance::Recovered"]
    rebuilt --> batch
Loading

Provenance tracking

flowchart LR
    wire["wire bytes"] -->|"parse"| received["Received(Turbine) / Received(Repair)"]
    partial["Partial FEC set"] -->|"recover"| recovered["Recovered"]
    column["blockstore column"] -->|"from_blockstore"| stored["Blockstore"]
    entries["serialized entries"] -->|"FecSet::build"| produced["BlockProduction"]

    received --> batch["insert batch"]
    recovered --> batch
    stored --> batch
    produced --> batch
Loading

Block production

flowchart TB
    entries["serialized entries"] -->|"coalesce"| chunk["serialized EntryBatch"]
    chunk -->|"FecSet::build(spec, data, keypair)"| set["FecSet, Provenance::BlockProduction"]
    set -.->|"merkle_root chaining"| chunk
    set -->|into_any| stream["AnyShred ‹Verified›"]
    stream --> wire["Broadcast"]
    stream --> columns["blockstore insert"]
    columns -->|from_blockstore| served["Shred ‹K, Verified› Provenance::Blockstore"]
    served -->|"into_repair_response(nonce)"| response["repair response"]
Loading

Review guide:

  • Focus on examples/ first - we want to confirm ergonomics are where we want them and that code actually becomes more readable first.
  • Next order of business is performance & benches
  • Only once we are happy with those the rest can be checked

The complete overhaul is implemented by five crates:

crate directory what it is
solana-shred-wire-format wire-format/ the layout: section boundaries, readers and writers over bytes.
solana-shred-verify verify/ the Merkle tree over an erasure batch, ed25519 signatures
solana-shredder shredder/ builds and signs an erasure batches
solana-fec-set-recovery fec-set-recovery/ rebuilds an erasure batch's missing shreds with Reed-Solomon.
solana-shred . the typestate shred lifecycle state machine

LoC tally

Impl LoC
ORIGINAL 5906
NEW 3542

Comment thread shred/README.md Resolved
Comment thread shred/README.md Resolved
Comment thread shred/README.md Resolved
Comment thread shred/README.md Resolved
Comment thread shred/README.md Resolved
Comment thread shred/README.md Resolved
Comment thread shred/README.md Resolved
Comment thread shred/README.md Resolved
Comment thread shred/README.md Resolved
Comment thread shred/README.md Resolved
Comment thread shred/README.md Resolved
Comment thread shred/README.md Resolved
Comment thread shred/README.md Resolved
Comment thread shred/README.md Resolved
Comment thread shred/README.md Resolved
Comment thread shred/README.md Resolved
Comment thread shred/README.md Resolved
@alexpyattaev alexpyattaev mentioned this pull request Nov 22, 2025
@github-actions

github-actions Bot commented Mar 3, 2026

Copy link
Copy Markdown

This pull request is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown

This pull request is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions

Copy link
Copy Markdown

This pull request is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@codecov-commenter

codecov-commenter commented Aug 19, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 70.20950% with 583 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.4%. Comparing base (a748ed1) to head (5882d70).
⚠️ Report is 245 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##           master    #6028     +/-   ##
=========================================
- Coverage    82.4%    82.4%   -0.1%     
=========================================
  Files         936      953     +17     
  Lines      372276   374232   +1956     
=========================================
+ Hits       307042   308425   +1383     
- Misses      65234    65807    +573     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@alexpyattaev alexpyattaev added noCI Suppress CI on this Pull Request and removed noCI Suppress CI on this Pull Request labels Aug 19, 2026
@plafer plafer mentioned this pull request Aug 27, 2026
Ports the agave-shred changes made on shred_integration back onto this
branch: shred id types, kind-erased accessors, header-only admission,
verify_with for a caller-side signature cache, ShredKind <-> u8, and
Eq/Hash on shreds. MerkleTree::try_new becomes pub.
Restores the structural check the incumbent sanitizer made: a data shred
whose flags set the slot-end bit without the FEC-set-end bit is rejected
while it is read, so every path into a shred is covered.

FecSetSpec now validates where an FEC set may start and which slots a
batch may chain between, before anything is written, so building can no
longer produce shreds that admission immediately rejects.

Adds golden payload vectors captured from the incumbent shredder, which
preserve the byte-for-byte compatibility coverage after it is deleted.
Verified narrows to what it actually promises.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants