Skip to content

Commit

Permalink
chore: upgrade go-libp2p
Browse files Browse the repository at this point in the history
  • Loading branch information
richard-ramos committed Oct 31, 2023
1 parent 5dfbd98 commit 84c0a61
Show file tree
Hide file tree
Showing 26 changed files with 133 additions and 149 deletions.
4 changes: 2 additions & 2 deletions cmd/waku/server/rest/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type AdminService struct {
}

type WakuPeer struct {
ID string `json:"id"`
ID peer.ID `json:"id"`
MultiAddrs []string `json:"multiaddrs"`
Protocols []string `json:"protocols"`
Connected bool `json:"connected"`
Expand Down Expand Up @@ -59,7 +59,7 @@ func (a *AdminService) getV1Peers(w http.ResponseWriter, req *http.Request) {
response := make([]WakuPeer, 0)
for _, peer := range peers {
wPeer := WakuPeer{
ID: peer.ID.Pretty(),
ID: peer.ID,
Connected: peer.Connected,
}

Expand Down
8 changes: 5 additions & 3 deletions cmd/waku/server/rest/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,11 @@ func (s *FilterService) unsubscribeGetMessage(ch <-chan filter.WakuFilterPushRes
var peerIds string
ind := 0
for entry := range ch {
s.log.Error("can't unsubscribe for ", zap.String("peer", entry.PeerID.String()), zap.Error(entry.Err))
if entry.Err == nil {
continue
}

s.log.Error("can't unsubscribe for ", zap.Stringer("peer", entry.PeerID), zap.Error(entry.Err))
if ind != 0 {
peerIds += ", "
}
Expand All @@ -211,8 +215,6 @@ func (s *FilterService) unsubscribeGetMessage(ch <-chan filter.WakuFilterPushRes
return http.StatusText(http.StatusOK)
}

// ///////////////////////
// ///////////////////////
type filterUnsubscribeAllRequest struct {
RequestId filterRequestId `json:"requestId"`
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/waku/server/rest/relay_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func TestRelayGetV1Messages(t *testing.T) {
go serviceB.Start(context.Background())
defer serviceB.Stop()

hostInfo, err := multiaddr.NewMultiaddr(fmt.Sprintf("/p2p/%s", serviceB.node.Host().ID().Pretty()))
hostInfo, err := multiaddr.NewMultiaddr(fmt.Sprintf("/p2p/%s", serviceB.node.Host().ID()))
require.NoError(t, err)

var addr multiaddr.Multiaddr
Expand Down
2 changes: 1 addition & 1 deletion cmd/waku/server/rest/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func TestGetMessages(t *testing.T) {
node1.Broadcaster().Submit(protocol.NewEnvelope(msg2, utils.GetUnixEpoch(), pubsubTopic1))
node1.Broadcaster().Submit(protocol.NewEnvelope(msg3, utils.GetUnixEpoch(), pubsubTopic1))

n1HostInfo, _ := multiaddr.NewMultiaddr(fmt.Sprintf("/p2p/%s", node1.Host().ID().Pretty()))
n1HostInfo, _ := multiaddr.NewMultiaddr(fmt.Sprintf("/p2p/%s", node1.Host().ID()))
n1Addr := node1.ListenAddresses()[0].Encapsulate(n1HostInfo)

node2, err := node.New()
Expand Down
2 changes: 1 addition & 1 deletion cmd/waku/server/rpc/admin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func TestV1Peers(t *testing.T) {

var reply2 SuccessReply

hostInfo, err := multiaddr.NewMultiaddr(fmt.Sprintf("/p2p/%s", host.ID().Pretty()))
hostInfo, err := multiaddr.NewMultiaddr(fmt.Sprintf("/p2p/%s", host.ID()))
require.NoError(t, err)

var addr multiaddr.Multiaddr
Expand Down
4 changes: 2 additions & 2 deletions cmd/waku/server/rpc/filter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func TestFilterSubscription(t *testing.T) {
d := makeFilterService(t, true)
defer d.node.Stop()

hostInfo, err := multiaddr.NewMultiaddr(fmt.Sprintf("/p2p/%s", host.ID().Pretty()))
hostInfo, err := multiaddr.NewMultiaddr(fmt.Sprintf("/p2p/%s", host.ID()))
require.NoError(t, err)

var addr multiaddr.Multiaddr
Expand Down Expand Up @@ -117,7 +117,7 @@ func TestFilterGetV1Messages(t *testing.T) {
go serviceB.Start()
defer serviceB.Stop()

hostInfo, err := multiaddr.NewMultiaddr(fmt.Sprintf("/p2p/%s", serviceB.node.Host().ID().Pretty()))
hostInfo, err := multiaddr.NewMultiaddr(fmt.Sprintf("/p2p/%s", serviceB.node.Host().ID()))
require.NoError(t, err)

var addr multiaddr.Multiaddr
Expand Down
2 changes: 1 addition & 1 deletion cmd/waku/server/rpc/relay_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func TestRelayGetV1Messages(t *testing.T) {
go serviceB.Start()
defer serviceB.Stop()

hostInfo, err := multiaddr.NewMultiaddr(fmt.Sprintf("/p2p/%s", serviceB.node.Host().ID().Pretty()))
hostInfo, err := multiaddr.NewMultiaddr(fmt.Sprintf("/p2p/%s", serviceB.node.Host().ID()))
require.NoError(t, err)

var addr multiaddr.Multiaddr
Expand Down
10 changes: 5 additions & 5 deletions examples/chat2/chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ func (c *Chat) connectionWatcher(connectionWg *sync.WaitGroup, connNotifier <-ch

for conn := range connNotifier {
if conn.Connected {
c.ui.InfoMessage(fmt.Sprintf("Peer %s connected", conn.PeerID.Pretty()))
c.ui.InfoMessage(fmt.Sprintf("Peer %s connected", conn.PeerID))
} else {
c.ui.InfoMessage(fmt.Sprintf("Peer %s disconnected", conn.PeerID.Pretty()))
c.ui.InfoMessage(fmt.Sprintf("Peer %s disconnected", conn.PeerID))
}
}
}
Expand Down Expand Up @@ -214,7 +214,7 @@ func (c *Chat) parseInput() {
c.ui.ErrorMessage(err)
return
}
peerInfoMsg += fmt.Sprintf("• %s:\n", p.Pretty())
peerInfoMsg += fmt.Sprintf("• %s:\n", p)

var strProtocols []string
for _, p := range peerProtocols {
Expand All @@ -224,7 +224,7 @@ func (c *Chat) parseInput() {
peerInfoMsg += fmt.Sprintf(" Protocols: %s\n", strings.Join(strProtocols, ", "))
peerInfoMsg += " Addresses:\n"
for _, addr := range peerInfo.Addrs {
peerInfoMsg += fmt.Sprintf(" - %s/p2p/%s\n", addr.String(), p.Pretty())
peerInfoMsg += fmt.Sprintf(" - %s/p2p/%s\n", addr.String(), p)
}
}
c.ui.InfoMessage(peerInfoMsg)
Expand Down Expand Up @@ -519,7 +519,7 @@ func (c *Chat) discoverNodes(connectionWg *sync.WaitGroup) {
err = c.node.DialPeerWithInfo(ctx, info)
if err != nil {

c.ui.ErrorMessage(fmt.Errorf("co!!uld not connect to %s: %w", info.ID.Pretty(), err))
c.ui.ErrorMessage(fmt.Errorf("co!!uld not connect to %s: %w", info.ID, err))
}
}(c.ctx, n)

Expand Down
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
];
doCheck = false;
# FIXME: This needs to be manually changed when updating modules.
vendorSha256 = "sha256-4xChSKAkwwrFp5/ZMnhtvsR4drVfw1cLE3YXwVHeW0A=";
vendorSha256 = "sha256-dgDzlzb/mO+8JGIxuoXGHdGuVZTC0IFzlbw8afZWCEI=";
# Fix for 'nix run' trying to execute 'go-waku'.
meta = { mainProgram = "waku"; };
};
Expand Down
63 changes: 30 additions & 33 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,22 @@ require (
github.com/gorilla/rpc v1.2.0
github.com/ipfs/go-ds-sql v0.3.0
github.com/ipfs/go-log/v2 v2.5.1
github.com/libp2p/go-libp2p v0.29.2
github.com/libp2p/go-libp2p v0.32.0
github.com/libp2p/go-libp2p-pubsub v0.9.3
github.com/libp2p/go-msgio v0.3.0
github.com/mattn/go-sqlite3 v1.14.17
github.com/multiformats/go-multiaddr v0.10.1
github.com/multiformats/go-multiaddr v0.12.0
github.com/stretchr/testify v1.8.4
github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a // indirect
github.com/urfave/cli/v2 v2.24.4
go.opencensus.io v0.24.0
go.uber.org/zap v1.24.0
golang.org/x/sync v0.3.0
github.com/urfave/cli/v2 v2.25.7
go.uber.org/zap v1.26.0
golang.org/x/sync v0.4.0
)

require (
github.com/gorilla/mux v1.8.0
github.com/waku-org/go-discover v0.0.0-20221209174356-61c833f34d98
golang.org/x/text v0.12.0
golang.org/x/text v0.13.0
)

require (
Expand All @@ -43,14 +42,15 @@ require (
)

require (
github.com/BurntSushi/toml v1.2.1 // indirect
github.com/BurntSushi/toml v1.3.2 // indirect
github.com/btcsuite/btcd v0.20.1-beta // indirect
github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d // indirect
github.com/deckarep/golang-set v1.8.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/google/pprof v0.0.0-20230705174524-200ffdc848b8 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.2 // indirect
github.com/google/pprof v0.0.0-20231023181126-ff6d637d2a7b // indirect
github.com/hashicorp/golang-lru/arc/v2 v2.0.5 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.5 // indirect
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
github.com/jackc/pgconn v1.8.0 // indirect
github.com/jackc/pgerrcode v0.0.0-20201024163028-a0d42d470451 // indirect
Expand All @@ -61,20 +61,20 @@ require (
github.com/jackc/pgtype v1.6.2 // indirect
github.com/jackc/pgx/v4 v4.10.1 // indirect
github.com/lib/pq v1.10.4 // indirect
github.com/onsi/ginkgo/v2 v2.11.0 // indirect
github.com/onsi/ginkgo/v2 v2.13.0 // indirect
github.com/quic-go/qpack v0.4.0 // indirect
github.com/quic-go/qtls-go1-19 v0.3.3 // indirect
github.com/quic-go/qtls-go1-20 v0.2.3 // indirect
github.com/quic-go/quic-go v0.36.4 // indirect
github.com/quic-go/webtransport-go v0.5.3 // indirect
github.com/quic-go/qtls-go1-20 v0.3.4 // indirect
github.com/quic-go/quic-go v0.39.3 // indirect
github.com/quic-go/webtransport-go v0.6.0 // indirect
github.com/rjeczalik/notify v0.9.3 // indirect
github.com/rogpeppe/go-internal v1.10.0 // indirect
github.com/status-im/status-go/extkeys v1.1.2 // indirect
github.com/waku-org/go-zerokit-rln-apple v0.0.0-20230916172309-ee0ee61dde2b // indirect
github.com/waku-org/go-zerokit-rln-arm v0.0.0-20230916171929-1dd9494ff065 // indirect
github.com/waku-org/go-zerokit-rln-x86_64 v0.0.0-20230916171518-2a77c3734dd1 // indirect
go.uber.org/dig v1.17.0 // indirect
go.uber.org/fx v1.20.0 // indirect
go.uber.org/dig v1.17.1 // indirect
go.uber.org/fx v1.20.1 // indirect
go.uber.org/mock v0.3.0 // indirect
golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df // indirect
)

Expand All @@ -98,37 +98,34 @@ require (
github.com/go-stack/stack v1.8.1 // indirect
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/godbus/dbus/v5 v5.1.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/mock v1.6.0 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/gopacket v1.1.19 // indirect
github.com/google/uuid v1.3.0
github.com/gorilla/websocket v1.5.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d
github.com/huin/goupnp v1.2.0 // indirect
github.com/huin/goupnp v1.3.0 // indirect
github.com/ipfs/go-cid v0.4.1 // indirect
github.com/ipfs/go-datastore v0.6.0 // indirect
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
github.com/jbenet/go-temp-err-catcher v0.1.0 // indirect
github.com/jbenet/goprocess v0.1.4 // indirect
github.com/klauspost/compress v1.16.7 // indirect
github.com/klauspost/compress v1.17.2 // indirect
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
github.com/koron/go-ssdp v0.0.4 // indirect
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
github.com/libp2p/go-cidranger v1.1.0 // indirect
github.com/libp2p/go-flow-metrics v0.1.0 // indirect
github.com/libp2p/go-libp2p-asn-util v0.3.0 // indirect
github.com/libp2p/go-mplex v0.7.0 // indirect
github.com/libp2p/go-nat v0.2.0 // indirect
github.com/libp2p/go-netroute v0.2.1 // indirect
github.com/libp2p/go-reuseport v0.3.0 // indirect
github.com/libp2p/go-reuseport v0.4.0 // indirect
github.com/libp2p/go-yamux/v4 v4.0.1 // indirect
github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/miekg/dns v1.1.55 // indirect
github.com/miekg/dns v1.1.56 // indirect
github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b // indirect
github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc // indirect
github.com/minio/sha256-simd v1.0.1 // indirect
Expand All @@ -140,9 +137,9 @@ require (
github.com/multiformats/go-multibase v0.2.0 // indirect
github.com/multiformats/go-multicodec v0.9.0 // indirect
github.com/multiformats/go-multihash v0.2.3 // indirect
github.com/multiformats/go-multistream v0.4.1 // indirect
github.com/multiformats/go-multistream v0.5.0 // indirect
github.com/multiformats/go-varint v0.0.7 // indirect
github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417 // indirect
github.com/opencontainers/runtime-spec v1.1.0 // indirect
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
Expand All @@ -159,13 +156,13 @@ require (
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.12.0 // indirect
golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1
golang.org/x/mod v0.12.0 // indirect
golang.org/x/net v0.14.0 // indirect
golang.org/x/sys v0.11.0
golang.org/x/crypto v0.14.0 // indirect
golang.org/x/exp v0.0.0-20231006140011-7918f672742d
golang.org/x/mod v0.13.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/sys v0.13.0
golang.org/x/time v0.0.0-20220922220347-f3bd1da661af // indirect
golang.org/x/tools v0.12.1-0.20230818130535-1517d1a3ba60 // indirect
golang.org/x/tools v0.14.0 // indirect
google.golang.org/protobuf v1.31.0
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
Loading

0 comments on commit 84c0a61

Please sign in to comment.