celestiaorg / celestiaorg/rsmt2d

Enhance `Codec`'s decoding options

Open
#279 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
Go
Stars
169
Forks
87
Avg merge
8h 9m
Merged PRs (30d)
7

Description

## Problem
Currently, `Decode` allows decoding only the entire axis. It requires a 2D bytes slice as input and reconstructs nil shares via non-nil ones. However, we now need an additional use case where we want to reconstruct only particular nil shares and not all of them. This optimization is a part of [lazy-extend](https://github.com/celestiaorg/rsmt2d/issues/266) effort and avoids unnecessary share reconstruction for `Codec`

## Solutions
* change the `Decode` slice share inputs to have three states: built, nil, and empty(zero-length). The new `empty` share slices will signal to `Codec` that they need to be reconstructed by the provided `built`, while `nil` shares will be left untouched.
* Less explicit and needs to be properly documented
* add a new `DecodeSome` method that takes the same shares slice as input + an additional slice of bools with the same line as the shares slice, following [klauspost's ReconstructSome](https://github.com/klauspost/reedsolomon/blob/674f18bb1f8189237afb301da140a899a4a85756/reedsolomon.go#L78) method.
* Allocates additional slice
* Two code paths for lazy and non-lazy decoding that can be single.

# Refs

Blocked on https://github.com/klauspost/reedsolomon/issues/264

Contributor guide

Open the contributing guide

Research direction

Start by reading the Decode behavior described in this issue and the linked lazy-extend issue #266. Compare the two proposed approaches, then review the referenced klauspost ReconstructSome implementation and issue #264. Done means Codec can reconstruct only the requested missing shares while leaving other nil shares untouched, with the chosen behavior documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
data
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.