Skip to content

Commit

Permalink
chore: bump to rsmt2d v0.11.0 (celestiaorg#2580)
Browse files Browse the repository at this point in the history
  • Loading branch information
rootulp committed Aug 18, 2023
1 parent 323f603 commit 1cc1da6
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 79 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require (
github.com/celestiaorg/go-header v0.2.12
github.com/celestiaorg/go-libp2p-messenger v0.2.0
github.com/celestiaorg/nmt v0.18.1
github.com/celestiaorg/rsmt2d v0.10.0
github.com/celestiaorg/rsmt2d v0.11.0
github.com/cosmos/cosmos-sdk v0.46.13
github.com/cosmos/cosmos-sdk/api v0.1.0
github.com/cristalhq/jwt v1.2.0
Expand Down Expand Up @@ -221,7 +221,7 @@ require (
github.com/josharian/intern v1.0.0 // indirect
github.com/klauspost/compress v1.16.7 // indirect
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
github.com/klauspost/reedsolomon v1.11.1 // indirect
github.com/klauspost/reedsolomon v1.11.8 // indirect
github.com/koron/go-ssdp v0.0.4 // indirect
github.com/lib/pq v1.10.7 // indirect
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,8 @@ github.com/celestiaorg/nmt v0.18.1 h1:zU3apzW4y0fs0ilQA74XnEYW8FvRv0CUK2LXK66L3r
github.com/celestiaorg/nmt v0.18.1/go.mod h1:0l8q6UYRju1xNrxtvV6NwPdW3lfsN6KuZ0htRnModdc=
github.com/celestiaorg/quantum-gravity-bridge v1.3.0 h1:9zPIp7w1FWfkPnn16y3S4FpFLnQtS7rm81CUVcHEts0=
github.com/celestiaorg/quantum-gravity-bridge v1.3.0/go.mod h1:6WOajINTDEUXpSj5UZzod16UZ96ZVB/rFNKyM+Mt1gI=
github.com/celestiaorg/rsmt2d v0.10.0 h1:8dprr6CW5mCk5YPnbiLdirojw9YsJOE+XB+GORb8sT0=
github.com/celestiaorg/rsmt2d v0.10.0/go.mod h1:BiCZkCJfhDHUEOJKXUeu+CudjluecKvRTqHcuxKvodc=
github.com/celestiaorg/rsmt2d v0.11.0 h1:lcto/637WyTEZR3dLRoNvyuExfnUbxvdvKi3qz/2V4k=
github.com/celestiaorg/rsmt2d v0.11.0/go.mod h1:6Y580I3gVr0+OVFfW6m2JTwnCCmvW3WfbwSLfuT+HCA=
github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4=
github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
github.com/cenkalti/backoff/v4 v4.1.1/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw=
Expand Down Expand Up @@ -1157,8 +1157,8 @@ github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/q
github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
github.com/klauspost/crc32 v0.0.0-20161016154125-cb6bfca970f6/go.mod h1:+ZoRqAPRLkC4NPOvfYeR5KNOrY6TD+/sAC3HXPZgDYg=
github.com/klauspost/pgzip v1.0.2-0.20170402124221-0bf5dcad4ada/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs=
github.com/klauspost/reedsolomon v1.11.1 h1:0gCWQXOB8pVe1Y5SGozDA5t2qoVxX3prsV+qHgI/Fik=
github.com/klauspost/reedsolomon v1.11.1/go.mod h1:FXLZzlJIdfqEnQLdUKWNRuMZg747hZ4oYp2Ml60Lb/k=
github.com/klauspost/reedsolomon v1.11.8 h1:s8RpUW5TK4hjr+djiOpbZJB4ksx+TdYbRH7vHQpwPOY=
github.com/klauspost/reedsolomon v1.11.8/go.mod h1:4bXRN+cVzMdml6ti7qLouuYi32KHJ5MGv0Qd8a47h6A=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/koron/go-ssdp v0.0.0-20191105050749-2e1c40ed0b5d/go.mod h1:5Ky9EC2xfoUKUor0Hjgi2BJhCSXJfMOFlmyYrVKGQMk=
Expand Down
2 changes: 1 addition & 1 deletion share/eds/eds.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func getProofs(ctx context.Context, eds *rsmt2d.ExtendedDataSquare) (map[cid.Cid
}

// recompute proofs from eds
shares := share.ExtractEDS(eds)
shares := eds.Flattened()
shareCount := len(shares)
if shareCount == 0 {
return nil, ErrEmptySquare
Expand Down
2 changes: 1 addition & 1 deletion share/eds/edstest/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

func RandByzantineEDS(t *testing.T, size int) *rsmt2d.ExtendedDataSquare {
eds := RandEDS(t, size)
shares := share.ExtractEDS(eds)
shares := eds.Flattened()
copy(share.GetData(shares[0]), share.GetData(shares[1])) // corrupting eds
eds, err := rsmt2d.ImportExtendedDataSquare(shares, share.DefaultRSMT2DCodec(), wrapper.NewConstructor(uint64(size)))
require.NoError(t, err, "failure to recompute the extended data square")
Expand Down
4 changes: 2 additions & 2 deletions share/eds/retriever_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func TestRetriever_Retrieve(t *testing.T) {
require.NoError(t, err)
out, err := r.Retrieve(ctx, &dah)
require.NoError(t, err)
assert.True(t, share.EqualEDS(in, out))
assert.True(t, in.Equals(out))
})
}
}
Expand All @@ -74,7 +74,7 @@ func TestRetriever_ByzantineError(t *testing.T) {
defer cancel()

bserv := mdutils.Bserv()
shares := share.ExtractEDS(edstest.RandEDS(t, width))
shares := edstest.RandEDS(t, width).Flattened()
_, err := ipld.ImportShares(ctx, shares, bserv)
require.NoError(t, err)

Expand Down
12 changes: 6 additions & 6 deletions share/getters/getter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ func TestTeeGetter(t *testing.T) {

retrievedEDS, err := tg.GetEDS(ctx, &dah)
require.NoError(t, err)
require.True(t, share.EqualEDS(randEds, retrievedEDS))
require.True(t, randEds.Equals(retrievedEDS))

// eds store now has the EDS and it can be retrieved
ok, err = edsStore.Has(ctx, dah.Hash())
assert.True(t, ok)
assert.NoError(t, err)
finalEDS, err := edsStore.Get(ctx, dah.Hash())
assert.NoError(t, err)
require.True(t, share.EqualEDS(randEds, finalEDS))
require.True(t, randEds.Equals(finalEDS))
})

t.Run("ShardAlreadyExistsDoesntError", func(t *testing.T) {
Expand All @@ -70,12 +70,12 @@ func TestTeeGetter(t *testing.T) {

retrievedEDS, err := tg.GetEDS(ctx, &dah)
require.NoError(t, err)
require.True(t, share.EqualEDS(randEds, retrievedEDS))
require.True(t, randEds.Equals(retrievedEDS))

// no error should be returned, even though the EDS identified by the DAH already exists
retrievedEDS, err = tg.GetEDS(ctx, &dah)
require.NoError(t, err)
require.True(t, share.EqualEDS(randEds, retrievedEDS))
require.True(t, randEds.Equals(retrievedEDS))
})
}

Expand Down Expand Up @@ -120,7 +120,7 @@ func TestStoreGetter(t *testing.T) {

retrievedEDS, err := sg.GetEDS(ctx, &dah)
require.NoError(t, err)
assert.True(t, share.EqualEDS(randEds, retrievedEDS))
assert.True(t, randEds.Equals(retrievedEDS))

// root not found
root := share.Root{}
Expand Down Expand Up @@ -199,7 +199,7 @@ func TestIPLDGetter(t *testing.T) {

retrievedEDS, err := sg.GetEDS(ctx, &dah)
require.NoError(t, err)
assert.True(t, share.EqualEDS(randEds, retrievedEDS))
assert.True(t, randEds.Equals(retrievedEDS))
})

t.Run("GetSharesByNamespace", func(t *testing.T) {
Expand Down
58 changes: 0 additions & 58 deletions share/helpers.go

This file was deleted.

2 changes: 1 addition & 1 deletion share/ipld/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func ImportShares(
}

func ImportEDS(ctx context.Context, square *rsmt2d.ExtendedDataSquare, adder blockservice.BlockService) error {
shares := share.ExtractEDS(square)
shares := square.Flattened()
_, err := ImportShares(ctx, shares, adder)
return err
}
8 changes: 4 additions & 4 deletions share/ipld/get_shares_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func TestBlockRecovery(t *testing.T) {
colRoots, err := testEds.ColRoots()
require.NoError(t, err)

flat := share.ExtractEDS(testEds)
flat := testEds.Flattened()

// recover a partially complete square
rdata := removeRandShares(flat, tc.d)
Expand All @@ -116,7 +116,7 @@ func TestBlockRecovery(t *testing.T) {
reds, err := rsmt2d.ImportExtendedDataSquare(rdata, share.DefaultRSMT2DCodec(), wrapper.NewConstructor(squareSize))
require.NoError(t, err)
// check that the squares are equal
assert.Equal(t, share.ExtractEDS(testEds), share.ExtractEDS(reds))
assert.Equal(t, testEds.Flattened(), reds.Flattened())
})
}
}
Expand All @@ -133,7 +133,7 @@ func Test_ConvertEDStoShares(t *testing.T) {
)
require.NoError(t, err)

resshares := share.ExtractODS(testEds)
resshares := testEds.FlattenedODS()
require.Equal(t, shares, resshares)
}

Expand Down Expand Up @@ -434,7 +434,7 @@ func TestBatchSize(t *testing.T) {
bs := blockstore.NewBlockstore(dssync.MutexWrap(ds.NewMapDatastore()))

randEds := edstest.RandEDS(t, tt.origWidth)
_, err := AddShares(ctx, share.ExtractODS(randEds), blockservice.New(bs, offline.Exchange(bs)))
_, err := AddShares(ctx, randEds.FlattenedODS(), blockservice.New(bs, offline.Exchange(bs)))
require.NoError(t, err)

out, err := bs.AllKeysChan(ctx)
Expand Down

0 comments on commit 1cc1da6

Please sign in to comment.