@@ -2,6 +2,7 @@ package shrex_getter //nolint:stylecheck // underscore in pkg name will be fixed
22
33import (
44 "context"
5+ "fmt"
56 "sync/atomic"
67 "testing"
78 "time"
@@ -241,7 +242,7 @@ func TestShrexGetter(t *testing.T) {
241242 })
242243
243244 t .Run ("Samples_Available" , func (t * testing.T ) {
244- ctx , cancel := context .WithTimeout (ctx , time .Second )
245+ ctx , cancel := context .WithTimeout (ctx , time .Minute )
245246 t .Cleanup (cancel )
246247
247248 // generate test data
@@ -257,20 +258,24 @@ func TestShrexGetter(t *testing.T) {
257258 Height : height ,
258259 })
259260
260- coords := []shwap.SampleCoords {
261- {Row : 0 , Col : 0 },
262- {Row : 0 , Col : 1 },
263- {Row : 0 , Col : 2 },
264- {Row : 0 , Col : 3 },
261+ odsSize := len (eh .DAH .RowRoots ) / 2
262+ coords := make ([]shwap.SampleCoords , odsSize * odsSize )
263+ total := 0
264+ for i := 0 ; i < odsSize ; i ++ {
265+ for j := 0 ; j < odsSize ; j ++ {
266+ coords [total ] = shwap.SampleCoords {Row : i , Col : j }
267+ total ++
268+ }
265269 }
270+
266271 got , err := getter .GetSamples (ctx , eh , coords )
267272 require .NoError (t , err )
268273 assert .Len (t , got , len (coords ))
269274
270- rowShares := randEDS .Row ( 0 )
275+ odsShares := randEDS .FlattenedODS ( )
271276 require .NoError (t , err )
272277 for i , samples := range got {
273- assert .Equal (t , rowShares [i ], samples .ToBytes ())
278+ assert .Equal (t , odsShares [i ], samples .ToBytes (), fmt . Sprintf ( "sample %d" , i ))
274279 }
275280 })
276281
@@ -343,13 +348,16 @@ func TestShrexGetter(t *testing.T) {
343348 Height : height ,
344349 })
345350
346- row , err := getter .GetRow (ctx , eh , 0 )
347- require .NoError (t , err )
348- shrs , err := row .Shares ()
349- require .NoError (t , err )
350- edsRow := randEDS .Row (0 )
351- for i , shr := range shrs {
352- require .Equal (t , edsRow [i ], shr .ToBytes ())
351+ odsSize := len (roots .RowRoots )
352+ for i := 0 ; i < odsSize ; i ++ {
353+ row , err := getter .GetRow (ctx , eh , i )
354+ require .NoError (t , err )
355+ shrs , err := row .Shares ()
356+ require .NoError (t , err )
357+ edsRow := randEDS .Row (uint (i ))
358+ for j , shr := range shrs {
359+ require .Equal (t , edsRow [j ], shr .ToBytes ())
360+ }
353361 }
354362 })
355363
0 commit comments