diff --git a/api/grpc/node/node.pb.go b/api/grpc/node/node.pb.go index ebfd8c58e..4ce01f3a0 100644 --- a/api/grpc/node/node.pb.go +++ b/api/grpc/node/node.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.1 -// protoc v4.23.4 +// protoc v5.26.1 // source: node/node.proto package node @@ -853,6 +853,125 @@ func (x *BatchHeader) GetReferenceBlockNumber() uint32 { return 0 } +// Node info request +type NodeInfoRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *NodeInfoRequest) Reset() { + *x = NodeInfoRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_node_node_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NodeInfoRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NodeInfoRequest) ProtoMessage() {} + +func (x *NodeInfoRequest) ProtoReflect() protoreflect.Message { + mi := &file_node_node_proto_msgTypes[13] + 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 NodeInfoRequest.ProtoReflect.Descriptor instead. +func (*NodeInfoRequest) Descriptor() ([]byte, []int) { + return file_node_node_proto_rawDescGZIP(), []int{13} +} + +// Node info reply +type NodeInfoReply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Semver string `protobuf:"bytes,1,opt,name=semver,proto3" json:"semver,omitempty"` + Arch string `protobuf:"bytes,2,opt,name=arch,proto3" json:"arch,omitempty"` + Os string `protobuf:"bytes,3,opt,name=os,proto3" json:"os,omitempty"` + NumCpu uint32 `protobuf:"varint,4,opt,name=num_cpu,json=numCpu,proto3" json:"num_cpu,omitempty"` + MemBytes uint64 `protobuf:"varint,5,opt,name=mem_bytes,json=memBytes,proto3" json:"mem_bytes,omitempty"` +} + +func (x *NodeInfoReply) Reset() { + *x = NodeInfoReply{} + if protoimpl.UnsafeEnabled { + mi := &file_node_node_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NodeInfoReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NodeInfoReply) ProtoMessage() {} + +func (x *NodeInfoReply) ProtoReflect() protoreflect.Message { + mi := &file_node_node_proto_msgTypes[14] + 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 NodeInfoReply.ProtoReflect.Descriptor instead. +func (*NodeInfoReply) Descriptor() ([]byte, []int) { + return file_node_node_proto_rawDescGZIP(), []int{14} +} + +func (x *NodeInfoReply) GetSemver() string { + if x != nil { + return x.Semver + } + return "" +} + +func (x *NodeInfoReply) GetArch() string { + if x != nil { + return x.Arch + } + return "" +} + +func (x *NodeInfoReply) GetOs() string { + if x != nil { + return x.Os + } + return "" +} + +func (x *NodeInfoReply) GetNumCpu() uint32 { + if x != nil { + return x.NumCpu + } + return 0 +} + +func (x *NodeInfoReply) GetMemBytes() uint64 { + if x != nil { + return x.MemBytes + } + return 0 +} + var File_node_node_proto protoreflect.FileDescriptor var file_node_node_proto_rawDesc = []byte{ @@ -951,25 +1070,42 @@ var file_node_node_proto_rawDesc = []byte{ 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x14, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, - 0x72, 0x32, 0x4e, 0x0a, 0x09, 0x44, 0x69, 0x73, 0x70, 0x65, 0x72, 0x73, 0x61, 0x6c, 0x12, 0x41, - 0x0a, 0x0b, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x73, 0x12, 0x18, 0x2e, - 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x73, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x53, - 0x74, 0x6f, 0x72, 0x65, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, - 0x00, 0x32, 0xa0, 0x01, 0x0a, 0x09, 0x52, 0x65, 0x74, 0x72, 0x69, 0x65, 0x76, 0x61, 0x6c, 0x12, - 0x4a, 0x0a, 0x0e, 0x52, 0x65, 0x74, 0x72, 0x69, 0x65, 0x76, 0x65, 0x43, 0x68, 0x75, 0x6e, 0x6b, - 0x73, 0x12, 0x1b, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x52, 0x65, 0x74, 0x72, 0x69, 0x65, 0x76, - 0x65, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, - 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x52, 0x65, 0x74, 0x72, 0x69, 0x65, 0x76, 0x65, 0x43, 0x68, - 0x75, 0x6e, 0x6b, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x47, 0x0a, 0x0d, 0x47, - 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x62, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x1a, 0x2e, 0x6e, - 0x6f, 0x64, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x62, 0x48, 0x65, 0x61, 0x64, 0x65, - 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, - 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x62, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x65, 0x70, - 0x6c, 0x79, 0x22, 0x00, 0x42, 0x2c, 0x5a, 0x2a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, - 0x6f, 0x6d, 0x2f, 0x4c, 0x61, 0x79, 0x72, 0x2d, 0x4c, 0x61, 0x62, 0x73, 0x2f, 0x65, 0x69, 0x67, - 0x65, 0x6e, 0x64, 0x61, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x6e, 0x6f, - 0x64, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x72, 0x22, 0x11, 0x0a, 0x0f, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x22, 0x81, 0x01, 0x0a, 0x0d, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, + 0x6f, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x65, 0x6d, 0x76, 0x65, 0x72, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x65, 0x6d, 0x76, 0x65, 0x72, 0x12, 0x12, + 0x0a, 0x04, 0x61, 0x72, 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x61, 0x72, + 0x63, 0x68, 0x12, 0x0e, 0x0a, 0x02, 0x6f, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, + 0x6f, 0x73, 0x12, 0x17, 0x0a, 0x07, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x70, 0x75, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x0d, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x43, 0x70, 0x75, 0x12, 0x1b, 0x0a, 0x09, 0x6d, + 0x65, 0x6d, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, + 0x6d, 0x65, 0x6d, 0x42, 0x79, 0x74, 0x65, 0x73, 0x32, 0x88, 0x01, 0x0a, 0x09, 0x44, 0x69, 0x73, + 0x70, 0x65, 0x72, 0x73, 0x61, 0x6c, 0x12, 0x41, 0x0a, 0x0b, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x43, + 0x68, 0x75, 0x6e, 0x6b, 0x73, 0x12, 0x18, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x53, 0x74, 0x6f, + 0x72, 0x65, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x16, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x43, 0x68, 0x75, 0x6e, + 0x6b, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x38, 0x0a, 0x08, 0x4e, 0x6f, 0x64, + 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x15, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x4e, 0x6f, 0x64, + 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x6e, + 0x6f, 0x64, 0x65, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x70, 0x6c, + 0x79, 0x22, 0x00, 0x32, 0xda, 0x01, 0x0a, 0x09, 0x52, 0x65, 0x74, 0x72, 0x69, 0x65, 0x76, 0x61, + 0x6c, 0x12, 0x4a, 0x0a, 0x0e, 0x52, 0x65, 0x74, 0x72, 0x69, 0x65, 0x76, 0x65, 0x43, 0x68, 0x75, + 0x6e, 0x6b, 0x73, 0x12, 0x1b, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x52, 0x65, 0x74, 0x72, 0x69, + 0x65, 0x76, 0x65, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x19, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x52, 0x65, 0x74, 0x72, 0x69, 0x65, 0x76, 0x65, + 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x47, 0x0a, + 0x0d, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x62, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x1a, + 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x62, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x6e, 0x6f, 0x64, + 0x65, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x62, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, + 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x38, 0x0a, 0x08, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, + 0x66, 0x6f, 0x12, 0x15, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, + 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x6e, 0x6f, 0x64, 0x65, + 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, + 0x42, 0x2c, 0x5a, 0x2a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x4c, + 0x61, 0x79, 0x72, 0x2d, 0x4c, 0x61, 0x62, 0x73, 0x2f, 0x65, 0x69, 0x67, 0x65, 0x6e, 0x64, 0x61, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x6e, 0x6f, 0x64, 0x65, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -984,7 +1120,7 @@ func file_node_node_proto_rawDescGZIP() []byte { return file_node_node_proto_rawDescData } -var file_node_node_proto_msgTypes = make([]protoimpl.MessageInfo, 13) +var file_node_node_proto_msgTypes = make([]protoimpl.MessageInfo, 15) var file_node_node_proto_goTypes = []interface{}{ (*StoreChunksRequest)(nil), // 0: node.StoreChunksRequest (*StoreChunksReply)(nil), // 1: node.StoreChunksReply @@ -999,7 +1135,9 @@ var file_node_node_proto_goTypes = []interface{}{ (*BlobHeader)(nil), // 10: node.BlobHeader (*BlobQuorumInfo)(nil), // 11: node.BlobQuorumInfo (*BatchHeader)(nil), // 12: node.BatchHeader - (*common.G1Commitment)(nil), // 13: common.G1Commitment + (*NodeInfoRequest)(nil), // 13: node.NodeInfoRequest + (*NodeInfoReply)(nil), // 14: node.NodeInfoReply + (*common.G1Commitment)(nil), // 15: common.G1Commitment } var file_node_node_proto_depIdxs = []int32{ 12, // 0: node.StoreChunksRequest.batch_header:type_name -> node.BatchHeader @@ -1008,18 +1146,22 @@ var file_node_node_proto_depIdxs = []int32{ 6, // 3: node.GetBlobHeaderReply.proof:type_name -> node.MerkleProof 10, // 4: node.Blob.header:type_name -> node.BlobHeader 8, // 5: node.Blob.bundles:type_name -> node.Bundle - 13, // 6: node.BlobHeader.commitment:type_name -> common.G1Commitment + 15, // 6: node.BlobHeader.commitment:type_name -> common.G1Commitment 9, // 7: node.BlobHeader.length_commitment:type_name -> node.G2Commitment 9, // 8: node.BlobHeader.length_proof:type_name -> node.G2Commitment 11, // 9: node.BlobHeader.quorum_headers:type_name -> node.BlobQuorumInfo 0, // 10: node.Dispersal.StoreChunks:input_type -> node.StoreChunksRequest - 2, // 11: node.Retrieval.RetrieveChunks:input_type -> node.RetrieveChunksRequest - 4, // 12: node.Retrieval.GetBlobHeader:input_type -> node.GetBlobHeaderRequest - 1, // 13: node.Dispersal.StoreChunks:output_type -> node.StoreChunksReply - 3, // 14: node.Retrieval.RetrieveChunks:output_type -> node.RetrieveChunksReply - 5, // 15: node.Retrieval.GetBlobHeader:output_type -> node.GetBlobHeaderReply - 13, // [13:16] is the sub-list for method output_type - 10, // [10:13] is the sub-list for method input_type + 13, // 11: node.Dispersal.NodeInfo:input_type -> node.NodeInfoRequest + 2, // 12: node.Retrieval.RetrieveChunks:input_type -> node.RetrieveChunksRequest + 4, // 13: node.Retrieval.GetBlobHeader:input_type -> node.GetBlobHeaderRequest + 13, // 14: node.Retrieval.NodeInfo:input_type -> node.NodeInfoRequest + 1, // 15: node.Dispersal.StoreChunks:output_type -> node.StoreChunksReply + 14, // 16: node.Dispersal.NodeInfo:output_type -> node.NodeInfoReply + 3, // 17: node.Retrieval.RetrieveChunks:output_type -> node.RetrieveChunksReply + 5, // 18: node.Retrieval.GetBlobHeader:output_type -> node.GetBlobHeaderReply + 14, // 19: node.Retrieval.NodeInfo:output_type -> node.NodeInfoReply + 15, // [15:20] is the sub-list for method output_type + 10, // [10:15] is the sub-list for method input_type 10, // [10:10] is the sub-list for extension type_name 10, // [10:10] is the sub-list for extension extendee 0, // [0:10] is the sub-list for field type_name @@ -1187,6 +1329,30 @@ func file_node_node_proto_init() { return nil } } + file_node_node_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NodeInfoRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_node_node_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NodeInfoReply); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -1194,7 +1360,7 @@ func file_node_node_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_node_node_proto_rawDesc, NumEnums: 0, - NumMessages: 13, + NumMessages: 15, NumExtensions: 0, NumServices: 2, }, diff --git a/api/grpc/node/node_grpc.pb.go b/api/grpc/node/node_grpc.pb.go index 0dcf6f0eb..20ef64b70 100644 --- a/api/grpc/node/node_grpc.pb.go +++ b/api/grpc/node/node_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v4.23.4 +// - protoc v5.26.1 // source: node/node.proto package node @@ -20,6 +20,7 @@ const _ = grpc.SupportPackageIsVersion7 const ( Dispersal_StoreChunks_FullMethodName = "/node.Dispersal/StoreChunks" + Dispersal_NodeInfo_FullMethodName = "/node.Dispersal/NodeInfo" ) // DispersalClient is the client API for Dispersal service. @@ -33,6 +34,8 @@ type DispersalClient interface { // for the protocol-defined length of custody. It will return a signature at the // end to attest to the data in this request it has processed. StoreChunks(ctx context.Context, in *StoreChunksRequest, opts ...grpc.CallOption) (*StoreChunksReply, error) + // Retrieve node info metadata + NodeInfo(ctx context.Context, in *NodeInfoRequest, opts ...grpc.CallOption) (*NodeInfoReply, error) } type dispersalClient struct { @@ -52,6 +55,15 @@ func (c *dispersalClient) StoreChunks(ctx context.Context, in *StoreChunksReques return out, nil } +func (c *dispersalClient) NodeInfo(ctx context.Context, in *NodeInfoRequest, opts ...grpc.CallOption) (*NodeInfoReply, error) { + out := new(NodeInfoReply) + err := c.cc.Invoke(ctx, Dispersal_NodeInfo_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // DispersalServer is the server API for Dispersal service. // All implementations must embed UnimplementedDispersalServer // for forward compatibility @@ -63,6 +75,8 @@ type DispersalServer interface { // for the protocol-defined length of custody. It will return a signature at the // end to attest to the data in this request it has processed. StoreChunks(context.Context, *StoreChunksRequest) (*StoreChunksReply, error) + // Retrieve node info metadata + NodeInfo(context.Context, *NodeInfoRequest) (*NodeInfoReply, error) mustEmbedUnimplementedDispersalServer() } @@ -73,6 +87,9 @@ type UnimplementedDispersalServer struct { func (UnimplementedDispersalServer) StoreChunks(context.Context, *StoreChunksRequest) (*StoreChunksReply, error) { return nil, status.Errorf(codes.Unimplemented, "method StoreChunks not implemented") } +func (UnimplementedDispersalServer) NodeInfo(context.Context, *NodeInfoRequest) (*NodeInfoReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method NodeInfo not implemented") +} func (UnimplementedDispersalServer) mustEmbedUnimplementedDispersalServer() {} // UnsafeDispersalServer may be embedded to opt out of forward compatibility for this service. @@ -104,6 +121,24 @@ func _Dispersal_StoreChunks_Handler(srv interface{}, ctx context.Context, dec fu return interceptor(ctx, in, info, handler) } +func _Dispersal_NodeInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(NodeInfoRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DispersalServer).NodeInfo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Dispersal_NodeInfo_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DispersalServer).NodeInfo(ctx, req.(*NodeInfoRequest)) + } + return interceptor(ctx, in, info, handler) +} + // Dispersal_ServiceDesc is the grpc.ServiceDesc for Dispersal service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -115,6 +150,10 @@ var Dispersal_ServiceDesc = grpc.ServiceDesc{ MethodName: "StoreChunks", Handler: _Dispersal_StoreChunks_Handler, }, + { + MethodName: "NodeInfo", + Handler: _Dispersal_NodeInfo_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "node/node.proto", @@ -123,6 +162,7 @@ var Dispersal_ServiceDesc = grpc.ServiceDesc{ const ( Retrieval_RetrieveChunks_FullMethodName = "/node.Retrieval/RetrieveChunks" Retrieval_GetBlobHeader_FullMethodName = "/node.Retrieval/GetBlobHeader" + Retrieval_NodeInfo_FullMethodName = "/node.Retrieval/NodeInfo" ) // RetrievalClient is the client API for Retrieval service. @@ -131,8 +171,10 @@ const ( type RetrievalClient interface { // RetrieveChunks retrieves the chunks for a blob custodied at the Node. RetrieveChunks(ctx context.Context, in *RetrieveChunksRequest, opts ...grpc.CallOption) (*RetrieveChunksReply, error) - // Similar to RetrieveChunks, this just returns the header of the blob. + // GetBlobHeader is similar to RetrieveChunks, this just returns the header of the blob. GetBlobHeader(ctx context.Context, in *GetBlobHeaderRequest, opts ...grpc.CallOption) (*GetBlobHeaderReply, error) + // Retrieve node info metadata + NodeInfo(ctx context.Context, in *NodeInfoRequest, opts ...grpc.CallOption) (*NodeInfoReply, error) } type retrievalClient struct { @@ -161,14 +203,25 @@ func (c *retrievalClient) GetBlobHeader(ctx context.Context, in *GetBlobHeaderRe return out, nil } +func (c *retrievalClient) NodeInfo(ctx context.Context, in *NodeInfoRequest, opts ...grpc.CallOption) (*NodeInfoReply, error) { + out := new(NodeInfoReply) + err := c.cc.Invoke(ctx, Retrieval_NodeInfo_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // RetrievalServer is the server API for Retrieval service. // All implementations must embed UnimplementedRetrievalServer // for forward compatibility type RetrievalServer interface { // RetrieveChunks retrieves the chunks for a blob custodied at the Node. RetrieveChunks(context.Context, *RetrieveChunksRequest) (*RetrieveChunksReply, error) - // Similar to RetrieveChunks, this just returns the header of the blob. + // GetBlobHeader is similar to RetrieveChunks, this just returns the header of the blob. GetBlobHeader(context.Context, *GetBlobHeaderRequest) (*GetBlobHeaderReply, error) + // Retrieve node info metadata + NodeInfo(context.Context, *NodeInfoRequest) (*NodeInfoReply, error) mustEmbedUnimplementedRetrievalServer() } @@ -182,6 +235,9 @@ func (UnimplementedRetrievalServer) RetrieveChunks(context.Context, *RetrieveChu func (UnimplementedRetrievalServer) GetBlobHeader(context.Context, *GetBlobHeaderRequest) (*GetBlobHeaderReply, error) { return nil, status.Errorf(codes.Unimplemented, "method GetBlobHeader not implemented") } +func (UnimplementedRetrievalServer) NodeInfo(context.Context, *NodeInfoRequest) (*NodeInfoReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method NodeInfo not implemented") +} func (UnimplementedRetrievalServer) mustEmbedUnimplementedRetrievalServer() {} // UnsafeRetrievalServer may be embedded to opt out of forward compatibility for this service. @@ -231,6 +287,24 @@ func _Retrieval_GetBlobHeader_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } +func _Retrieval_NodeInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(NodeInfoRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RetrievalServer).NodeInfo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Retrieval_NodeInfo_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RetrievalServer).NodeInfo(ctx, req.(*NodeInfoRequest)) + } + return interceptor(ctx, in, info, handler) +} + // Retrieval_ServiceDesc is the grpc.ServiceDesc for Retrieval service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -246,6 +320,10 @@ var Retrieval_ServiceDesc = grpc.ServiceDesc{ MethodName: "GetBlobHeader", Handler: _Retrieval_GetBlobHeader_Handler, }, + { + MethodName: "NodeInfo", + Handler: _Retrieval_NodeInfo_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "node/node.proto", diff --git a/api/proto/node/node.proto b/api/proto/node/node.proto index f31646742..1e99dfa2d 100644 --- a/api/proto/node/node.proto +++ b/api/proto/node/node.proto @@ -14,6 +14,8 @@ service Dispersal { // for the protocol-defined length of custody. It will return a signature at the // end to attest to the data in this request it has processed. rpc StoreChunks(StoreChunksRequest) returns (StoreChunksReply) {} + // Retrieve node info metadata + rpc NodeInfo(NodeInfoRequest) returns (NodeInfoReply) {} } service Retrieval { @@ -21,6 +23,8 @@ service Retrieval { rpc RetrieveChunks(RetrieveChunksRequest) returns (RetrieveChunksReply) {} // GetBlobHeader is similar to RetrieveChunks, this just returns the header of the blob. rpc GetBlobHeader(GetBlobHeaderRequest) returns (GetBlobHeaderReply) {} + // Retrieve node info metadata + rpc NodeInfo(NodeInfoRequest) returns (NodeInfoReply) {} } // Requests and replies @@ -153,3 +157,16 @@ message BatchHeader { // The Ethereum block number at which the batch is dispersed. uint32 reference_block_number = 3; } + +// Node info request +message NodeInfoRequest { +} + +// Node info reply +message NodeInfoReply { + string semver = 1; + string arch = 2; + string os = 3; + uint32 num_cpu = 4; + uint64 mem_bytes = 5; +} diff --git a/go.mod b/go.mod index ed50d2642..2bad729c8 100644 --- a/go.mod +++ b/go.mod @@ -195,7 +195,7 @@ require ( github.com/prometheus/procfs v0.12.0 // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect - github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect + github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible github.com/stretchr/objx v0.5.2 // indirect github.com/swaggo/files v1.0.1 github.com/swaggo/gin-swagger v1.6.0 diff --git a/node/Makefile b/node/Makefile index 6b2715211..7a7455f9a 100644 --- a/node/Makefile +++ b/node/Makefile @@ -19,9 +19,18 @@ build: clean go mod tidy go build -o ./bin/node ./cmd +proto: + cd .. && make protoc + clean: rm -rf ./bin +lint: + golangci-lint run + +test: + go test -short ./... + docker: docker-node docker-plugin docker-node: diff --git a/node/config.go b/node/config.go index e1f09ec1a..8a2d95143 100644 --- a/node/config.go +++ b/node/config.go @@ -31,9 +31,9 @@ var ( // this is used for eigen metrics QuorumNames = map[core.QuorumID]string{ 0: "eth_quorum", - 1: "permissioned_quorum", + 1: "eignen_quorum", } - SemVer = "v0.0.0" + SemVer = "0.0.0" GitCommit = "" GitDate = "" ) @@ -72,6 +72,7 @@ type Config struct { ClientIPHeader string UseSecureGrpc bool ReachabilityPollIntervalSec uint64 + DisableNodeInfoResources bool EthClientConfig geth.EthClientConfig LoggerConfig common.LoggerConfig @@ -201,5 +202,6 @@ func NewConfig(ctx *cli.Context) (*Config, error) { NumBatchDeserializationWorkers: ctx.GlobalInt(flags.NumBatchDeserializationWorkersFlag.Name), ClientIPHeader: ctx.GlobalString(flags.ClientIPHeaderFlag.Name), UseSecureGrpc: ctx.GlobalBoolT(flags.ChurnerUseSecureGRPC.Name), + DisableNodeInfoResources: ctx.GlobalBool(flags.DisableNodeInfoResourcesFlag.Name), }, nil } diff --git a/node/flags/flags.go b/node/flags/flags.go index d6a5d8abf..7e81119c4 100644 --- a/node/flags/flags.go +++ b/node/flags/flags.go @@ -259,6 +259,13 @@ var ( Value: "", EnvVar: common.PrefixEnvVar(EnvVarPrefix, "CLIENT_IP_HEADER"), } + + DisableNodeInfoResourcesFlag = cli.BoolFlag{ + Name: common.PrefixFlag(FlagPrefix, "disable-node-info-resources"), + Usage: "Disable system resource information (OS, architecture, CPU, memory) on the NodeInfo API", + Required: false, + EnvVar: common.PrefixEnvVar(EnvVarPrefix, "DISABLE_NODE_INFO_RESOURCES"), + } ) var requiredFlags = []cli.Flag{ @@ -299,6 +306,7 @@ var optionalFlags = []cli.Flag{ EcdsaKeyFileFlag, EcdsaKeyPasswordFlag, DataApiUrlFlag, + DisableNodeInfoResourcesFlag, } func init() { diff --git a/node/grpc/server.go b/node/grpc/server.go index 45f77c150..b6dbae008 100644 --- a/node/grpc/server.go +++ b/node/grpc/server.go @@ -4,6 +4,7 @@ import ( "context" "errors" "fmt" + "runtime" "sync" "time" @@ -17,6 +18,9 @@ import ( "github.com/Layr-Labs/eigenda/encoding" "github.com/Layr-Labs/eigenda/node" "github.com/Layr-Labs/eigensdk-go/logging" + "github.com/shirou/gopsutil/mem" + + _ "go.uber.org/automaxprocs" "google.golang.org/grpc" "google.golang.org/grpc/reflection" @@ -130,6 +134,20 @@ func (s *Server) serveRetrieval() error { } +func (s *Server) NodeInfo(ctx context.Context, in *pb.NodeInfoRequest) (*pb.NodeInfoReply, error) { + if s.config.DisableNodeInfoResources { + return &pb.NodeInfoReply{Semver: node.SemVer}, nil + } + + memBytes := uint64(0) + v, err := mem.VirtualMemory() + if err == nil { + memBytes = v.Total + } + + return &pb.NodeInfoReply{Semver: node.SemVer, Os: runtime.GOOS, Arch: runtime.GOARCH, NumCpu: uint32(runtime.GOMAXPROCS(0)), MemBytes: memBytes}, nil +} + func (s *Server) handleStoreChunksRequest(ctx context.Context, in *pb.StoreChunksRequest) (*pb.StoreChunksReply, error) { start := time.Now() diff --git a/node/grpc/server_test.go b/node/grpc/server_test.go index 5bc8b5e27..84623ec94 100644 --- a/node/grpc/server_test.go +++ b/node/grpc/server_test.go @@ -278,6 +278,13 @@ func storeChunks(t *testing.T, server *grpc.Server) ([32]byte, [32]byte, []*core return batchHeaderHash, batchRoot, blobHeaders, blobHeadersProto } +func TestNodeInfoRequest(t *testing.T) { + server := newTestServer(t, true) + resp, err := server.NodeInfo(context.Background(), &pb.NodeInfoRequest{}) + assert.True(t, resp.Semver == "0.0.0") + assert.True(t, err == nil) +} + func TestStoreChunksRequestValidation(t *testing.T) { server := newTestServer(t, true)