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()).
ChunkJoinernow 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 failedfetch()for a data chunk just propagates as an error, even when enough parity chunks exist to reconstruct it.What's needed
erasure-coding/reed-solomon.tsonly hasrsEncode; needs a matrix-inversion-based reconstruct, mirroringklauspost/reedsolomon'sReconstructData).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) — thedecodertype there is the model to follow (fetch strategies,recover(),decode()).