Skip to content

Commit

Permalink
chore: migrate to boxo
Browse files Browse the repository at this point in the history
  • Loading branch information
Wondertan authored and distractedm1nd committed Sep 5, 2023
1 parent da8244e commit 4a2ef55
Show file tree
Hide file tree
Showing 34 changed files with 112 additions and 103 deletions.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,10 @@ lint-imports:

## sort-imports: Sort Go imports.
sort-imports:
@goimports-reviser -company-prefixes "github.com/celestiaorg" -project-name "github.com/celestiaorg/"$(PROJECTNAME)"" -output stdout .
@for file in `find . -type f -name '*.go'`; \
do goimports-reviser -company-prefixes "github.com/celestiaorg" -project-name "github.com/celestiaorg/"$(PROJECTNAME)"" $$file \
|| exit 1; \
done;
.PHONY: sort-imports

## adr-gen: Generate ADR from template. Must set NUM and TITLE parameters.
Expand Down
7 changes: 3 additions & 4 deletions blob/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (

ds "github.com/ipfs/go-datastore"
ds_sync "github.com/ipfs/go-datastore/sync"
mdutils "github.com/ipfs/go-merkledag/test"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
tmrand "github.com/tendermint/tendermint/libs/rand"
Expand Down Expand Up @@ -324,7 +323,7 @@ func TestService_GetSingleBlobWithoutPadding(t *testing.T) {
rawShares = append(rawShares, append(rawShares0, padding0.ToBytes())...)
rawShares = append(rawShares, append(rawShares1, padding1.ToBytes())...)

bs := mdutils.Bserv()
bs := ipld.NewMemBlockservice()
batching := ds_sync.MutexWrap(ds.NewMapDatastore())
headerStore, err := store.NewStore[*header.ExtendedHeader](batching)
require.NoError(t, err)
Expand Down Expand Up @@ -375,7 +374,7 @@ func TestService_GetAllWithoutPadding(t *testing.T) {
rawShares = append(rawShares, append(rawShares0, padding0.ToBytes())...)
}

bs := mdutils.Bserv()
bs := ipld.NewMemBlockservice()
batching := ds_sync.MutexWrap(ds.NewMapDatastore())
headerStore, err := store.NewStore[*header.ExtendedHeader](batching)
require.NoError(t, err)
Expand All @@ -397,7 +396,7 @@ func TestService_GetAllWithoutPadding(t *testing.T) {
}

func createService(ctx context.Context, t *testing.T, blobs []*Blob) *Service {
bs := mdutils.Bserv()
bs := ipld.NewMemBlockservice()
batching := ds_sync.MutexWrap(ds.NewMapDatastore())
headerStore, err := store.NewStore[*header.ExtendedHeader](batching)
require.NoError(t, err)
Expand Down
10 changes: 5 additions & 5 deletions das/daser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ import (
"time"

"github.com/golang/mock/gomock"
"github.com/ipfs/go-blockservice"
"github.com/ipfs/boxo/blockservice"
"github.com/ipfs/go-datastore"
ds_sync "github.com/ipfs/go-datastore/sync"
mdutils "github.com/ipfs/go-merkledag/test"
pubsub "github.com/libp2p/go-libp2p-pubsub"
mocknet "github.com/libp2p/go-libp2p/p2p/net/mock"
"github.com/stretchr/testify/assert"
Expand All @@ -31,6 +30,7 @@ import (
availability_test "github.com/celestiaorg/celestia-node/share/availability/test"
"github.com/celestiaorg/celestia-node/share/eds/byzantine"
"github.com/celestiaorg/celestia-node/share/getters"
"github.com/celestiaorg/celestia-node/share/ipld"
)

var timeout = time.Second * 15
Expand All @@ -39,7 +39,7 @@ var timeout = time.Second * 15
// the DASer checkpoint is updated to network head.
func TestDASerLifecycle(t *testing.T) {
ds := ds_sync.MutexWrap(datastore.NewMapDatastore())
bServ := mdutils.Bserv()
bServ := ipld.NewMemBlockservice()
avail := light.TestAvailability(getters.NewIPLDGetter(bServ))
// 15 headers from the past and 15 future headers
mockGet, sub, mockService := createDASerSubcomponents(t, bServ, 15, 15)
Expand Down Expand Up @@ -79,7 +79,7 @@ func TestDASerLifecycle(t *testing.T) {

func TestDASer_Restart(t *testing.T) {
ds := ds_sync.MutexWrap(datastore.NewMapDatastore())
bServ := mdutils.Bserv()
bServ := ipld.NewMemBlockservice()
avail := light.TestAvailability(getters.NewIPLDGetter(bServ))
// 15 headers from the past and 15 future headers
mockGet, sub, mockService := createDASerSubcomponents(t, bServ, 15, 15)
Expand Down Expand Up @@ -147,7 +147,7 @@ func TestDASer_stopsAfter_BEFP(t *testing.T) {
t.Cleanup(cancel)

ds := ds_sync.MutexWrap(datastore.NewMapDatastore())
bServ := mdutils.Bserv()
bServ := ipld.NewMemBlockservice()
// create mock network
net, err := mocknet.FullMeshLinked(1)
require.NoError(t, err)
Expand Down
11 changes: 4 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ go 1.21

toolchain go1.21.0

replace github.com/ipfs/go-verifcid => github.com/celestiaorg/go-verifcid v0.0.1-lazypatch

require (
cosmossdk.io/errors v1.0.0
cosmossdk.io/math v1.1.2
Expand All @@ -32,15 +30,13 @@ require (
github.com/hashicorp/go-retryablehttp v0.7.4
github.com/hashicorp/golang-lru v1.0.2
github.com/imdario/mergo v0.3.16
github.com/ipfs/boxo v0.11.0
github.com/ipfs/go-block-format v0.2.0
github.com/ipfs/go-blockservice v0.5.1 // down 1 version, 0.5.2 is marked as deprecated and raises alerts
github.com/ipfs/boxo v0.12.0
github.com/ipfs/go-block-format v0.1.2
github.com/ipfs/go-cid v0.4.1
github.com/ipfs/go-datastore v0.6.0
github.com/ipfs/go-ipld-cbor v0.1.0
github.com/ipfs/go-ipld-format v0.6.0
github.com/ipfs/go-log/v2 v2.5.1
github.com/ipfs/go-merkledag v0.11.0
github.com/ipld/go-car v0.6.2
github.com/libp2p/go-libp2p v0.30.0
github.com/libp2p/go-libp2p-kad-dht v0.25.0
Expand Down Expand Up @@ -200,15 +196,16 @@ require (
github.com/influxdata/influxdb-client-go/v2 v2.12.2 // indirect
github.com/influxdata/line-protocol v0.0.0-20210311194329-9aa0e372d097 // indirect
github.com/ipfs/bbloom v0.0.4 // indirect
github.com/ipfs/go-blockservice v0.5.0
github.com/ipfs/go-ipfs-blockstore v1.3.1 // indirect
github.com/ipfs/go-ipfs-delay v0.0.1 // indirect
github.com/ipfs/go-ipfs-ds-help v1.1.0
github.com/ipfs/go-ipfs-exchange-interface v0.2.1 // indirect
github.com/ipfs/go-ipfs-exchange-offline v0.3.0 // indirect
github.com/ipfs/go-ipfs-pq v0.0.3 // indirect
github.com/ipfs/go-ipfs-util v0.0.3 // indirect
github.com/ipfs/go-ipld-legacy v0.2.1 // indirect
github.com/ipfs/go-log v1.0.5 // indirect
github.com/ipfs/go-merkledag v0.11.0 // indirect
github.com/ipfs/go-metrics-interface v0.0.1 // indirect
github.com/ipfs/go-peertaskqueue v0.8.1 // indirect
github.com/ipfs/go-verifcid v0.0.2 // indirect
Expand Down
15 changes: 7 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,6 @@ github.com/celestiaorg/go-header v0.3.0 h1:9fhxSgldPiWWq3yd9u7oSk5vYqaLV1JkeTnJd
github.com/celestiaorg/go-header v0.3.0/go.mod h1:H8xhnDLDLbkpwmWPhCaZyTnIV3dlVxBHPnxNXS2Qu6c=
github.com/celestiaorg/go-libp2p-messenger v0.2.0 h1:/0MuPDcFamQMbw9xTZ73yImqgTO3jHV7wKHvWD/Irao=
github.com/celestiaorg/go-libp2p-messenger v0.2.0/go.mod h1:s9PIhMi7ApOauIsfBcQwbr7m+HBzmVfDIS+QLdgzDSo=
github.com/celestiaorg/go-verifcid v0.0.1-lazypatch h1:9TSe3w1cmJmbWlweCwCTIZkan7jV8M+KwglXpdD+UG8=
github.com/celestiaorg/go-verifcid v0.0.1-lazypatch/go.mod h1:kXPYu0XqTNUKWA1h3M95UHjUqBzDwXVVt/RXZDjKJmQ=
github.com/celestiaorg/merkletree v0.0.0-20210714075610-a84dc3ddbbe4 h1:CJdIpo8n5MFP2MwK0gSRcOVlDlFdQJO1p+FqdxYzmvc=
github.com/celestiaorg/merkletree v0.0.0-20210714075610-a84dc3ddbbe4/go.mod h1:fzuHnhzj1pUygGz+1ZkB3uQbEUL4htqCGJ4Qs2LwMZA=
github.com/celestiaorg/nmt v0.19.0 h1:9VXFeI/gt+q8h5HeCE0RjXJhOxsFzxJUjHrkvF9CMYE=
Expand Down Expand Up @@ -1023,8 +1021,8 @@ github.com/influxdata/usage-client v0.0.0-20160829180054-6d3895376368/go.mod h1:
github.com/ipfs/bbloom v0.0.1/go.mod h1:oqo8CVWsJFMOZqTglBG4wydCE4IQA/G2/SEofB0rjUI=
github.com/ipfs/bbloom v0.0.4 h1:Gi+8EGJ2y5qiD5FbsbpX/TMNcJw8gSqr7eyjHa4Fhvs=
github.com/ipfs/bbloom v0.0.4/go.mod h1:cS9YprKXpoZ9lT0n/Mw/a6/aFV6DTjTLYHeA+gyqMG0=
github.com/ipfs/boxo v0.11.0 h1:urMxhZ3xoF4HssJVD3+0ssGT9pptEfHfbL8DYdoWFlg=
github.com/ipfs/boxo v0.11.0/go.mod h1:8IfDmp+FzFGcF4zjAgHMVPpwYw4AjN9ePEzDfkaYJ1w=
github.com/ipfs/boxo v0.12.0 h1:AXHg/1ONZdRQHQLgG5JHsSC3XoE4DjCAMgK+asZvUcQ=
github.com/ipfs/boxo v0.12.0/go.mod h1:xAnfiU6PtxWCnRqu7dcXQ10bB5/kvI1kXRotuGqGBhg=
github.com/ipfs/go-bitfield v1.0.0/go.mod h1:N/UiujQy+K+ceU1EF5EkVd1TNqevLrCQMIcAEPrdtus=
github.com/ipfs/go-bitfield v1.1.0 h1:fh7FIo8bSwaJEh6DdTWbCeZ1eqOaOkKFI74SCnsWbGA=
github.com/ipfs/go-bitfield v1.1.0/go.mod h1:paqf1wjq/D2BBmzfTVFlJQ9IlFOZpg422HL0HqsGWHU=
Expand All @@ -1040,16 +1038,14 @@ github.com/ipfs/go-block-format v0.0.1/go.mod h1:DK/YYcsSUIVAFNwo/KZCdIIbpN0ROH/
github.com/ipfs/go-block-format v0.0.2/go.mod h1:AWR46JfpcObNfg3ok2JHDUfdiHRgWhJgCQF+KIgOPJY=
github.com/ipfs/go-block-format v0.0.3/go.mod h1:4LmD4ZUw0mhO+JSKdpWwrzATiEfM7WWgQ8H5l6P8MVk=
github.com/ipfs/go-block-format v0.1.1/go.mod h1:+McEIT+g52p+zz5xGAABGSOKrzmrdX97bc0USBdWPUs=
github.com/ipfs/go-block-format v0.1.2 h1:GAjkfhVx1f4YTODS6Esrj1wt2HhrtwTnhEr+DyPUaJo=
github.com/ipfs/go-block-format v0.1.2/go.mod h1:mACVcrxarQKstUU3Yf/RdwbC4DzPV6++rO2a3d+a/KE=
github.com/ipfs/go-block-format v0.2.0 h1:ZqrkxBA2ICbDRbK8KJs/u0O3dlp6gmAuuXUJNiW1Ycs=
github.com/ipfs/go-block-format v0.2.0/go.mod h1:+jpL11nFx5A/SPpsoBn6Bzkra/zaArfSmsknbPMYgzM=
github.com/ipfs/go-blockservice v0.1.0/go.mod h1:hzmMScl1kXHg3M2BjTymbVPjv627N7sYcvYaKbop39M=
github.com/ipfs/go-blockservice v0.1.4/go.mod h1:OTZhFpkgY48kNzbgyvcexW9cHrpjBYIjSR0KoDOFOLU=
github.com/ipfs/go-blockservice v0.2.1/go.mod h1:k6SiwmgyYgs4M/qt+ww6amPeUH9EISLRBnvUurKJhi8=
github.com/ipfs/go-blockservice v0.3.0/go.mod h1:P5ppi8IHDC7O+pA0AlGTF09jruB2h+oP3wVVaZl8sfk=
github.com/ipfs/go-blockservice v0.5.0 h1:B2mwhhhVQl2ntW2EIpaWPwSCxSuqr5fFA93Ms4bYLEY=
github.com/ipfs/go-blockservice v0.5.0/go.mod h1:W6brZ5k20AehbmERplmERn8o2Ni3ZZubvAxaIUeaT6w=
github.com/ipfs/go-blockservice v0.5.1 h1:9pAtkyKAz/skdHTh0kH8VulzWp+qmSDD0aI17TYP/s0=
github.com/ipfs/go-blockservice v0.5.1/go.mod h1:VpMblFEqG67A/H2sHKAemeH9vlURVavlysbdUI632yk=
github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM=
github.com/ipfs/go-cid v0.0.2/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM=
github.com/ipfs/go-cid v0.0.3/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM=
Expand Down Expand Up @@ -1219,6 +1215,9 @@ github.com/ipfs/go-unixfsnode v1.5.2/go.mod h1:NlOebRwYx8lMCNMdhAhEspYPBD3obp7TE
github.com/ipfs/go-unixfsnode v1.7.1/go.mod h1:PVfoyZkX1B34qzT3vJO4nsLUpRCyhnMuHBznRcXirlk=
github.com/ipfs/go-unixfsnode v1.7.4 h1:iLvKyAVKUYOIAW2t4kDYqsT7VLGj31eXJE2aeqGfbwA=
github.com/ipfs/go-unixfsnode v1.7.4/go.mod h1:PVfoyZkX1B34qzT3vJO4nsLUpRCyhnMuHBznRcXirlk=
github.com/ipfs/go-verifcid v0.0.1/go.mod h1:5Hrva5KBeIog4A+UpqlaIU+DEstipcJYQQZc0g37pY0=
github.com/ipfs/go-verifcid v0.0.2 h1:XPnUv0XmdH+ZIhLGKg6U2vaPaRDXb9urMyNVCE7uvTs=
github.com/ipfs/go-verifcid v0.0.2/go.mod h1:40cD9x1y4OWnFXbLNJYRe7MpNvWlMn3LZAG5Wb4xnPU=
github.com/ipfs/interface-go-ipfs-core v0.9.0/go.mod h1:F3EcmDy53GFkF0H3iEJpfJC320fZ/4G60eftnItrrJ0=
github.com/ipfs/interface-go-ipfs-core v0.10.0/go.mod h1:F3EcmDy53GFkF0H3iEJpfJC320fZ/4G60eftnItrrJ0=
github.com/ipld/go-car v0.5.0/go.mod h1:ppiN5GWpjOZU9PgpAZ9HbZd9ZgSpwPMr48fGRJOWmvE=
Expand Down
5 changes: 3 additions & 2 deletions header/headertest/fraud/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ package headerfraud

import (
"context"
"github.com/ipfs/boxo/blockservice"
"testing"
"time"

"github.com/ipfs/go-blockservice"
"github.com/stretchr/testify/require"
"github.com/tendermint/tendermint/libs/bytes"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
Expand Down Expand Up @@ -46,7 +46,8 @@ func NewFraudMaker(t *testing.T, height int64, vals []types.PrivValidator, valSe
}

func (f *FraudMaker) MakeExtendedHeader(odsSize int, edsStore *eds.Store) header.ConstructFn {
return func(h *types.Header,
return func(
h *types.Header,
comm *types.Commit,
vals *types.ValidatorSet,
eds *rsmt2d.ExtendedDataSquare,
Expand Down
2 changes: 1 addition & 1 deletion nodebuilder/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"fmt"
"strings"

"github.com/ipfs/boxo/blockservice"
"github.com/ipfs/boxo/exchange"
"github.com/ipfs/go-blockservice"
logging "github.com/ipfs/go-log/v2"
pubsub "github.com/libp2p/go-libp2p-pubsub"
"github.com/libp2p/go-libp2p/core/host"
Expand Down
12 changes: 0 additions & 12 deletions nodebuilder/p2p/ipld.go

This file was deleted.

3 changes: 2 additions & 1 deletion nodebuilder/p2p/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"go.uber.org/fx"

"github.com/celestiaorg/celestia-node/nodebuilder/node"
"github.com/celestiaorg/celestia-node/share/ipld"
)

var log = logging.Logger("module/p2p")
Expand All @@ -27,7 +28,7 @@ func ConstructModule(tp node.Type, cfg *Config) fx.Option {
fx.Provide(routedHost),
fx.Provide(pubSub),
fx.Provide(dataExchange),
fx.Provide(blockService),
fx.Provide(ipld.NewBlockservice),
fx.Provide(peerRouting),
fx.Provide(contentRouting),
fx.Provide(addrsFactory(cfg.AnnounceAddresses, cfg.NoAnnounceAddresses)),
Expand Down
2 changes: 1 addition & 1 deletion nodebuilder/share/constructors.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"errors"

"github.com/filecoin-project/dagstore"
"github.com/ipfs/go-blockservice"
"github.com/ipfs/boxo/blockservice"
"github.com/ipfs/go-datastore"
"github.com/libp2p/go-libp2p/core/host"
"github.com/libp2p/go-libp2p/core/routing"
Expand Down
2 changes: 1 addition & 1 deletion nodebuilder/tests/fraud_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ package tests

import (
"context"
"github.com/ipfs/go-datastore"
"testing"
"time"

"github.com/ipfs/go-datastore"
ds_sync "github.com/ipfs/go-datastore/sync"
"github.com/libp2p/go-libp2p/core/host"
"github.com/libp2p/go-libp2p/core/peer"
Expand Down
4 changes: 2 additions & 2 deletions share/availability/cache/availability_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import (

"github.com/ipfs/go-datastore"
"github.com/ipfs/go-datastore/sync"
mdutils "github.com/ipfs/go-merkledag/test"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/celestiaorg/celestia-app/pkg/da"

"github.com/celestiaorg/celestia-node/share"
availability_test "github.com/celestiaorg/celestia-node/share/availability/test"
"github.com/celestiaorg/celestia-node/share/ipld"
)

// TestCacheAvailability tests to ensure that the successful result of a
Expand Down Expand Up @@ -86,7 +86,7 @@ func TestCacheAvailability_NoDuplicateSampling(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
// create root to cache
root := availability_test.RandFillBS(t, 16, mdutils.Bserv())
root := availability_test.RandFillBS(t, 16, ipld.NewMemBlockservice())
// wrap dummyAvailability with a datastore
ds := sync.MutexWrap(datastore.NewMapDatastore())
ca := NewShareAvailability(&dummyAvailability{counter: 0}, ds)
Expand Down
6 changes: 3 additions & 3 deletions share/availability/cache/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ import (

ds "github.com/ipfs/go-datastore"
dssync "github.com/ipfs/go-datastore/sync"
mdutils "github.com/ipfs/go-merkledag/test"

"github.com/celestiaorg/celestia-node/share"
"github.com/celestiaorg/celestia-node/share/availability/full"
"github.com/celestiaorg/celestia-node/share/availability/light"
availability_test "github.com/celestiaorg/celestia-node/share/availability/test"
"github.com/celestiaorg/celestia-node/share/getters"
"github.com/celestiaorg/celestia-node/share/ipld"
)

// LightAvailabilityWithLocalRandSquare wraps light.GetterWithRandSquare with cache availability
func LightAvailabilityWithLocalRandSquare(t *testing.T, n int) (share.Availability, *share.Root) {
bServ := mdutils.Bserv()
bServ := ipld.NewMemBlockservice()
store := dssync.MutexWrap(ds.NewMapDatastore())
getter := getters.NewIPLDGetter(bServ)
avail := NewShareAvailability(
Expand All @@ -28,7 +28,7 @@ func LightAvailabilityWithLocalRandSquare(t *testing.T, n int) (share.Availabili

// FullAvailabilityWithLocalRandSquare wraps full.GetterWithRandSquare with cache availability
func FullAvailabilityWithLocalRandSquare(t *testing.T, n int) (share.Availability, *share.Root) {
bServ := mdutils.Bserv()
bServ := ipld.NewMemBlockservice()
store := dssync.MutexWrap(ds.NewMapDatastore())
getter := getters.NewIPLDGetter(bServ)
avail := NewShareAvailability(
Expand Down
4 changes: 2 additions & 2 deletions share/availability/full/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ import (
"testing"
"time"

mdutils "github.com/ipfs/go-merkledag/test"
routinghelpers "github.com/libp2p/go-libp2p-routing-helpers"
"github.com/libp2p/go-libp2p/p2p/discovery/routing"

"github.com/celestiaorg/celestia-node/share"
availability_test "github.com/celestiaorg/celestia-node/share/availability/test"
"github.com/celestiaorg/celestia-node/share/getters"
"github.com/celestiaorg/celestia-node/share/ipld"
"github.com/celestiaorg/celestia-node/share/p2p/discovery"
)

// GetterWithRandSquare provides a share.Getter filled with 'n' NMT
// trees of 'n' random shares, essentially storing a whole square.
func GetterWithRandSquare(t *testing.T, n int) (share.Getter, *share.Root) {
bServ := mdutils.Bserv()
bServ := ipld.NewMemBlockservice()
getter := getters.NewIPLDGetter(bServ)
return getter, availability_test.RandFillBS(t, n, bServ)
}
Expand Down
8 changes: 4 additions & 4 deletions share/availability/light/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,26 @@ package light
import (
"testing"

"github.com/ipfs/go-blockservice"
mdutils "github.com/ipfs/go-merkledag/test"
"github.com/ipfs/boxo/blockservice"

"github.com/celestiaorg/celestia-node/share"
availability_test "github.com/celestiaorg/celestia-node/share/availability/test"
"github.com/celestiaorg/celestia-node/share/getters"
"github.com/celestiaorg/celestia-node/share/ipld"
)

// GetterWithRandSquare provides a share.Getter filled with 'n' NMT trees of 'n' random shares,
// essentially storing a whole square.
func GetterWithRandSquare(t *testing.T, n int) (share.Getter, *share.Root) {
bServ := mdutils.Bserv()
bServ := ipld.NewMemBlockservice()
getter := getters.NewIPLDGetter(bServ)
return getter, availability_test.RandFillBS(t, n, bServ)
}

// EmptyGetter provides an unfilled share.Getter with corresponding blockservice.BlockService than
// can be filled by the test.
func EmptyGetter() (share.Getter, blockservice.BlockService) {
bServ := mdutils.Bserv()
bServ := ipld.NewMemBlockservice()
getter := getters.NewIPLDGetter(bServ)
return getter, bServ
}
Expand Down
4 changes: 2 additions & 2 deletions share/availability/test/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (

"github.com/ipfs/boxo/bitswap"
"github.com/ipfs/boxo/bitswap/network"
"github.com/ipfs/boxo/blockservice"
"github.com/ipfs/boxo/blockstore"
"github.com/ipfs/boxo/routing/offline"
"github.com/ipfs/go-blockservice"
ds "github.com/ipfs/go-datastore"
dssync "github.com/ipfs/go-datastore/sync"
record "github.com/libp2p/go-libp2p-record"
Expand Down Expand Up @@ -94,7 +94,7 @@ func (dn *TestDagNet) NewTestNodeWithBlockstore(dstore ds.Datastore, bstore bloc
)
nd := &TestNode{
net: dn,
BlockService: blockservice.New(bstore, bs),
BlockService: ipld.NewBlockservice(bstore, bs),
Host: hst,
}
dn.nodes = append(dn.nodes, nd)
Expand Down
Loading

0 comments on commit 4a2ef55

Please sign in to comment.