From 1a1ef542d0553bc481500ff9ad77c8136bf01da1 Mon Sep 17 00:00:00 2001 From: luk Date: Tue, 13 Feb 2024 09:00:50 +0200 Subject: [PATCH] Adding GetNodeInfo (#41) * proto,rpc_server: added NodeInfo that replaces PeerID and also yields max_frame * proto,rpc_server: added peer_score and added another source for maxframe --------- Co-authored-by: 0xluk --- .../ceremony/ceremony_execution_engine.go | 4 + node/execution/execution_engine.go | 1 + node/protobufs/node.pb.go | 216 ++++++++++-------- node/protobufs/node.pb.gw.go | 32 +-- node/protobufs/node.proto | 8 +- node/protobufs/node_grpc.pb.go | 30 +-- node/rpc/rpc_server.go | 22 +- 7 files changed, 176 insertions(+), 137 deletions(-) diff --git a/node/execution/ceremony/ceremony_execution_engine.go b/node/execution/ceremony/ceremony_execution_engine.go index 71fc5a2..edc9343 100644 --- a/node/execution/ceremony/ceremony_execution_engine.go +++ b/node/execution/ceremony/ceremony_execution_engine.go @@ -1210,3 +1210,7 @@ func (e *CeremonyExecutionEngine) ensureSecrets( func (e *CeremonyExecutionEngine) GetPeerInfo() *protobufs.PeerInfoResponse { return e.clock.GetPeerInfo() } + +func (e *CeremonyExecutionEngine) GetFrame() *protobufs.ClockFrame { + return e.clock.GetFrame() +} diff --git a/node/execution/execution_engine.go b/node/execution/execution_engine.go index 5e0a0e8..ce3c3c0 100644 --- a/node/execution/execution_engine.go +++ b/node/execution/execution_engine.go @@ -14,4 +14,5 @@ type ExecutionEngine interface { message *protobufs.Message, ) ([]*protobufs.Message, error) GetPeerInfo() *protobufs.PeerInfoResponse + GetFrame() *protobufs.ClockFrame } diff --git a/node/protobufs/node.pb.go b/node/protobufs/node.pb.go index 848a0f5..4b916ac 100644 --- a/node/protobufs/node.pb.go +++ b/node/protobufs/node.pb.go @@ -192,14 +192,14 @@ func (*GetPeerInfoRequest) Descriptor() ([]byte, []int) { return file_node_proto_rawDescGZIP(), []int{2} } -type GetPeerIDRequest struct { +type GetNodeInfoRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields } -func (x *GetPeerIDRequest) Reset() { - *x = GetPeerIDRequest{} +func (x *GetNodeInfoRequest) Reset() { + *x = GetNodeInfoRequest{} if protoimpl.UnsafeEnabled { mi := &file_node_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -207,13 +207,13 @@ func (x *GetPeerIDRequest) Reset() { } } -func (x *GetPeerIDRequest) String() string { +func (x *GetNodeInfoRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*GetPeerIDRequest) ProtoMessage() {} +func (*GetNodeInfoRequest) ProtoMessage() {} -func (x *GetPeerIDRequest) ProtoReflect() protoreflect.Message { +func (x *GetNodeInfoRequest) ProtoReflect() protoreflect.Message { mi := &file_node_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -225,8 +225,8 @@ func (x *GetPeerIDRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use GetPeerIDRequest.ProtoReflect.Descriptor instead. -func (*GetPeerIDRequest) Descriptor() ([]byte, []int) { +// Deprecated: Use GetNodeInfoRequest.ProtoReflect.Descriptor instead. +func (*GetNodeInfoRequest) Descriptor() ([]byte, []int) { return file_node_proto_rawDescGZIP(), []int{3} } @@ -575,16 +575,18 @@ func (x *NetworkInfo) GetPeerScore() float64 { return 0 } -type PeerIDResponse struct { +type NodeInfoResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - PeerId string `protobuf:"bytes,1,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"` + PeerId string `protobuf:"bytes,1,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"` + MaxFrame uint64 `protobuf:"varint,2,opt,name=max_frame,json=maxFrame,proto3" json:"max_frame,omitempty"` + PeerScore uint64 `protobuf:"varint,3,opt,name=peer_score,json=peerScore,proto3" json:"peer_score,omitempty"` } -func (x *PeerIDResponse) Reset() { - *x = PeerIDResponse{} +func (x *NodeInfoResponse) Reset() { + *x = NodeInfoResponse{} if protoimpl.UnsafeEnabled { mi := &file_node_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -592,13 +594,13 @@ func (x *PeerIDResponse) Reset() { } } -func (x *PeerIDResponse) String() string { +func (x *NodeInfoResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*PeerIDResponse) ProtoMessage() {} +func (*NodeInfoResponse) ProtoMessage() {} -func (x *PeerIDResponse) ProtoReflect() protoreflect.Message { +func (x *NodeInfoResponse) ProtoReflect() protoreflect.Message { mi := &file_node_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -610,18 +612,32 @@ func (x *PeerIDResponse) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use PeerIDResponse.ProtoReflect.Descriptor instead. -func (*PeerIDResponse) Descriptor() ([]byte, []int) { +// Deprecated: Use NodeInfoResponse.ProtoReflect.Descriptor instead. +func (*NodeInfoResponse) Descriptor() ([]byte, []int) { return file_node_proto_rawDescGZIP(), []int{10} } -func (x *PeerIDResponse) GetPeerId() string { +func (x *NodeInfoResponse) GetPeerId() string { if x != nil { return x.PeerId } return "" } +func (x *NodeInfoResponse) GetMaxFrame() uint64 { + if x != nil { + return x.MaxFrame + } + return 0 +} + +func (x *NodeInfoResponse) GetPeerScore() uint64 { + if x != nil { + return x.PeerScore + } + return 0 +} + type NetworkInfoResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -811,56 +827,60 @@ var file_node_proto_rawDesc = []byte{ 0x6d, 0x62, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x22, 0x14, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x50, 0x65, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x12, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x50, 0x65, 0x65, - 0x72, 0x49, 0x44, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x17, 0x0a, 0x15, 0x47, 0x65, - 0x74, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x22, 0x6c, 0x0a, 0x0e, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x73, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5a, 0x0a, 0x16, 0x74, 0x72, 0x75, 0x6e, 0x63, 0x61, 0x74, - 0x65, 0x64, 0x5f, 0x63, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x73, 0x18, - 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, - 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x63, 0x6c, 0x6f, 0x63, 0x6b, 0x2e, 0x70, 0x62, - 0x2e, 0x43, 0x6c, 0x6f, 0x63, 0x6b, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x52, 0x14, 0x74, 0x72, 0x75, - 0x6e, 0x63, 0x61, 0x74, 0x65, 0x64, 0x43, 0x6c, 0x6f, 0x63, 0x6b, 0x46, 0x72, 0x61, 0x6d, 0x65, - 0x73, 0x22, 0x5a, 0x0a, 0x11, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x45, 0x0a, 0x0b, 0x63, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, - 0x66, 0x72, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x71, 0x75, - 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x63, 0x6c, - 0x6f, 0x63, 0x6b, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6c, 0x6f, 0x63, 0x6b, 0x46, 0x72, 0x61, 0x6d, - 0x65, 0x52, 0x0a, 0x63, 0x6c, 0x6f, 0x63, 0x6b, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x22, 0xd5, 0x01, - 0x0a, 0x08, 0x50, 0x65, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x17, 0x0a, 0x07, 0x70, 0x65, - 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x70, 0x65, 0x65, - 0x72, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x61, 0x64, 0x64, 0x72, - 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x61, 0x64, - 0x64, 0x72, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x78, 0x5f, 0x66, 0x72, 0x61, 0x6d, 0x65, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x46, 0x72, 0x61, 0x6d, 0x65, - 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x18, - 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, - 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, - 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x73, 0x69, 0x67, - 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, - 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, - 0x69, 0x63, 0x4b, 0x65, 0x79, 0x22, 0xad, 0x01, 0x0a, 0x10, 0x50, 0x65, 0x65, 0x72, 0x49, 0x6e, - 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3e, 0x0a, 0x09, 0x70, 0x65, - 0x65, 0x72, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x14, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, + 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x17, 0x0a, 0x15, + 0x47, 0x65, 0x74, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x6c, 0x0a, 0x0e, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5a, 0x0a, 0x16, 0x74, 0x72, 0x75, 0x6e, 0x63, + 0x61, 0x74, 0x65, 0x64, 0x5f, 0x63, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x66, 0x72, 0x61, 0x6d, 0x65, + 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, + 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x63, 0x6c, 0x6f, 0x63, 0x6b, 0x2e, + 0x70, 0x62, 0x2e, 0x43, 0x6c, 0x6f, 0x63, 0x6b, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x52, 0x14, 0x74, + 0x72, 0x75, 0x6e, 0x63, 0x61, 0x74, 0x65, 0x64, 0x43, 0x6c, 0x6f, 0x63, 0x6b, 0x46, 0x72, 0x61, + 0x6d, 0x65, 0x73, 0x22, 0x5a, 0x0a, 0x11, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x49, 0x6e, 0x66, 0x6f, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x45, 0x0a, 0x0b, 0x63, 0x6c, 0x6f, 0x63, + 0x6b, 0x5f, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, + 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, + 0x63, 0x6c, 0x6f, 0x63, 0x6b, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6c, 0x6f, 0x63, 0x6b, 0x46, 0x72, + 0x61, 0x6d, 0x65, 0x52, 0x0a, 0x63, 0x6c, 0x6f, 0x63, 0x6b, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x22, + 0xd5, 0x01, 0x0a, 0x08, 0x50, 0x65, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x17, 0x0a, 0x07, + 0x70, 0x65, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x70, + 0x65, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x61, 0x64, + 0x64, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x6d, 0x75, 0x6c, 0x74, 0x69, + 0x61, 0x64, 0x64, 0x72, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x78, 0x5f, 0x66, 0x72, 0x61, + 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x46, 0x72, 0x61, + 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, + 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x73, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c, + 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x70, 0x75, + 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x22, 0xad, 0x01, 0x0a, 0x10, 0x50, 0x65, 0x65, 0x72, + 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3e, 0x0a, 0x09, + 0x70, 0x65, 0x65, 0x72, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x21, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, + 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x49, 0x6e, + 0x66, 0x6f, 0x52, 0x08, 0x70, 0x65, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x59, 0x0a, 0x17, + 0x75, 0x6e, 0x63, 0x6f, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x70, 0x65, + 0x65, 0x72, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, - 0x52, 0x08, 0x70, 0x65, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x59, 0x0a, 0x17, 0x75, 0x6e, - 0x63, 0x6f, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x70, 0x65, 0x65, 0x72, - 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x71, 0x75, - 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, - 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x15, - 0x75, 0x6e, 0x63, 0x6f, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x76, 0x65, 0x50, 0x65, 0x65, - 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x65, 0x0a, 0x0b, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, - 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x17, 0x0a, 0x07, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x70, 0x65, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1e, 0x0a, - 0x0a, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x61, 0x64, 0x64, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, - 0x09, 0x52, 0x0a, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x61, 0x64, 0x64, 0x72, 0x73, 0x12, 0x1d, 0x0a, - 0x0a, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x01, 0x52, 0x09, 0x70, 0x65, 0x65, 0x72, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x22, 0x29, 0x0a, 0x0e, - 0x50, 0x65, 0x65, 0x72, 0x49, 0x44, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x17, - 0x0a, 0x07, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x06, 0x70, 0x65, 0x65, 0x72, 0x49, 0x64, 0x22, 0x5e, 0x0a, 0x13, 0x4e, 0x65, 0x74, 0x77, 0x6f, + 0x52, 0x15, 0x75, 0x6e, 0x63, 0x6f, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x76, 0x65, 0x50, + 0x65, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x65, 0x0a, 0x0b, 0x4e, 0x65, 0x74, 0x77, 0x6f, + 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x17, 0x0a, 0x07, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x70, 0x65, 0x65, 0x72, 0x49, 0x64, 0x12, + 0x1e, 0x0a, 0x0a, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x61, 0x64, 0x64, 0x72, 0x73, 0x18, 0x02, 0x20, + 0x03, 0x28, 0x09, 0x52, 0x0a, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x61, 0x64, 0x64, 0x72, 0x73, 0x12, + 0x1d, 0x0a, 0x0a, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x01, 0x52, 0x09, 0x70, 0x65, 0x65, 0x72, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x22, 0x67, + 0x0a, 0x10, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x65, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x6d, + 0x61, 0x78, 0x5f, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, + 0x6d, 0x61, 0x78, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x65, 0x65, 0x72, + 0x5f, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x70, 0x65, + 0x65, 0x72, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x22, 0x5e, 0x0a, 0x13, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x0c, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, @@ -882,7 +902,7 @@ var file_node_proto_rawDesc = []byte{ 0x66, 0x69, 0x72, 0x6d, 0x65, 0x64, 0x5f, 0x6f, 0x77, 0x6e, 0x65, 0x64, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x16, 0x75, 0x6e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x65, 0x64, 0x4f, 0x77, 0x6e, 0x65, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, - 0x73, 0x32, 0xfa, 0x04, 0x0a, 0x0b, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x73, 0x32, 0x80, 0x05, 0x0a, 0x0b, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x5f, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x73, 0x12, 0x29, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x46, 0x72, 0x61, 0x6d, @@ -902,31 +922,31 @@ var file_node_proto_rawDesc = []byte{ 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x5f, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x50, 0x65, 0x65, 0x72, 0x49, 0x44, - 0x12, 0x29, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, - 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x65, - 0x65, 0x72, 0x49, 0x44, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x71, 0x75, - 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, - 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x49, 0x44, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6e, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x74, 0x77, 0x6f, - 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2e, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, - 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, - 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, - 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, - 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x68, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, - 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2c, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, - 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x47, - 0x65, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, - 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x54, 0x6f, 0x6b, - 0x65, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x3a, - 0x5a, 0x38, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, - 0x69, 0x75, 0x6d, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, - 0x75, 0x6d, 0x2f, 0x6d, 0x6f, 0x6e, 0x6f, 0x72, 0x65, 0x70, 0x6f, 0x2f, 0x6e, 0x6f, 0x64, 0x65, - 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, + 0x6e, 0x73, 0x65, 0x12, 0x65, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, + 0x66, 0x6f, 0x12, 0x2b, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, + 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, + 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x29, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, + 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, + 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6e, 0x0a, 0x0e, 0x47, 0x65, + 0x74, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2e, 0x2e, 0x71, + 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, + 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, + 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x71, + 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, + 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, + 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x68, 0x0a, 0x0c, 0x47, 0x65, + 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2c, 0x2e, 0x71, 0x75, 0x69, + 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, + 0x65, 0x2e, 0x70, 0x62, 0x2e, 0x47, 0x65, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x49, 0x6e, 0x66, + 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x71, 0x75, 0x69, 0x6c, 0x69, + 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, + 0x70, 0x62, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x3a, 0x5a, 0x38, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x71, + 0x75, 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x71, 0x75, + 0x69, 0x6c, 0x69, 0x62, 0x72, 0x69, 0x75, 0x6d, 0x2f, 0x6d, 0x6f, 0x6e, 0x6f, 0x72, 0x65, 0x70, + 0x6f, 0x2f, 0x6e, 0x6f, 0x64, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x73, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -946,14 +966,14 @@ var file_node_proto_goTypes = []interface{}{ (*GetFramesRequest)(nil), // 0: quilibrium.node.node.pb.GetFramesRequest (*GetFrameInfoRequest)(nil), // 1: quilibrium.node.node.pb.GetFrameInfoRequest (*GetPeerInfoRequest)(nil), // 2: quilibrium.node.node.pb.GetPeerInfoRequest - (*GetPeerIDRequest)(nil), // 3: quilibrium.node.node.pb.GetPeerIDRequest + (*GetNodeInfoRequest)(nil), // 3: quilibrium.node.node.pb.GetNodeInfoRequest (*GetNetworkInfoRequest)(nil), // 4: quilibrium.node.node.pb.GetNetworkInfoRequest (*FramesResponse)(nil), // 5: quilibrium.node.node.pb.FramesResponse (*FrameInfoResponse)(nil), // 6: quilibrium.node.node.pb.FrameInfoResponse (*PeerInfo)(nil), // 7: quilibrium.node.node.pb.PeerInfo (*PeerInfoResponse)(nil), // 8: quilibrium.node.node.pb.PeerInfoResponse (*NetworkInfo)(nil), // 9: quilibrium.node.node.pb.NetworkInfo - (*PeerIDResponse)(nil), // 10: quilibrium.node.node.pb.PeerIDResponse + (*NodeInfoResponse)(nil), // 10: quilibrium.node.node.pb.NodeInfoResponse (*NetworkInfoResponse)(nil), // 11: quilibrium.node.node.pb.NetworkInfoResponse (*GetTokenInfoRequest)(nil), // 12: quilibrium.node.node.pb.GetTokenInfoRequest (*TokenInfoResponse)(nil), // 13: quilibrium.node.node.pb.TokenInfoResponse @@ -968,13 +988,13 @@ var file_node_proto_depIdxs = []int32{ 0, // 5: quilibrium.node.node.pb.NodeService.GetFrames:input_type -> quilibrium.node.node.pb.GetFramesRequest 1, // 6: quilibrium.node.node.pb.NodeService.GetFrameInfo:input_type -> quilibrium.node.node.pb.GetFrameInfoRequest 2, // 7: quilibrium.node.node.pb.NodeService.GetPeerInfo:input_type -> quilibrium.node.node.pb.GetPeerInfoRequest - 3, // 8: quilibrium.node.node.pb.NodeService.GetPeerID:input_type -> quilibrium.node.node.pb.GetPeerIDRequest + 3, // 8: quilibrium.node.node.pb.NodeService.GetNodeInfo:input_type -> quilibrium.node.node.pb.GetNodeInfoRequest 4, // 9: quilibrium.node.node.pb.NodeService.GetNetworkInfo:input_type -> quilibrium.node.node.pb.GetNetworkInfoRequest 12, // 10: quilibrium.node.node.pb.NodeService.GetTokenInfo:input_type -> quilibrium.node.node.pb.GetTokenInfoRequest 5, // 11: quilibrium.node.node.pb.NodeService.GetFrames:output_type -> quilibrium.node.node.pb.FramesResponse 6, // 12: quilibrium.node.node.pb.NodeService.GetFrameInfo:output_type -> quilibrium.node.node.pb.FrameInfoResponse 8, // 13: quilibrium.node.node.pb.NodeService.GetPeerInfo:output_type -> quilibrium.node.node.pb.PeerInfoResponse - 10, // 14: quilibrium.node.node.pb.NodeService.GetPeerID:output_type -> quilibrium.node.node.pb.PeerIDResponse + 10, // 14: quilibrium.node.node.pb.NodeService.GetNodeInfo:output_type -> quilibrium.node.node.pb.NodeInfoResponse 11, // 15: quilibrium.node.node.pb.NodeService.GetNetworkInfo:output_type -> quilibrium.node.node.pb.NetworkInfoResponse 13, // 16: quilibrium.node.node.pb.NodeService.GetTokenInfo:output_type -> quilibrium.node.node.pb.TokenInfoResponse 11, // [11:17] is the sub-list for method output_type @@ -1028,7 +1048,7 @@ func file_node_proto_init() { } } file_node_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetPeerIDRequest); i { + switch v := v.(*GetNodeInfoRequest); i { case 0: return &v.state case 1: @@ -1112,7 +1132,7 @@ func file_node_proto_init() { } } file_node_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PeerIDResponse); i { + switch v := v.(*NodeInfoResponse); i { case 0: return &v.state case 1: diff --git a/node/protobufs/node.pb.gw.go b/node/protobufs/node.pb.gw.go index f21b7f4..471f9c6 100644 --- a/node/protobufs/node.pb.gw.go +++ b/node/protobufs/node.pb.gw.go @@ -133,8 +133,8 @@ func local_request_NodeService_GetPeerInfo_0(ctx context.Context, marshaler runt } -func request_NodeService_GetPeerID_0(ctx context.Context, marshaler runtime.Marshaler, client NodeServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq GetPeerIDRequest +func request_NodeService_GetNodeInfo_0(ctx context.Context, marshaler runtime.Marshaler, client NodeServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetNodeInfoRequest var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) @@ -145,13 +145,13 @@ func request_NodeService_GetPeerID_0(ctx context.Context, marshaler runtime.Mars return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.GetPeerID(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.GetNodeInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_NodeService_GetPeerID_0(ctx context.Context, marshaler runtime.Marshaler, server NodeServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq GetPeerIDRequest +func local_request_NodeService_GetNodeInfo_0(ctx context.Context, marshaler runtime.Marshaler, server NodeServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetNodeInfoRequest var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) @@ -162,7 +162,7 @@ func local_request_NodeService_GetPeerID_0(ctx context.Context, marshaler runtim return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.GetPeerID(ctx, &protoReq) + msg, err := server.GetNodeInfo(ctx, &protoReq) return msg, metadata, err } @@ -316,7 +316,7 @@ func RegisterNodeServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux }) - mux.Handle("POST", pattern_NodeService_GetPeerID_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_NodeService_GetNodeInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -324,12 +324,12 @@ func RegisterNodeServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/quilibrium.node.node.pb.NodeService/GetPeerID", runtime.WithHTTPPathPattern("/quilibrium.node.node.pb.NodeService/GetPeerID")) + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/quilibrium.node.node.pb.NodeService/GetNodeInfo", runtime.WithHTTPPathPattern("/quilibrium.node.node.pb.NodeService/GetNodeInfo")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_NodeService_GetPeerID_0(annotatedContext, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_NodeService_GetNodeInfo_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { @@ -337,7 +337,7 @@ func RegisterNodeServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux return } - forward_NodeService_GetPeerID_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_NodeService_GetNodeInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -498,25 +498,25 @@ func RegisterNodeServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux }) - mux.Handle("POST", pattern_NodeService_GetPeerID_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_NodeService_GetNodeInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/quilibrium.node.node.pb.NodeService/GetPeerID", runtime.WithHTTPPathPattern("/quilibrium.node.node.pb.NodeService/GetPeerID")) + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/quilibrium.node.node.pb.NodeService/GetNodeInfo", runtime.WithHTTPPathPattern("/quilibrium.node.node.pb.NodeService/GetNodeInfo")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_NodeService_GetPeerID_0(annotatedContext, inboundMarshaler, client, req, pathParams) + resp, md, err := request_NodeService_GetNodeInfo_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_NodeService_GetPeerID_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_NodeService_GetNodeInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -574,7 +574,7 @@ var ( pattern_NodeService_GetPeerInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"quilibrium.node.node.pb.NodeService", "GetPeerInfo"}, "")) - pattern_NodeService_GetPeerID_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"quilibrium.node.node.pb.NodeService", "GetPeerID"}, "")) + pattern_NodeService_GetNodeInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"quilibrium.node.node.pb.NodeService", "GetNodeInfo"}, "")) pattern_NodeService_GetNetworkInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"quilibrium.node.node.pb.NodeService", "GetNetworkInfo"}, "")) @@ -588,7 +588,7 @@ var ( forward_NodeService_GetPeerInfo_0 = runtime.ForwardResponseMessage - forward_NodeService_GetPeerID_0 = runtime.ForwardResponseMessage + forward_NodeService_GetNodeInfo_0 = runtime.ForwardResponseMessage forward_NodeService_GetNetworkInfo_0 = runtime.ForwardResponseMessage diff --git a/node/protobufs/node.proto b/node/protobufs/node.proto index 031b11d..8f3dad9 100644 --- a/node/protobufs/node.proto +++ b/node/protobufs/node.proto @@ -21,7 +21,7 @@ message GetFrameInfoRequest { message GetPeerInfoRequest {} -message GetPeerIDRequest {} +message GetNodeInfoRequest {} message GetNetworkInfoRequest {} @@ -54,8 +54,10 @@ message NetworkInfo { double peer_score = 3; } -message PeerIDResponse { +message NodeInfoResponse { string peer_id = 1; + uint64 max_frame = 2; + uint64 peer_score = 3; } message NetworkInfoResponse { @@ -83,7 +85,7 @@ service NodeService { rpc GetFrames(GetFramesRequest) returns (FramesResponse); rpc GetFrameInfo(GetFrameInfoRequest) returns (FrameInfoResponse); rpc GetPeerInfo(GetPeerInfoRequest) returns (PeerInfoResponse); - rpc GetPeerID(GetPeerIDRequest) returns (PeerIDResponse); + rpc GetNodeInfo(GetNodeInfoRequest) returns (NodeInfoResponse); rpc GetNetworkInfo(GetNetworkInfoRequest) returns (NetworkInfoResponse); rpc GetTokenInfo(GetTokenInfoRequest) returns (TokenInfoResponse); } \ No newline at end of file diff --git a/node/protobufs/node_grpc.pb.go b/node/protobufs/node_grpc.pb.go index d612a47..19d6daf 100644 --- a/node/protobufs/node_grpc.pb.go +++ b/node/protobufs/node_grpc.pb.go @@ -22,7 +22,7 @@ const ( NodeService_GetFrames_FullMethodName = "/quilibrium.node.node.pb.NodeService/GetFrames" NodeService_GetFrameInfo_FullMethodName = "/quilibrium.node.node.pb.NodeService/GetFrameInfo" NodeService_GetPeerInfo_FullMethodName = "/quilibrium.node.node.pb.NodeService/GetPeerInfo" - NodeService_GetPeerID_FullMethodName = "/quilibrium.node.node.pb.NodeService/GetPeerID" + NodeService_GetNodeInfo_FullMethodName = "/quilibrium.node.node.pb.NodeService/GetNodeInfo" NodeService_GetNetworkInfo_FullMethodName = "/quilibrium.node.node.pb.NodeService/GetNetworkInfo" NodeService_GetTokenInfo_FullMethodName = "/quilibrium.node.node.pb.NodeService/GetTokenInfo" ) @@ -34,7 +34,7 @@ type NodeServiceClient interface { GetFrames(ctx context.Context, in *GetFramesRequest, opts ...grpc.CallOption) (*FramesResponse, error) GetFrameInfo(ctx context.Context, in *GetFrameInfoRequest, opts ...grpc.CallOption) (*FrameInfoResponse, error) GetPeerInfo(ctx context.Context, in *GetPeerInfoRequest, opts ...grpc.CallOption) (*PeerInfoResponse, error) - GetPeerID(ctx context.Context, in *GetPeerIDRequest, opts ...grpc.CallOption) (*PeerIDResponse, error) + GetNodeInfo(ctx context.Context, in *GetNodeInfoRequest, opts ...grpc.CallOption) (*NodeInfoResponse, error) GetNetworkInfo(ctx context.Context, in *GetNetworkInfoRequest, opts ...grpc.CallOption) (*NetworkInfoResponse, error) GetTokenInfo(ctx context.Context, in *GetTokenInfoRequest, opts ...grpc.CallOption) (*TokenInfoResponse, error) } @@ -74,9 +74,9 @@ func (c *nodeServiceClient) GetPeerInfo(ctx context.Context, in *GetPeerInfoRequ return out, nil } -func (c *nodeServiceClient) GetPeerID(ctx context.Context, in *GetPeerIDRequest, opts ...grpc.CallOption) (*PeerIDResponse, error) { - out := new(PeerIDResponse) - err := c.cc.Invoke(ctx, NodeService_GetPeerID_FullMethodName, in, out, opts...) +func (c *nodeServiceClient) GetNodeInfo(ctx context.Context, in *GetNodeInfoRequest, opts ...grpc.CallOption) (*NodeInfoResponse, error) { + out := new(NodeInfoResponse) + err := c.cc.Invoke(ctx, NodeService_GetNodeInfo_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -108,7 +108,7 @@ type NodeServiceServer interface { GetFrames(context.Context, *GetFramesRequest) (*FramesResponse, error) GetFrameInfo(context.Context, *GetFrameInfoRequest) (*FrameInfoResponse, error) GetPeerInfo(context.Context, *GetPeerInfoRequest) (*PeerInfoResponse, error) - GetPeerID(context.Context, *GetPeerIDRequest) (*PeerIDResponse, error) + GetNodeInfo(context.Context, *GetNodeInfoRequest) (*NodeInfoResponse, error) GetNetworkInfo(context.Context, *GetNetworkInfoRequest) (*NetworkInfoResponse, error) GetTokenInfo(context.Context, *GetTokenInfoRequest) (*TokenInfoResponse, error) mustEmbedUnimplementedNodeServiceServer() @@ -127,8 +127,8 @@ func (UnimplementedNodeServiceServer) GetFrameInfo(context.Context, *GetFrameInf func (UnimplementedNodeServiceServer) GetPeerInfo(context.Context, *GetPeerInfoRequest) (*PeerInfoResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetPeerInfo not implemented") } -func (UnimplementedNodeServiceServer) GetPeerID(context.Context, *GetPeerIDRequest) (*PeerIDResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetPeerID not implemented") +func (UnimplementedNodeServiceServer) GetNodeInfo(context.Context, *GetNodeInfoRequest) (*NodeInfoResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetNodeInfo not implemented") } func (UnimplementedNodeServiceServer) GetNetworkInfo(context.Context, *GetNetworkInfoRequest) (*NetworkInfoResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetNetworkInfo not implemented") @@ -203,20 +203,20 @@ func _NodeService_GetPeerInfo_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } -func _NodeService_GetPeerID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetPeerIDRequest) +func _NodeService_GetNodeInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetNodeInfoRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(NodeServiceServer).GetPeerID(ctx, in) + return srv.(NodeServiceServer).GetNodeInfo(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: NodeService_GetPeerID_FullMethodName, + FullMethod: NodeService_GetNodeInfo_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(NodeServiceServer).GetPeerID(ctx, req.(*GetPeerIDRequest)) + return srv.(NodeServiceServer).GetNodeInfo(ctx, req.(*GetNodeInfoRequest)) } return interceptor(ctx, in, info, handler) } @@ -277,8 +277,8 @@ var NodeService_ServiceDesc = grpc.ServiceDesc{ Handler: _NodeService_GetPeerInfo_Handler, }, { - MethodName: "GetPeerID", - Handler: _NodeService_GetPeerID_Handler, + MethodName: "GetNodeInfo", + Handler: _NodeService_GetNodeInfo_Handler, }, { MethodName: "GetNetworkInfo", diff --git a/node/rpc/rpc_server.go b/node/rpc/rpc_server.go index 5e31dba..ec53c1e 100644 --- a/node/rpc/rpc_server.go +++ b/node/rpc/rpc_server.go @@ -199,16 +199,28 @@ func (r *RPCServer) GetNetworkInfo( return r.pubSub.GetNetworkInfo(), nil } -// GetPeerID implements protobufs.NodeServiceServer. -func (r *RPCServer) GetPeerID( +// GetNodeInfo implements protobufs.NodeServiceServer. +func (r *RPCServer) GetNodeInfo( ctx context.Context, - req *protobufs.GetPeerIDRequest, -) (*protobufs.PeerIDResponse, error) { + req *protobufs.GetNodeInfoRequest, +) (*protobufs.NodeInfoResponse, error) { peerID, err := peer.IDFromBytes(r.pubSub.GetPeerID()) if err != nil { return nil, errors.Wrap(err, "getting id from bytes") } - return &protobufs.PeerIDResponse{PeerId: peerID.String()}, nil + + maxFrame := &protobufs.ClockFrame{} + for _, e := range r.executionEngines { + if frame := e.GetFrame(); frame != nil { + if frameNr := frame.GetFrameNumber(); frameNr > maxFrame.GetFrameNumber() { + maxFrame = frame + } + } + } + + peerScore := r.pubSub.GetPeerScore(r.pubSub.GetPeerID()) + + return &protobufs.NodeInfoResponse{PeerId: peerID.String(), MaxFrame: maxFrame.FrameNumber, PeerScore: uint64(peerScore)}, nil } // GetPeerInfo implements protobufs.NodeServiceServer.