celestiaorg / rsmt2d

Go implementation of two dimensional Reed-Solomon merkle tree data availability scheme.
Apache License 2.0
162 stars 80 forks source link

Consider EDS helper `Roots` #249

Closed rootulp closed 1 year ago

rootulp commented 1 year ago

Context

https://github.com/celestiaorg/celestia-node/pull/2458/files#diff-c33387bdad1a81ed3928f505eadee22744b6fca98b897cacbcb918402843a4cbR246

Proposal

Consider adding a Roots() helper to EDS. Something like:

// Roots returns a byte slice with this eds's RowRoots and ColRoots
// concatenated.
func (eds *ExtendedDataSquare) Roots() (roots [][]byte, err error) {
    rowRoots, err := eds.RowRoots()
    if err != nil {
        return nil, err
    }
    colRoots, err := eds.ColRoots()
    if err != nil {
        return nil, err
    }

    roots = make([][]byte, 0, len(rowRoots)+len(colRoots))
    roots = append(roots, rowRoots...)
    roots = append(roots, colRoots...)
    return roots, nil
}
bao1029p commented 1 year ago

Hi guys, can we work on this ?

rootulp commented 1 year ago

Sure go for it 👍

bao1029p commented 1 year ago

@rootulp hey i created a PR can you give approval for the CI to run