Skip to content

Commit

Permalink
[p2p] bump to go-libp2p v0.14.3 (iotexproject#2722)
Browse files Browse the repository at this point in the history
  • Loading branch information
dustinxie committed Jul 16, 2021
1 parent 812b27f commit 6380da3
Show file tree
Hide file tree
Showing 12 changed files with 788 additions and 381 deletions.
4 changes: 2 additions & 2 deletions chainservice/chainservice.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"math/rand"
"time"

peerstore "github.com/libp2p/go-libp2p-peerstore"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/pkg/errors"
"go.uber.org/zap"
"google.golang.org/protobuf/proto"
Expand Down Expand Up @@ -588,7 +588,7 @@ func (cs *ChainService) HandleBlock(ctx context.Context, peer string, pbBlock *i
}

// HandleSyncRequest handles incoming sync request.
func (cs *ChainService) HandleSyncRequest(ctx context.Context, peer peerstore.PeerInfo, sync *iotexrpc.BlockSync) error {
func (cs *ChainService) HandleSyncRequest(ctx context.Context, peer peer.AddrInfo, sync *iotexrpc.BlockSync) error {
return cs.blocksync.ProcessSyncRequest(ctx, sync.Start, sync.End, func(ctx context.Context, blk *block.Block) error {
return cs.p2pAgent.UnicastOutbound(
p2p.WitContext(ctx, p2p.Context{ChainID: cs.chain.ChainID()}),
Expand Down
12 changes: 6 additions & 6 deletions dispatcher/dispatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"sync/atomic"
"time"

peerstore "github.com/libp2p/go-libp2p-peerstore"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
"go.uber.org/zap"
Expand All @@ -32,7 +32,7 @@ type Subscriber interface {
ReportFullness(context.Context, iotexrpc.MessageType, float32)
HandleAction(context.Context, *iotextypes.Action) error
HandleBlock(context.Context, string, *iotextypes.Block) error
HandleSyncRequest(context.Context, peerstore.PeerInfo, *iotexrpc.BlockSync) error
HandleSyncRequest(context.Context, peer.AddrInfo, *iotexrpc.BlockSync) error
HandleConsensusMsg(*iotextypes.ConsensusMessage) error
}

Expand All @@ -47,7 +47,7 @@ type Dispatcher interface {
HandleBroadcast(context.Context, uint32, string, proto.Message)
// HandleTell handles the incoming tell message. The transportation layer semantics is exact once. The sender is
// given for the sake of replying the message
HandleTell(context.Context, uint32, peerstore.PeerInfo, proto.Message)
HandleTell(context.Context, uint32, peer.AddrInfo, proto.Message)
}

var requestMtc = prometheus.NewCounterVec(
Expand Down Expand Up @@ -79,7 +79,7 @@ type blockSyncMsg struct {
ctx context.Context
chainID uint32
sync *iotexrpc.BlockSync
peer peerstore.PeerInfo
peer peer.AddrInfo
}

func (m blockSyncMsg) ChainID() uint32 {
Expand Down Expand Up @@ -368,7 +368,7 @@ func (d *IotxDispatcher) dispatchBlock(ctx context.Context, chainID uint32, peer
}

// dispatchBlockSyncReq adds the passed block sync request to the news handling queue.
func (d *IotxDispatcher) dispatchBlockSyncReq(ctx context.Context, chainID uint32, peer peerstore.PeerInfo, msg proto.Message) {
func (d *IotxDispatcher) dispatchBlockSyncReq(ctx context.Context, chainID uint32, peer peer.AddrInfo, msg proto.Message) {
if atomic.LoadInt32(&d.shutdown) != 0 {
return
}
Expand Down Expand Up @@ -424,7 +424,7 @@ func (d *IotxDispatcher) HandleBroadcast(ctx context.Context, chainID uint32, pe
}

// HandleTell handles incoming unicast message
func (d *IotxDispatcher) HandleTell(ctx context.Context, chainID uint32, peer peerstore.PeerInfo, message proto.Message) {
func (d *IotxDispatcher) HandleTell(ctx context.Context, chainID uint32, peer peer.AddrInfo, message proto.Message) {
msgType, err := goproto.GetTypeFromRPCMsg(message)
if err != nil {
log.L().Warn("Unexpected message handled by HandleTell.", zap.Error(err))
Expand Down
6 changes: 3 additions & 3 deletions dispatcher/dispatcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"time"

"github.com/golang/mock/gomock"
peerstore "github.com/libp2p/go-libp2p-peerstore"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/stretchr/testify/assert"
"google.golang.org/protobuf/proto"

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

for i := 0; i < 100; i++ {
for _, msg := range msgs {
d.HandleTell(ctx, config.Default.Chain.ID, peerstore.PeerInfo{}, msg)
d.HandleTell(ctx, config.Default.Chain.ID, peer.AddrInfo{}, msg)
}
}
}
Expand All @@ -93,7 +93,7 @@ func (ds *dummySubscriber) ReportFullness(context.Context, iotexrpc.MessageType,

func (ds *dummySubscriber) HandleBlock(context.Context, string, *iotextypes.Block) error { return nil }

func (ds *dummySubscriber) HandleSyncRequest(context.Context, peerstore.PeerInfo, *iotexrpc.BlockSync) error {
func (ds *dummySubscriber) HandleSyncRequest(context.Context, peer.AddrInfo, *iotexrpc.BlockSync) error {
return nil
}

Expand Down
6 changes: 3 additions & 3 deletions e2etest/local_actpool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"testing"
"time"

peerstore "github.com/libp2p/go-libp2p-peerstore"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/stretchr/testify/require"
"google.golang.org/protobuf/proto"

Expand Down Expand Up @@ -56,7 +56,7 @@ func TestLocalActPool(t *testing.T) {
func(_ context.Context, _ uint32, _ string, _ proto.Message) {

},
func(_ context.Context, _ uint32, _ peerstore.PeerInfo, _ proto.Message) {
func(_ context.Context, _ uint32, _ peer.AddrInfo, _ proto.Message) {

},
)
Expand Down Expand Up @@ -134,7 +134,7 @@ func TestPressureActPool(t *testing.T) {
func(_ context.Context, _ uint32, _ string, _ proto.Message) {

},
func(_ context.Context, _ uint32, _ peerstore.PeerInfo, _ proto.Message) {
func(_ context.Context, _ uint32, _ peer.AddrInfo, _ proto.Message) {

},
)
Expand Down
6 changes: 3 additions & 3 deletions e2etest/local_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (
"testing"
"time"

peerstore "github.com/libp2p/go-libp2p-peerstore"
multiaddr "github.com/multiformats/go-multiaddr"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/multiformats/go-multiaddr"
"github.com/stretchr/testify/require"
"google.golang.org/protobuf/proto"

Expand Down Expand Up @@ -93,7 +93,7 @@ func TestLocalCommit(t *testing.T) {
cfg.Genesis.Hash(),
func(_ context.Context, _ uint32, _ string, _ proto.Message) {
},
func(_ context.Context, _ uint32, _ peerstore.PeerInfo, _ proto.Message) {
func(_ context.Context, _ uint32, _ peer.AddrInfo, _ proto.Message) {
},
)
require.NotNil(p)
Expand Down
24 changes: 10 additions & 14 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,27 @@ require (
github.com/cenkalti/backoff v2.2.1+incompatible
github.com/ethereum/go-ethereum v1.10.1
github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a
github.com/go-logfmt/logfmt v0.5.0 // indirect
github.com/go-sql-driver/mysql v1.4.1
github.com/gogo/protobuf v1.3.1 // indirect
github.com/golang/mock v1.4.4
github.com/golang/protobuf v1.4.3
github.com/golang/snappy v0.0.2-0.20200707131729-196ae77b8a26
github.com/gorilla/websocket v1.4.2
github.com/grpc-ecosystem/go-grpc-middleware v1.2.0
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
github.com/iotexproject/go-fsm v1.0.0
github.com/iotexproject/go-p2p v0.2.12
github.com/iotexproject/go-pkgs v0.1.5-0.20210604060651-be5ee19f2575
github.com/iotexproject/go-p2p v0.3.0
github.com/iotexproject/go-pkgs v0.1.5
github.com/iotexproject/iotex-address v0.2.4
github.com/iotexproject/iotex-antenna-go/v2 v2.5.1-0.20210604061028-2c2056a5bfdb
github.com/iotexproject/iotex-election v0.3.5-0.20210611041425-20ddf674363d
github.com/iotexproject/iotex-proto v0.5.1-0.20210622180547-9200a5ad73cb
github.com/libp2p/go-libp2p v0.0.21 // indirect
github.com/libp2p/go-libp2p-peerstore v0.0.5
github.com/libp2p/go-libp2p-core v0.8.5
github.com/mattn/go-sqlite3 v1.11.0
github.com/miguelmota/go-ethereum-hdwallet v0.0.0-20200123000308-a60dcd172b4c
github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1
github.com/minio/sha256-simd v0.1.1 // indirect
github.com/multiformats/go-multiaddr v0.0.2
github.com/multiformats/go-multiaddr v0.3.3
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.3.0
github.com/prometheus/client_golang v1.10.0
github.com/rodaine/table v1.0.1
github.com/rs/zerolog v1.18.0
github.com/schollz/progressbar/v2 v2.15.0
Expand All @@ -41,12 +37,12 @@ require (
go.etcd.io/bbolt v1.3.5
go.uber.org/automaxprocs v1.2.0
go.uber.org/config v1.3.1
go.uber.org/zap v1.14.0
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83
golang.org/x/net v0.0.0-20201021035429-f5854403a974
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9
go.uber.org/zap v1.16.0
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2
golang.org/x/net v0.0.0-20210423184538-5f58ad60dda6
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
google.golang.org/genproto v0.0.0-20201211151036-40ec1c210f7a
google.golang.org/grpc v1.33.1
google.golang.org/grpc v1.33.2
google.golang.org/protobuf v1.25.0
gopkg.in/yaml.v2 v2.4.0
)
Expand Down
Loading

0 comments on commit 6380da3

Please sign in to comment.