Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Libp2p To v0.32.1 and Go to v1.21.5 #13304

Merged
merged 14 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/gomodtidy/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.20-alpine
FROM golang:1.21-alpine

COPY entrypoint.sh /entrypoint.sh

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/fuzz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.20'
go-version: '1.21.5'
- id: list
uses: shogo82148/actions-go-fuzz/list@v0
with:
Expand All @@ -36,7 +36,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.20'
go-version: '1.21.5'
- uses: shogo82148/actions-go-fuzz/run@v0
with:
packages: ${{ matrix.package }}
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Go 1.20
- name: Set up Go 1.21
uses: actions/setup-go@v3
with:
go-version: '1.20'
go-version: '1.21.5'
- name: Run Gosec Security Scanner
run: | # https://github.com/securego/gosec/issues/469
export PATH=$PATH:$(go env GOPATH)/bin
Expand All @@ -45,10 +45,10 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

- name: Set up Go 1.20
- name: Set up Go 1.21
uses: actions/setup-go@v3
with:
go-version: '1.20'
go-version: '1.21.5'
id: go

- name: Golangci-lint
Expand All @@ -64,7 +64,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: '1.20'
go-version: '1.21.5'
id: go

- name: Check out code into the Go module directory
Expand Down
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ run:
- proto
- tools/analyzers
timeout: 10m
go: '1.19'
go: '1.21.5'

linters:
enable-all: true
Expand Down
2 changes: 1 addition & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_depe
go_rules_dependencies()

go_register_toolchains(
go_version = "1.20.10",
go_version = "1.21.5",
nogo = "@//:nogo",
)

Expand Down
2 changes: 1 addition & 1 deletion beacon-chain/p2p/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ go_library(
"@com_github_libp2p_go_libp2p//core/peer:go_default_library",
"@com_github_libp2p_go_libp2p//core/peerstore:go_default_library",
"@com_github_libp2p_go_libp2p//core/protocol:go_default_library",
"@com_github_libp2p_go_libp2p//p2p/muxer/mplex:go_default_library",
"@com_github_libp2p_go_libp2p//p2p/security/noise:go_default_library",
"@com_github_libp2p_go_libp2p//p2p/transport/tcp:go_default_library",
"@com_github_libp2p_go_libp2p_mplex//:go_default_library",
"@com_github_libp2p_go_libp2p_pubsub//:go_default_library",
"@com_github_libp2p_go_libp2p_pubsub//pb:go_default_library",
"@com_github_multiformats_go_multiaddr//:go_default_library",
Expand Down
4 changes: 2 additions & 2 deletions beacon-chain/p2p/dial_relay_node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func TestMakePeer_InvalidMultiaddress(t *testing.T) {
func TestMakePeer_OK(t *testing.T) {
a, err := MakePeer("/ip4/127.0.0.1/tcp/5678/p2p/QmUn6ycS8Fu6L462uZvuEfDoSgYX6kqP4aSZWMa7z1tWAX")
require.NoError(t, err, "Unexpected error when making a valid peer")
assert.Equal(t, "QmUn6ycS8Fu6L462uZvuEfDoSgYX6kqP4aSZWMa7z1tWAX", a.ID.Pretty(), "Unexpected peer ID")
assert.Equal(t, "QmUn6ycS8Fu6L462uZvuEfDoSgYX6kqP4aSZWMa7z1tWAX", a.ID.String(), "Unexpected peer ID")
}

func TestDialRelayNode_InvalidPeerString(t *testing.T) {
Expand All @@ -31,7 +31,7 @@ func TestDialRelayNode_OK(t *testing.T) {
ctx := context.Background()
relay := bh.NewBlankHost(swarmt.GenSwarm(t))
host := bh.NewBlankHost(swarmt.GenSwarm(t))
relayAddr := fmt.Sprintf("%s/p2p/%s", relay.Addrs()[0], relay.ID().Pretty())
relayAddr := fmt.Sprintf("%s/p2p/%s", relay.Addrs()[0], relay.ID().String())

assert.NoError(t, dialRelayNode(ctx, host, relayAddr), "Unexpected error when dialing relay node")
assert.Equal(t, relay.ID(), host.Peerstore().PeerInfo(relay.ID()).ID, "Host peerstore does not have peer info on relay node")
Expand Down
4 changes: 2 additions & 2 deletions beacon-chain/p2p/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (s *Service) selfAddresses() string {
addresses = append(addresses, s.dv5Listener.Self().String())
}
for _, addr := range s.host.Addrs() {
addresses = append(addresses, addr.String()+"/p2p/"+s.host.ID().Pretty())
addresses = append(addresses, addr.String()+"/p2p/"+s.host.ID().String())
}
return strings.Join(addresses, ",")
}
Expand All @@ -61,7 +61,7 @@ func formatPeers(h host.Host) string {
func formatPeer(pid peer.ID, ma []ma.Multiaddr) string {
var addresses []string
for _, a := range ma {
addresses = append(addresses, a.String()+"/p2p/"+pid.Pretty())
addresses = append(addresses, a.String()+"/p2p/"+pid.String())
}
return strings.Join(addresses, ",")
}
2 changes: 1 addition & 1 deletion beacon-chain/p2p/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"net"

"github.com/libp2p/go-libp2p"
mplex "github.com/libp2p/go-libp2p-mplex"
"github.com/libp2p/go-libp2p/core/network"
"github.com/libp2p/go-libp2p/core/peer"
"github.com/libp2p/go-libp2p/p2p/muxer/mplex"
"github.com/libp2p/go-libp2p/p2p/security/noise"
"github.com/libp2p/go-libp2p/p2p/transport/tcp"
ma "github.com/multiformats/go-multiaddr"
Expand Down
4 changes: 2 additions & 2 deletions beacon-chain/p2p/peers/status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1108,7 +1108,7 @@ func TestInbound(t *testing.T) {

result := p.Inbound()
require.Equal(t, 1, len(result))
assert.Equal(t, inbound.Pretty(), result[0].Pretty())
assert.Equal(t, inbound.String(), result[0].String())
}

func TestOutbound(t *testing.T) {
Expand All @@ -1127,7 +1127,7 @@ func TestOutbound(t *testing.T) {

result := p.Outbound()
require.Equal(t, 1, len(result))
assert.Equal(t, outbound.Pretty(), result[0].Pretty())
assert.Equal(t, outbound.String(), result[0].String())
}

// addPeer is a helper to add a peer with a given connection state)
Expand Down
2 changes: 1 addition & 1 deletion beacon-chain/p2p/testing/p2p.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ type TestP2P struct {
// NewTestP2P initializes a new p2p test service.
func NewTestP2P(t *testing.T) *TestP2P {
ctx := context.Background()
h := bhost.NewBlankHost(swarmt.GenSwarm(t))
h := bhost.NewBlankHost(swarmt.GenSwarm(t, swarmt.OptDisableQUIC))
ps, err := pubsub.NewFloodSub(ctx, h,
pubsub.WithMessageSigning(false),
pubsub.WithStrictSignatureVerification(false),
Expand Down
4 changes: 2 additions & 2 deletions beacon-chain/rpc/eth/node/handlers_peers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func TestGetPeers(t *testing.T) {
require.NoError(t, json.Unmarshal(writer.Body.Bytes(), resp))
require.Equal(t, 1, len(resp.Data))
returnedPeer := resp.Data[0]
assert.Equal(t, expectedId.Pretty(), returnedPeer.PeerId)
assert.Equal(t, expectedId.String(), returnedPeer.PeerId)
expectedEnr, err := peerStatus.ENR(expectedId)
require.NoError(t, err)
serializedEnr, err := p2p.SerializeENR(expectedEnr)
Expand Down Expand Up @@ -230,7 +230,7 @@ func TestGetPeers(t *testing.T) {
require.NoError(t, json.Unmarshal(writer.Body.Bytes(), resp))
assert.Equal(t, len(tt.wantIds), len(resp.Data), "Wrong number of peers returned")
for _, id := range tt.wantIds {
expectedId := id.Pretty()
expectedId := id.String()
found := false
for _, returnedPeer := range resp.Data {
if returnedPeer.PeerId == expectedId {
Expand Down
2 changes: 1 addition & 1 deletion beacon-chain/rpc/eth/node/handlers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func TestGetIdentity(t *testing.T) {
require.Equal(t, http.StatusOK, writer.Code)
resp := &GetIdentityResponse{}
require.NoError(t, json.Unmarshal(writer.Body.Bytes(), resp))
expectedID := peer.ID("foo").Pretty()
expectedID := peer.ID("foo").String()
assert.Equal(t, expectedID, resp.Data.PeerId)
expectedEnr, err := p2p.SerializeENR(enrRecord)
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion beacon-chain/rpc/prysm/v1alpha1/node/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ func (ns *Server) ListPeers(ctx context.Context, _ *empty.Empty) (*ethpb.Peers,
if multiaddr != nil {
multiAddrStr = multiaddr.String()
}
address := fmt.Sprintf("%s/p2p/%s", multiAddrStr, pid.Pretty())
address := fmt.Sprintf("%s/p2p/%s", multiAddrStr, pid.String())
pbDirection := ethpb.PeerDirection_UNKNOWN
switch direction {
case network.DirInbound:
Expand Down
4 changes: 2 additions & 2 deletions beacon-chain/sync/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ func (s *Service) registerRPC(baseTopic string, handle rpcHandler) {
ctx, span := trace.StartSpan(ctx, "sync.rpc")
defer span.End()
span.AddAttributes(trace.StringAttribute("topic", topic))
span.AddAttributes(trace.StringAttribute("peer", stream.Conn().RemotePeer().Pretty()))
log := log.WithField("peer", stream.Conn().RemotePeer().Pretty()).WithField("topic", string(stream.Protocol()))
span.AddAttributes(trace.StringAttribute("peer", stream.Conn().RemotePeer().String()))
log := log.WithField("peer", stream.Conn().RemotePeer().String()).WithField("topic", string(stream.Protocol()))

// Check before hand that peer is valid.
if s.cfg.p2p.Peers().IsBad(stream.Conn().RemotePeer()) {
Expand Down
2 changes: 1 addition & 1 deletion beacon-chain/sync/rpc_beacon_blocks_by_range.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (s *Service) beaconBlocksByRangeRPCHandler(ctx context.Context, msg interfa
trace.Int64Attribute("start", int64(rp.start)), // lint:ignore uintcast -- This conversion is OK for tracing.
trace.Int64Attribute("end", int64(rp.end)), // lint:ignore uintcast -- This conversion is OK for tracing.
trace.Int64Attribute("count", int64(m.Count)),
trace.StringAttribute("peer", stream.Conn().RemotePeer().Pretty()),
trace.StringAttribute("peer", stream.Conn().RemotePeer().String()),
trace.Int64Attribute("remaining_capacity", remainingBucketCapacity),
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/prysmctl/p2p/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (c *client) registerRPCHandler(baseTopic string, handle rpcHandler) {
_ = _err
}()

log.WithField("peer", stream.Conn().RemotePeer().Pretty()).WithField("topic", string(stream.Protocol()))
log.WithField("peer", stream.Conn().RemotePeer().String()).WithField("topic", string(stream.Protocol()))

base, ok := p2p.RPCTopicMappings[baseTopic]
if !ok {
Expand Down
Loading
Loading