Skip to content

Commit 6be6630

Browse files
committed
libp2p: stop reporting ProtocolVersion
1 parent 649283b commit 6be6630

File tree

4 files changed

+17
-26
lines changed

4 files changed

+17
-26
lines changed

core/commands/id.go

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,11 @@ import (
2626
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"
2727

2828
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
3534
}
3635

3736
const (
@@ -126,7 +125,6 @@ EXAMPLE:
126125
output := format
127126
output = strings.Replace(output, "<id>", out.ID, -1)
128127
output = strings.Replace(output, "<aver>", out.AgentVersion, -1)
129-
output = strings.Replace(output, "<pver>", out.ProtocolVersion, -1)
130128
output = strings.Replace(output, "<pubkey>", out.PublicKey, -1)
131129
output = strings.Replace(output, "<addrs>", strings.Join(out.Addresses, "\n"), -1)
132130
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{
178176
info.Protocols = append(info.Protocols, protocols...)
179177
sort.Slice(info.Protocols, func(i, j int) bool { return info.Protocols[i] < info.Protocols[j] })
180178

181-
if v, err := ps.Get(p, "ProtocolVersion"); err == nil {
182-
if vs, ok := v.(string); ok {
183-
info.ProtocolVersion = vs
184-
}
185-
}
186179
if v, err := ps.Get(p, "AgentVersion"); err == nil {
187180
if vs, ok := v.(string); ok {
188181
info.AgentVersion = vs

core/commands/swarm.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -490,11 +490,6 @@ func (ci *connInfo) identifyPeer(ps pstore.Peerstore, p peer.ID) (IdOutput, erro
490490
sort.Slice(info.Protocols, func(i, j int) bool { return info.Protocols[i] < info.Protocols[j] })
491491
}
492492

493-
if v, err := ps.Get(p, "ProtocolVersion"); err == nil {
494-
if vs, ok := v.(string); ok {
495-
info.ProtocolVersion = vs
496-
}
497-
}
498493
if v, err := ps.Get(p, "AgentVersion"); err == nil {
499494
if vs, ok := v.(string); ok {
500495
info.AgentVersion = vs

docs/changelogs/v0.22.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- [Gateway: support for `order=` and `dups=` parameters (IPIP-412)](#gateway-support-for-order-and-dups-parameters-ipip-412)
1010
- [`ipfs name publish` now supports V2 only IPNS records](#ipfs-name-publish-now-supports-v2-only-ipns-records)
1111
- [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)
1213
- [📝 Changelog](#-changelog)
1314
- [👨‍👩‍👧‍👦 Contributors](#-contributors)
1415

@@ -55,6 +56,12 @@ This has been fixed and as before will give the best record from either the DHT
5556

5657
For details see [#9927](https://github.com/ipfs/kubo/issues/9927) and [#10020](https://github.com/ipfs/kubo/pull/10020).
5758

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+
5865
### 📝 Changelog
5966

6067
### 👨‍👩‍👧‍👦 Contributors

test/cli/swarm_test.go

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,11 @@ import (
1313
// TODO: Migrate the rest of the sharness swarm test.
1414
func TestSwarm(t *testing.T) {
1515
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
2221
}
2322
type peer struct {
2423
Identify identifyType
@@ -53,7 +52,6 @@ func TestSwarm(t *testing.T) {
5352
actualPublicKey := output.Peers[0].Identify.PublicKey
5453
actualAgentVersion := output.Peers[0].Identify.AgentVersion
5554
actualAdresses := output.Peers[0].Identify.Addresses
56-
actualProtocolVersion := output.Peers[0].Identify.ProtocolVersion
5755
actualProtocols := output.Peers[0].Identify.Protocols
5856

5957
expectedID := otherNode.PeerID().String()
@@ -62,7 +60,6 @@ func TestSwarm(t *testing.T) {
6260
assert.Equal(t, actualID, expectedID)
6361
assert.NotNil(t, actualPublicKey)
6462
assert.NotNil(t, actualAgentVersion)
65-
assert.NotNil(t, actualProtocolVersion)
6663
assert.Len(t, actualAdresses, 1)
6764
assert.Equal(t, expectedAddresses[0], actualAdresses[0])
6865
assert.Greater(t, len(actualProtocols), 0)
@@ -89,7 +86,6 @@ func TestSwarm(t *testing.T) {
8986
assert.Equal(t, outputIdentify.ID, otherNodeIDOutput.ID)
9087
assert.Equal(t, outputIdentify.PublicKey, otherNodeIDOutput.PublicKey)
9188
assert.Equal(t, outputIdentify.AgentVersion, otherNodeIDOutput.AgentVersion)
92-
assert.Equal(t, outputIdentify.ProtocolVersion, otherNodeIDOutput.ProtocolVersion)
9389
assert.ElementsMatch(t, outputIdentify.Addresses, otherNodeIDOutput.Addresses)
9490
assert.ElementsMatch(t, outputIdentify.Protocols, otherNodeIDOutput.Protocols)
9591

0 commit comments

Comments
 (0)