Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stop relying on the deprecated go-libp2p-core package #773

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion discovery/impl/local_test.go
Expand Up @@ -8,7 +8,7 @@ import (

"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"

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Expand Up @@ -45,7 +45,6 @@ require (
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 @@ -106,6 +105,7 @@ require (
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
2 changes: 1 addition & 1 deletion retrievalmarket/impl/client.go
Expand Up @@ -11,7 +11,7 @@ import (
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"
Expand Down
2 changes: 1 addition & 1 deletion retrievalmarket/impl/client_test.go
Expand Up @@ -15,7 +15,7 @@ import (
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"
Expand Down
2 changes: 1 addition & 1 deletion retrievalmarket/impl/clientstates/client_states.go
Expand Up @@ -5,7 +5,7 @@ import (

"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"
Expand Down
2 changes: 1 addition & 1 deletion retrievalmarket/impl/clientstates/client_states_test.go
Expand Up @@ -7,7 +7,7 @@ import (
"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"

Expand Down
2 changes: 1 addition & 1 deletion retrievalmarket/impl/dtutils/dtutils.go
Expand Up @@ -10,7 +10,7 @@ import (
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
2 changes: 1 addition & 1 deletion retrievalmarket/impl/dtutils/dtutils_test.go
Expand Up @@ -9,7 +9,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
2 changes: 1 addition & 1 deletion retrievalmarket/impl/provider_environments.go
Expand Up @@ -7,7 +7,7 @@ import (

"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
4 changes: 2 additions & 2 deletions retrievalmarket/impl/provider_test.go
Expand Up @@ -14,7 +14,7 @@ import (
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/multiformats/go-multicodec"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -260,7 +260,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
Expand Up @@ -11,7 +11,7 @@ import (
"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 @@ -10,7 +10,7 @@ import (
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
2 changes: 1 addition & 1 deletion retrievalmarket/migrations/maptypes/maptypes.go
Expand Up @@ -2,7 +2,7 @@ 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"
Expand Down
14 changes: 7 additions & 7 deletions retrievalmarket/migrations/migrations.go
Expand Up @@ -2,7 +2,7 @@ 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"
Expand Down Expand Up @@ -74,10 +74,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 +90,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
2 changes: 1 addition & 1 deletion retrievalmarket/migrations/migrations_test.go
Expand Up @@ -7,7 +7,7 @@ import (
"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"
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
2 changes: 1 addition & 1 deletion retrievalmarket/storage_retrieval_integration_test.go
Expand Up @@ -15,7 +15,7 @@ import (
"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"

Expand Down
20 changes: 10 additions & 10 deletions retrievalmarket/types.go
Expand Up @@ -8,8 +8,8 @@ import (
"github.com/ipfs/go-cid"
"github.com/ipld/go-ipld-prime"
"github.com/ipld/go-ipld-prime/codec/dagcbor"
"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"
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"

Expand Down Expand Up @@ -175,10 +175,10 @@ const (
// for the retrieval deal
type QueryParams 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
}

// Query is a query to a given provider to determine information about a piece
Expand Down Expand Up @@ -210,10 +210,10 @@ func NewQueryV1(payloadCID cid.Cid, pieceCID *cid.Cid) Query {
type QueryResponse struct {
Status QueryResponseStatus
PieceCIDFound 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 All @@ -233,9 +233,9 @@ func (qr QueryResponse) PieceRetrievalPrice() abi.TokenAmount {

// PayloadRetrievalPrice is the expected price to retrieve just the given payload
// & selector (V1)
//func (qr QueryResponse) PayloadRetrievalPrice() abi.TokenAmount {
// func (qr QueryResponse) PayloadRetrievalPrice() abi.TokenAmount {
// return types.BigMul(qr.MinPricePerByte, types.NewInt(qr.ExpectedPayloadSize))
//}
// }

// IsTerminalError returns true if this status indicates processing of this deal
// is complete with an error
Expand Down
2 changes: 1 addition & 1 deletion retrievalmarket/types_test.go
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/ipld/go-ipld-prime/codec/dagcbor"
basicnode "github.com/ipld/go-ipld-prime/node/basic"
selectorparse "github.com/ipld/go-ipld-prime/traversal/selector/parse"
"github.com/libp2p/go-libp2p-core/test"
"github.com/libp2p/go-libp2p/core/test"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

Expand Down
6 changes: 3 additions & 3 deletions shared/retrystream.go
Expand Up @@ -6,9 +6,9 @@ import (

logging "github.com/ipfs/go-log/v2"
"github.com/jpillora/backoff"
"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/network"
"github.com/libp2p/go-libp2p/core/peer"
"github.com/libp2p/go-libp2p/core/protocol"
"golang.org/x/xerrors"
)

Expand Down
6 changes: 3 additions & 3 deletions shared/retrystream_test.go
Expand Up @@ -6,9 +6,9 @@ import (
"testing"
"time"

"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/network"
"github.com/libp2p/go-libp2p/core/peer"
"github.com/libp2p/go-libp2p/core/protocol"
"github.com/stretchr/testify/require"
"golang.org/x/xerrors"
)
Expand Down
4 changes: 2 additions & 2 deletions shared_testutil/generators.go
Expand Up @@ -6,8 +6,8 @@ import (

"github.com/ipfs/go-cid"
"github.com/ipld/go-ipld-prime"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p-core/test"
"github.com/libp2p/go-libp2p/core/peer"
"github.com/libp2p/go-libp2p/core/test"
"github.com/stretchr/testify/require"

"github.com/filecoin-project/go-address"
Expand Down
2 changes: 1 addition & 1 deletion shared_testutil/mockindexprovider.go
Expand Up @@ -5,7 +5,7 @@ import (
"sync"

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

provider "github.com/filecoin-project/index-provider"
"github.com/filecoin-project/index-provider/metadata"
Expand Down
2 changes: 1 addition & 1 deletion shared_testutil/mocknet.go
Expand Up @@ -18,7 +18,7 @@ import (
unixfile "github.com/ipfs/go-unixfs/file"
"github.com/ipld/go-ipld-prime"
cidlink "github.com/ipld/go-ipld-prime/linking/cid"
"github.com/libp2p/go-libp2p-core/host"
"github.com/libp2p/go-libp2p/core/host"
mocknet "github.com/libp2p/go-libp2p/p2p/net/mock"
"github.com/stretchr/testify/require"
"golang.org/x/net/context"
Expand Down
2 changes: 1 addition & 1 deletion shared_testutil/test_datatransfer.go
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/ipfs/go-cid"
"github.com/ipld/go-ipld-prime"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p/core/peer"

datatransfer "github.com/filecoin-project/go-data-transfer"
)
Expand Down
2 changes: 1 addition & 1 deletion shared_testutil/test_network_types.go
Expand Up @@ -5,7 +5,7 @@ import (
"testing"

"github.com/ipfs/go-cid"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p/core/peer"
ma "github.com/multiformats/go-multiaddr"
"github.com/stretchr/testify/require"

Expand Down
2 changes: 1 addition & 1 deletion shared_testutil/testchannel.go
Expand Up @@ -4,7 +4,7 @@ import (
"github.com/ipfs/go-cid"
"github.com/ipld/go-ipld-prime"
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/exp/rand"

datatransfer "github.com/filecoin-project/go-data-transfer"
Expand Down