Skip to content

Commit f5d4bb1

Browse files
committed
fix manager tests
1 parent 1fa131a commit f5d4bb1

1 file changed

Lines changed: 24 additions & 24 deletions

File tree

block/manager_test.go

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -64,19 +64,19 @@ func getManager(t *testing.T, backend goDA.DA) *Manager {
6464
}
6565

6666
// getBlockBiggerThan generates a block with the given height bigger than the specified limit.
67-
func getBlockBiggerThan(blockHeight, limit uint64) (*types.SignedHeader, *types.Data, error) {
68-
for numTxs := 0; ; numTxs += 100 {
69-
header, data := types.GetRandomBlock(blockHeight, numTxs)
70-
blob, err := header.MarshalBinary()
71-
if err != nil {
72-
return nil, nil, err
73-
}
67+
// func getBlockBiggerThan(blockHeight, limit uint64) (*types.SignedHeader, *types.Data, error) {
68+
// for numTxs := 0; ; numTxs += 100 {
69+
// header, data := types.GetRandomBlock(blockHeight, numTxs)
70+
// blob, err := header.MarshalBinary()
71+
// if err != nil {
72+
// return nil, nil, err
73+
// }
7474

75-
if uint64(len(blob)) > limit {
76-
return header, data, nil
77-
}
78-
}
79-
}
75+
// if uint64(len(blob)) > limit {
76+
// return header, data, nil
77+
// }
78+
// }
79+
// }
8080

8181
func TestInitialStateClean(t *testing.T) {
8282
require := require.New(t)
@@ -412,16 +412,16 @@ func Test_submitBlocksToDA_BlockMarshalErrorCase1(t *testing.T) {
412412

413413
m := getManager(t, goDATest.NewDummyDA())
414414

415-
header1, _ := types.GetRandomBlock(uint64(1), 5)
416-
header2, _ := types.GetRandomBlock(uint64(2), 5)
417-
header3, _ := types.GetRandomBlock(uint64(3), 5)
415+
header1, data1 := types.GetRandomBlock(uint64(1), 5)
416+
header2, data2 := types.GetRandomBlock(uint64(2), 5)
417+
header3, data3 := types.GetRandomBlock(uint64(3), 5)
418418

419419
store := mocks.NewStore(t)
420420
invalidateBlockHeader(header1)
421421
store.On("GetMetadata", ctx, LastSubmittedHeightKey).Return(nil, ds.ErrNotFound)
422-
store.On("GetBlock", ctx, uint64(1)).Return(header1, nil)
423-
store.On("GetBlock", ctx, uint64(2)).Return(header2, nil)
424-
store.On("GetBlock", ctx, uint64(3)).Return(header3, nil)
422+
store.On("GetBlockData", ctx, uint64(1)).Return(header1, data1, nil)
423+
store.On("GetBlockData", ctx, uint64(2)).Return(header2, data2, nil)
424+
store.On("GetBlockData", ctx, uint64(3)).Return(header3, data3, nil)
425425
store.On("Height").Return(uint64(3))
426426

427427
m.store = store
@@ -446,19 +446,19 @@ func Test_submitBlocksToDA_BlockMarshalErrorCase2(t *testing.T) {
446446

447447
m := getManager(t, goDATest.NewDummyDA())
448448

449-
header1, _ := types.GetRandomBlock(uint64(1), 5)
450-
header2, _ := types.GetRandomBlock(uint64(2), 5)
451-
header3, _ := types.GetRandomBlock(uint64(3), 5)
449+
header1, data1 := types.GetRandomBlock(uint64(1), 5)
450+
header2, data2 := types.GetRandomBlock(uint64(2), 5)
451+
header3, data3 := types.GetRandomBlock(uint64(3), 5)
452452

453453
store := mocks.NewStore(t)
454454
invalidateBlockHeader(header3)
455455
store.On("SetMetadata", ctx, DAIncludedHeightKey, []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}).Return(nil)
456456
store.On("SetMetadata", ctx, DAIncludedHeightKey, []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02}).Return(nil)
457457
store.On("SetMetadata", ctx, LastSubmittedHeightKey, []byte(strconv.FormatUint(2, 10))).Return(nil)
458458
store.On("GetMetadata", ctx, LastSubmittedHeightKey).Return(nil, ds.ErrNotFound)
459-
store.On("GetBlock", ctx, uint64(1)).Return(header1, nil)
460-
store.On("GetBlock", ctx, uint64(2)).Return(header2, nil)
461-
store.On("GetBlock", ctx, uint64(3)).Return(header3, nil)
459+
store.On("GetBlockData", ctx, uint64(1)).Return(header1, data1, nil)
460+
store.On("GetBlockData", ctx, uint64(2)).Return(header2, data2, nil)
461+
store.On("GetBlockData", ctx, uint64(3)).Return(header3, data3, nil)
462462
store.On("Height").Return(uint64(3))
463463

464464
m.store = store

0 commit comments

Comments
 (0)