@cryptotaxi247 / kubo / commits / 6be6630e4

libp2p: stop reporting ProtocolVersion

Jorropo committed Jul 21, 2023 at 20:36 UTC 6be6630e4e838cf3ef0202d058a3657c7241b06e
4 files changed +17 -26
core/commands/id.go
+5 -12
@@ -26,12 +26,11 @@ import (
26 const offlineIDErrorMessage = "'ipfs id' cannot query information on remote peers without a running daemon; if you only want to convert --peerid-base, pass --offline option"
27
28 type IdOutput struct { // nolint
29 - ID string
30 - PublicKey string
31 - Addresses []string
32 - AgentVersion string
33 - ProtocolVersion string
34 - Protocols []protocol.ID
29 + ID string
30 + PublicKey string
31 + Addresses []string
32 + AgentVersion string
33 + Protocols []protocol.ID
34 }
35
36 const (
@@ -126,7 +125,6 @@ EXAMPLE:
125 output := format
126 output = strings.Replace(output, "<id>", out.ID, -1)
127 output = strings.Replace(output, "<aver>", out.AgentVersion, -1)
129 - output = strings.Replace(output, "<pver>", out.ProtocolVersion, -1)
128 output = strings.Replace(output, "<pubkey>", out.PublicKey, -1)
129 output = strings.Replace(output, "<addrs>", strings.Join(out.Addresses, "\n"), -1)
130 output = strings.Replace(output, "<protocols>", strings.Join(protocol.ConvertToStrings(out.Protocols), "\n"), -1)
@@ -178,11 +176,6 @@ func printPeer(keyEnc ke.KeyEncoder, ps pstore.Peerstore, p peer.ID) (interface{
176 info.Protocols = append(info.Protocols, protocols...)
177 sort.Slice(info.Protocols, func(i, j int) bool { return info.Protocols[i] < info.Protocols[j] })
178
181 - if v, err := ps.Get(p, "ProtocolVersion"); err == nil {
182 - if vs, ok := v.(string); ok {
183 - info.ProtocolVersion = vs
184 - }
185 - }
179 if v, err := ps.Get(p, "AgentVersion"); err == nil {
180 if vs, ok := v.(string); ok {
181 info.AgentVersion = vs
core/commands/swarm.go
-5
@@ -490,11 +490,6 @@ func (ci *connInfo) identifyPeer(ps pstore.Peerstore, p peer.ID) (IdOutput, erro
490 sort.Slice(info.Protocols, func(i, j int) bool { return info.Protocols[i] < info.Protocols[j] })
491 }
492
493 - if v, err := ps.Get(p, "ProtocolVersion"); err == nil {
494 - if vs, ok := v.(string); ok {
495 - info.ProtocolVersion = vs
496 - }
497 - }
493 if v, err := ps.Get(p, "AgentVersion"); err == nil {
494 if vs, ok := v.(string); ok {
495 info.AgentVersion = vs
docs/changelogs/v0.22.md
+7
@@ -9,6 +9,7 @@
9 - [Gateway: support for `order=` and `dups=` parameters (IPIP-412)](#gateway-support-for-order-and-dups-parameters-ipip-412)
10 - [`ipfs name publish` now supports V2 only IPNS records](#ipfs-name-publish-now-supports-v2-only-ipns-records)
11 - [IPNS name resolution has been fixed](#ipns-name-resolution-has-been-fixed)
12 + - [go-libp2p v0.29.0 update with smart dialing](#go-libp2p-v0.29.0-update-with-smart-dialing)
13 - [📝 Changelog](#-changelog)
14 - [👨‍👩‍👧‍👦 Contributors](#-contributors)
15
@@ -55,6 +56,12 @@ This has been fixed and as before will give the best record from either the DHT
56
57 For details see [#9927](https://github.com/ipfs/kubo/issues/9927) and [#10020](https://github.com/ipfs/kubo/pull/10020).
58
59 +# go-libp2p v0.29.0 update with smart dialing
60 +
61 +We updated from [go-libp2p](https://github.com/libp2p/go-libp2p) [v0.27.7](https://github.com/libp2p/go-libp2p/releases/tag/v0.27.7) to [v0.29.0](https://github.com/libp2p/go-libp2p/releases/tag/v0.29.0). This release includes smart dialing, which is a prioritization algorithm that will try to rank addresses and protocols rather than attempting all options in parallel. Anecdotally, we have observed [Kubo nodes make 30% less dials](https://github.com/libp2p/go-libp2p/issues/2326#issuecomment-1644332863) with no to low latency impact.
62 +
63 +This includes a breaking change to `ipfs id` and some of the `ipfs swarm` commands. We no longer report `ProtocolVersion`. This used to be hardcoded as `ipfs/0.1.0` and sent to other peers but was not providing any distinguishing value. See [libp2p/go-libp2p#2294](https://github.com/libp2p/go-libp2p/issues/2294) for more information.
64 +
65 ### 📝 Changelog
66
67 ### 👨‍👩‍👧‍👦 Contributors
test/cli/swarm_test.go
+5 -9
@@ -13,12 +13,11 @@ import (
13 // TODO: Migrate the rest of the sharness swarm test.
14 func TestSwarm(t *testing.T) {
15 type identifyType struct {
16 - ID string
17 - PublicKey string
18 - Addresses []string
19 - AgentVersion string
20 - ProtocolVersion string
21 - Protocols []string
16 + ID string
17 + PublicKey string
18 + Addresses []string
19 + AgentVersion string
20 + Protocols []string
21 }
22 type peer struct {
23 Identify identifyType
@@ -53,7 +52,6 @@ func TestSwarm(t *testing.T) {
52 actualPublicKey := output.Peers[0].Identify.PublicKey
53 actualAgentVersion := output.Peers[0].Identify.AgentVersion
54 actualAdresses := output.Peers[0].Identify.Addresses
56 - actualProtocolVersion := output.Peers[0].Identify.ProtocolVersion
55 actualProtocols := output.Peers[0].Identify.Protocols
56
57 expectedID := otherNode.PeerID().String()
@@ -62,7 +60,6 @@ func TestSwarm(t *testing.T) {
60 assert.Equal(t, actualID, expectedID)
61 assert.NotNil(t, actualPublicKey)
62 assert.NotNil(t, actualAgentVersion)
65 - assert.NotNil(t, actualProtocolVersion)
63 assert.Len(t, actualAdresses, 1)
64 assert.Equal(t, expectedAddresses[0], actualAdresses[0])
65 assert.Greater(t, len(actualProtocols), 0)
@@ -89,7 +86,6 @@ func TestSwarm(t *testing.T) {
86 assert.Equal(t, outputIdentify.ID, otherNodeIDOutput.ID)
87 assert.Equal(t, outputIdentify.PublicKey, otherNodeIDOutput.PublicKey)
88 assert.Equal(t, outputIdentify.AgentVersion, otherNodeIDOutput.AgentVersion)
92 - assert.Equal(t, outputIdentify.ProtocolVersion, otherNodeIDOutput.ProtocolVersion)
89 assert.ElementsMatch(t, outputIdentify.Addresses, otherNodeIDOutput.Addresses)
90 assert.ElementsMatch(t, outputIdentify.Protocols, otherNodeIDOutput.Protocols)
91