From 94ecfea860bd210e277cc6871e28510edf2fb2e6 Mon Sep 17 00:00:00 2001 From: yeying Date: Sat, 16 Aug 2025 15:07:35 +0800 Subject: [PATCH 1/6] Fix: gob: type not registered for interface: network.Direction --- waku/v2/peerstore/waku_peer_store.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/waku/v2/peerstore/waku_peer_store.go b/waku/v2/peerstore/waku_peer_store.go index af42a28a..9dbb6b8a 100644 --- a/waku/v2/peerstore/waku_peer_store.go +++ b/waku/v2/peerstore/waku_peer_store.go @@ -158,7 +158,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 From f20eeec0cc8bb44436a67cd3302b316184a4cd72 Mon Sep 17 00:00:00 2001 From: yeying Date: Sat, 16 Aug 2025 16:01:08 +0800 Subject: [PATCH 2/6] Fix: gob: type not registered for interface: network.Direction --- waku/v2/peerstore/waku_peer_store.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/waku/v2/peerstore/waku_peer_store.go b/waku/v2/peerstore/waku_peer_store.go index 9dbb6b8a..106b3f65 100644 --- a/waku/v2/peerstore/waku_peer_store.go +++ b/waku/v2/peerstore/waku_peer_store.go @@ -168,7 +168,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 From 757261646682a7d9f73e433f12a2dd0f9677bfe4 Mon Sep 17 00:00:00 2001 From: yeying Date: Sat, 27 Sep 2025 14:35:26 +0800 Subject: [PATCH 3/6] add log for metadata. --- waku/v2/protocol/metadata/waku_metadata.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/waku/v2/protocol/metadata/waku_metadata.go b/waku/v2/protocol/metadata/waku_metadata.go index 34327980..6e373b04 100644 --- a/waku/v2/protocol/metadata/waku_metadata.go +++ b/waku/v2/protocol/metadata/waku_metadata.go @@ -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() } From 82877ccefb1e2c9265ed12fc5e4eb3e1b02204f3 Mon Sep 17 00:00:00 2001 From: yeying Date: Sat, 27 Sep 2025 14:50:32 +0800 Subject: [PATCH 4/6] add log for metadata. --- waku/v2/protocol/metadata/waku_metadata.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/waku/v2/protocol/metadata/waku_metadata.go b/waku/v2/protocol/metadata/waku_metadata.go index 6e373b04..7800a81f 100644 --- a/waku/v2/protocol/metadata/waku_metadata.go +++ b/waku/v2/protocol/metadata/waku_metadata.go @@ -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 } From d7bb2f95e18645553c2300982c19e99e01d9856b Mon Sep 17 00:00:00 2001 From: yeying Date: Sat, 27 Sep 2025 15:58:30 +0800 Subject: [PATCH 5/6] update metadata proto. --- .../protocol/metadata/pb/waku_metadata.pb.go | 68 +++++-------------- 1 file changed, 17 insertions(+), 51 deletions(-) diff --git a/waku/v2/protocol/metadata/pb/waku_metadata.pb.go b/waku/v2/protocol/metadata/pb/waku_metadata.pb.go index ddd30f60..64d1140c 100644 --- a/waku/v2/protocol/metadata/pb/waku_metadata.pb.go +++ b/waku/v2/protocol/metadata/pb/waku_metadata.pb.go @@ -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,packed,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,packed,name=shards,proto3" json:"shards,omitempty"` } func (x *WakuMetadataResponse) Reset() { @@ -152,39 +132,25 @@ 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, 0x60, 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, 0x02, 0x20, 0x03, + 0x28, 0x0d, 0x52, 0x06, 0x73, 0x68, 0x61, 0x72, 0x64, 0x73, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x63, + 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x22, 0x61, 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, + 0x02, 0x20, 0x03, 0x28, 0x0d, 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 ( From e1240d9f9b97cee9f71ee548ad8294a41912a734 Mon Sep 17 00:00:00 2001 From: yeying Date: Sun, 28 Sep 2025 12:50:22 +0800 Subject: [PATCH 6/6] set packad=false for metadata. --- .../protocol/metadata/pb/waku_metadata.pb.go | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/waku/v2/protocol/metadata/pb/waku_metadata.pb.go b/waku/v2/protocol/metadata/pb/waku_metadata.pb.go index 64d1140c..3874d9c8 100644 --- a/waku/v2/protocol/metadata/pb/waku_metadata.pb.go +++ b/waku/v2/protocol/metadata/pb/waku_metadata.pb.go @@ -28,7 +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,2,rep,packed,name=shards,proto3" json:"shards,omitempty"` + Shards []uint32 `protobuf:"varint,2,rep,name=shards,proto3" json:"shards,omitempty"` } func (x *WakuMetadataRequest) Reset() { @@ -83,7 +83,7 @@ type WakuMetadataResponse 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,2,rep,packed,name=shards,proto3" json:"shards,omitempty"` + Shards []uint32 `protobuf:"varint,2,rep,name=shards,proto3" json:"shards,omitempty"` } func (x *WakuMetadataResponse) Reset() { @@ -137,20 +137,21 @@ 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, 0x60, 0x0a, 0x13, 0x57, 0x61, 0x6b, 0x75, 0x4d, + 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, 0x16, 0x0a, 0x06, 0x73, 0x68, 0x61, 0x72, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, - 0x28, 0x0d, 0x52, 0x06, 0x73, 0x68, 0x61, 0x72, 0x64, 0x73, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x63, - 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x22, 0x61, 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, - 0x02, 0x20, 0x03, 0x28, 0x0d, 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, + 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 (