Skip to content

Commit

Permalink
chore(deps): bump most libp2p dependencies (#2788)
Browse files Browse the repository at this point in the history
- `github.com/libp2p/go-libp2p-core/*` -> `github.com/libp2p/go-libp2p/core/*`
- `github.com/libp2p/go-libp2p-peerstore/pstoreds` -> `github.com/libp2p/go-libp2p/p2p/host/peerstore/pstoreds`
- `github.com/libp2p/go-libp2p-discovery` -> `github.com/libp2p/go-libp2p/p2p/discovery/routing`
- Fix btcsuite/btcd module issues
- Update mocks
  • Loading branch information
qdm12 authored Jan 4, 2023
1 parent 00b2ec1 commit 3729f32
Show file tree
Hide file tree
Showing 76 changed files with 245 additions and 618 deletions.
2 changes: 1 addition & 1 deletion dot/core/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"encoding/json"
"sync"

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

"github.com/ChainSafe/gossamer/dot/network"
"github.com/ChainSafe/gossamer/dot/peerset"
Expand Down
2 changes: 1 addition & 1 deletion dot/core/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/ChainSafe/gossamer/lib/runtime"
"github.com/ChainSafe/gossamer/lib/transaction"

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

func (s *Service) validateTransaction(head *types.Header, rt RuntimeInstance,
Expand Down
2 changes: 1 addition & 1 deletion dot/core/messages_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"github.com/ChainSafe/gossamer/pkg/scale"

"github.com/golang/mock/gomock"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p/core/peer"
"github.com/stretchr/testify/require"
)

Expand Down
2 changes: 1 addition & 1 deletion dot/core/messages_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"github.com/ChainSafe/gossamer/lib/transaction"

"github.com/golang/mock/gomock"
"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 dot/core/mocks_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dot/network/block_announce.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/ChainSafe/gossamer/lib/common"
"github.com/ChainSafe/gossamer/pkg/scale"

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

var (
Expand All @@ -36,7 +36,7 @@ func (*BlockAnnounceMessage) Type() byte {
return blockAnnounceMsgType
}

// string formats a BlockAnnounceMessage as a string
// String formats a BlockAnnounceMessage as a string
func (bm *BlockAnnounceMessage) String() string {
return fmt.Sprintf("BlockAnnounceMessage ParentHash=%s Number=%d StateRoot=%s ExtrinsicsRoot=%s Digest=%v",
bm.ParentHash,
Expand Down
2 changes: 1 addition & 1 deletion dot/network/block_announce_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/ChainSafe/gossamer/pkg/scale"
gomock "github.com/golang/mock/gomock"

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

Expand Down
2 changes: 1 addition & 1 deletion dot/network/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"path"
"time"

"github.com/libp2p/go-libp2p-core/crypto"
"github.com/libp2p/go-libp2p/core/crypto"

"github.com/ChainSafe/gossamer/internal/log"
"github.com/ChainSafe/gossamer/internal/metrics"
Expand Down
6 changes: 3 additions & 3 deletions dot/network/connmgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"context"
"sync"

"github.com/libp2p/go-libp2p-core/connmgr"
"github.com/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p/core/connmgr"
"github.com/libp2p/go-libp2p/core/network"
"github.com/libp2p/go-libp2p/core/peer"
ma "github.com/multiformats/go-multiaddr"

"github.com/ChainSafe/gossamer/dot/peerset"
Expand Down
4 changes: 2 additions & 2 deletions dot/network/connmgr_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"testing"
"time"

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

"github.com/ChainSafe/gossamer/dot/peerset"
Expand Down
14 changes: 7 additions & 7 deletions dot/network/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import (

ethmetrics "github.com/ethereum/go-ethereum/metrics"
badger "github.com/ipfs/go-ds-badger2"
libp2phost "github.com/libp2p/go-libp2p-core/host"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p-core/peerstore"
"github.com/libp2p/go-libp2p-core/protocol"
libp2pdiscovery "github.com/libp2p/go-libp2p-discovery"
kaddht "github.com/libp2p/go-libp2p-kad-dht"
"github.com/libp2p/go-libp2p-kad-dht/dual"
libp2phost "github.com/libp2p/go-libp2p/core/host"
"github.com/libp2p/go-libp2p/core/peer"
"github.com/libp2p/go-libp2p/core/peerstore"
"github.com/libp2p/go-libp2p/core/protocol"
"github.com/libp2p/go-libp2p/p2p/discovery/routing"
)

const (
Expand All @@ -36,7 +36,7 @@ var (
type discovery struct {
ctx context.Context
dht *dual.DHT
rd *libp2pdiscovery.RoutingDiscovery
rd *routing.RoutingDiscovery
h libp2phost.Host
bootnodes []peer.AddrInfo
ds *badger.Datastore
Expand Down Expand Up @@ -131,7 +131,7 @@ func (d *discovery) stop() error {
}

func (d *discovery) discoverAndAdvertise() error {
d.rd = libp2pdiscovery.NewRoutingDiscovery(d.dht)
d.rd = routing.NewRoutingDiscovery(d.dht)

err := d.dht.Bootstrap(d.ctx)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions dot/network/discovery_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"time"

badger "github.com/ipfs/go-ds-badger2"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p-core/routing"
"github.com/libp2p/go-libp2p/core/peer"
"github.com/libp2p/go-libp2p/core/routing"
"github.com/stretchr/testify/require"
)

Expand Down
6 changes: 3 additions & 3 deletions dot/network/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import (
"github.com/ChainSafe/gossamer/internal/log"
"github.com/ChainSafe/gossamer/lib/common"
"github.com/ChainSafe/gossamer/lib/common/variadic"
gomock "github.com/golang/mock/gomock"
libp2pnetwork "github.com/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/golang/mock/gomock"
libp2pnetwork "github.com/libp2p/go-libp2p/core/network"
"github.com/libp2p/go-libp2p/core/peer"
"github.com/stretchr/testify/require"
)

Expand Down
20 changes: 10 additions & 10 deletions dot/network/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ import (
"github.com/dgraph-io/ristretto"
badger "github.com/ipfs/go-ds-badger2"
"github.com/libp2p/go-libp2p"
libp2phost "github.com/libp2p/go-libp2p-core/host"
"github.com/libp2p/go-libp2p-core/metrics"
libp2pnetwork "github.com/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p-core/peerstore"
"github.com/libp2p/go-libp2p-core/protocol"
"github.com/libp2p/go-libp2p-peerstore/pstoreds"
libp2phost "github.com/libp2p/go-libp2p/core/host"
"github.com/libp2p/go-libp2p/core/metrics"
"github.com/libp2p/go-libp2p/core/network"
"github.com/libp2p/go-libp2p/core/peer"
"github.com/libp2p/go-libp2p/core/peerstore"
"github.com/libp2p/go-libp2p/core/protocol"
"github.com/libp2p/go-libp2p/p2p/host/peerstore/pstoreds"
ma "github.com/multiformats/go-multiaddr"
)

Expand Down Expand Up @@ -259,7 +259,7 @@ func (h *host) close() error {
}

// registerStreamHandler registers the stream handler for the given protocol id.
func (h *host) registerStreamHandler(pid protocol.ID, handler func(libp2pnetwork.Stream)) {
func (h *host) registerStreamHandler(pid protocol.ID, handler func(network.Stream)) {
h.p2pHost.SetStreamHandler(pid, handler)
}

Expand Down Expand Up @@ -288,7 +288,7 @@ func (h *host) bootstrap() {

// send creates a new outbound stream with the given peer and writes the message. It also returns
// the newly created stream.
func (h *host) send(p peer.ID, pid protocol.ID, msg Message) (libp2pnetwork.Stream, error) {
func (h *host) send(p peer.ID, pid protocol.ID, msg Message) (network.Stream, error) {
// open outbound stream with host protocol id
stream, err := h.p2pHost.NewStream(h.ctx, p, pid)
if err != nil {
Expand All @@ -312,7 +312,7 @@ func (h *host) send(p peer.ID, pid protocol.ID, msg Message) (libp2pnetwork.Stre
return stream, nil
}

func (h *host) writeToStream(s libp2pnetwork.Stream, msg Message) error {
func (h *host) writeToStream(s network.Stream, msg Message) error {
encMsg, err := msg.Encode()
if err != nil {
return err
Expand Down
4 changes: 2 additions & 2 deletions dot/network/host_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (

"github.com/ChainSafe/gossamer/dot/peerset"
"github.com/ChainSafe/gossamer/lib/common"
"github.com/libp2p/go-libp2p-core/peerstore"
"github.com/libp2p/go-libp2p-core/protocol"
"github.com/libp2p/go-libp2p/core/peerstore"
"github.com/libp2p/go-libp2p/core/protocol"
ma "github.com/multiformats/go-multiaddr"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down
2 changes: 1 addition & 1 deletion dot/network/inbound.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
package network

import (
libp2pnetwork "github.com/libp2p/go-libp2p-core/network"
libp2pnetwork "github.com/libp2p/go-libp2p/core/network"
)

func (s *Service) readStream(stream libp2pnetwork.Stream, decoder messageDecoder, handler messageHandler,
Expand Down
4 changes: 2 additions & 2 deletions dot/network/light.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"github.com/ChainSafe/gossamer/lib/common"
"github.com/ChainSafe/gossamer/pkg/scale"

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

// handleLightStream handles streams with the <protocol-id>/light/2 protocol ID
Expand Down
2 changes: 1 addition & 1 deletion dot/network/light_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/ChainSafe/gossamer/dot/types"
"github.com/ChainSafe/gossamer/lib/common"

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

Expand Down
2 changes: 1 addition & 1 deletion dot/network/message_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

"github.com/ChainSafe/gossamer/lib/common"
"github.com/dgraph-io/ristretto"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p/core/peer"
)

// msgCacheTTL is default duration a key-value will be stored in messageCache.
Expand Down
2 changes: 1 addition & 1 deletion dot/network/message_cache_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/ChainSafe/gossamer/dot/types"
"github.com/ChainSafe/gossamer/lib/common"
"github.com/dgraph-io/ristretto"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p/core/peer"
"github.com/stretchr/testify/require"
)

Expand Down
2 changes: 1 addition & 1 deletion dot/network/mock_syncer_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dot/network/mock_transaction_handler_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions dot/network/notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"io"
"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/ChainSafe/gossamer/dot/peerset"
)
Expand Down
4 changes: 2 additions & 2 deletions dot/network/notifications_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"time"
"unsafe"

libp2pnetwork "github.com/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p-core/peer"
libp2pnetwork "github.com/libp2p/go-libp2p/core/network"
"github.com/libp2p/go-libp2p/core/peer"
"github.com/stretchr/testify/require"

"github.com/ChainSafe/gossamer/dot/types"
Expand Down
2 changes: 1 addition & 1 deletion dot/network/peersdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package network
import (
"sync"

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

type peersData struct {
Expand Down
6 changes: 3 additions & 3 deletions dot/network/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import (
"github.com/ChainSafe/gossamer/internal/mdns"
"github.com/ChainSafe/gossamer/internal/metrics"
"github.com/ChainSafe/gossamer/lib/common"
libp2pnetwork "github.com/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p-core/protocol"
libp2pnetwork "github.com/libp2p/go-libp2p/core/network"
"github.com/libp2p/go-libp2p/core/peer"
"github.com/libp2p/go-libp2p/core/protocol"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
)
Expand Down
2 changes: 1 addition & 1 deletion dot/network/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package network
import (
"context"

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

"github.com/ChainSafe/gossamer/dot/peerset"
"github.com/ChainSafe/gossamer/dot/types"
Expand Down
2 changes: 1 addition & 1 deletion dot/network/stream_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"sync"
"time"

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

var cleanupStreamInterval = time.Minute
Expand Down
6 changes: 3 additions & 3 deletions dot/network/stream_manager_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import (
"time"

"github.com/libp2p/go-libp2p"
libp2phost "github.com/libp2p/go-libp2p-core/host"
"github.com/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p-core/peer"
libp2phost "github.com/libp2p/go-libp2p/core/host"
"github.com/libp2p/go-libp2p/core/network"
"github.com/libp2p/go-libp2p/core/peer"
ma "github.com/multiformats/go-multiaddr"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down
4 changes: 2 additions & 2 deletions dot/network/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"time"

"github.com/ChainSafe/gossamer/dot/peerset"
libp2pnetwork "github.com/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p-core/peer"
libp2pnetwork "github.com/libp2p/go-libp2p/core/network"
"github.com/libp2p/go-libp2p/core/peer"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion dot/network/sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package network
import (
"testing"

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

Expand Down
2 changes: 1 addition & 1 deletion dot/network/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"fmt"
"time"

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

"github.com/ChainSafe/gossamer/dot/types"
"github.com/ChainSafe/gossamer/lib/common"
Expand Down
Loading

0 comments on commit 3729f32

Please sign in to comment.