Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 93c88a1

Browse files
authoredApr 2, 2021
Merge pull request #264 from lazyledger/ismail/fix_bug_block_recov_test
Fixes a minor glitch in a test that caused confusion about rsmt2d ref: celestiaorg/rsmt2d#21
2 parents c0d9fa6 + 4693b8c commit 93c88a1

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed
 

‎p2p/ipld/read_test.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -160,14 +160,14 @@ func TestBlockRecovery(t *testing.T) {
160160
// adjustedLeafSize describes the size of a leaf that will not get split
161161
adjustedLeafSize := types.MsgShareSize
162162

163-
originalSquareWidth := 2
164-
sharecount := originalSquareWidth * originalSquareWidth
165-
extendedSquareWidth := originalSquareWidth * originalSquareWidth
163+
originalSquareWidth := 8
164+
shareCount := originalSquareWidth * originalSquareWidth
165+
extendedSquareWidth := 2 * originalSquareWidth
166166
extendedShareCount := extendedSquareWidth * extendedSquareWidth
167167

168168
// generate test data
169-
quarterShares := generateRandNamespacedRawData(sharecount, types.NamespaceSize, adjustedLeafSize)
170-
allShares := generateRandNamespacedRawData(sharecount, types.NamespaceSize, adjustedLeafSize)
169+
quarterShares := generateRandNamespacedRawData(shareCount, types.NamespaceSize, adjustedLeafSize)
170+
allShares := generateRandNamespacedRawData(shareCount, types.NamespaceSize, adjustedLeafSize)
171171

172172
testCases := []struct {
173173
name string
@@ -177,8 +177,7 @@ func TestBlockRecovery(t *testing.T) {
177177
errString string
178178
d int // number of shares to delete
179179
}{
180-
// missing more shares causes RepairExtendedDataSquare to hang see
181-
// https://github.com/lazyledger/rsmt2d/issues/21
180+
{"missing 1/2 shares", quarterShares, false, "", extendedShareCount / 2},
182181
{"missing 1/4 shares", quarterShares, false, "", extendedShareCount / 4},
183182
{"missing all but one shares", allShares, true, "failed to solve data square", extendedShareCount - 1},
184183
}
@@ -227,7 +226,8 @@ func TestBlockRecovery(t *testing.T) {
227226
}
228227

229228
func flatten(eds *rsmt2d.ExtendedDataSquare) [][]byte {
230-
out := make([][]byte, eds.Width()*eds.Width())
229+
flattenedEDSSize := eds.Width() * eds.Width()
230+
out := make([][]byte, flattenedEDSSize)
231231
count := 0
232232
for i := uint(0); i < eds.Width(); i++ {
233233
for _, share := range eds.Row(i) {

0 commit comments

Comments
 (0)
Please sign in to comment.