Skip to content

Commit

Permalink
fix: build the correct square
Browse files Browse the repository at this point in the history
  • Loading branch information
rach-id committed Aug 3, 2023
1 parent c2c0afa commit b747251
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions pkg/proof/proof_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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))
Expand Down

0 comments on commit b747251

Please sign in to comment.