From 91bd477f4fa265e55d6a2df5e4f5274d6542d757 Mon Sep 17 00:00:00 2001 From: Nishant Das Date: Wed, 2 Jun 2021 13:44:34 +0800 Subject: [PATCH] Add Metadata V2 Object and Interface (#8962) * checkpoint changes * gaz * add error check * gaz * fix tests * fix tests * terence's review * terence's review Co-authored-by: Raul Jordan --- beacon-chain/p2p/BUILD.bazel | 2 + beacon-chain/p2p/broadcaster_test.go | 3 +- beacon-chain/p2p/discovery_test.go | 5 +- beacon-chain/p2p/interfaces.go | 4 +- beacon-chain/p2p/peers/BUILD.bazel | 3 +- beacon-chain/p2p/peers/peerdata/BUILD.bazel | 1 + beacon-chain/p2p/peers/peerdata/store.go | 3 +- beacon-chain/p2p/peers/status.go | 19 +- beacon-chain/p2p/peers/status_test.go | 19 +- beacon-chain/p2p/service.go | 11 +- beacon-chain/p2p/subnets.go | 7 +- beacon-chain/p2p/subnets_test.go | 5 +- beacon-chain/p2p/testing/BUILD.bazel | 1 + beacon-chain/p2p/testing/fuzz_p2p.go | 4 +- .../p2p/testing/mock_metadataprovider.go | 10 +- beacon-chain/p2p/testing/p2p.go | 10 +- beacon-chain/p2p/utils.go | 12 +- beacon-chain/rpc/debug/p2p.go | 9 +- beacon-chain/rpc/nodev1/BUILD.bazel | 1 + beacon-chain/rpc/nodev1/node.go | 2 +- beacon-chain/rpc/nodev1/node_test.go | 3 +- beacon-chain/sync/rate_limiter.go | 2 +- beacon-chain/sync/rpc_metadata.go | 12 +- beacon-chain/sync/rpc_metadata_test.go | 18 +- beacon-chain/sync/rpc_ping.go | 6 +- beacon-chain/sync/rpc_ping_test.go | 31 +- beacon-chain/sync/rpc_status_test.go | 8 +- fuzz/generated.ssz.go | 5 - proto/beacon/p2p/v1/BUILD.bazel | 13 +- proto/beacon/p2p/v1/generated.ssz.go | 124 +++++-- proto/beacon/p2p/v1/messages.pb.go | 136 ++++++-- proto/beacon/p2p/v1/messages.proto | 16 +- proto/beacon/rpc/v1/debug.pb.go | 308 +++++++++--------- proto/beacon/rpc/v1/debug.proto | 13 +- shared/grpcutils/grpcutils_test.go | 10 +- shared/interfaces/BUILD.bazel | 4 + shared/interfaces/metadata_interface.go | 17 + shared/interfaces/metadata_wrapper.go | 101 ++++++ tools/analyzers/interfacechecker/analyzer.go | 1 + validator/rpc/beacon_test.go | 2 +- .../cli_import_export_test.go | 4 +- .../standard-protection-format/import.go | 2 +- .../slasher_client_test.go | 2 +- 43 files changed, 660 insertions(+), 309 deletions(-) create mode 100644 shared/interfaces/metadata_interface.go create mode 100644 shared/interfaces/metadata_wrapper.go diff --git a/beacon-chain/p2p/BUILD.bazel b/beacon-chain/p2p/BUILD.bazel index 2f2db80c41..1e2fa6de7c 100644 --- a/beacon-chain/p2p/BUILD.bazel +++ b/beacon-chain/p2p/BUILD.bazel @@ -56,6 +56,7 @@ go_library( "//shared/featureconfig:go_default_library", "//shared/fileutil:go_default_library", "//shared/hashutil:go_default_library", + "//shared/interfaces:go_default_library", "//shared/iputils:go_default_library", "//shared/p2putils:go_default_library", "//shared/params:go_default_library", @@ -139,6 +140,7 @@ go_test( "//shared/bytesutil:go_default_library", "//shared/event:go_default_library", "//shared/hashutil:go_default_library", + "//shared/interfaces:go_default_library", "//shared/iputils:go_default_library", "//shared/p2putils:go_default_library", "//shared/params:go_default_library", diff --git a/beacon-chain/p2p/broadcaster_test.go b/beacon-chain/p2p/broadcaster_test.go index 28408d1906..296024557a 100644 --- a/beacon-chain/p2p/broadcaster_test.go +++ b/beacon-chain/p2p/broadcaster_test.go @@ -21,6 +21,7 @@ import ( pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" testpb "github.com/prysmaticlabs/prysm/proto/testing" "github.com/prysmaticlabs/prysm/shared/bytesutil" + "github.com/prysmaticlabs/prysm/shared/interfaces" "github.com/prysmaticlabs/prysm/shared/testutil" "github.com/prysmaticlabs/prysm/shared/testutil/assert" "github.com/prysmaticlabs/prysm/shared/testutil/require" @@ -253,7 +254,7 @@ func TestService_BroadcastAttestationWithDiscoveryAttempts(t *testing.T) { // Set for 2nd peer if i == 2 { s.dv5Listener = listener - s.metaData = new(pb.MetaData) + s.metaData = interfaces.WrappedMetadataV0(new(pb.MetaDataV0)) bitV := bitfield.NewBitvector64() bitV.SetBitAt(subnet, true) s.updateSubnetRecordWithMetadata(bitV) diff --git a/beacon-chain/p2p/discovery_test.go b/beacon-chain/p2p/discovery_test.go index 9395415ace..d801f87674 100644 --- a/beacon-chain/p2p/discovery_test.go +++ b/beacon-chain/p2p/discovery_test.go @@ -31,6 +31,7 @@ import ( testp2p "github.com/prysmaticlabs/prysm/beacon-chain/p2p/testing" pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" "github.com/prysmaticlabs/prysm/shared/bytesutil" + "github.com/prysmaticlabs/prysm/shared/interfaces" "github.com/prysmaticlabs/prysm/shared/iputils" "github.com/prysmaticlabs/prysm/shared/testutil/assert" "github.com/prysmaticlabs/prysm/shared/testutil/require" @@ -333,9 +334,9 @@ func addPeer(t *testing.T, p *peers.Status, state peerdata.PeerConnectionState) require.NoError(t, err) p.Add(new(enr.Record), id, nil, network.DirInbound) p.SetConnectionState(id, state) - p.SetMetadata(id, &pb.MetaData{ + p.SetMetadata(id, interfaces.WrappedMetadataV0(&pb.MetaDataV0{ SeqNumber: 0, Attnets: bitfield.NewBitvector64(), - }) + })) return id } diff --git a/beacon-chain/p2p/interfaces.go b/beacon-chain/p2p/interfaces.go index 525b7b9376..d8ce119151 100644 --- a/beacon-chain/p2p/interfaces.go +++ b/beacon-chain/p2p/interfaces.go @@ -13,7 +13,7 @@ import ( ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1" "github.com/prysmaticlabs/prysm/beacon-chain/p2p/encoder" "github.com/prysmaticlabs/prysm/beacon-chain/p2p/peers" - pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" + "github.com/prysmaticlabs/prysm/shared/interfaces" "google.golang.org/protobuf/proto" ) @@ -92,6 +92,6 @@ type PeersProvider interface { // MetadataProvider returns the metadata related information for the local peer. type MetadataProvider interface { - Metadata() *pb.MetaData + Metadata() interfaces.Metadata MetadataSeq() uint64 } diff --git a/beacon-chain/p2p/peers/BUILD.bazel b/beacon-chain/p2p/peers/BUILD.bazel index b039625f8f..66e4dd53cb 100644 --- a/beacon-chain/p2p/peers/BUILD.bazel +++ b/beacon-chain/p2p/peers/BUILD.bazel @@ -11,6 +11,7 @@ go_library( "//beacon-chain/p2p/peers/peerdata:go_default_library", "//beacon-chain/p2p/peers/scorers:go_default_library", "//proto/beacon/p2p/v1:go_default_library", + "//shared/interfaces:go_default_library", "//shared/params:go_default_library", "//shared/rand:go_default_library", "//shared/timeutils:go_default_library", @@ -21,7 +22,6 @@ go_library( "@com_github_multiformats_go_multiaddr//net:go_default_library", "@com_github_prysmaticlabs_eth2_types//:go_default_library", "@com_github_prysmaticlabs_go_bitfield//:go_default_library", - "@org_golang_google_protobuf//proto:go_default_library", ], ) @@ -39,6 +39,7 @@ go_test( "//cmd/beacon-chain/flags:go_default_library", "//proto/beacon/p2p/v1:go_default_library", "//shared/featureconfig:go_default_library", + "//shared/interfaces:go_default_library", "//shared/params:go_default_library", "//shared/testutil/assert:go_default_library", "//shared/testutil/require:go_default_library", diff --git a/beacon-chain/p2p/peers/peerdata/BUILD.bazel b/beacon-chain/p2p/peers/peerdata/BUILD.bazel index e9ae88d9f2..9ba8b6b6b4 100644 --- a/beacon-chain/p2p/peers/peerdata/BUILD.bazel +++ b/beacon-chain/p2p/peers/peerdata/BUILD.bazel @@ -9,6 +9,7 @@ go_library( deps = [ "//proto/beacon/p2p/v1:go_default_library", "//proto/beacon/rpc/v1:go_default_library", + "//shared/interfaces:go_default_library", "@com_github_ethereum_go_ethereum//p2p/enr:go_default_library", "@com_github_libp2p_go_libp2p_core//network:go_default_library", "@com_github_libp2p_go_libp2p_core//peer:go_default_library", diff --git a/beacon-chain/p2p/peers/peerdata/store.go b/beacon-chain/p2p/peers/peerdata/store.go index e91719d1af..a6a0ae3dcb 100644 --- a/beacon-chain/p2p/peers/peerdata/store.go +++ b/beacon-chain/p2p/peers/peerdata/store.go @@ -13,6 +13,7 @@ import ( ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1" pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" pbrpc "github.com/prysmaticlabs/prysm/proto/beacon/rpc/v1" + "github.com/prysmaticlabs/prysm/shared/interfaces" ) var ( @@ -49,7 +50,7 @@ type PeerData struct { Enr *enr.Record NextValidTime time.Time // Chain related data. - MetaData *pb.MetaData + MetaData interfaces.Metadata ChainState *pb.Status ChainStateLastUpdated time.Time ChainStateValidationError error diff --git a/beacon-chain/p2p/peers/status.go b/beacon-chain/p2p/peers/status.go index a3e9c2535f..0c4683bbe7 100644 --- a/beacon-chain/p2p/peers/status.go +++ b/beacon-chain/p2p/peers/status.go @@ -39,10 +39,10 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/p2p/peers/peerdata" "github.com/prysmaticlabs/prysm/beacon-chain/p2p/peers/scorers" pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" + "github.com/prysmaticlabs/prysm/shared/interfaces" "github.com/prysmaticlabs/prysm/shared/params" "github.com/prysmaticlabs/prysm/shared/rand" "github.com/prysmaticlabs/prysm/shared/timeutils" - "google.golang.org/protobuf/proto" ) const ( @@ -230,7 +230,7 @@ func (p *Status) InboundLimit() int { } // SetMetadata sets the metadata of the given remote peer. -func (p *Status) SetMetadata(pid peer.ID, metaData *pb.MetaData) { +func (p *Status) SetMetadata(pid peer.ID, metaData interfaces.Metadata) { p.store.Lock() defer p.store.Unlock() @@ -240,12 +240,15 @@ func (p *Status) SetMetadata(pid peer.ID, metaData *pb.MetaData) { // Metadata returns a copy of the metadata corresponding to the provided // peer id. -func (p *Status) Metadata(pid peer.ID) (*pb.MetaData, error) { +func (p *Status) Metadata(pid peer.ID) (interfaces.Metadata, error) { p.store.RLock() defer p.store.RUnlock() if peerData, ok := p.store.PeerData(pid); ok { - return proto.Clone(peerData.MetaData).(*pb.MetaData), nil + if peerData.MetaData == nil || peerData.MetaData.IsNil() { + return nil, nil + } + return peerData.MetaData.Copy(), nil } return nil, peerdata.ErrPeerUnknown } @@ -256,10 +259,10 @@ func (p *Status) CommitteeIndices(pid peer.ID) ([]uint64, error) { defer p.store.RUnlock() if peerData, ok := p.store.PeerData(pid); ok { - if peerData.Enr == nil || peerData.MetaData == nil { + if peerData.Enr == nil || peerData.MetaData == nil || peerData.MetaData.IsNil() { return []uint64{}, nil } - return indicesFromBitfield(peerData.MetaData.Attnets), nil + return indicesFromBitfield(peerData.MetaData.AttnetsBitfield()), nil } return nil, peerdata.ErrPeerUnknown } @@ -274,8 +277,8 @@ func (p *Status) SubscribedToSubnet(index uint64) []peer.ID { for pid, peerData := range p.store.Peers() { // look at active peers connectedStatus := peerData.ConnState == PeerConnecting || peerData.ConnState == PeerConnected - if connectedStatus && peerData.MetaData != nil && peerData.MetaData.Attnets != nil { - indices := indicesFromBitfield(peerData.MetaData.Attnets) + if connectedStatus && peerData.MetaData != nil && !peerData.MetaData.IsNil() && peerData.MetaData.AttnetsBitfield() != nil { + indices := indicesFromBitfield(peerData.MetaData.AttnetsBitfield()) for _, idx := range indices { if idx == index { peers = append(peers, pid) diff --git a/beacon-chain/p2p/peers/status_test.go b/beacon-chain/p2p/peers/status_test.go index 73ca8c9a5f..c1876bda40 100644 --- a/beacon-chain/p2p/peers/status_test.go +++ b/beacon-chain/p2p/peers/status_test.go @@ -18,6 +18,7 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/p2p/peers/peerdata" "github.com/prysmaticlabs/prysm/beacon-chain/p2p/peers/scorers" pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" + "github.com/prysmaticlabs/prysm/shared/interfaces" "github.com/prysmaticlabs/prysm/shared/params" "github.com/prysmaticlabs/prysm/shared/testutil/assert" "github.com/prysmaticlabs/prysm/shared/testutil/require" @@ -187,10 +188,10 @@ func TestPeerCommitteeIndices(t *testing.T) { bitV.SetBitAt(uint64(i), true) } } - p.SetMetadata(id, &pb.MetaData{ + p.SetMetadata(id, interfaces.WrappedMetadataV0(&pb.MetaDataV0{ SeqNumber: 2, Attnets: bitV, - }) + })) wantedIndices := []uint64{2, 8, 9} @@ -222,10 +223,10 @@ func TestPeerSubscribedToSubnet(t *testing.T) { bitV.SetBitAt(uint64(i), true) } } - p.SetMetadata(expectedPeer, &pb.MetaData{ + p.SetMetadata(expectedPeer, interfaces.WrappedMetadataV0(&pb.MetaDataV0{ SeqNumber: 2, Attnets: bitV, - }) + })) numPeers = 3 for i := 0; i < numPeers; i++ { addPeer(t, p, peers.PeerDisconnected) @@ -369,15 +370,15 @@ func TestAddMetaData(t *testing.T) { } newPeer := p.All()[2] - newMetaData := &pb.MetaData{ + newMetaData := &pb.MetaDataV0{ SeqNumber: 8, Attnets: bitfield.NewBitvector64(), } - p.SetMetadata(newPeer, newMetaData) + p.SetMetadata(newPeer, interfaces.WrappedMetadataV0(newMetaData)) md, err := p.Metadata(newPeer) require.NoError(t, err) - assert.Equal(t, newMetaData.SeqNumber, md.SeqNumber, "Unexpected sequence number") + assert.Equal(t, newMetaData.SeqNumber, md.SequenceNumber(), "Unexpected sequence number") } func TestPeerConnectionStatuses(t *testing.T) { @@ -1001,10 +1002,10 @@ func addPeer(t *testing.T, p *peers.Status, state peerdata.PeerConnectionState) require.NoError(t, err) p.Add(new(enr.Record), id, nil, network.DirUnknown) p.SetConnectionState(id, state) - p.SetMetadata(id, &pb.MetaData{ + p.SetMetadata(id, interfaces.WrappedMetadataV0(&pb.MetaDataV0{ SeqNumber: 0, Attnets: bitfield.NewBitvector64(), - }) + })) return id } diff --git a/beacon-chain/p2p/service.go b/beacon-chain/p2p/service.go index 795961932d..ee4d310719 100644 --- a/beacon-chain/p2p/service.go +++ b/beacon-chain/p2p/service.go @@ -26,14 +26,13 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/p2p/encoder" "github.com/prysmaticlabs/prysm/beacon-chain/p2p/peers" "github.com/prysmaticlabs/prysm/beacon-chain/p2p/peers/scorers" - pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" "github.com/prysmaticlabs/prysm/shared" + "github.com/prysmaticlabs/prysm/shared/interfaces" "github.com/prysmaticlabs/prysm/shared/params" "github.com/prysmaticlabs/prysm/shared/runutil" "github.com/prysmaticlabs/prysm/shared/slotutil" "github.com/sirupsen/logrus" "go.opencensus.io/trace" - "google.golang.org/protobuf/proto" ) var _ shared.Service = (*Service)(nil) @@ -65,7 +64,7 @@ type Service struct { addrFilter *multiaddr.Filters ipLimiter *leakybucket.Collector privKey *ecdsa.PrivateKey - metaData *pb.MetaData + metaData interfaces.Metadata pubsub *pubsub.PubSub joinedTopics map[string]*pubsub.Topic joinedTopicsLock sync.Mutex @@ -342,13 +341,13 @@ func (s *Service) DiscoveryAddresses() ([]multiaddr.Multiaddr, error) { } // Metadata returns a copy of the peer's metadata. -func (s *Service) Metadata() *pb.MetaData { - return proto.Clone(s.metaData).(*pb.MetaData) +func (s *Service) Metadata() interfaces.Metadata { + return s.metaData.Copy() } // MetadataSeq returns the metadata sequence number. func (s *Service) MetadataSeq() uint64 { - return s.metaData.SeqNumber + return s.metaData.SequenceNumber() } // AddPingMethod adds the metadata ping rpc method to the p2p service, so that it can diff --git a/beacon-chain/p2p/subnets.go b/beacon-chain/p2p/subnets.go index 67da8e19b5..e0f42c8601 100644 --- a/beacon-chain/p2p/subnets.go +++ b/beacon-chain/p2p/subnets.go @@ -7,6 +7,7 @@ import ( "github.com/ethereum/go-ethereum/p2p/enode" "github.com/ethereum/go-ethereum/p2p/enr" "github.com/prysmaticlabs/go-bitfield" + "github.com/prysmaticlabs/prysm/shared/interfaces" "go.opencensus.io/trace" pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" @@ -102,10 +103,10 @@ func (s *Service) hasPeerWithSubnet(topic string) bool { func (s *Service) updateSubnetRecordWithMetadata(bitV bitfield.Bitvector64) { entry := enr.WithEntry(attSubnetEnrKey, &bitV) s.dv5Listener.LocalNode().Set(entry) - s.metaData = &pb.MetaData{ - SeqNumber: s.metaData.SeqNumber + 1, + s.metaData = interfaces.WrappedMetadataV0(&pb.MetaDataV0{ + SeqNumber: s.metaData.SequenceNumber() + 1, Attnets: bitV, - } + }) } // Initializes a bitvector of attestation subnets beacon nodes is subscribed to diff --git a/beacon-chain/p2p/subnets_test.go b/beacon-chain/p2p/subnets_test.go index f4e45ee029..868e30476a 100644 --- a/beacon-chain/p2p/subnets_test.go +++ b/beacon-chain/p2p/subnets_test.go @@ -13,6 +13,7 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/core/feed" statefeed "github.com/prysmaticlabs/prysm/beacon-chain/core/feed/state" pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" + "github.com/prysmaticlabs/prysm/shared/interfaces" "github.com/prysmaticlabs/prysm/shared/params" "github.com/prysmaticlabs/prysm/shared/testutil/assert" "github.com/prysmaticlabs/prysm/shared/testutil/require" @@ -119,9 +120,9 @@ func TestStartDiscV5_DiscoverPeersWithSubnets(t *testing.T) { // Update ENR of a peer. testService := &Service{ dv5Listener: listeners[0], - metaData: &pb.MetaData{ + metaData: interfaces.WrappedMetadataV0(&pb.MetaDataV0{ Attnets: bitfield.NewBitvector64(), - }, + }), } cache.SubnetIDs.AddAttesterSubnetID(0, 10) testService.RefreshENR() diff --git a/beacon-chain/p2p/testing/BUILD.bazel b/beacon-chain/p2p/testing/BUILD.bazel index 893fa2dd83..01f9ebfe6d 100644 --- a/beacon-chain/p2p/testing/BUILD.bazel +++ b/beacon-chain/p2p/testing/BUILD.bazel @@ -22,6 +22,7 @@ go_library( "//beacon-chain/p2p/peers:go_default_library", "//beacon-chain/p2p/peers/scorers:go_default_library", "//proto/beacon/p2p/v1:go_default_library", + "//shared/interfaces:go_default_library", "@com_github_ethereum_go_ethereum//crypto:go_default_library", "@com_github_ethereum_go_ethereum//p2p/enode:go_default_library", "@com_github_ethereum_go_ethereum//p2p/enr:go_default_library", diff --git a/beacon-chain/p2p/testing/fuzz_p2p.go b/beacon-chain/p2p/testing/fuzz_p2p.go index 6be4ecb47c..7e77bd6428 100644 --- a/beacon-chain/p2p/testing/fuzz_p2p.go +++ b/beacon-chain/p2p/testing/fuzz_p2p.go @@ -11,11 +11,11 @@ import ( pubsub "github.com/libp2p/go-libp2p-pubsub" "github.com/multiformats/go-multiaddr" ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1" + "github.com/prysmaticlabs/prysm/shared/interfaces" "google.golang.org/protobuf/proto" "github.com/prysmaticlabs/prysm/beacon-chain/p2p/encoder" "github.com/prysmaticlabs/prysm/beacon-chain/p2p/peers" - pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" ) // FakeP2P stack @@ -75,7 +75,7 @@ func (p *FakeP2P) LeaveTopic(_ string) error { } // Metadata -- fake. -func (p *FakeP2P) Metadata() *pb.MetaData { +func (p *FakeP2P) Metadata() interfaces.Metadata { return nil } diff --git a/beacon-chain/p2p/testing/mock_metadataprovider.go b/beacon-chain/p2p/testing/mock_metadataprovider.go index d7b46e4e5f..c63c0081e3 100644 --- a/beacon-chain/p2p/testing/mock_metadataprovider.go +++ b/beacon-chain/p2p/testing/mock_metadataprovider.go @@ -1,18 +1,20 @@ package testing -import pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" +import ( + "github.com/prysmaticlabs/prysm/shared/interfaces" +) // MockMetadataProvider is a fake implementation of the MetadataProvider interface. type MockMetadataProvider struct { - Data *pb.MetaData + Data interfaces.Metadata } // Metadata -- -func (m *MockMetadataProvider) Metadata() *pb.MetaData { +func (m *MockMetadataProvider) Metadata() interfaces.Metadata { return m.Data } // MetadataSeq -- func (m *MockMetadataProvider) MetadataSeq() uint64 { - return m.Data.SeqNumber + return m.Data.SequenceNumber() } diff --git a/beacon-chain/p2p/testing/p2p.go b/beacon-chain/p2p/testing/p2p.go index 31555ed32c..74010f6c6f 100644 --- a/beacon-chain/p2p/testing/p2p.go +++ b/beacon-chain/p2p/testing/p2p.go @@ -24,7 +24,7 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/p2p/encoder" "github.com/prysmaticlabs/prysm/beacon-chain/p2p/peers" "github.com/prysmaticlabs/prysm/beacon-chain/p2p/peers/scorers" - pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" + "github.com/prysmaticlabs/prysm/shared/interfaces" "github.com/sirupsen/logrus" "google.golang.org/protobuf/proto" ) @@ -39,7 +39,7 @@ type TestP2P struct { DelaySend bool Digest [4]byte peers *peers.Status - LocalMetadata *pb.MetaData + LocalMetadata interfaces.Metadata } // NewTestP2P initializes a new p2p test service. @@ -338,13 +338,13 @@ func (p *TestP2P) ForkDigest() ([4]byte, error) { } // Metadata mocks the peer's metadata. -func (p *TestP2P) Metadata() *pb.MetaData { - return proto.Clone(p.LocalMetadata).(*pb.MetaData) +func (p *TestP2P) Metadata() interfaces.Metadata { + return p.LocalMetadata.Copy() } // MetadataSeq mocks metadata sequence number. func (p *TestP2P) MetadataSeq() uint64 { - return p.LocalMetadata.SeqNumber + return p.LocalMetadata.SequenceNumber() } // AddPingMethod mocks the p2p func. diff --git a/beacon-chain/p2p/utils.go b/beacon-chain/p2p/utils.go index afb5974882..3164d2a36b 100644 --- a/beacon-chain/p2p/utils.go +++ b/beacon-chain/p2p/utils.go @@ -20,6 +20,7 @@ import ( "github.com/prysmaticlabs/go-bitfield" pbp2p "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" "github.com/prysmaticlabs/prysm/shared/fileutil" + "github.com/prysmaticlabs/prysm/shared/interfaces" "github.com/prysmaticlabs/prysm/shared/iputils" "github.com/sirupsen/logrus" "google.golang.org/protobuf/proto" @@ -106,7 +107,8 @@ func privKeyFromFile(path string) (*ecdsa.PrivateKey, error) { // Retrieves node p2p metadata from a set of configuration values // from the p2p service. -func metaDataFromConfig(cfg *Config) (*pbp2p.MetaData, error) { +// TODO: Figure out how to do a v1/v2 check. +func metaDataFromConfig(cfg *Config) (interfaces.Metadata, error) { defaultKeyPath := path.Join(cfg.DataDir, metaDataPath) metaDataPath := cfg.MetaDataDir @@ -116,7 +118,7 @@ func metaDataFromConfig(cfg *Config) (*pbp2p.MetaData, error) { return nil, err } if metaDataPath == "" && !defaultMetadataExist { - metaData := &pbp2p.MetaData{ + metaData := &pbp2p.MetaDataV0{ SeqNumber: 0, Attnets: bitfield.NewBitvector64(), } @@ -127,7 +129,7 @@ func metaDataFromConfig(cfg *Config) (*pbp2p.MetaData, error) { if err := fileutil.WriteFile(defaultKeyPath, dst); err != nil { return nil, err } - return metaData, nil + return interfaces.WrappedMetadataV0(metaData), nil } if defaultMetadataExist && metaDataPath == "" { metaDataPath = defaultKeyPath @@ -137,11 +139,11 @@ func metaDataFromConfig(cfg *Config) (*pbp2p.MetaData, error) { log.WithError(err).Error("Error reading metadata from file") return nil, err } - metaData := &pbp2p.MetaData{} + metaData := &pbp2p.MetaDataV0{} if err := proto.Unmarshal(src, metaData); err != nil { return nil, err } - return metaData, nil + return interfaces.WrappedMetadataV0(metaData), nil } // Retrieves an external ipv4 address and converts into a libp2p formatted value. diff --git a/beacon-chain/rpc/debug/p2p.go b/beacon-chain/rpc/debug/p2p.go index 8b18f9d527..7a54a170c9 100644 --- a/beacon-chain/rpc/debug/p2p.go +++ b/beacon-chain/rpc/debug/p2p.go @@ -93,13 +93,20 @@ func (ds *Server) getPeer(pid peer.ID) (*pbrpc.DebugPeerResponse, error) { aVersion = "" } peerInfo := &pbrpc.DebugPeerResponse_PeerInfo{ - Metadata: metadata, Protocols: protocols, FaultCount: uint64(resp), ProtocolVersion: pVersion, AgentVersion: aVersion, PeerLatency: uint64(peerStore.LatencyEWMA(pid).Milliseconds()), } + if metadata != nil && !metadata.IsNil() { + switch { + case metadata.MetadataObjV0() != nil: + peerInfo.MetadataV0 = metadata.MetadataObjV0() + case metadata.MetadataObjV1() != nil: + peerInfo.MetadataV1 = metadata.MetadataObjV1() + } + } addresses := peerStore.Addrs(pid) var stringAddrs []string if addr != nil { diff --git a/beacon-chain/rpc/nodev1/BUILD.bazel b/beacon-chain/rpc/nodev1/BUILD.bazel index a0053f7c6c..2ed0e0df3d 100644 --- a/beacon-chain/rpc/nodev1/BUILD.bazel +++ b/beacon-chain/rpc/nodev1/BUILD.bazel @@ -44,6 +44,7 @@ go_test( "//beacon-chain/p2p/testing:go_default_library", "//beacon-chain/sync/initial-sync/testing:go_default_library", "//proto/beacon/p2p/v1:go_default_library", + "//shared/interfaces:go_default_library", "//shared/testutil:go_default_library", "//shared/testutil/assert:go_default_library", "//shared/testutil/require:go_default_library", diff --git a/beacon-chain/rpc/nodev1/node.go b/beacon-chain/rpc/nodev1/node.go index ce6e880ba7..e4fece93c4 100644 --- a/beacon-chain/rpc/nodev1/node.go +++ b/beacon-chain/rpc/nodev1/node.go @@ -60,7 +60,7 @@ func (ns *Server) GetIdentity(ctx context.Context, _ *emptypb.Empty) (*ethpb.Ide metadata := ðpb.Metadata{ SeqNumber: ns.MetadataProvider.MetadataSeq(), - Attnets: ns.MetadataProvider.Metadata().Attnets, + Attnets: ns.MetadataProvider.Metadata().AttnetsBitfield(), } return ðpb.IdentityResponse{ diff --git a/beacon-chain/rpc/nodev1/node_test.go b/beacon-chain/rpc/nodev1/node_test.go index fac21f7d20..5783687558 100644 --- a/beacon-chain/rpc/nodev1/node_test.go +++ b/beacon-chain/rpc/nodev1/node_test.go @@ -23,6 +23,7 @@ import ( mockp2p "github.com/prysmaticlabs/prysm/beacon-chain/p2p/testing" syncmock "github.com/prysmaticlabs/prysm/beacon-chain/sync/initial-sync/testing" pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" + "github.com/prysmaticlabs/prysm/shared/interfaces" "github.com/prysmaticlabs/prysm/shared/testutil" "github.com/prysmaticlabs/prysm/shared/testutil/assert" "github.com/prysmaticlabs/prysm/shared/testutil/require" @@ -80,7 +81,7 @@ func TestGetIdentity(t *testing.T) { require.NoError(t, err) attnets := bitfield.NewBitvector64() attnets.SetBitAt(1, true) - metadataProvider := &mockp2p.MockMetadataProvider{Data: &pb.MetaData{SeqNumber: 1, Attnets: attnets}} + metadataProvider := &mockp2p.MockMetadataProvider{Data: interfaces.WrappedMetadataV0(&pb.MetaDataV0{SeqNumber: 1, Attnets: attnets})} t.Run("OK", func(t *testing.T) { peerManager := &mockp2p.MockPeerManager{ diff --git a/beacon-chain/sync/rate_limiter.go b/beacon-chain/sync/rate_limiter.go index 4c049b3721..11807cc48c 100644 --- a/beacon-chain/sync/rate_limiter.go +++ b/beacon-chain/sync/rate_limiter.go @@ -40,7 +40,7 @@ func newRateLimiter(p2pProvider p2p.P2P) *limiter { topicMap := make(map[string]*leakybucket.Collector, len(p2p.RPCTopicMappings)) // Goodbye Message topicMap[addEncoding(p2p.RPCGoodByeTopicV1)] = leakybucket.NewCollector(1, 1, false /* deleteEmptyBuckets */) - // Metadata Message + // MetadataV0 Message topicMap[addEncoding(p2p.RPCMetaDataTopicV1)] = leakybucket.NewCollector(1, defaultBurstLimit, false /* deleteEmptyBuckets */) // Ping Message topicMap[addEncoding(p2p.RPCPingTopicV1)] = leakybucket.NewCollector(1, defaultBurstLimit, false /* deleteEmptyBuckets */) diff --git a/beacon-chain/sync/rpc_metadata.go b/beacon-chain/sync/rpc_metadata.go index f01acb8251..80c5a1fdad 100644 --- a/beacon-chain/sync/rpc_metadata.go +++ b/beacon-chain/sync/rpc_metadata.go @@ -8,6 +8,7 @@ import ( "github.com/pkg/errors" "github.com/prysmaticlabs/prysm/beacon-chain/p2p" pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" + "github.com/prysmaticlabs/prysm/shared/interfaces" ) // metaDataHandler reads the incoming metadata rpc request from the peer. @@ -22,7 +23,10 @@ func (s *Service) metaDataHandler(_ context.Context, _ interface{}, stream libp2 if _, err := stream.Write([]byte{responseCodeSuccess}); err != nil { return err } - _, err := s.cfg.P2P.Encoding().EncodeWithMaxLength(stream, s.cfg.P2P.Metadata()) + if s.cfg.P2P.Metadata() == nil || s.cfg.P2P.Metadata().IsNil() { + return errors.New("nil metadata stored for host") + } + _, err := s.cfg.P2P.Encoding().EncodeWithMaxLength(stream, s.cfg.P2P.Metadata().InnerObject()) if err != nil { return err } @@ -30,7 +34,7 @@ func (s *Service) metaDataHandler(_ context.Context, _ interface{}, stream libp2 return nil } -func (s *Service) sendMetaDataRequest(ctx context.Context, id peer.ID) (*pb.MetaData, error) { +func (s *Service) sendMetaDataRequest(ctx context.Context, id peer.ID) (interfaces.Metadata, error) { ctx, cancel := context.WithTimeout(ctx, respTimeout) defer cancel() @@ -52,9 +56,9 @@ func (s *Service) sendMetaDataRequest(ctx context.Context, id peer.ID) (*pb.Meta if err != nil { return nil, err } - msg := new(pb.MetaData) + msg := new(pb.MetaDataV0) if err := s.cfg.P2P.Encoding().DecodeWithMaxLength(stream, msg); err != nil { return nil, err } - return msg, nil + return interfaces.WrappedMetadataV0(msg), nil } diff --git a/beacon-chain/sync/rpc_metadata_test.go b/beacon-chain/sync/rpc_metadata_test.go index 2840adb9a5..b0fc63d527 100644 --- a/beacon-chain/sync/rpc_metadata_test.go +++ b/beacon-chain/sync/rpc_metadata_test.go @@ -7,13 +7,13 @@ import ( "time" "github.com/kevinms/leakybucket-go" - "github.com/libp2p/go-libp2p-core/network" "github.com/libp2p/go-libp2p-core/protocol" db "github.com/prysmaticlabs/prysm/beacon-chain/db/testing" "github.com/prysmaticlabs/prysm/beacon-chain/p2p" p2ptest "github.com/prysmaticlabs/prysm/beacon-chain/p2p/testing" pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" + "github.com/prysmaticlabs/prysm/shared/interfaces" "github.com/prysmaticlabs/prysm/shared/sszutil" "github.com/prysmaticlabs/prysm/shared/testutil" "github.com/prysmaticlabs/prysm/shared/testutil/assert" @@ -26,10 +26,10 @@ func TestMetaDataRPCHandler_ReceivesMetadata(t *testing.T) { p1.Connect(p2) assert.Equal(t, 1, len(p1.BHost.Network().Peers()), "Expected peers to be connected") bitfield := [8]byte{'A', 'B'} - p1.LocalMetadata = &pb.MetaData{ + p1.LocalMetadata = interfaces.WrappedMetadataV0(&pb.MetaDataV0{ SeqNumber: 2, Attnets: bitfield[:], - } + }) // Set up a head state in the database with data we expect. d := db.SetupDB(t) @@ -50,9 +50,9 @@ func TestMetaDataRPCHandler_ReceivesMetadata(t *testing.T) { p2.BHost.SetStreamHandler(pcl, func(stream network.Stream) { defer wg.Done() expectSuccess(t, stream) - out := new(pb.MetaData) + out := new(pb.MetaDataV0) assert.NoError(t, r.cfg.P2P.Encoding().DecodeWithMaxLength(stream, out)) - assert.DeepEqual(t, p1.LocalMetadata, out, "Metadata unequal") + assert.DeepEqual(t, p1.LocalMetadata.InnerObject(), out, "MetadataV0 unequal") }) stream1, err := p1.BHost.NewStream(context.Background(), p2.BHost.ID(), pcl) require.NoError(t, err) @@ -75,10 +75,10 @@ func TestMetadataRPCHandler_SendsMetadata(t *testing.T) { p1.Connect(p2) assert.Equal(t, 1, len(p1.BHost.Network().Peers()), "Expected peers to be connected") bitfield := [8]byte{'A', 'B'} - p2.LocalMetadata = &pb.MetaData{ + p2.LocalMetadata = interfaces.WrappedMetadataV0(&pb.MetaDataV0{ SeqNumber: 2, Attnets: bitfield[:], - } + }) // Set up a head state in the database with data we expect. d := db.SetupDB(t) @@ -114,8 +114,8 @@ func TestMetadataRPCHandler_SendsMetadata(t *testing.T) { metadata, err := r.sendMetaDataRequest(context.Background(), p2.BHost.ID()) assert.NoError(t, err) - if !sszutil.DeepEqual(metadata, p2.LocalMetadata) { - t.Fatalf("Metadata unequal, received %v but wanted %v", metadata, p2.LocalMetadata) + if !sszutil.DeepEqual(metadata.InnerObject(), p2.LocalMetadata.InnerObject()) { + t.Fatalf("MetadataV0 unequal, received %v but wanted %v", metadata, p2.LocalMetadata) } if testutil.WaitTimeout(&wg, 1*time.Second) { diff --git a/beacon-chain/sync/rpc_ping.go b/beacon-chain/sync/rpc_ping.go index 67aaa505d2..aa8babb211 100644 --- a/beacon-chain/sync/rpc_ping.go +++ b/beacon-chain/sync/rpc_ping.go @@ -131,12 +131,12 @@ func (s *Service) validateSequenceNum(seq types.SSZUint64, id peer.ID) (bool, er if err != nil { return false, err } - if md == nil { + if md == nil || md.IsNil() { return false, nil } // Return error on invalid sequence number. - if md.SeqNumber > uint64(seq) { + if md.SequenceNumber() > uint64(seq) { return false, p2ptypes.ErrInvalidSequenceNum } - return md.SeqNumber == uint64(seq), nil + return md.SequenceNumber() == uint64(seq), nil } diff --git a/beacon-chain/sync/rpc_ping_test.go b/beacon-chain/sync/rpc_ping_test.go index 5f916ded9d..3c8609a02f 100644 --- a/beacon-chain/sync/rpc_ping_test.go +++ b/beacon-chain/sync/rpc_ping_test.go @@ -15,6 +15,7 @@ import ( p2ptest "github.com/prysmaticlabs/prysm/beacon-chain/p2p/testing" p2ptypes "github.com/prysmaticlabs/prysm/beacon-chain/p2p/types" pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" + "github.com/prysmaticlabs/prysm/shared/interfaces" "github.com/prysmaticlabs/prysm/shared/testutil" "github.com/prysmaticlabs/prysm/shared/testutil/assert" "github.com/prysmaticlabs/prysm/shared/testutil/require" @@ -25,15 +26,15 @@ func TestPingRPCHandler_ReceivesPing(t *testing.T) { p2 := p2ptest.NewTestP2P(t) p1.Connect(p2) assert.Equal(t, 1, len(p1.BHost.Network().Peers()), "Expected peers to be connected") - p1.LocalMetadata = &pb.MetaData{ + p1.LocalMetadata = interfaces.WrappedMetadataV0(&pb.MetaDataV0{ SeqNumber: 2, Attnets: []byte{'A', 'B'}, - } + }) - p2.LocalMetadata = &pb.MetaData{ + p2.LocalMetadata = interfaces.WrappedMetadataV0(&pb.MetaDataV0{ SeqNumber: 2, Attnets: []byte{'C', 'D'}, - } + }) // Set up a head state in the database with data we expect. d := db.SetupDB(t) @@ -82,15 +83,15 @@ func TestPingRPCHandler_SendsPing(t *testing.T) { p2 := p2ptest.NewTestP2P(t) p1.Connect(p2) assert.Equal(t, 1, len(p1.BHost.Network().Peers()), "Expected peers to be connected") - p1.LocalMetadata = &pb.MetaData{ + p1.LocalMetadata = interfaces.WrappedMetadataV0(&pb.MetaDataV0{ SeqNumber: 2, Attnets: []byte{'A', 'B'}, - } + }) - p2.LocalMetadata = &pb.MetaData{ + p2.LocalMetadata = interfaces.WrappedMetadataV0(&pb.MetaDataV0{ SeqNumber: 2, Attnets: []byte{'C', 'D'}, - } + }) // Set up a head state in the database with data we expect. d := db.SetupDB(t) @@ -147,15 +148,15 @@ func TestPingRPCHandler_BadSequenceNumber(t *testing.T) { p2 := p2ptest.NewTestP2P(t) p1.Connect(p2) assert.Equal(t, 1, len(p1.BHost.Network().Peers()), "Expected peers to be connected") - p1.LocalMetadata = &pb.MetaData{ + p1.LocalMetadata = interfaces.WrappedMetadataV0(&pb.MetaDataV0{ SeqNumber: 2, Attnets: []byte{'A', 'B'}, - } + }) - p2.LocalMetadata = &pb.MetaData{ + p2.LocalMetadata = interfaces.WrappedMetadataV0(&pb.MetaDataV0{ SeqNumber: 2, Attnets: []byte{'C', 'D'}, - } + }) // Set up a head state in the database with data we expect. d := db.SetupDB(t) @@ -167,13 +168,13 @@ func TestPingRPCHandler_BadSequenceNumber(t *testing.T) { rateLimiter: newRateLimiter(p1), } - badMetadata := &pb.MetaData{ + badMetadata := &pb.MetaDataV0{ SeqNumber: 3, Attnets: []byte{'E', 'F'}, } p1.Peers().Add(new(enr.Record), p2.BHost.ID(), p2.BHost.Addrs()[0], network.DirUnknown) - p1.Peers().SetMetadata(p2.BHost.ID(), badMetadata) + p1.Peers().SetMetadata(p2.BHost.ID(), interfaces.WrappedMetadataV0(badMetadata)) // Setup streams pcl := protocol.ID("/testing") @@ -189,7 +190,7 @@ func TestPingRPCHandler_BadSequenceNumber(t *testing.T) { stream1, err := p1.BHost.NewStream(context.Background(), p2.BHost.ID(), pcl) require.NoError(t, err) - wantedSeq := types.SSZUint64(p2.LocalMetadata.SeqNumber) + wantedSeq := types.SSZUint64(p2.LocalMetadata.SequenceNumber()) err = r.pingHandler(context.Background(), &wantedSeq, stream1) assert.ErrorContains(t, p2ptypes.ErrInvalidSequenceNum.Error(), err) diff --git a/beacon-chain/sync/rpc_status_test.go b/beacon-chain/sync/rpc_status_test.go index 93fdf39726..e704a422d7 100644 --- a/beacon-chain/sync/rpc_status_test.go +++ b/beacon-chain/sync/rpc_status_test.go @@ -250,15 +250,15 @@ func TestHandshakeHandlers_Roundtrip(t *testing.T) { p2 := p2ptest.NewTestP2P(t) db := testingDB.SetupDB(t) - p1.LocalMetadata = &pb.MetaData{ + p1.LocalMetadata = interfaces.WrappedMetadataV0(&pb.MetaDataV0{ SeqNumber: 2, Attnets: bytesutil.PadTo([]byte{'A', 'B'}, 8), - } + }) - p2.LocalMetadata = &pb.MetaData{ + p2.LocalMetadata = interfaces.WrappedMetadataV0(&pb.MetaDataV0{ SeqNumber: 2, Attnets: bytesutil.PadTo([]byte{'C', 'D'}, 8), - } + }) st, err := stateV0.InitializeFromProto(&pb.BeaconState{ Slot: 5, diff --git a/fuzz/generated.ssz.go b/fuzz/generated.ssz.go index a38446dec4..619b0ebb01 100644 --- a/fuzz/generated.ssz.go +++ b/fuzz/generated.ssz.go @@ -1,5 +1,4 @@ // Code generated by fastssz. DO NOT EDIT. -// Hash: 4c0e0bd2735c90105ba59d0074491eb2a45ef4ce93979be7fc6b9cd96e3bd1ee package fuzz import ( @@ -61,10 +60,6 @@ func (i *InputBlockWithPrestate) UnmarshalSSZ(buf []byte) error { return ssz.ErrOffset } - if o0 < 8 { - return ssz.ErrInvalidVariableOffset - } - // Offset (1) 'Block' if o1 = ssz.ReadOffset(buf[4:8]); o1 > size || o0 > o1 { return ssz.ErrOffset diff --git a/proto/beacon/p2p/v1/BUILD.bazel b/proto/beacon/p2p/v1/BUILD.bazel index 69116be121..aa071cca1a 100644 --- a/proto/beacon/p2p/v1/BUILD.bazel +++ b/proto/beacon/p2p/v1/BUILD.bazel @@ -13,11 +13,11 @@ go_proto_library( proto = ":v1_proto", visibility = ["//visibility:public"], deps = [ - "@com_github_prysmaticlabs_eth2_types//:go_default_library", - "@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:go_default_library", - "@com_github_prysmaticlabs_ethereumapis//eth/ext:go_default_library", - "@com_github_prysmaticlabs_go_bitfield//:go_default_library", "@com_github_golang_protobuf//proto:go_default_library", + "@com_github_prysmaticlabs_eth2_types//:go_default_library", + "@com_github_prysmaticlabs_ethereumapis//eth/ext:go_default_library", + "@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:go_default_library", + "@com_github_prysmaticlabs_go_bitfield//:go_default_library", "@io_bazel_rules_go//proto/wkt:descriptor_go_proto", "@io_bazel_rules_go//proto/wkt:struct_go_proto", "@org_golang_google_protobuf//reflect/protoreflect:go_default_library", @@ -37,7 +37,8 @@ ssz_gen_marshal( "BeaconBlocksByRangeRequest", "DepositMessage", "ENRForkID", - "MetaData", + "MetaDataV0", + "MetaDataV1", "Fork", "ForkData", "HistoricalBatch", @@ -76,8 +77,8 @@ proto_library( srcs = [":ssz_proto_files"], visibility = ["//visibility:public"], deps = [ - "@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:proto", "@com_github_prysmaticlabs_ethereumapis//eth/ext:proto", + "@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:proto", "@com_google_protobuf//:descriptor_proto", "@com_google_protobuf//:timestamp_proto", ], diff --git a/proto/beacon/p2p/v1/generated.ssz.go b/proto/beacon/p2p/v1/generated.ssz.go index c6f77543ac..15ee76c5bb 100644 --- a/proto/beacon/p2p/v1/generated.ssz.go +++ b/proto/beacon/p2p/v1/generated.ssz.go @@ -1,5 +1,4 @@ // Code generated by fastssz. DO NOT EDIT. -// Hash: 8a6d892aeb6b44fa52d8739c644593e8d8389d02923b7611a25b2697a2e9de94 package ethereum_beacon_p2p_v1 import ( @@ -288,13 +287,13 @@ func (e *ENRForkID) HashTreeRootWith(hh *ssz.Hasher) (err error) { return } -// MarshalSSZ ssz marshals the MetaData object -func (m *MetaData) MarshalSSZ() ([]byte, error) { +// MarshalSSZ ssz marshals the MetaDataV0 object +func (m *MetaDataV0) MarshalSSZ() ([]byte, error) { return ssz.MarshalSSZ(m) } -// MarshalSSZTo ssz marshals the MetaData object to a target array -func (m *MetaData) MarshalSSZTo(buf []byte) (dst []byte, err error) { +// MarshalSSZTo ssz marshals the MetaDataV0 object to a target array +func (m *MetaDataV0) MarshalSSZTo(buf []byte) (dst []byte, err error) { dst = buf // Field (0) 'SeqNumber' @@ -310,8 +309,8 @@ func (m *MetaData) MarshalSSZTo(buf []byte) (dst []byte, err error) { return } -// UnmarshalSSZ ssz unmarshals the MetaData object -func (m *MetaData) UnmarshalSSZ(buf []byte) error { +// UnmarshalSSZ ssz unmarshals the MetaDataV0 object +func (m *MetaDataV0) UnmarshalSSZ(buf []byte) error { var err error size := uint64(len(buf)) if size != 16 { @@ -330,19 +329,19 @@ func (m *MetaData) UnmarshalSSZ(buf []byte) error { return err } -// SizeSSZ returns the ssz encoded size in bytes for the MetaData object -func (m *MetaData) SizeSSZ() (size int) { +// SizeSSZ returns the ssz encoded size in bytes for the MetaDataV0 object +func (m *MetaDataV0) SizeSSZ() (size int) { size = 16 return } -// HashTreeRoot ssz hashes the MetaData object -func (m *MetaData) HashTreeRoot() ([32]byte, error) { +// HashTreeRoot ssz hashes the MetaDataV0 object +func (m *MetaDataV0) HashTreeRoot() ([32]byte, error) { return ssz.HashWithDefaultHasher(m) } -// HashTreeRootWith ssz hashes the MetaData object with a hasher -func (m *MetaData) HashTreeRootWith(hh *ssz.Hasher) (err error) { +// HashTreeRootWith ssz hashes the MetaDataV0 object with a hasher +func (m *MetaDataV0) HashTreeRootWith(hh *ssz.Hasher) (err error) { indx := hh.Index() // Field (0) 'SeqNumber' @@ -359,6 +358,97 @@ func (m *MetaData) HashTreeRootWith(hh *ssz.Hasher) (err error) { return } +// MarshalSSZ ssz marshals the MetaDataV1 object +func (m *MetaDataV1) MarshalSSZ() ([]byte, error) { + return ssz.MarshalSSZ(m) +} + +// MarshalSSZTo ssz marshals the MetaDataV1 object to a target array +func (m *MetaDataV1) MarshalSSZTo(buf []byte) (dst []byte, err error) { + dst = buf + + // Field (0) 'SeqNumber' + dst = ssz.MarshalUint64(dst, m.SeqNumber) + + // Field (1) 'Attnets' + if len(m.Attnets) != 8 { + err = ssz.ErrBytesLength + return + } + dst = append(dst, m.Attnets...) + + // Field (2) 'Syncnets' + if len(m.Syncnets) != 64 { + err = ssz.ErrBytesLength + return + } + dst = append(dst, m.Syncnets...) + + return +} + +// UnmarshalSSZ ssz unmarshals the MetaDataV1 object +func (m *MetaDataV1) UnmarshalSSZ(buf []byte) error { + var err error + size := uint64(len(buf)) + if size != 80 { + return ssz.ErrSize + } + + // Field (0) 'SeqNumber' + m.SeqNumber = ssz.UnmarshallUint64(buf[0:8]) + + // Field (1) 'Attnets' + if cap(m.Attnets) == 0 { + m.Attnets = make([]byte, 0, len(buf[8:16])) + } + m.Attnets = append(m.Attnets, buf[8:16]...) + + // Field (2) 'Syncnets' + if cap(m.Syncnets) == 0 { + m.Syncnets = make([]byte, 0, len(buf[16:80])) + } + m.Syncnets = append(m.Syncnets, buf[16:80]...) + + return err +} + +// SizeSSZ returns the ssz encoded size in bytes for the MetaDataV1 object +func (m *MetaDataV1) SizeSSZ() (size int) { + size = 80 + return +} + +// HashTreeRoot ssz hashes the MetaDataV1 object +func (m *MetaDataV1) HashTreeRoot() ([32]byte, error) { + return ssz.HashWithDefaultHasher(m) +} + +// HashTreeRootWith ssz hashes the MetaDataV1 object with a hasher +func (m *MetaDataV1) HashTreeRootWith(hh *ssz.Hasher) (err error) { + indx := hh.Index() + + // Field (0) 'SeqNumber' + hh.PutUint64(m.SeqNumber) + + // Field (1) 'Attnets' + if len(m.Attnets) != 8 { + err = ssz.ErrBytesLength + return + } + hh.PutBytes(m.Attnets) + + // Field (2) 'Syncnets' + if len(m.Syncnets) != 64 { + err = ssz.ErrBytesLength + return + } + hh.PutBytes(m.Syncnets) + + hh.Merkleize(indx) + return +} + // MarshalSSZ ssz marshals the BeaconState object func (b *BeaconState) MarshalSSZ() ([]byte, error) { return ssz.MarshalSSZ(b) @@ -663,10 +753,6 @@ func (b *BeaconState) UnmarshalSSZ(buf []byte) error { return ssz.ErrOffset } - if o7 < 2687377 { - return ssz.ErrInvalidVariableOffset - } - // Field (8) 'Eth1Data' if b.Eth1Data == nil { b.Eth1Data = new(v1alpha1.Eth1Data) @@ -2035,10 +2121,6 @@ func (p *PendingAttestation) UnmarshalSSZ(buf []byte) error { return ssz.ErrOffset } - if o0 < 148 { - return ssz.ErrInvalidVariableOffset - } - // Field (1) 'Data' if p.Data == nil { p.Data = new(v1alpha1.AttestationData) diff --git a/proto/beacon/p2p/v1/messages.pb.go b/proto/beacon/p2p/v1/messages.pb.go index 7f1d5255f4..13fbd41459 100755 --- a/proto/beacon/p2p/v1/messages.pb.go +++ b/proto/beacon/p2p/v1/messages.pb.go @@ -235,7 +235,7 @@ func (x *ENRForkID) GetNextForkEpoch() github_com_prysmaticlabs_eth2_types.Epoch return github_com_prysmaticlabs_eth2_types.Epoch(0) } -type MetaData struct { +type MetaDataV0 struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -244,8 +244,8 @@ type MetaData struct { Attnets github_com_prysmaticlabs_go_bitfield.Bitvector64 `protobuf:"bytes,2,opt,name=attnets,proto3" json:"attnets,omitempty" cast-type:"github.com/prysmaticlabs/go-bitfield.Bitvector64" ssz-size:"8"` } -func (x *MetaData) Reset() { - *x = MetaData{} +func (x *MetaDataV0) Reset() { + *x = MetaDataV0{} if protoimpl.UnsafeEnabled { mi := &file_proto_beacon_p2p_v1_messages_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -253,13 +253,13 @@ func (x *MetaData) Reset() { } } -func (x *MetaData) String() string { +func (x *MetaDataV0) String() string { return protoimpl.X.MessageStringOf(x) } -func (*MetaData) ProtoMessage() {} +func (*MetaDataV0) ProtoMessage() {} -func (x *MetaData) ProtoReflect() protoreflect.Message { +func (x *MetaDataV0) ProtoReflect() protoreflect.Message { mi := &file_proto_beacon_p2p_v1_messages_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -271,25 +271,88 @@ func (x *MetaData) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use MetaData.ProtoReflect.Descriptor instead. -func (*MetaData) Descriptor() ([]byte, []int) { +// Deprecated: Use MetaDataV0.ProtoReflect.Descriptor instead. +func (*MetaDataV0) Descriptor() ([]byte, []int) { return file_proto_beacon_p2p_v1_messages_proto_rawDescGZIP(), []int{3} } -func (x *MetaData) GetSeqNumber() uint64 { +func (x *MetaDataV0) GetSeqNumber() uint64 { if x != nil { return x.SeqNumber } return 0 } -func (x *MetaData) GetAttnets() github_com_prysmaticlabs_go_bitfield.Bitvector64 { +func (x *MetaDataV0) GetAttnets() github_com_prysmaticlabs_go_bitfield.Bitvector64 { if x != nil { return x.Attnets } return github_com_prysmaticlabs_go_bitfield.Bitvector64(nil) } +type MetaDataV1 struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SeqNumber uint64 `protobuf:"varint,1,opt,name=seq_number,json=seqNumber,proto3" json:"seq_number,omitempty"` + Attnets github_com_prysmaticlabs_go_bitfield.Bitvector64 `protobuf:"bytes,2,opt,name=attnets,proto3" json:"attnets,omitempty" cast-type:"github.com/prysmaticlabs/go-bitfield.Bitvector64" ssz-size:"8"` + Syncnets github_com_prysmaticlabs_go_bitfield.Bitvector512 `protobuf:"bytes,3,opt,name=syncnets,proto3" json:"syncnets,omitempty" cast-type:"github.com/prysmaticlabs/go-bitfield.Bitvector512" ssz-size:"64"` +} + +func (x *MetaDataV1) Reset() { + *x = MetaDataV1{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_beacon_p2p_v1_messages_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MetaDataV1) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MetaDataV1) ProtoMessage() {} + +func (x *MetaDataV1) ProtoReflect() protoreflect.Message { + mi := &file_proto_beacon_p2p_v1_messages_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MetaDataV1.ProtoReflect.Descriptor instead. +func (*MetaDataV1) Descriptor() ([]byte, []int) { + return file_proto_beacon_p2p_v1_messages_proto_rawDescGZIP(), []int{4} +} + +func (x *MetaDataV1) GetSeqNumber() uint64 { + if x != nil { + return x.SeqNumber + } + return 0 +} + +func (x *MetaDataV1) GetAttnets() github_com_prysmaticlabs_go_bitfield.Bitvector64 { + if x != nil { + return x.Attnets + } + return github_com_prysmaticlabs_go_bitfield.Bitvector64(nil) +} + +func (x *MetaDataV1) GetSyncnets() github_com_prysmaticlabs_go_bitfield.Bitvector512 { + if x != nil { + return x.Syncnets + } + return github_com_prysmaticlabs_go_bitfield.Bitvector512(nil) +} + var File_proto_beacon_p2p_v1_messages_proto protoreflect.FileDescriptor var file_proto_beacon_p2p_v1_messages_proto_rawDesc = []byte{ @@ -341,15 +404,29 @@ var file_proto_beacon_p2p_v1_messages_proto_rawDesc = []byte{ 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x65, 0x74, 0x68, 0x32, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x45, 0x70, 0x6f, 0x63, 0x68, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x46, 0x6f, 0x72, 0x6b, 0x45, - 0x70, 0x6f, 0x63, 0x68, 0x22, 0x7e, 0x0a, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, - 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x71, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x73, 0x65, 0x71, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, - 0x53, 0x0a, 0x07, 0x61, 0x74, 0x74, 0x6e, 0x65, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, - 0x42, 0x39, 0x8a, 0xb5, 0x18, 0x01, 0x38, 0x82, 0xb5, 0x18, 0x30, 0x67, 0x69, 0x74, 0x68, 0x75, - 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, - 0x61, 0x62, 0x73, 0x2f, 0x67, 0x6f, 0x2d, 0x62, 0x69, 0x74, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x2e, - 0x42, 0x69, 0x74, 0x76, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x36, 0x34, 0x52, 0x07, 0x61, 0x74, 0x74, - 0x6e, 0x65, 0x74, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x70, 0x6f, 0x63, 0x68, 0x22, 0x80, 0x01, 0x0a, 0x0a, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, + 0x61, 0x56, 0x30, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x71, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, + 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x73, 0x65, 0x71, 0x4e, 0x75, 0x6d, 0x62, + 0x65, 0x72, 0x12, 0x53, 0x0a, 0x07, 0x61, 0x74, 0x74, 0x6e, 0x65, 0x74, 0x73, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0c, 0x42, 0x39, 0x8a, 0xb5, 0x18, 0x01, 0x38, 0x82, 0xb5, 0x18, 0x30, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, + 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x67, 0x6f, 0x2d, 0x62, 0x69, 0x74, 0x66, 0x69, 0x65, + 0x6c, 0x64, 0x2e, 0x42, 0x69, 0x74, 0x76, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x36, 0x34, 0x52, 0x07, + 0x61, 0x74, 0x74, 0x6e, 0x65, 0x74, 0x73, 0x22, 0xd9, 0x01, 0x0a, 0x0a, 0x4d, 0x65, 0x74, 0x61, + 0x44, 0x61, 0x74, 0x61, 0x56, 0x31, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x71, 0x5f, 0x6e, 0x75, + 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x73, 0x65, 0x71, 0x4e, + 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x53, 0x0a, 0x07, 0x61, 0x74, 0x74, 0x6e, 0x65, 0x74, 0x73, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x39, 0x8a, 0xb5, 0x18, 0x01, 0x38, 0x82, 0xb5, 0x18, + 0x30, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, + 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x67, 0x6f, 0x2d, 0x62, 0x69, 0x74, + 0x66, 0x69, 0x65, 0x6c, 0x64, 0x2e, 0x42, 0x69, 0x74, 0x76, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x36, + 0x34, 0x52, 0x07, 0x61, 0x74, 0x74, 0x6e, 0x65, 0x74, 0x73, 0x12, 0x57, 0x0a, 0x08, 0x73, 0x79, + 0x6e, 0x63, 0x6e, 0x65, 0x74, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x3b, 0x8a, 0xb5, + 0x18, 0x02, 0x36, 0x34, 0x82, 0xb5, 0x18, 0x31, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x79, 0x73, 0x6d, 0x61, 0x74, 0x69, 0x63, 0x6c, 0x61, 0x62, 0x73, + 0x2f, 0x67, 0x6f, 0x2d, 0x62, 0x69, 0x74, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x2e, 0x42, 0x69, 0x74, + 0x76, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x35, 0x31, 0x32, 0x52, 0x08, 0x73, 0x79, 0x6e, 0x63, 0x6e, + 0x65, 0x74, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -364,12 +441,13 @@ func file_proto_beacon_p2p_v1_messages_proto_rawDescGZIP() []byte { return file_proto_beacon_p2p_v1_messages_proto_rawDescData } -var file_proto_beacon_p2p_v1_messages_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_proto_beacon_p2p_v1_messages_proto_msgTypes = make([]protoimpl.MessageInfo, 5) var file_proto_beacon_p2p_v1_messages_proto_goTypes = []interface{}{ (*Status)(nil), // 0: ethereum.beacon.p2p.v1.Status (*BeaconBlocksByRangeRequest)(nil), // 1: ethereum.beacon.p2p.v1.BeaconBlocksByRangeRequest (*ENRForkID)(nil), // 2: ethereum.beacon.p2p.v1.ENRForkID - (*MetaData)(nil), // 3: ethereum.beacon.p2p.v1.MetaData + (*MetaDataV0)(nil), // 3: ethereum.beacon.p2p.v1.MetaDataV0 + (*MetaDataV1)(nil), // 4: ethereum.beacon.p2p.v1.MetaDataV1 } var file_proto_beacon_p2p_v1_messages_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for method output_type @@ -422,7 +500,19 @@ func file_proto_beacon_p2p_v1_messages_proto_init() { } } file_proto_beacon_p2p_v1_messages_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MetaData); i { + switch v := v.(*MetaDataV0); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_beacon_p2p_v1_messages_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MetaDataV1); i { case 0: return &v.state case 1: @@ -440,7 +530,7 @@ func file_proto_beacon_p2p_v1_messages_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_proto_beacon_p2p_v1_messages_proto_rawDesc, NumEnums: 0, - NumMessages: 4, + NumMessages: 5, NumExtensions: 0, NumServices: 0, }, diff --git a/proto/beacon/p2p/v1/messages.proto b/proto/beacon/p2p/v1/messages.proto index 4317f26d70..9610c2f5e0 100644 --- a/proto/beacon/p2p/v1/messages.proto +++ b/proto/beacon/p2p/v1/messages.proto @@ -32,7 +32,21 @@ message ENRForkID { attnets: Bitvector[ATTESTATION_SUBNET_COUNT] ) */ -message MetaData { +message MetaDataV0 { uint64 seq_number = 1; bytes attnets = 2 [(ethereum.eth.ext.ssz_size) = "8", (ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/go-bitfield.Bitvector64"]; +} + +/* + Spec Definition: + MetaData + ( + seq_number: uint64 + attnets: Bitvector[ATTESTATION_SUBNET_COUNT] + ) +*/ +message MetaDataV1 { + uint64 seq_number = 1; + bytes attnets = 2 [(ethereum.eth.ext.ssz_size) = "8", (ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/go-bitfield.Bitvector64"]; + bytes syncnets = 3 [(ethereum.eth.ext.ssz_size) = "64", (ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/go-bitfield.Bitvector512"]; } \ No newline at end of file diff --git a/proto/beacon/rpc/v1/debug.pb.go b/proto/beacon/rpc/v1/debug.pb.go index b6dd1b0438..5bf89b750d 100755 --- a/proto/beacon/rpc/v1/debug.pb.go +++ b/proto/beacon/rpc/v1/debug.pb.go @@ -919,12 +919,13 @@ type DebugPeerResponse_PeerInfo struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Metadata *v1.MetaData `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` - Protocols []string `protobuf:"bytes,2,rep,name=protocols,proto3" json:"protocols,omitempty"` - FaultCount uint64 `protobuf:"varint,3,opt,name=fault_count,json=faultCount,proto3" json:"fault_count,omitempty"` - ProtocolVersion string `protobuf:"bytes,4,opt,name=protocol_version,json=protocolVersion,proto3" json:"protocol_version,omitempty"` - AgentVersion string `protobuf:"bytes,5,opt,name=agent_version,json=agentVersion,proto3" json:"agent_version,omitempty"` - PeerLatency uint64 `protobuf:"varint,6,opt,name=peer_latency,json=peerLatency,proto3" json:"peer_latency,omitempty"` + MetadataV0 *v1.MetaDataV0 `protobuf:"bytes,1,opt,name=metadataV0,proto3" json:"metadataV0,omitempty"` + MetadataV1 *v1.MetaDataV1 `protobuf:"bytes,2,opt,name=metadataV1,proto3" json:"metadataV1,omitempty"` + Protocols []string `protobuf:"bytes,3,rep,name=protocols,proto3" json:"protocols,omitempty"` + FaultCount uint64 `protobuf:"varint,4,opt,name=fault_count,json=faultCount,proto3" json:"fault_count,omitempty"` + ProtocolVersion string `protobuf:"bytes,5,opt,name=protocol_version,json=protocolVersion,proto3" json:"protocol_version,omitempty"` + AgentVersion string `protobuf:"bytes,6,opt,name=agent_version,json=agentVersion,proto3" json:"agent_version,omitempty"` + PeerLatency uint64 `protobuf:"varint,7,opt,name=peer_latency,json=peerLatency,proto3" json:"peer_latency,omitempty"` } func (x *DebugPeerResponse_PeerInfo) Reset() { @@ -959,9 +960,16 @@ func (*DebugPeerResponse_PeerInfo) Descriptor() ([]byte, []int) { return file_proto_beacon_rpc_v1_debug_proto_rawDescGZIP(), []int{9, 0} } -func (x *DebugPeerResponse_PeerInfo) GetMetadata() *v1.MetaData { +func (x *DebugPeerResponse_PeerInfo) GetMetadataV0() *v1.MetaDataV0 { if x != nil { - return x.Metadata + return x.MetadataV0 + } + return nil +} + +func (x *DebugPeerResponse_PeerInfo) GetMetadataV1() *v1.MetaDataV1 { + if x != nil { + return x.MetadataV1 } return nil } @@ -1113,7 +1121,7 @@ var file_proto_beacon_rpc_v1_debug_proto_rawDesc = []byte{ 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x62, 0x75, 0x67, 0x50, 0x65, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x09, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x73, 0x22, 0xfa, 0x05, 0x0a, 0x11, 0x44, 0x65, 0x62, 0x75, 0x67, 0x50, 0x65, 0x65, 0x72, + 0x65, 0x73, 0x22, 0xc4, 0x06, 0x0a, 0x11, 0x44, 0x65, 0x62, 0x75, 0x67, 0x50, 0x65, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2f, 0x0a, 0x13, 0x6c, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x12, 0x6c, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x69, 0x6e, 0x67, @@ -1145,125 +1153,129 @@ var file_proto_beacon_rpc_v1_debug_proto_rawDesc = []byte{ 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x09, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x49, 0x6e, - 0x66, 0x6f, 0x1a, 0xfa, 0x01, 0x0a, 0x08, 0x50, 0x65, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, - 0x3c, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x20, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x62, 0x65, 0x61, - 0x63, 0x6f, 0x6e, 0x2e, 0x70, 0x32, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x44, - 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x1c, 0x0a, - 0x09, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, - 0x52, 0x09, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x66, - 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, - 0x52, 0x0a, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x29, 0x0a, 0x10, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, - 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x23, 0x0a, 0x0d, 0x61, 0x67, 0x65, 0x6e, 0x74, - 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, - 0x61, 0x67, 0x65, 0x6e, 0x74, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x21, 0x0a, 0x0c, - 0x70, 0x65, 0x65, 0x72, 0x5f, 0x6c, 0x61, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x04, 0x52, 0x0b, 0x70, 0x65, 0x65, 0x72, 0x4c, 0x61, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x22, - 0xcb, 0x03, 0x0a, 0x09, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x23, 0x0a, - 0x0d, 0x6f, 0x76, 0x65, 0x72, 0x61, 0x6c, 0x6c, 0x5f, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x02, 0x52, 0x0c, 0x6f, 0x76, 0x65, 0x72, 0x61, 0x6c, 0x6c, 0x53, 0x63, 0x6f, - 0x72, 0x65, 0x12, 0x29, 0x0a, 0x10, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x65, 0x64, 0x5f, - 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0f, 0x70, 0x72, - 0x6f, 0x63, 0x65, 0x73, 0x73, 0x65, 0x64, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x12, 0x30, 0x0a, - 0x14, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x5f, - 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x02, 0x52, 0x12, 0x62, 0x6c, 0x6f, - 0x63, 0x6b, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x12, - 0x55, 0x0a, 0x0c, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x5f, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x73, 0x18, - 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, - 0x2e, 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x53, - 0x63, 0x6f, 0x72, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x54, 0x6f, 0x70, 0x69, 0x63, 0x53, 0x63, - 0x6f, 0x72, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x74, 0x6f, 0x70, 0x69, 0x63, - 0x53, 0x63, 0x6f, 0x72, 0x65, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x67, 0x6f, 0x73, 0x73, 0x69, 0x70, - 0x5f, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0b, 0x67, 0x6f, - 0x73, 0x73, 0x69, 0x70, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x12, 0x2b, 0x0a, 0x11, 0x62, 0x65, 0x68, - 0x61, 0x76, 0x69, 0x6f, 0x75, 0x72, 0x5f, 0x70, 0x65, 0x6e, 0x61, 0x6c, 0x74, 0x79, 0x18, 0x06, - 0x20, 0x01, 0x28, 0x02, 0x52, 0x10, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x75, 0x72, 0x50, - 0x65, 0x6e, 0x61, 0x6c, 0x74, 0x79, 0x12, 0x29, 0x0a, 0x10, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x72, 0x72, 0x6f, - 0x72, 0x1a, 0x6a, 0x0a, 0x10, 0x54, 0x6f, 0x70, 0x69, 0x63, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x73, - 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x40, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, - 0x6d, 0x2e, 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, - 0x54, 0x6f, 0x70, 0x69, 0x63, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, - 0x6f, 0x74, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xe6, 0x01, - 0x0a, 0x12, 0x54, 0x6f, 0x70, 0x69, 0x63, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x53, 0x6e, 0x61, 0x70, - 0x73, 0x68, 0x6f, 0x74, 0x12, 0x20, 0x0a, 0x0c, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x69, 0x6e, 0x5f, - 0x6d, 0x65, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x74, 0x69, 0x6d, 0x65, - 0x49, 0x6e, 0x4d, 0x65, 0x73, 0x68, 0x12, 0x38, 0x0a, 0x18, 0x66, 0x69, 0x72, 0x73, 0x74, 0x5f, - 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x64, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x69, - 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x02, 0x52, 0x16, 0x66, 0x69, 0x72, 0x73, 0x74, 0x4d, + 0x66, 0x6f, 0x1a, 0xc4, 0x02, 0x0a, 0x08, 0x50, 0x65, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, + 0x42, 0x0a, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x56, 0x30, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x62, + 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x2e, 0x70, 0x32, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x65, 0x74, + 0x61, 0x44, 0x61, 0x74, 0x61, 0x56, 0x30, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0x56, 0x30, 0x12, 0x42, 0x0a, 0x0a, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x56, + 0x31, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, + 0x75, 0x6d, 0x2e, 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x2e, 0x70, 0x32, 0x70, 0x2e, 0x76, 0x31, + 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x56, 0x31, 0x52, 0x0a, 0x6d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x56, 0x31, 0x12, 0x1c, 0x0a, 0x09, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x63, 0x6f, 0x6c, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x63, 0x6f, 0x6c, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x66, 0x61, 0x75, 0x6c, + 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x29, 0x0a, 0x10, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, + 0x6f, 0x6c, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x12, 0x23, 0x0a, 0x0d, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, + 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x56, + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x6c, + 0x61, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x70, 0x65, + 0x65, 0x72, 0x4c, 0x61, 0x74, 0x65, 0x6e, 0x63, 0x79, 0x22, 0xcb, 0x03, 0x0a, 0x09, 0x53, 0x63, + 0x6f, 0x72, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x23, 0x0a, 0x0d, 0x6f, 0x76, 0x65, 0x72, 0x61, + 0x6c, 0x6c, 0x5f, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0c, + 0x6f, 0x76, 0x65, 0x72, 0x61, 0x6c, 0x6c, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x12, 0x29, 0x0a, 0x10, + 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x65, 0x64, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0f, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x65, + 0x64, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x12, 0x30, 0x0a, 0x14, 0x62, 0x6c, 0x6f, 0x63, 0x6b, + 0x5f, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x5f, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x02, 0x52, 0x12, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x50, 0x72, 0x6f, 0x76, + 0x69, 0x64, 0x65, 0x72, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x12, 0x55, 0x0a, 0x0c, 0x74, 0x6f, 0x70, + 0x69, 0x63, 0x5f, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x32, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x62, 0x65, 0x61, 0x63, 0x6f, + 0x6e, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x49, 0x6e, + 0x66, 0x6f, 0x2e, 0x54, 0x6f, 0x70, 0x69, 0x63, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x73, 0x45, 0x6e, + 0x74, 0x72, 0x79, 0x52, 0x0b, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x73, + 0x12, 0x21, 0x0a, 0x0c, 0x67, 0x6f, 0x73, 0x73, 0x69, 0x70, 0x5f, 0x73, 0x63, 0x6f, 0x72, 0x65, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0b, 0x67, 0x6f, 0x73, 0x73, 0x69, 0x70, 0x53, 0x63, + 0x6f, 0x72, 0x65, 0x12, 0x2b, 0x0a, 0x11, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x75, 0x72, + 0x5f, 0x70, 0x65, 0x6e, 0x61, 0x6c, 0x74, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x02, 0x52, 0x10, + 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x75, 0x72, 0x50, 0x65, 0x6e, 0x61, 0x6c, 0x74, 0x79, + 0x12, 0x29, 0x0a, 0x10, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, + 0x72, 0x72, 0x6f, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x76, 0x61, 0x6c, 0x69, + 0x64, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x1a, 0x6a, 0x0a, 0x10, 0x54, + 0x6f, 0x70, 0x69, 0x63, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, + 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, + 0x79, 0x12, 0x40, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x2a, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x62, 0x65, 0x61, 0x63, + 0x6f, 0x6e, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x6f, 0x70, 0x69, 0x63, 0x53, + 0x63, 0x6f, 0x72, 0x65, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x52, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xe6, 0x01, 0x0a, 0x12, 0x54, 0x6f, 0x70, 0x69, + 0x63, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x12, 0x20, + 0x0a, 0x0c, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x69, 0x6e, 0x5f, 0x6d, 0x65, 0x73, 0x68, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x74, 0x69, 0x6d, 0x65, 0x49, 0x6e, 0x4d, 0x65, 0x73, 0x68, + 0x12, 0x38, 0x0a, 0x18, 0x66, 0x69, 0x72, 0x73, 0x74, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x5f, 0x64, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x69, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x02, 0x52, 0x16, 0x66, 0x69, 0x72, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x69, 0x65, 0x73, 0x12, 0x36, 0x0a, 0x17, 0x6d, 0x65, + 0x73, 0x68, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x64, 0x65, 0x6c, 0x69, 0x76, + 0x65, 0x72, 0x69, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x02, 0x52, 0x15, 0x6d, 0x65, 0x73, + 0x68, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x69, + 0x65, 0x73, 0x12, 0x3c, 0x0a, 0x1a, 0x69, 0x6e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x5f, 0x6d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x64, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x69, 0x65, 0x73, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x02, 0x52, 0x18, 0x69, 0x6e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x69, 0x65, 0x73, - 0x12, 0x36, 0x0a, 0x17, 0x6d, 0x65, 0x73, 0x68, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x5f, 0x64, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x69, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x02, 0x52, 0x15, 0x6d, 0x65, 0x73, 0x68, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x44, 0x65, - 0x6c, 0x69, 0x76, 0x65, 0x72, 0x69, 0x65, 0x73, 0x12, 0x3c, 0x0a, 0x1a, 0x69, 0x6e, 0x76, 0x61, - 0x6c, 0x69, 0x64, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x64, 0x65, 0x6c, 0x69, - 0x76, 0x65, 0x72, 0x69, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x02, 0x52, 0x18, 0x69, 0x6e, - 0x76, 0x61, 0x6c, 0x69, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x44, 0x65, 0x6c, 0x69, - 0x76, 0x65, 0x72, 0x69, 0x65, 0x73, 0x32, 0xa0, 0x07, 0x0a, 0x05, 0x44, 0x65, 0x62, 0x75, 0x67, - 0x12, 0x84, 0x01, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x42, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x53, 0x74, - 0x61, 0x74, 0x65, 0x12, 0x2a, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x62, - 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x65, 0x61, - 0x63, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x23, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x62, 0x65, 0x61, 0x63, 0x6f, - 0x6e, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x53, 0x5a, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x21, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1b, 0x12, 0x19, 0x2f, 0x65, - 0x74, 0x68, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x64, 0x65, 0x62, 0x75, - 0x67, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x78, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x42, 0x6c, - 0x6f, 0x63, 0x6b, 0x12, 0x24, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x62, - 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x6c, 0x6f, - 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x65, 0x74, 0x68, 0x65, + 0x32, 0xa0, 0x07, 0x0a, 0x05, 0x44, 0x65, 0x62, 0x75, 0x67, 0x12, 0x84, 0x01, 0x0a, 0x0e, 0x47, + 0x65, 0x74, 0x42, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x2a, 0x2e, + 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x2e, + 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x53, 0x74, 0x61, + 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x53, 0x5a, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x21, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1b, 0x12, 0x19, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x61, - 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x64, 0x65, 0x62, 0x75, 0x67, 0x2f, 0x62, 0x6c, 0x6f, 0x63, - 0x6b, 0x12, 0x7b, 0x0a, 0x0f, 0x53, 0x65, 0x74, 0x4c, 0x6f, 0x67, 0x67, 0x69, 0x6e, 0x67, 0x4c, - 0x65, 0x76, 0x65, 0x6c, 0x12, 0x2b, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, - 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x6f, - 0x67, 0x67, 0x69, 0x6e, 0x67, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x23, 0x82, 0xd3, 0xe4, 0x93, 0x02, - 0x1d, 0x22, 0x1b, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, - 0x2f, 0x64, 0x65, 0x62, 0x75, 0x67, 0x2f, 0x6c, 0x6f, 0x67, 0x67, 0x69, 0x6e, 0x67, 0x12, 0x8f, - 0x01, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x41, 0x72, 0x72, 0x61, 0x79, - 0x46, 0x6f, 0x72, 0x6b, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, - 0x74, 0x79, 0x1a, 0x34, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x62, 0x65, - 0x61, 0x63, 0x6f, 0x6e, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x41, 0x72, 0x72, 0x61, 0x79, 0x46, 0x6f, 0x72, 0x6b, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x26, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x20, - 0x12, 0x1e, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, - 0x64, 0x65, 0x62, 0x75, 0x67, 0x2f, 0x66, 0x6f, 0x72, 0x6b, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, - 0x12, 0x72, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x65, 0x65, 0x72, 0x73, 0x12, 0x16, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x2a, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, - 0x2e, 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x44, - 0x65, 0x62, 0x75, 0x67, 0x50, 0x65, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x73, 0x22, 0x21, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1b, 0x12, 0x19, 0x2f, 0x65, 0x74, 0x68, 0x2f, - 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x64, 0x65, 0x62, 0x75, 0x67, 0x2f, 0x70, - 0x65, 0x65, 0x72, 0x73, 0x12, 0x7a, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x50, 0x65, 0x65, 0x72, 0x12, - 0x22, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, - 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x62, - 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x62, - 0x75, 0x67, 0x50, 0x65, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x20, - 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1a, 0x12, 0x18, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x61, - 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x64, 0x65, 0x62, 0x75, 0x67, 0x2f, 0x70, 0x65, 0x65, 0x72, - 0x12, 0x96, 0x01, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x6f, - 0x6e, 0x53, 0x6c, 0x6f, 0x74, 0x12, 0x2c, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, - 0x2e, 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x49, - 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x6c, 0x6f, 0x74, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x2d, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x62, - 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x63, - 0x6c, 0x75, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x6c, 0x6f, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x25, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x12, 0x1d, 0x2f, 0x65, 0x74, 0x68, + 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x64, 0x65, 0x62, 0x75, 0x67, 0x2f, 0x73, 0x74, 0x61, 0x74, + 0x65, 0x12, 0x78, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x24, 0x2e, + 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x2e, + 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x62, + 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x53, 0x5a, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x21, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1b, + 0x12, 0x19, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, + 0x64, 0x65, 0x62, 0x75, 0x67, 0x2f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x7b, 0x0a, 0x0f, 0x53, + 0x65, 0x74, 0x4c, 0x6f, 0x67, 0x67, 0x69, 0x6e, 0x67, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x2b, + 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, + 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x6f, 0x67, 0x67, 0x69, 0x6e, 0x67, 0x4c, + 0x65, 0x76, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, + 0x70, 0x74, 0x79, 0x22, 0x23, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1d, 0x22, 0x1b, 0x2f, 0x65, 0x74, + 0x68, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x64, 0x65, 0x62, 0x75, 0x67, + 0x2f, 0x6c, 0x6f, 0x67, 0x67, 0x69, 0x6e, 0x67, 0x12, 0x8f, 0x01, 0x0a, 0x17, 0x47, 0x65, 0x74, + 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x41, 0x72, 0x72, 0x61, 0x79, 0x46, 0x6f, 0x72, 0x6b, 0x43, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x34, 0x2e, 0x65, + 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x2e, 0x72, + 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x41, 0x72, 0x72, 0x61, 0x79, + 0x46, 0x6f, 0x72, 0x6b, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x26, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x20, 0x12, 0x1e, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x64, 0x65, 0x62, 0x75, 0x67, 0x2f, - 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x66, 0x6f, 0x72, 0x6b, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x12, 0x72, 0x0a, 0x09, 0x4c, 0x69, + 0x73, 0x74, 0x50, 0x65, 0x65, 0x72, 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, + 0x2a, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x62, 0x65, 0x61, 0x63, 0x6f, + 0x6e, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x62, 0x75, 0x67, 0x50, 0x65, + 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x22, 0x21, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x1b, 0x12, 0x19, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x2f, 0x64, 0x65, 0x62, 0x75, 0x67, 0x2f, 0x70, 0x65, 0x65, 0x72, 0x73, 0x12, 0x7a, + 0x0a, 0x07, 0x47, 0x65, 0x74, 0x50, 0x65, 0x65, 0x72, 0x12, 0x22, 0x2e, 0x65, 0x74, 0x68, 0x65, + 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x65, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, + 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x2e, + 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x62, 0x75, 0x67, 0x50, 0x65, 0x65, 0x72, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x20, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1a, + 0x12, 0x18, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, + 0x64, 0x65, 0x62, 0x75, 0x67, 0x2f, 0x70, 0x65, 0x65, 0x72, 0x12, 0x96, 0x01, 0x0a, 0x10, 0x47, + 0x65, 0x74, 0x49, 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x6c, 0x6f, 0x74, 0x12, + 0x2c, 0x2e, 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x62, 0x65, 0x61, 0x63, 0x6f, + 0x6e, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, + 0x6f, 0x6e, 0x53, 0x6c, 0x6f, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2d, 0x2e, + 0x65, 0x74, 0x68, 0x65, 0x72, 0x65, 0x75, 0x6d, 0x2e, 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x2e, + 0x72, 0x70, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x6f, 0x6e, + 0x53, 0x6c, 0x6f, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x25, 0x82, 0xd3, + 0xe4, 0x93, 0x02, 0x1f, 0x12, 0x1d, 0x2f, 0x65, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, + 0x68, 0x61, 0x31, 0x2f, 0x64, 0x65, 0x62, 0x75, 0x67, 0x2f, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x73, + 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1300,9 +1312,10 @@ var file_proto_beacon_rpc_v1_debug_proto_goTypes = []interface{}{ (v1alpha1.PeerDirection)(0), // 16: ethereum.eth.v1alpha1.PeerDirection (v1alpha1.ConnectionState)(0), // 17: ethereum.eth.v1alpha1.ConnectionState (*v1.Status)(nil), // 18: ethereum.beacon.p2p.v1.Status - (*v1.MetaData)(nil), // 19: ethereum.beacon.p2p.v1.MetaData - (*empty.Empty)(nil), // 20: google.protobuf.Empty - (*v1alpha1.PeerRequest)(nil), // 21: ethereum.eth.v1alpha1.PeerRequest + (*v1.MetaDataV0)(nil), // 19: ethereum.beacon.p2p.v1.MetaDataV0 + (*v1.MetaDataV1)(nil), // 20: ethereum.beacon.p2p.v1.MetaDataV1 + (*empty.Empty)(nil), // 21: google.protobuf.Empty + (*v1alpha1.PeerRequest)(nil), // 22: ethereum.eth.v1alpha1.PeerRequest } var file_proto_beacon_rpc_v1_debug_proto_depIdxs = []int32{ 0, // 0: ethereum.beacon.rpc.v1.LoggingLevelRequest.level:type_name -> ethereum.beacon.rpc.v1.LoggingLevelRequest.Level @@ -1315,27 +1328,28 @@ var file_proto_beacon_rpc_v1_debug_proto_depIdxs = []int32{ 18, // 7: ethereum.beacon.rpc.v1.DebugPeerResponse.peer_status:type_name -> ethereum.beacon.p2p.v1.Status 11, // 8: ethereum.beacon.rpc.v1.DebugPeerResponse.score_info:type_name -> ethereum.beacon.rpc.v1.ScoreInfo 15, // 9: ethereum.beacon.rpc.v1.ScoreInfo.topic_scores:type_name -> ethereum.beacon.rpc.v1.ScoreInfo.TopicScoresEntry - 19, // 10: ethereum.beacon.rpc.v1.DebugPeerResponse.PeerInfo.metadata:type_name -> ethereum.beacon.p2p.v1.MetaData - 12, // 11: ethereum.beacon.rpc.v1.ScoreInfo.TopicScoresEntry.value:type_name -> ethereum.beacon.rpc.v1.TopicScoreSnapshot - 3, // 12: ethereum.beacon.rpc.v1.Debug.GetBeaconState:input_type -> ethereum.beacon.rpc.v1.BeaconStateRequest - 4, // 13: ethereum.beacon.rpc.v1.Debug.GetBlock:input_type -> ethereum.beacon.rpc.v1.BlockRequest - 6, // 14: ethereum.beacon.rpc.v1.Debug.SetLoggingLevel:input_type -> ethereum.beacon.rpc.v1.LoggingLevelRequest - 20, // 15: ethereum.beacon.rpc.v1.Debug.GetProtoArrayForkChoice:input_type -> google.protobuf.Empty - 20, // 16: ethereum.beacon.rpc.v1.Debug.ListPeers:input_type -> google.protobuf.Empty - 21, // 17: ethereum.beacon.rpc.v1.Debug.GetPeer:input_type -> ethereum.eth.v1alpha1.PeerRequest - 1, // 18: ethereum.beacon.rpc.v1.Debug.GetInclusionSlot:input_type -> ethereum.beacon.rpc.v1.InclusionSlotRequest - 5, // 19: ethereum.beacon.rpc.v1.Debug.GetBeaconState:output_type -> ethereum.beacon.rpc.v1.SSZResponse - 5, // 20: ethereum.beacon.rpc.v1.Debug.GetBlock:output_type -> ethereum.beacon.rpc.v1.SSZResponse - 20, // 21: ethereum.beacon.rpc.v1.Debug.SetLoggingLevel:output_type -> google.protobuf.Empty - 7, // 22: ethereum.beacon.rpc.v1.Debug.GetProtoArrayForkChoice:output_type -> ethereum.beacon.rpc.v1.ProtoArrayForkChoiceResponse - 9, // 23: ethereum.beacon.rpc.v1.Debug.ListPeers:output_type -> ethereum.beacon.rpc.v1.DebugPeerResponses - 10, // 24: ethereum.beacon.rpc.v1.Debug.GetPeer:output_type -> ethereum.beacon.rpc.v1.DebugPeerResponse - 2, // 25: ethereum.beacon.rpc.v1.Debug.GetInclusionSlot:output_type -> ethereum.beacon.rpc.v1.InclusionSlotResponse - 19, // [19:26] is the sub-list for method output_type - 12, // [12:19] is the sub-list for method input_type - 12, // [12:12] is the sub-list for extension type_name - 12, // [12:12] is the sub-list for extension extendee - 0, // [0:12] is the sub-list for field type_name + 19, // 10: ethereum.beacon.rpc.v1.DebugPeerResponse.PeerInfo.metadataV0:type_name -> ethereum.beacon.p2p.v1.MetaDataV0 + 20, // 11: ethereum.beacon.rpc.v1.DebugPeerResponse.PeerInfo.metadataV1:type_name -> ethereum.beacon.p2p.v1.MetaDataV1 + 12, // 12: ethereum.beacon.rpc.v1.ScoreInfo.TopicScoresEntry.value:type_name -> ethereum.beacon.rpc.v1.TopicScoreSnapshot + 3, // 13: ethereum.beacon.rpc.v1.Debug.GetBeaconState:input_type -> ethereum.beacon.rpc.v1.BeaconStateRequest + 4, // 14: ethereum.beacon.rpc.v1.Debug.GetBlock:input_type -> ethereum.beacon.rpc.v1.BlockRequest + 6, // 15: ethereum.beacon.rpc.v1.Debug.SetLoggingLevel:input_type -> ethereum.beacon.rpc.v1.LoggingLevelRequest + 21, // 16: ethereum.beacon.rpc.v1.Debug.GetProtoArrayForkChoice:input_type -> google.protobuf.Empty + 21, // 17: ethereum.beacon.rpc.v1.Debug.ListPeers:input_type -> google.protobuf.Empty + 22, // 18: ethereum.beacon.rpc.v1.Debug.GetPeer:input_type -> ethereum.eth.v1alpha1.PeerRequest + 1, // 19: ethereum.beacon.rpc.v1.Debug.GetInclusionSlot:input_type -> ethereum.beacon.rpc.v1.InclusionSlotRequest + 5, // 20: ethereum.beacon.rpc.v1.Debug.GetBeaconState:output_type -> ethereum.beacon.rpc.v1.SSZResponse + 5, // 21: ethereum.beacon.rpc.v1.Debug.GetBlock:output_type -> ethereum.beacon.rpc.v1.SSZResponse + 21, // 22: ethereum.beacon.rpc.v1.Debug.SetLoggingLevel:output_type -> google.protobuf.Empty + 7, // 23: ethereum.beacon.rpc.v1.Debug.GetProtoArrayForkChoice:output_type -> ethereum.beacon.rpc.v1.ProtoArrayForkChoiceResponse + 9, // 24: ethereum.beacon.rpc.v1.Debug.ListPeers:output_type -> ethereum.beacon.rpc.v1.DebugPeerResponses + 10, // 25: ethereum.beacon.rpc.v1.Debug.GetPeer:output_type -> ethereum.beacon.rpc.v1.DebugPeerResponse + 2, // 26: ethereum.beacon.rpc.v1.Debug.GetInclusionSlot:output_type -> ethereum.beacon.rpc.v1.InclusionSlotResponse + 20, // [20:27] is the sub-list for method output_type + 13, // [13:20] is the sub-list for method input_type + 13, // [13:13] is the sub-list for extension type_name + 13, // [13:13] is the sub-list for extension extendee + 0, // [0:13] is the sub-list for field type_name } func init() { file_proto_beacon_rpc_v1_debug_proto_init() } diff --git a/proto/beacon/rpc/v1/debug.proto b/proto/beacon/rpc/v1/debug.proto index daea969079..60b758b675 100644 --- a/proto/beacon/rpc/v1/debug.proto +++ b/proto/beacon/rpc/v1/debug.proto @@ -137,17 +137,18 @@ message DebugPeerResponse { message PeerInfo { // Metadata of the peer, containing their bitfield // and sequence number. - ethereum.beacon.p2p.v1.MetaData metadata = 1; + ethereum.beacon.p2p.v1.MetaDataV0 metadataV0 = 1; + ethereum.beacon.p2p.v1.MetaDataV1 metadataV1 = 2; // List of protocols the peer supports. - repeated string protocols = 2; + repeated string protocols = 3; // Number of times peer has been penalised. - uint64 fault_count = 3; + uint64 fault_count = 4; // Protocol Version peer is running. - string protocol_version = 4; + string protocol_version = 5; // Agent Version peer is running. - string agent_version = 5; + string agent_version = 6; // Latency of responses from peer(in ms). - uint64 peer_latency = 6; + uint64 peer_latency = 7; } // Listening addresses know of the peer. repeated string listening_addresses = 1; diff --git a/shared/grpcutils/grpcutils_test.go b/shared/grpcutils/grpcutils_test.go index 92be314e78..85f46b1e51 100644 --- a/shared/grpcutils/grpcutils_test.go +++ b/shared/grpcutils/grpcutils_test.go @@ -15,7 +15,7 @@ func TestAppendHeaders(t *testing.T) { ctx := AppendHeaders(context.Background(), []string{"first=value1"}) md, ok := metadata.FromOutgoingContext(ctx) require.Equal(t, true, ok, "Failed to read context metadata") - require.Equal(t, 1, md.Len(), "Metadata contains wrong number of values") + require.Equal(t, 1, md.Len(), "MetadataV0 contains wrong number of values") assert.Equal(t, "value1", md.Get("first")[0]) }) @@ -23,7 +23,7 @@ func TestAppendHeaders(t *testing.T) { ctx := AppendHeaders(context.Background(), []string{"first=value1", "second=value2"}) md, ok := metadata.FromOutgoingContext(ctx) require.Equal(t, true, ok, "Failed to read context metadata") - require.Equal(t, 2, md.Len(), "Metadata contains wrong number of values") + require.Equal(t, 2, md.Len(), "MetadataV0 contains wrong number of values") assert.Equal(t, "value1", md.Get("first")[0]) assert.Equal(t, "value2", md.Get("second")[0]) }) @@ -32,7 +32,7 @@ func TestAppendHeaders(t *testing.T) { ctx := AppendHeaders(context.Background(), []string{"first=value1", ""}) md, ok := metadata.FromOutgoingContext(ctx) require.Equal(t, true, ok, "Failed to read context metadata") - require.Equal(t, 1, md.Len(), "Metadata contains wrong number of values") + require.Equal(t, 1, md.Len(), "MetadataV0 contains wrong number of values") assert.Equal(t, "value1", md.Get("first")[0]) }) @@ -41,7 +41,7 @@ func TestAppendHeaders(t *testing.T) { ctx := AppendHeaders(context.Background(), []string{"first=value1", "second"}) md, ok := metadata.FromOutgoingContext(ctx) require.Equal(t, true, ok, "Failed to read context metadata") - require.Equal(t, 1, md.Len(), "Metadata contains wrong number of values") + require.Equal(t, 1, md.Len(), "MetadataV0 contains wrong number of values") assert.Equal(t, "value1", md.Get("first")[0]) assert.LogsContain(t, logHook, "Skipping second") }) @@ -50,7 +50,7 @@ func TestAppendHeaders(t *testing.T) { ctx := AppendHeaders(context.Background(), []string{"first=value=1"}) md, ok := metadata.FromOutgoingContext(ctx) require.Equal(t, true, ok, "Failed to read context metadata") - require.Equal(t, 1, md.Len(), "Metadata contains wrong number of values") + require.Equal(t, 1, md.Len(), "MetadataV0 contains wrong number of values") assert.Equal(t, "value=1", md.Get("first")[0]) }) } diff --git a/shared/interfaces/BUILD.bazel b/shared/interfaces/BUILD.bazel index 02ddd03576..274f138c1d 100644 --- a/shared/interfaces/BUILD.bazel +++ b/shared/interfaces/BUILD.bazel @@ -4,14 +4,18 @@ go_library( name = "go_default_library", srcs = [ "block_interface.go", + "metadata_interface.go", + "metadata_wrapper.go", "phase0_block_wrapper.go", ], importpath = "github.com/prysmaticlabs/prysm/shared/interfaces", visibility = ["//visibility:public"], deps = [ + "//proto/beacon/p2p/v1:go_default_library", "//shared/copyutil:go_default_library", "@com_github_prysmaticlabs_eth2_types//:go_default_library", "@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:go_default_library", + "@com_github_prysmaticlabs_go_bitfield//:go_default_library", "@org_golang_google_protobuf//proto:go_default_library", ], ) diff --git a/shared/interfaces/metadata_interface.go b/shared/interfaces/metadata_interface.go new file mode 100644 index 0000000000..216411195b --- /dev/null +++ b/shared/interfaces/metadata_interface.go @@ -0,0 +1,17 @@ +package interfaces + +import ( + "github.com/prysmaticlabs/go-bitfield" + pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" +) + +// Metadata returns the interface of a p2p metadata type. +type Metadata interface { + SequenceNumber() uint64 + AttnetsBitfield() bitfield.Bitvector64 + InnerObject() interface{} + IsNil() bool + Copy() Metadata + MetadataObjV0() *pb.MetaDataV0 + MetadataObjV1() *pb.MetaDataV1 +} diff --git a/shared/interfaces/metadata_wrapper.go b/shared/interfaces/metadata_wrapper.go new file mode 100644 index 0000000000..f15161f9ee --- /dev/null +++ b/shared/interfaces/metadata_wrapper.go @@ -0,0 +1,101 @@ +package interfaces + +import ( + "github.com/prysmaticlabs/go-bitfield" + pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" + "google.golang.org/protobuf/proto" +) + +// MetadataV0 is a convenience wrapper around our metadata protobuf object. +type MetadataV0 struct { + md *pb.MetaDataV0 +} + +// WrappedMetadataV0 wrappers around the provided protobuf object. +func WrappedMetadataV0(md *pb.MetaDataV0) MetadataV0 { + return MetadataV0{md: md} +} + +// SequenceNumber returns the sequence number from the metadata. +func (m MetadataV0) SequenceNumber() uint64 { + return m.md.SeqNumber +} + +// AttnetsBitfield retruns the bitfield stored in the metadata. +func (m MetadataV0) AttnetsBitfield() bitfield.Bitvector64 { + return m.md.Attnets +} + +// InnerObject returns the underlying metadata protobuf structure. +func (m MetadataV0) InnerObject() interface{} { + return m.md +} + +// IsNil checks for the nilness of the underlying object. +func (m MetadataV0) IsNil() bool { + return m.md == nil +} + +// Copy performs a full copy of the underlying metadata object. +func (m MetadataV0) Copy() Metadata { + return WrappedMetadataV0(proto.Clone(m.md).(*pb.MetaDataV0)) +} + +// MetadataObjV0 returns the inner metadata object in its type +// specified form. If it doesn't exist then we return nothing. +func (m MetadataV0) MetadataObjV0() *pb.MetaDataV0 { + return m.md +} + +// MetadataObjV1 returns the inner metatdata object in its type +// specified form. If it doesn't exist then we return nothing. +func (m MetadataV0) MetadataObjV1() *pb.MetaDataV1 { + return nil +} + +// MetadataV1 is a convenience wrapper around our metadata v2 protobuf object. +type MetadataV1 struct { + md *pb.MetaDataV1 +} + +// WrappedMetadataV1 wrappers around the provided protobuf object. +func WrappedMetadataV1(md *pb.MetaDataV1) MetadataV1 { + return MetadataV1{md: md} +} + +// SequenceNumber returns the sequence number from the metadata. +func (m MetadataV1) SequenceNumber() uint64 { + return m.md.SeqNumber +} + +// AttnetsBitfield retruns the bitfield stored in the metadata. +func (m MetadataV1) AttnetsBitfield() bitfield.Bitvector64 { + return m.md.Attnets +} + +// InnerObject returns the underlying metadata protobuf structure. +func (m MetadataV1) InnerObject() interface{} { + return m.md +} + +// IsNil checks for the nilness of the underlying object. +func (m MetadataV1) IsNil() bool { + return m.md == nil +} + +// Copy performs a full copy of the underlying metadata object. +func (m MetadataV1) Copy() Metadata { + return WrappedMetadataV1(proto.Clone(m.md).(*pb.MetaDataV1)) +} + +// MetadataObjV0 returns the inner metadata object in its type +// specified form. If it doesn't exist then we return nothing. +func (m MetadataV1) MetadataObjV0() *pb.MetaDataV0 { + return nil +} + +// MetadataObjV1 returns the inner metatdata object in its type +// specified form. If it doesn't exist then we return nothing. +func (m MetadataV1) MetadataObjV1() *pb.MetaDataV1 { + return m.md +} diff --git a/tools/analyzers/interfacechecker/analyzer.go b/tools/analyzers/interfacechecker/analyzer.go index 09337c9718..40cc4f7975 100644 --- a/tools/analyzers/interfacechecker/analyzer.go +++ b/tools/analyzers/interfacechecker/analyzer.go @@ -27,6 +27,7 @@ var Analyzer = &analysis.Analyzer{ // These are the selected interfaces that we want to parse through and check nilness for. var selectedInterfaces = []string{ "interfaces.SignedBeaconBlock", + "interfaces.MetadataV0", "interface.BeaconState", "interface.ReadOnlyBeaconState", "interface.WriteOnlyBeaconState", diff --git a/validator/rpc/beacon_test.go b/validator/rpc/beacon_test.go index 6d619fd637..72d51ce94d 100644 --- a/validator/rpc/beacon_test.go +++ b/validator/rpc/beacon_test.go @@ -88,7 +88,7 @@ func TestGrpcHeaders(t *testing.T) { err := s.registerBeaconClient() require.NoError(t, err) md, _ := metadata.FromOutgoingContext(s.ctx) - require.Equal(t, 2, md.Len(), "Metadata contains wrong number of values") + require.Equal(t, 2, md.Len(), "MetadataV0 contains wrong number of values") assert.Equal(t, "value1", md.Get("first")[0]) assert.Equal(t, "value2", md.Get("second")[0]) } diff --git a/validator/slashing-protection/cli_import_export_test.go b/validator/slashing-protection/cli_import_export_test.go index 849ba8bdc9..3c4aaeadfa 100644 --- a/validator/slashing-protection/cli_import_export_test.go +++ b/validator/slashing-protection/cli_import_export_test.go @@ -84,7 +84,7 @@ func TestImportExportSlashingProtectionCli_RoundTrip(t *testing.T) { // We verify the parsed JSON file matches. Given there is no guarantee of order, // we will have to carefully compare and sort values as needed. // - // First, we compare basic data such as the Metadata value in the JSON file. + // First, we compare basic data such as the MetadataV0 value in the JSON file. require.DeepEqual(t, mockJSON.Metadata, receivedJSON.Metadata) wantedHistoryByPublicKey := make(map[string]*format.ProtectionData) for _, item := range mockJSON.Data { @@ -160,7 +160,7 @@ func TestImportExportSlashingProtectionCli_EmptyData(t *testing.T) { // We verify the parsed JSON file matches. Given there is no guarantee of order, // we will have to carefully compare and sort values as needed. // - // First, we compare basic data such as the Metadata value in the JSON file. + // First, we compare basic data such as the MetadataV0 value in the JSON file. require.DeepEqual(t, mockJSON.Metadata, receivedJSON.Metadata) wantedHistoryByPublicKey := make(map[string]*format.ProtectionData) for _, item := range mockJSON.Data { diff --git a/validator/slashing-protection/local/standard-protection-format/import.go b/validator/slashing-protection/local/standard-protection-format/import.go index 6685dc5adf..60c6eba8f9 100644 --- a/validator/slashing-protection/local/standard-protection-format/import.go +++ b/validator/slashing-protection/local/standard-protection-format/import.go @@ -36,7 +36,7 @@ func ImportStandardProtectionJSON(ctx context.Context, validatorDB db.Database, return nil } - // We validate the `Metadata` field of the slashing protection JSON file. + // We validate the `MetadataV0` field of the slashing protection JSON file. if err := validateMetadata(ctx, validatorDB, interchangeJSON); err != nil { return errors.Wrap(err, "slashing protection JSON metadata was incorrect") } diff --git a/validator/slashing-protection/slasher_client_test.go b/validator/slashing-protection/slasher_client_test.go index d00f16c586..5dda0590ce 100644 --- a/validator/slashing-protection/slasher_client_test.go +++ b/validator/slashing-protection/slasher_client_test.go @@ -17,7 +17,7 @@ func TestGrpcHeaders(t *testing.T) { } s.startSlasherClient() md, _ := metadata.FromOutgoingContext(s.ctx) - require.Equal(t, 2, md.Len(), "Metadata contains wrong number of values") + require.Equal(t, 2, md.Len(), "MetadataV0 contains wrong number of values") assert.Equal(t, "value1", md.Get("first")[0]) assert.Equal(t, "value2", md.Get("second")[0]) }