Merge e1240d9f9b97cee9f71ee548ad8294a41912a734 into f40bcd7e797881dfccfa57fb70ba58e7dd3cf560

This commit is contained in:
kobofare 2025-12-10 16:23:45 +05:30 committed by GitHub
commit 2cbc11ebd0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 23 additions and 56 deletions

View File

@ -159,7 +159,7 @@ func (ps *WakuPeerstoreImpl) ConnFailures(pID peer.ID) int {
// SetDirection sets connection direction for a specific peer.
func (ps *WakuPeerstoreImpl) SetDirection(p peer.ID, direction network.Direction) error {
return ps.peerStore.Put(p, peerDirection, direction)
return ps.peerStore.Put(p, peerDirection, int(direction))
}
// Direction fetches the connection direction (Inbound or outBound) for a specific peer
@ -169,7 +169,7 @@ func (ps *WakuPeerstoreImpl) Direction(p peer.ID) (network.Direction, error) {
return network.DirUnknown, err
}
return result.(network.Direction), nil
return network.Direction(result.(int)), nil
}
// AddPubSubTopic adds a new pubSubTopic for a peer

View File

@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.31.0
// protoc v4.24.4
// protoc v6.32.1
// source: waku_metadata.proto
// rfc: https://rfc.vac.dev/spec/66/
@ -28,13 +28,7 @@ type WakuMetadataRequest struct {
unknownFields protoimpl.UnknownFields
ClusterId *uint32 `protobuf:"varint,1,opt,name=cluster_id,json=clusterId,proto3,oneof" json:"cluster_id,omitempty"`
Shards []uint32 `protobuf:"varint,3,rep,packed,name=shards,proto3" json:"shards,omitempty"`
// Starting from nwaku v0.26, if field 3 contains no data, it will attempt to
// decode this field first assuming it's a packed field, and if that fails,
// attempt to decode as an unpacked field
//
// Deprecated: Marked as deprecated in waku_metadata.proto.
ShardsDeprecated []uint32 `protobuf:"varint,2,rep,name=shards_deprecated,json=shardsDeprecated,proto3" json:"shards_deprecated,omitempty"`
Shards []uint32 `protobuf:"varint,2,rep,name=shards,proto3" json:"shards,omitempty"`
}
func (x *WakuMetadataRequest) Reset() {
@ -83,27 +77,13 @@ func (x *WakuMetadataRequest) GetShards() []uint32 {
return nil
}
// Deprecated: Marked as deprecated in waku_metadata.proto.
func (x *WakuMetadataRequest) GetShardsDeprecated() []uint32 {
if x != nil {
return x.ShardsDeprecated
}
return nil
}
type WakuMetadataResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ClusterId *uint32 `protobuf:"varint,1,opt,name=cluster_id,json=clusterId,proto3,oneof" json:"cluster_id,omitempty"`
Shards []uint32 `protobuf:"varint,3,rep,packed,name=shards,proto3" json:"shards,omitempty"`
// Starting from nwaku v0.26, if field 3 contains no data, it will attempt to
// decode this field first assuming it's a packed field, and if that fails,
// attempt to decode as an unpacked field
//
// Deprecated: Marked as deprecated in waku_metadata.proto.
ShardsDeprecated []uint32 `protobuf:"varint,2,rep,name=shards_deprecated,json=shardsDeprecated,proto3" json:"shards_deprecated,omitempty"`
Shards []uint32 `protobuf:"varint,2,rep,name=shards,proto3" json:"shards,omitempty"`
}
func (x *WakuMetadataResponse) Reset() {
@ -152,39 +132,26 @@ func (x *WakuMetadataResponse) GetShards() []uint32 {
return nil
}
// Deprecated: Marked as deprecated in waku_metadata.proto.
func (x *WakuMetadataResponse) GetShardsDeprecated() []uint32 {
if x != nil {
return x.ShardsDeprecated
}
return nil
}
var File_waku_metadata_proto protoreflect.FileDescriptor
var file_waku_metadata_proto_rawDesc = []byte{
0x0a, 0x13, 0x77, 0x61, 0x6b, 0x75, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x77, 0x61, 0x6b, 0x75, 0x2e, 0x6d, 0x65, 0x74, 0x61,
0x64, 0x61, 0x74, 0x61, 0x2e, 0x76, 0x31, 0x22, 0x93, 0x01, 0x0a, 0x13, 0x57, 0x61, 0x6b, 0x75,
0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12,
0x22, 0x0a, 0x0a, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20,
0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x09, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x64,
0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x68, 0x61, 0x72, 0x64, 0x73, 0x18, 0x03, 0x20,
0x03, 0x28, 0x0d, 0x52, 0x06, 0x73, 0x68, 0x61, 0x72, 0x64, 0x73, 0x12, 0x31, 0x0a, 0x11, 0x73,
0x68, 0x61, 0x72, 0x64, 0x73, 0x5f, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64,
0x18, 0x02, 0x20, 0x03, 0x28, 0x0d, 0x42, 0x04, 0x10, 0x00, 0x18, 0x01, 0x52, 0x10, 0x73, 0x68,
0x61, 0x72, 0x64, 0x73, 0x44, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x42, 0x0d,
0x0a, 0x0b, 0x5f, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x22, 0x94, 0x01,
0x0a, 0x14, 0x57, 0x61, 0x6b, 0x75, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x22, 0x0a, 0x0a, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65,
0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x09, 0x63, 0x6c,
0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x64, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x68,
0x61, 0x72, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x73, 0x68, 0x61, 0x72,
0x64, 0x73, 0x12, 0x31, 0x0a, 0x11, 0x73, 0x68, 0x61, 0x72, 0x64, 0x73, 0x5f, 0x64, 0x65, 0x70,
0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0d, 0x42, 0x04, 0x10,
0x00, 0x18, 0x01, 0x52, 0x10, 0x73, 0x68, 0x61, 0x72, 0x64, 0x73, 0x44, 0x65, 0x70, 0x72, 0x65,
0x63, 0x61, 0x74, 0x65, 0x64, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65,
0x72, 0x5f, 0x69, 0x64, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x64, 0x61, 0x74, 0x61, 0x2e, 0x76, 0x31, 0x22, 0x64, 0x0a, 0x13, 0x57, 0x61, 0x6b, 0x75, 0x4d,
0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x22,
0x0a, 0x0a, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01,
0x28, 0x0d, 0x48, 0x00, 0x52, 0x09, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x64, 0x88,
0x01, 0x01, 0x12, 0x1a, 0x0a, 0x06, 0x73, 0x68, 0x61, 0x72, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03,
0x28, 0x0d, 0x42, 0x02, 0x10, 0x00, 0x52, 0x06, 0x73, 0x68, 0x61, 0x72, 0x64, 0x73, 0x42, 0x0d,
0x0a, 0x0b, 0x5f, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x22, 0x65, 0x0a,
0x14, 0x57, 0x61, 0x6b, 0x75, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x22, 0x0a, 0x0a, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72,
0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x09, 0x63, 0x6c, 0x75,
0x73, 0x74, 0x65, 0x72, 0x49, 0x64, 0x88, 0x01, 0x01, 0x12, 0x1a, 0x0a, 0x06, 0x73, 0x68, 0x61,
0x72, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0d, 0x42, 0x02, 0x10, 0x00, 0x52, 0x06, 0x73,
0x68, 0x61, 0x72, 0x64, 0x73, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65,
0x72, 0x5f, 0x69, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x33,
}
var (

View File

@ -125,7 +125,7 @@ func (wakuM *WakuMetadata) Request(ctx context.Context, peerID peer.ID) (*pb.Wak
writer := pbio.NewDelimitedWriter(stream)
reader := pbio.NewDelimitedReader(stream, math.MaxInt32)
logger.Debug("sending metadata request")
logger.Info("sending metadata request", zap.Uint32("clusterId", *clusterID), zap.Uint32s("shards", shards))
err = writer.WriteMsg(request)
if err != nil {
@ -148,7 +148,7 @@ func (wakuM *WakuMetadata) Request(ctx context.Context, peerID peer.ID) (*pb.Wak
}
stream.Close()
logger.Debug("received metadata response")
logger.Info("received metadata response", zap.Uint32("clusterId", *response.ClusterId), zap.Uint32s("shards", request.Shards))
return response, nil
}
@ -186,7 +186,7 @@ func (wakuM *WakuMetadata) onRequest(ctx context.Context) func(network.Stream) {
}
return
}
logger.Debug("sent metadata response to peer")
logger.Info("sent metadata response to peer", zap.Uint32("clusterId", *clusterID), zap.Uint32s("shards", shards))
stream.Close()
}