celestiaorg/rsmt2d

Is indexing into the `rebuiltExtendedShares` necessary?

rootulp opened this issue · 1 comments

Context

// Otherwise copy them from the EDS.
startIndex := len(shares) - int(eds.originalDataWidth)
rebuiltShares = append(
rebuiltShares[0:eds.originalDataWidth],
shares[startIndex:]...,

Question

Is indexing into rebuiltExtendedShares necessary? It appears to only contain the parity shares so I would expect this to be sufficient:

-		startIndex := len(rebuiltExtendedShares) - int(eds.originalDataWidth)
-		rebuiltShares = append(
-			rebuiltShares[0:eds.originalDataWidth],
-			rebuiltExtendedShares[startIndex:]...,
-		)
+		rebuiltShares = append(rebuiltShares[0:eds.originalDataWidth], rebuiltExtendedShares...)

To elaborate, it appears sufficient b/c he rebuiltExtendedShares are the output of Encode which only returns the parity shares.