Skip to content

Commit

Permalink
stop relying on the deprecated go-libp2p-core package
Browse files Browse the repository at this point in the history
  • Loading branch information
marten-seemann committed Dec 31, 2022
1 parent cba436e commit 4d8c03a
Show file tree
Hide file tree
Showing 58 changed files with 112 additions and 211 deletions.
5 changes: 1 addition & 4 deletions discovery/impl/local_test.go
Expand Up @@ -6,14 +6,11 @@ import (
"testing"
"time"

"github.com/ipfs/go-datastore"
dshelp "github.com/ipfs/go-ipfs-ds-help"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p/core/peer"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/filecoin-project/go-address"

discoveryimpl "github.com/filecoin-project/go-fil-markets/discovery/impl"
"github.com/filecoin-project/go-fil-markets/discovery/migrations"
"github.com/filecoin-project/go-fil-markets/retrievalmarket"
Expand Down
6 changes: 2 additions & 4 deletions go.mod
Expand Up @@ -19,7 +19,6 @@ require (
github.com/filecoin-project/specs-actors v0.9.13
github.com/hannahhoward/cbor-gen-for v0.0.0-20200817222906-ea96cece81f1
github.com/hannahhoward/go-pubsub v0.0.0-20200423002714-8d62886cc36e
github.com/hashicorp/go-multierror v1.1.1
github.com/ipfs/go-block-format v0.0.3
github.com/ipfs/go-blockservice v0.4.0
github.com/ipfs/go-cid v0.3.2
Expand All @@ -42,10 +41,8 @@ require (
github.com/ipld/go-car/v2 v2.5.0
github.com/ipld/go-codec-dagpb v1.5.0
github.com/ipld/go-ipld-prime v0.18.0
github.com/jbenet/go-random v0.0.0-20190219211222-123a90aedc0c
github.com/jpillora/backoff v1.0.0
github.com/libp2p/go-libp2p v0.23.2
github.com/libp2p/go-libp2p-core v0.20.1
github.com/multiformats/go-multiaddr v0.7.0
github.com/multiformats/go-multibase v0.1.1
github.com/multiformats/go-multicodec v0.6.0
Expand Down Expand Up @@ -82,7 +79,6 @@ require (
github.com/gogo/protobuf v1.3.2 // indirect
github.com/google/gopacket v1.1.19 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/huin/goupnp v1.0.3 // indirect
github.com/ipfs/bbloom v0.0.4 // indirect
Expand All @@ -100,12 +96,14 @@ require (
github.com/ipfs/go-verifcid v0.0.2 // indirect
github.com/ipld/go-ipld-adl-hamt v0.0.0-20220616142416-9004dbd839e0 // indirect
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
github.com/jbenet/go-random v0.0.0-20190219211222-123a90aedc0c // indirect
github.com/jbenet/goprocess v0.1.4 // indirect
github.com/klauspost/cpuid/v2 v2.1.1 // indirect
github.com/koron/go-ssdp v0.0.3 // indirect
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
github.com/libp2p/go-cidranger v1.1.0 // indirect
github.com/libp2p/go-libp2p-asn-util v0.2.0 // indirect
github.com/libp2p/go-libp2p-core v0.20.1 // indirect
github.com/libp2p/go-msgio v0.2.0 // indirect
github.com/libp2p/go-nat v0.1.0 // indirect
github.com/libp2p/go-netroute v0.2.0 // indirect
Expand Down
6 changes: 1 addition & 5 deletions retrievalmarket/impl/client.go
Expand Up @@ -5,16 +5,12 @@ import (
"errors"
"sync"

"github.com/hannahhoward/go-pubsub"
"github.com/ipfs/go-cid"
"github.com/ipfs/go-datastore"
bstore "github.com/ipfs/go-ipfs-blockstore"
logging "github.com/ipfs/go-log/v2"
selectorparse "github.com/ipld/go-ipld-prime/traversal/selector/parse"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p/core/peer"
"golang.org/x/xerrors"

"github.com/filecoin-project/go-address"
datatransfer "github.com/filecoin-project/go-data-transfer"
versionedfsm "github.com/filecoin-project/go-ds-versioning/pkg/fsm"
"github.com/filecoin-project/go-state-types/abi"
Expand Down
5 changes: 1 addition & 4 deletions retrievalmarket/impl/client_test.go
Expand Up @@ -9,18 +9,15 @@ import (
"testing"
"time"

"github.com/ipfs/go-cid"
"github.com/ipfs/go-datastore"
"github.com/ipfs/go-datastore/namespace"
dss "github.com/ipfs/go-datastore/sync"
"github.com/ipld/go-ipld-prime/codec/dagcbor"
selectorparse "github.com/ipld/go-ipld-prime/traversal/selector/parse"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p/core/peer"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
cbg "github.com/whyrusleeping/cbor-gen"

"github.com/filecoin-project/go-address"
datatransfer "github.com/filecoin-project/go-data-transfer"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big"
Expand Down
4 changes: 1 addition & 3 deletions retrievalmarket/impl/clientstates/client_states.go
Expand Up @@ -3,11 +3,9 @@ package clientstates
import (
"context"

"github.com/ipfs/go-cid"
logging "github.com/ipfs/go-log/v2"
peer "github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p/core/peer"

"github.com/filecoin-project/go-address"
datatransfer "github.com/filecoin-project/go-data-transfer"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big"
Expand Down
4 changes: 1 addition & 3 deletions retrievalmarket/impl/clientstates/client_states_test.go
Expand Up @@ -6,12 +6,10 @@ import (
"math/rand"
"testing"

"github.com/ipfs/go-cid"
peer "github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p/core/peer"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/filecoin-project/go-address"
datatransfer "github.com/filecoin-project/go-data-transfer"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big"
Expand Down
3 changes: 1 addition & 2 deletions retrievalmarket/impl/dtutils/dtutils.go
Expand Up @@ -9,8 +9,7 @@ import (
"github.com/ipfs/go-graphsync/storeutil"
bstore "github.com/ipfs/go-ipfs-blockstore"
logging "github.com/ipfs/go-log/v2"
"github.com/ipld/go-ipld-prime"
peer "github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p/core/peer"

datatransfer "github.com/filecoin-project/go-data-transfer"
"github.com/filecoin-project/go-statemachine/fsm"
Expand Down
3 changes: 1 addition & 2 deletions retrievalmarket/impl/dtutils/dtutils_test.go
Expand Up @@ -8,8 +8,7 @@ import (

ds "github.com/ipfs/go-datastore"
bstore "github.com/ipfs/go-ipfs-blockstore"
"github.com/ipld/go-ipld-prime"
peer "github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p/core/peer"
"github.com/stretchr/testify/require"

datatransfer "github.com/filecoin-project/go-data-transfer"
Expand Down
3 changes: 1 addition & 2 deletions retrievalmarket/impl/provider_environments.go
Expand Up @@ -5,9 +5,8 @@ import (
"errors"
"fmt"

"github.com/ipfs/go-cid"
bstore "github.com/ipfs/go-ipfs-blockstore"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p/core/peer"
"golang.org/x/xerrors"

"github.com/filecoin-project/dagstore"
Expand Down
8 changes: 2 additions & 6 deletions retrievalmarket/impl/provider_test.go
Expand Up @@ -8,19 +8,15 @@ import (
"testing"
"time"

"github.com/ipfs/go-cid"
"github.com/ipfs/go-datastore"
"github.com/ipfs/go-datastore/namespace"
dss "github.com/ipfs/go-datastore/sync"
"github.com/ipld/go-ipld-prime/codec/dagcbor"
selectorparse "github.com/ipld/go-ipld-prime/traversal/selector/parse"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/multiformats/go-multicodec"
"github.com/libp2p/go-libp2p/core/peer"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
cbg "github.com/whyrusleeping/cbor-gen"

"github.com/filecoin-project/go-address"
datatransfer "github.com/filecoin-project/go-data-transfer"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big"
Expand Down Expand Up @@ -260,7 +256,7 @@ func TestDynamicPricing(t *testing.T) {
sa.MarkUnsealed(context.TODO(), p.SectorID, p.Offset.Unpadded(), p.Length.Unpadded())
},
expFunc: func(t *testing.T, pieceStore *tut.TestPieceStore, dagStore *tut.MockDagStoreWrapper) {
//pieceStore.ExpectCID(payloadCID, expectedCIDInfo)
// pieceStore.ExpectCID(payloadCID, expectedCIDInfo)
pieceStore.ExpectPiece(expectedPieceCID1, piece1)
pieceStore.ExpectPiece(expectedPieceCID2, piece2)
dagStore.AddBlockToPieceIndex(payloadCID, expectedPieceCID1)
Expand Down
5 changes: 1 addition & 4 deletions retrievalmarket/impl/requestvalidation/requestvalidation.go
Expand Up @@ -6,12 +6,9 @@ import (
"errors"
"time"

"github.com/hannahhoward/go-pubsub"
"github.com/ipfs/go-cid"
"github.com/ipld/go-ipld-prime"
"github.com/ipld/go-ipld-prime/codec/dagcbor"
selectorparse "github.com/ipld/go-ipld-prime/traversal/selector/parse"
peer "github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p/core/peer"

datatransfer "github.com/filecoin-project/go-data-transfer"
"github.com/filecoin-project/go-state-types/abi"
Expand Down
Expand Up @@ -5,12 +5,10 @@ import (
"errors"
"testing"

"github.com/ipfs/go-cid"
"github.com/ipld/go-ipld-prime"
basicnode "github.com/ipld/go-ipld-prime/node/basic"
"github.com/ipld/go-ipld-prime/traversal/selector/builder"
selectorparse "github.com/ipld/go-ipld-prime/traversal/selector/parse"
peer "github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p/core/peer"
"github.com/stretchr/testify/require"

datatransfer "github.com/filecoin-project/go-data-transfer"
Expand Down
4 changes: 1 addition & 3 deletions retrievalmarket/migrations/maptypes/maptypes.go
@@ -1,10 +1,8 @@
package maptypes

import (
"github.com/ipfs/go-cid"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p/core/peer"

"github.com/filecoin-project/go-address"
datatransfer "github.com/filecoin-project/go-data-transfer"
"github.com/filecoin-project/go-state-types/abi"

Expand Down
16 changes: 7 additions & 9 deletions retrievalmarket/migrations/migrations.go
@@ -1,11 +1,9 @@
package migrations

import (
"github.com/ipfs/go-cid"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p/core/peer"
cbg "github.com/whyrusleeping/cbor-gen"

"github.com/filecoin-project/go-address"
datatransfer "github.com/filecoin-project/go-data-transfer"
versioning "github.com/filecoin-project/go-ds-versioning/pkg"
"github.com/filecoin-project/go-ds-versioning/pkg/versioned"
Expand Down Expand Up @@ -74,10 +72,10 @@ type RetrievalPeer0 struct {
// QueryParams0 is version 0 of QueryParams
type QueryParams0 struct {
PieceCID *cid.Cid // optional, query if miner has this cid in this piece. some miners may not be able to respond.
//Selector ipld.Node // optional, query if miner has this cid in this piece. some miners may not be able to respond.
//MaxPricePerByte abi.TokenAmount // optional, tell miner uninterested if more expensive than this
//MinPaymentInterval uint64 // optional, tell miner uninterested unless payment interval is greater than this
//MinPaymentIntervalIncrease uint64 // optional, tell miner uninterested unless payment interval increase is greater than this
// Selector ipld.Node // optional, query if miner has this cid in this piece. some miners may not be able to respond.
// MaxPricePerByte abi.TokenAmount // optional, tell miner uninterested if more expensive than this
// MinPaymentInterval uint64 // optional, tell miner uninterested unless payment interval is greater than this
// MinPaymentIntervalIncrease uint64 // optional, tell miner uninterested unless payment interval increase is greater than this
}

// Query0 is version 0 of Query
Expand All @@ -90,10 +88,10 @@ type Query0 struct {
type QueryResponse0 struct {
Status retrievalmarket.QueryResponseStatus
PieceCIDFound retrievalmarket.QueryItemStatus // V1 - if a PieceCID was requested, the result
//SelectorFound QueryItemStatus // V1 - if a Selector was requested, the result
// SelectorFound QueryItemStatus // V1 - if a Selector was requested, the result

Size uint64 // Total size of piece in bytes
//ExpectedPayloadSize uint64 // V1 - optional, if PayloadCID + selector are specified and miner knows, can offer an expected size
// ExpectedPayloadSize uint64 // V1 - optional, if PayloadCID + selector are specified and miner knows, can offer an expected size

PaymentAddress address.Address // address to send funds to -- may be different than miner addr
MinPricePerByte abi.TokenAmount
Expand Down
5 changes: 1 addition & 4 deletions retrievalmarket/migrations/migrations_test.go
Expand Up @@ -4,13 +4,10 @@ import (
"context"
"testing"

"github.com/ipfs/go-cid"
"github.com/ipfs/go-datastore"
dss "github.com/ipfs/go-datastore/sync"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p/core/peer"
"github.com/stretchr/testify/require"

"github.com/filecoin-project/go-address"
datatransfer "github.com/filecoin-project/go-data-transfer"
versionedfsm "github.com/filecoin-project/go-ds-versioning/pkg/fsm"
"github.com/filecoin-project/go-state-types/abi"
Expand Down
10 changes: 5 additions & 5 deletions retrievalmarket/network/libp2p_impl.go
Expand Up @@ -6,10 +6,10 @@ import (
"time"

logging "github.com/ipfs/go-log/v2"
"github.com/libp2p/go-libp2p-core/host"
"github.com/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p-core/protocol"
"github.com/libp2p/go-libp2p/core/host"
"github.com/libp2p/go-libp2p/core/network"
"github.com/libp2p/go-libp2p/core/peer"
"github.com/libp2p/go-libp2p/core/protocol"
ma "github.com/multiformats/go-multiaddr"

"github.com/filecoin-project/go-fil-markets/retrievalmarket"
Expand Down Expand Up @@ -64,7 +64,7 @@ type libp2pRetrievalMarketNetwork struct {
supportedProtocols []protocol.ID
}

// NewQueryStream creates a new RetrievalQueryStream using the provided peer.ID
// NewQueryStream creates a new RetrievalQueryStream using the provided peer.ID
func (impl *libp2pRetrievalMarketNetwork) NewQueryStream(id peer.ID) (RetrievalQueryStream, error) {
s, err := impl.retryStream.OpenStream(context.Background(), id, impl.supportedProtocols)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions retrievalmarket/network/libp2p_impl_test.go
Expand Up @@ -5,8 +5,8 @@ import (
"testing"
"time"

"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p-core/protocol"
"github.com/libp2p/go-libp2p/core/peer"
"github.com/libp2p/go-libp2p/core/protocol"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

Expand Down
2 changes: 1 addition & 1 deletion retrievalmarket/network/network.go
@@ -1,7 +1,7 @@
package network

import (
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p/core/peer"
ma "github.com/multiformats/go-multiaddr"

"github.com/filecoin-project/go-fil-markets/retrievalmarket"
Expand Down
4 changes: 2 additions & 2 deletions retrievalmarket/network/old_query_stream.go
Expand Up @@ -3,8 +3,8 @@ package network
import (
"bufio"

"github.com/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p/core/network"
"github.com/libp2p/go-libp2p/core/peer"

cborutil "github.com/filecoin-project/go-cbor-util"

Expand Down
4 changes: 2 additions & 2 deletions retrievalmarket/network/query_stream.go
Expand Up @@ -3,8 +3,8 @@ package network
import (
"bufio"

"github.com/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p/core/network"
"github.com/libp2p/go-libp2p/core/peer"

cborutil "github.com/filecoin-project/go-cbor-util"

Expand Down
7 changes: 1 addition & 6 deletions retrievalmarket/storage_retrieval_integration_test.go
Expand Up @@ -8,18 +8,13 @@ import (
"testing"
"time"

"github.com/ipfs/go-cid"
"github.com/ipfs/go-datastore"
"github.com/ipfs/go-datastore/namespace"
"github.com/ipld/go-car"
"github.com/ipld/go-ipld-prime"
cidlink "github.com/ipld/go-ipld-prime/linking/cid"
selectorparse "github.com/ipld/go-ipld-prime/traversal/selector/parse"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p/core/peer"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/filecoin-project/go-address"
datatransfer "github.com/filecoin-project/go-data-transfer"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big"
Expand Down

0 comments on commit 4d8c03a

Please sign in to comment.