celestiaorg / rsmt2d

Go implementation of two dimensional Reed-Solomon merkle tree data availability scheme.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Clarification around `rowRoots` provided to `Repair`

rootulp opened this issue · comments

Context

// Repair attempts to repair an incomplete extended data
// square (EDS), comparing repaired rows and columns against expected Merkle
// roots.
//
// # Input
//
// Missing shares must be nil.
//
// # Output
//
// The EDS is modified in-place. If repairing is successful, the EDS will be
// complete. If repairing is unsuccessful, the EDS will be the most-repaired
// prior to the Byzantine row or column being repaired, and the Byzantine row
// or column prior to repair is returned in the error with missing shares as
// nil.
func (eds *ExtendedDataSquare) Repair(

Question

Should the rowRoots and columnRoots that are provided to Repair be the row roots that are computed on the complete EDS or the incomplete EDS? I assume the complete EDS because computing row roots for an incomplete EDS is undefined behavior (see #122).

However, if the row roots are indeed the ones computed on the complete EDS prior to shares being removed, I don't understand why this test exists. I would expect every test case in that test to fail because Repair is being called with bad roots. The only reason test cases in that test pass is because row roots are being computed after shares are removed from the data square which is undefined behavior.

On the complete EDS iirc. In the node we pass there roots from DAH

However, if the row roots are indeed the ones computed on the complete EDS prior to shares being removed, I don't understand why this test exists. I would expect every test case in that test to fail because Repair is being called with bad roots. The only reason test cases in that test pass is because row roots are being computed after shares are removed from the data square which is undefined behavior.

Interestingly, I also contemplated the same issue yesterday regarding why roots are computed from the corrupted EDS. As mentioned by @Wondertan, the roots should be derived from the DA header, which, in the tests, represents the roots of the sample EDS before it got corrupted.

Regarding the specific test, my understanding is that it seems to aim at examining whether a full node can identify faulty erasure coding, even when the roots of the DA header are corrupted, meaning they were computed from a corrupted EDS.
However, even if this is the scenario, I am still unsure why one can even compute a row root while some shares are nil as also mentioned in this issue #214 (in this test, some shares in the EDS are set to nil, and then the roots are computed from the altered EDS)

I am still unsure why one can even compute a row root while some shares are nil

+1. If an EDS contains nil shares, I think RowRoots should return an error.