From b747251305c05c3955d6e34930500612004be0ee Mon Sep 17 00:00:00 2001 From: rachid Date: Thu, 3 Aug 2023 21:50:47 +0200 Subject: [PATCH] fix: build the correct square --- pkg/proof/proof_test.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/pkg/proof/proof_test.go b/pkg/proof/proof_test.go index 983f1010bc..148cdc30f7 100644 --- a/pkg/proof/proof_test.go +++ b/pkg/proof/proof_test.go @@ -225,12 +225,11 @@ func TestNewShareInclusionProof(t *testing.T) { // TestAllSharesInclusionProof creates proof for all the shares in a block. // Since we can't prove multiple namespaces at the moment, the block will contain all the shares with the same namespace. func TestAllSharesInclusionProof(t *testing.T) { - txs := testfactory.GenerateRandomTxs(64, 500) + txs := testfactory.GenerateRandomTxs(243, 500) - dataSquare, err := square.Construct(txs.ToSliceOfBytes(), appconsts.LatestVersion, appconsts.SquareSizeUpperBound(appconsts.LatestVersion)) - if err != nil { - panic(err) - } + dataSquare, err := square.Construct(txs.ToSliceOfBytes(), appconsts.LatestVersion, 128) + require.NoError(t, err) + assert.Equal(t, 256, len(dataSquare)) // erasure the data square which we use to create the data root. eds, err := da.ExtendShares(shares.ToBytes(dataSquare)) @@ -242,13 +241,13 @@ func TestAllSharesInclusionProof(t *testing.T) { require.NoError(t, err) dataRoot := dah.Hash() - actualNID, err := proof.ParseNamespace(dataSquare, 0, 64) + actualNID, err := proof.ParseNamespace(dataSquare, 0, 256) require.NoError(t, err) require.Equal(t, appns.TxNamespace, actualNID) proof, err := proof.NewShareInclusionProof( dataSquare, appns.TxNamespace, - shares.NewRange(0, 64), + shares.NewRange(0, 256), ) require.NoError(t, err) assert.NoError(t, proof.Validate(dataRoot))