Skip to content

ChunkJoiner can't reconstruct missing/corrupted chunks from parity data #1

Description

@slapec93

ChunkJoiner now correctly parses redundancy-encoded trees (it skips parity refs instead of misreading them as data — see the previous fix), but it still can't do the thing erasure coding actually exists for: recovering a data chunk when it's missing or unavailable. Today a failed fetch() for a data chunk just propagates as an error, even when enough parity chunks exist to reconstruct it.

What's needed

  • A Reed-Solomon decode primitive (erasure-coding/reed-solomon.ts only has rsEncode; needs a matrix-inversion-based reconstruct, mirroring klauspost/reedsolomon's ReconstructData).
  • Wire it into ChunkJoiner: when a data-shard fetch fails, fetch the sibling data + parity chunks in that batch and reconstruct the missing one instead of failing.

Reference

Bee's Go implementation of this exact behavior lives in pkg/file/redundancy/getter/getter.go (ethersphere/bee) — the decoder type there is the model to follow (fetch strategies, recover(), decode()).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions