diff --git a/power-snapshot/api/proto/query.pb.go b/power-snapshot/api/proto/query.pb.go index c1e07c1..c75c0af 100644 --- a/power-snapshot/api/proto/query.pb.go +++ b/power-snapshot/api/proto/query.pb.go @@ -12,6 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.35.1 +// protoc v5.28.2 +// source: query.proto + package snapshot import ( @@ -28,6 +34,120 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +type GetAllAddrPowerByDayRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Day string `protobuf:"bytes,1,opt,name=day,proto3" json:"day,omitempty"` + NetId int64 `protobuf:"varint,2,opt,name=netId,proto3" json:"netId,omitempty"` +} + +func (x *GetAllAddrPowerByDayRequest) Reset() { + *x = GetAllAddrPowerByDayRequest{} + mi := &file_query_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetAllAddrPowerByDayRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetAllAddrPowerByDayRequest) ProtoMessage() {} + +func (x *GetAllAddrPowerByDayRequest) ProtoReflect() protoreflect.Message { + mi := &file_query_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetAllAddrPowerByDayRequest.ProtoReflect.Descriptor instead. +func (*GetAllAddrPowerByDayRequest) Descriptor() ([]byte, []int) { + return file_query_proto_rawDescGZIP(), []int{0} +} + +func (x *GetAllAddrPowerByDayRequest) GetDay() string { + if x != nil { + return x.Day + } + return "" +} + +func (x *GetAllAddrPowerByDayRequest) GetNetId() int64 { + if x != nil { + return x.NetId + } + return 0 +} + +type GetAllAddrPowerByDayResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Day string `protobuf:"bytes,1,opt,name=day,proto3" json:"day,omitempty"` + Info string `protobuf:"bytes,3,opt,name=info,proto3" json:"info,omitempty"` + NetId int64 `protobuf:"varint,4,opt,name=netId,proto3" json:"netId,omitempty"` +} + +func (x *GetAllAddrPowerByDayResponse) Reset() { + *x = GetAllAddrPowerByDayResponse{} + mi := &file_query_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetAllAddrPowerByDayResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetAllAddrPowerByDayResponse) ProtoMessage() {} + +func (x *GetAllAddrPowerByDayResponse) ProtoReflect() protoreflect.Message { + mi := &file_query_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetAllAddrPowerByDayResponse.ProtoReflect.Descriptor instead. +func (*GetAllAddrPowerByDayResponse) Descriptor() ([]byte, []int) { + return file_query_proto_rawDescGZIP(), []int{1} +} + +func (x *GetAllAddrPowerByDayResponse) GetDay() string { + if x != nil { + return x.Day + } + return "" +} + +func (x *GetAllAddrPowerByDayResponse) GetInfo() string { + if x != nil { + return x.Info + } + return "" +} + +func (x *GetAllAddrPowerByDayResponse) GetNetId() int64 { + if x != nil { + return x.NetId + } + return 0 +} + type SyncAllAddrPowerRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -38,11 +158,9 @@ type SyncAllAddrPowerRequest struct { func (x *SyncAllAddrPowerRequest) Reset() { *x = SyncAllAddrPowerRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_query_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_query_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *SyncAllAddrPowerRequest) String() string { @@ -52,8 +170,8 @@ func (x *SyncAllAddrPowerRequest) String() string { func (*SyncAllAddrPowerRequest) ProtoMessage() {} func (x *SyncAllAddrPowerRequest) ProtoReflect() protoreflect.Message { - mi := &file_proto_query_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + mi := &file_query_proto_msgTypes[2] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -65,7 +183,7 @@ func (x *SyncAllAddrPowerRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use SyncAllAddrPowerRequest.ProtoReflect.Descriptor instead. func (*SyncAllAddrPowerRequest) Descriptor() ([]byte, []int) { - return file_proto_query_proto_rawDescGZIP(), []int{0} + return file_query_proto_rawDescGZIP(), []int{2} } func (x *SyncAllAddrPowerRequest) GetNetId() int64 { @@ -87,11 +205,9 @@ type AddressPowerRequest struct { func (x *AddressPowerRequest) Reset() { *x = AddressPowerRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_query_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_query_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *AddressPowerRequest) String() string { @@ -101,8 +217,8 @@ func (x *AddressPowerRequest) String() string { func (*AddressPowerRequest) ProtoMessage() {} func (x *AddressPowerRequest) ProtoReflect() protoreflect.Message { - mi := &file_proto_query_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + mi := &file_query_proto_msgTypes[3] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -114,7 +230,7 @@ func (x *AddressPowerRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use AddressPowerRequest.ProtoReflect.Descriptor instead. func (*AddressPowerRequest) Descriptor() ([]byte, []int) { - return file_proto_query_proto_rawDescGZIP(), []int{1} + return file_query_proto_rawDescGZIP(), []int{3} } func (x *AddressPowerRequest) GetNetId() int64 { @@ -148,11 +264,9 @@ type SyncDateHeightRequest struct { func (x *SyncDateHeightRequest) Reset() { *x = SyncDateHeightRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_query_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_query_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *SyncDateHeightRequest) String() string { @@ -162,8 +276,8 @@ func (x *SyncDateHeightRequest) String() string { func (*SyncDateHeightRequest) ProtoMessage() {} func (x *SyncDateHeightRequest) ProtoReflect() protoreflect.Message { - mi := &file_proto_query_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { + mi := &file_query_proto_msgTypes[4] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -175,7 +289,7 @@ func (x *SyncDateHeightRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use SyncDateHeightRequest.ProtoReflect.Descriptor instead. func (*SyncDateHeightRequest) Descriptor() ([]byte, []int) { - return file_proto_query_proto_rawDescGZIP(), []int{2} + return file_query_proto_rawDescGZIP(), []int{4} } func (x *SyncDateHeightRequest) GetNetId() int64 { @@ -196,11 +310,9 @@ type SyncAddrPowerRequest struct { func (x *SyncAddrPowerRequest) Reset() { *x = SyncAddrPowerRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_query_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_query_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *SyncAddrPowerRequest) String() string { @@ -210,8 +322,8 @@ func (x *SyncAddrPowerRequest) String() string { func (*SyncAddrPowerRequest) ProtoMessage() {} func (x *SyncAddrPowerRequest) ProtoReflect() protoreflect.Message { - mi := &file_proto_query_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { + mi := &file_query_proto_msgTypes[5] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -223,7 +335,7 @@ func (x *SyncAddrPowerRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use SyncAddrPowerRequest.ProtoReflect.Descriptor instead. func (*SyncAddrPowerRequest) Descriptor() ([]byte, []int) { - return file_proto_query_proto_rawDescGZIP(), []int{3} + return file_query_proto_rawDescGZIP(), []int{5} } func (x *SyncAddrPowerRequest) GetNetId() int64 { @@ -240,6 +352,173 @@ func (x *SyncAddrPowerRequest) GetAddress() string { return "" } +type DataHeightRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NetId int64 `protobuf:"varint,1,opt,name=netId,proto3" json:"netId,omitempty"` + Day string `protobuf:"bytes,2,opt,name=day,proto3" json:"day,omitempty"` +} + +func (x *DataHeightRequest) Reset() { + *x = DataHeightRequest{} + mi := &file_query_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DataHeightRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DataHeightRequest) ProtoMessage() {} + +func (x *DataHeightRequest) ProtoReflect() protoreflect.Message { + mi := &file_query_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DataHeightRequest.ProtoReflect.Descriptor instead. +func (*DataHeightRequest) Descriptor() ([]byte, []int) { + return file_query_proto_rawDescGZIP(), []int{6} +} + +func (x *DataHeightRequest) GetNetId() int64 { + if x != nil { + return x.NetId + } + return 0 +} + +func (x *DataHeightRequest) GetDay() string { + if x != nil { + return x.Day + } + return "" +} + +type AddressPowerByDayRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NetId int64 `protobuf:"varint,1,opt,name=netId,proto3" json:"netId,omitempty"` + Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` + Day string `protobuf:"bytes,3,opt,name=day,proto3" json:"day,omitempty"` +} + +func (x *AddressPowerByDayRequest) Reset() { + *x = AddressPowerByDayRequest{} + mi := &file_query_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AddressPowerByDayRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddressPowerByDayRequest) ProtoMessage() {} + +func (x *AddressPowerByDayRequest) ProtoReflect() protoreflect.Message { + mi := &file_query_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AddressPowerByDayRequest.ProtoReflect.Descriptor instead. +func (*AddressPowerByDayRequest) Descriptor() ([]byte, []int) { + return file_query_proto_rawDescGZIP(), []int{7} +} + +func (x *AddressPowerByDayRequest) GetNetId() int64 { + if x != nil { + return x.NetId + } + return 0 +} + +func (x *AddressPowerByDayRequest) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +func (x *AddressPowerByDayRequest) GetDay() string { + if x != nil { + return x.Day + } + return "" +} + +type DataHeightResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Day string `protobuf:"bytes,1,opt,name=day,proto3" json:"day,omitempty"` + Height int64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"` +} + +func (x *DataHeightResponse) Reset() { + *x = DataHeightResponse{} + mi := &file_query_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DataHeightResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DataHeightResponse) ProtoMessage() {} + +func (x *DataHeightResponse) ProtoReflect() protoreflect.Message { + mi := &file_query_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DataHeightResponse.ProtoReflect.Descriptor instead. +func (*DataHeightResponse) Descriptor() ([]byte, []int) { + return file_query_proto_rawDescGZIP(), []int{8} +} + +func (x *DataHeightResponse) GetDay() string { + if x != nil { + return x.Day + } + return "" +} + +func (x *DataHeightResponse) GetHeight() int64 { + if x != nil { + return x.Height + } + return 0 +} + type AddressPowerResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -256,11 +535,9 @@ type AddressPowerResponse struct { func (x *AddressPowerResponse) Reset() { *x = AddressPowerResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_query_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_query_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *AddressPowerResponse) String() string { @@ -270,8 +547,8 @@ func (x *AddressPowerResponse) String() string { func (*AddressPowerResponse) ProtoMessage() {} func (x *AddressPowerResponse) ProtoReflect() protoreflect.Message { - mi := &file_proto_query_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { + mi := &file_query_proto_msgTypes[9] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -283,7 +560,7 @@ func (x *AddressPowerResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use AddressPowerResponse.ProtoReflect.Descriptor instead. func (*AddressPowerResponse) Descriptor() ([]byte, []int) { - return file_proto_query_proto_rawDescGZIP(), []int{4} + return file_query_proto_rawDescGZIP(), []int{9} } func (x *AddressPowerResponse) GetAddress() string { @@ -343,11 +620,9 @@ type SyncAllAddrPowerResponse struct { func (x *SyncAllAddrPowerResponse) Reset() { *x = SyncAllAddrPowerResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_query_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_query_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *SyncAllAddrPowerResponse) String() string { @@ -357,8 +632,8 @@ func (x *SyncAllAddrPowerResponse) String() string { func (*SyncAllAddrPowerResponse) ProtoMessage() {} func (x *SyncAllAddrPowerResponse) ProtoReflect() protoreflect.Message { - mi := &file_proto_query_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { + mi := &file_query_proto_msgTypes[10] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -370,7 +645,7 @@ func (x *SyncAllAddrPowerResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use SyncAllAddrPowerResponse.ProtoReflect.Descriptor instead. func (*SyncAllAddrPowerResponse) Descriptor() ([]byte, []int) { - return file_proto_query_proto_rawDescGZIP(), []int{5} + return file_query_proto_rawDescGZIP(), []int{10} } type SyncDateHeightResponse struct { @@ -381,11 +656,9 @@ type SyncDateHeightResponse struct { func (x *SyncDateHeightResponse) Reset() { *x = SyncDateHeightResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_query_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_query_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *SyncDateHeightResponse) String() string { @@ -395,8 +668,8 @@ func (x *SyncDateHeightResponse) String() string { func (*SyncDateHeightResponse) ProtoMessage() {} func (x *SyncDateHeightResponse) ProtoReflect() protoreflect.Message { - mi := &file_proto_query_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { + mi := &file_query_proto_msgTypes[11] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -408,7 +681,7 @@ func (x *SyncDateHeightResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use SyncDateHeightResponse.ProtoReflect.Descriptor instead. func (*SyncDateHeightResponse) Descriptor() ([]byte, []int) { - return file_proto_query_proto_rawDescGZIP(), []int{6} + return file_query_proto_rawDescGZIP(), []int{11} } type SyncAddrPowerResponse struct { @@ -419,11 +692,9 @@ type SyncAddrPowerResponse struct { func (x *SyncAddrPowerResponse) Reset() { *x = SyncAddrPowerResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_query_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_query_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *SyncAddrPowerResponse) String() string { @@ -433,8 +704,8 @@ func (x *SyncAddrPowerResponse) String() string { func (*SyncAddrPowerResponse) ProtoMessage() {} func (x *SyncAddrPowerResponse) ProtoReflect() protoreflect.Message { - mi := &file_proto_query_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { + mi := &file_query_proto_msgTypes[12] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -446,7 +717,7 @@ func (x *SyncAddrPowerResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use SyncAddrPowerResponse.ProtoReflect.Descriptor instead. func (*SyncAddrPowerResponse) Descriptor() ([]byte, []int) { - return file_proto_query_proto_rawDescGZIP(), []int{7} + return file_query_proto_rawDescGZIP(), []int{12} } type SyncAllDeveloperWeightRequest struct { @@ -457,11 +728,9 @@ type SyncAllDeveloperWeightRequest struct { func (x *SyncAllDeveloperWeightRequest) Reset() { *x = SyncAllDeveloperWeightRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_query_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_query_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *SyncAllDeveloperWeightRequest) String() string { @@ -471,8 +740,8 @@ func (x *SyncAllDeveloperWeightRequest) String() string { func (*SyncAllDeveloperWeightRequest) ProtoMessage() {} func (x *SyncAllDeveloperWeightRequest) ProtoReflect() protoreflect.Message { - mi := &file_proto_query_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { + mi := &file_query_proto_msgTypes[13] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -484,7 +753,7 @@ func (x *SyncAllDeveloperWeightRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use SyncAllDeveloperWeightRequest.ProtoReflect.Descriptor instead. func (*SyncAllDeveloperWeightRequest) Descriptor() ([]byte, []int) { - return file_proto_query_proto_rawDescGZIP(), []int{8} + return file_query_proto_rawDescGZIP(), []int{13} } type SyncAllDeveloperWeightResponse struct { @@ -495,11 +764,9 @@ type SyncAllDeveloperWeightResponse struct { func (x *SyncAllDeveloperWeightResponse) Reset() { *x = SyncAllDeveloperWeightResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_query_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_query_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *SyncAllDeveloperWeightResponse) String() string { @@ -509,8 +776,8 @@ func (x *SyncAllDeveloperWeightResponse) String() string { func (*SyncAllDeveloperWeightResponse) ProtoMessage() {} func (x *SyncAllDeveloperWeightResponse) ProtoReflect() protoreflect.Message { - mi := &file_proto_query_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { + mi := &file_query_proto_msgTypes[14] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -522,7 +789,7 @@ func (x *SyncAllDeveloperWeightResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use SyncAllDeveloperWeightResponse.ProtoReflect.Descriptor instead. func (*SyncAllDeveloperWeightResponse) Descriptor() ([]byte, []int) { - return file_proto_query_proto_rawDescGZIP(), []int{9} + return file_query_proto_rawDescGZIP(), []int{14} } type SyncDeveloperWeightRequest struct { @@ -535,11 +802,9 @@ type SyncDeveloperWeightRequest struct { func (x *SyncDeveloperWeightRequest) Reset() { *x = SyncDeveloperWeightRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_query_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_query_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *SyncDeveloperWeightRequest) String() string { @@ -549,8 +814,8 @@ func (x *SyncDeveloperWeightRequest) String() string { func (*SyncDeveloperWeightRequest) ProtoMessage() {} func (x *SyncDeveloperWeightRequest) ProtoReflect() protoreflect.Message { - mi := &file_proto_query_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { + mi := &file_query_proto_msgTypes[15] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -562,7 +827,7 @@ func (x *SyncDeveloperWeightRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use SyncDeveloperWeightRequest.ProtoReflect.Descriptor instead. func (*SyncDeveloperWeightRequest) Descriptor() ([]byte, []int) { - return file_proto_query_proto_rawDescGZIP(), []int{10} + return file_query_proto_rawDescGZIP(), []int{15} } func (x *SyncDeveloperWeightRequest) GetDateStr() string { @@ -580,11 +845,9 @@ type SyncDeveloperWeightResponse struct { func (x *SyncDeveloperWeightResponse) Reset() { *x = SyncDeveloperWeightResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_proto_query_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_query_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *SyncDeveloperWeightResponse) String() string { @@ -594,8 +857,8 @@ func (x *SyncDeveloperWeightResponse) String() string { func (*SyncDeveloperWeightResponse) ProtoMessage() {} func (x *SyncDeveloperWeightResponse) ProtoReflect() protoreflect.Message { - mi := &file_proto_query_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { + mi := &file_query_proto_msgTypes[16] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -607,316 +870,222 @@ func (x *SyncDeveloperWeightResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use SyncDeveloperWeightResponse.ProtoReflect.Descriptor instead. func (*SyncDeveloperWeightResponse) Descriptor() ([]byte, []int) { - return file_proto_query_proto_rawDescGZIP(), []int{11} -} - -var File_proto_query_proto protoreflect.FileDescriptor - -var file_proto_query_proto_rawDesc = []byte{ - 0x0a, 0x11, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x22, 0x2f, 0x0a, - 0x17, 0x53, 0x79, 0x6e, 0x63, 0x41, 0x6c, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x50, 0x6f, 0x77, 0x65, - 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x65, 0x74, 0x49, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6e, 0x65, 0x74, 0x49, 0x64, 0x22, 0x64, - 0x0a, 0x13, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, + return file_query_proto_rawDescGZIP(), []int{16} +} + +var File_query_proto protoreflect.FileDescriptor + +var file_query_proto_rawDesc = []byte{ + 0x0a, 0x0b, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x73, + 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x22, 0x45, 0x0a, 0x1b, 0x47, 0x65, 0x74, 0x41, 0x6c, + 0x6c, 0x41, 0x64, 0x64, 0x72, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x42, 0x79, 0x44, 0x61, 0x79, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x64, 0x61, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x03, 0x64, 0x61, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x65, 0x74, 0x49, + 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6e, 0x65, 0x74, 0x49, 0x64, 0x22, 0x5a, + 0x0a, 0x1c, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x50, 0x6f, 0x77, 0x65, + 0x72, 0x42, 0x79, 0x44, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x10, + 0x0a, 0x03, 0x64, 0x61, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x64, 0x61, 0x79, + 0x12, 0x12, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x69, 0x6e, 0x66, 0x6f, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x65, 0x74, 0x49, 0x64, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x05, 0x6e, 0x65, 0x74, 0x49, 0x64, 0x22, 0x2f, 0x0a, 0x17, 0x53, 0x79, + 0x6e, 0x63, 0x41, 0x6c, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x65, 0x74, 0x49, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6e, 0x65, 0x74, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x61, - 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x5f, - 0x6e, 0x75, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x72, 0x61, 0x6e, 0x64, 0x6f, - 0x6d, 0x4e, 0x75, 0x6d, 0x22, 0x2d, 0x0a, 0x15, 0x53, 0x79, 0x6e, 0x63, 0x44, 0x61, 0x74, 0x65, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6e, 0x65, 0x74, 0x49, 0x64, 0x22, 0x64, 0x0a, 0x13, 0x41, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x65, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x05, 0x6e, 0x65, 0x74, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x5f, 0x6e, 0x75, 0x6d, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x4e, 0x75, + 0x6d, 0x22, 0x2d, 0x0a, 0x15, 0x53, 0x79, 0x6e, 0x63, 0x44, 0x61, 0x74, 0x65, 0x48, 0x65, 0x69, + 0x67, 0x68, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x65, + 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6e, 0x65, 0x74, 0x49, 0x64, + 0x22, 0x46, 0x0a, 0x14, 0x53, 0x79, 0x6e, 0x63, 0x41, 0x64, 0x64, 0x72, 0x50, 0x6f, 0x77, 0x65, + 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x65, 0x74, 0x49, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6e, 0x65, 0x74, 0x49, 0x64, 0x12, 0x18, + 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x3b, 0x0a, 0x11, 0x44, 0x61, 0x74, 0x61, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x65, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6e, 0x65, - 0x74, 0x49, 0x64, 0x22, 0x46, 0x0a, 0x14, 0x53, 0x79, 0x6e, 0x63, 0x41, 0x64, 0x64, 0x72, 0x50, - 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6e, - 0x65, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6e, 0x65, 0x74, 0x49, - 0x64, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x83, 0x02, 0x0a, 0x14, - 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x19, - 0x0a, 0x08, 0x73, 0x70, 0x5f, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x07, 0x73, 0x70, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6c, 0x69, - 0x65, 0x6e, 0x74, 0x5f, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0b, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x12, 0x2c, 0x0a, 0x12, - 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x68, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x5f, 0x70, 0x6f, 0x77, - 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x48, - 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x12, 0x27, 0x0a, 0x0f, 0x64, 0x65, - 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x5f, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0e, 0x64, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x50, 0x6f, - 0x77, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x68, 0x65, 0x69, - 0x67, 0x68, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, - 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x73, - 0x74, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x64, 0x61, 0x74, 0x65, 0x53, 0x74, - 0x72, 0x22, 0x1a, 0x0a, 0x18, 0x53, 0x79, 0x6e, 0x63, 0x41, 0x6c, 0x6c, 0x41, 0x64, 0x64, 0x72, - 0x50, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x18, 0x0a, - 0x16, 0x53, 0x79, 0x6e, 0x63, 0x44, 0x61, 0x74, 0x65, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x17, 0x0a, 0x15, 0x53, 0x79, 0x6e, 0x63, 0x41, - 0x64, 0x64, 0x72, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x1f, 0x0a, 0x1d, 0x53, 0x79, 0x6e, 0x63, 0x41, 0x6c, 0x6c, 0x44, 0x65, 0x76, 0x65, 0x6c, - 0x6f, 0x70, 0x65, 0x72, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x22, 0x20, 0x0a, 0x1e, 0x53, 0x79, 0x6e, 0x63, 0x41, 0x6c, 0x6c, 0x44, 0x65, 0x76, 0x65, + 0x74, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x64, 0x61, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x03, 0x64, 0x61, 0x79, 0x22, 0x5c, 0x0a, 0x18, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x50, 0x6f, 0x77, 0x65, 0x72, 0x42, 0x79, 0x44, 0x61, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x65, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x05, 0x6e, 0x65, 0x74, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x12, 0x10, 0x0a, 0x03, 0x64, 0x61, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, + 0x64, 0x61, 0x79, 0x22, 0x3e, 0x0a, 0x12, 0x44, 0x61, 0x74, 0x61, 0x48, 0x65, 0x69, 0x67, 0x68, + 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x64, 0x61, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x64, 0x61, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x68, + 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x68, 0x65, 0x69, + 0x67, 0x68, 0x74, 0x22, 0x83, 0x02, 0x0a, 0x14, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x50, + 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, + 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x70, 0x5f, 0x70, 0x6f, 0x77, + 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x70, 0x50, 0x6f, 0x77, 0x65, + 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x70, 0x6f, 0x77, 0x65, + 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x50, + 0x6f, 0x77, 0x65, 0x72, 0x12, 0x2c, 0x0a, 0x12, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x68, 0x6f, + 0x6c, 0x64, 0x65, 0x72, 0x5f, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x10, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x48, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x50, 0x6f, 0x77, + 0x65, 0x72, 0x12, 0x27, 0x0a, 0x0f, 0x64, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x5f, + 0x70, 0x6f, 0x77, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x64, 0x65, 0x76, + 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x62, + 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x19, + 0x0a, 0x08, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x73, 0x74, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x07, 0x64, 0x61, 0x74, 0x65, 0x53, 0x74, 0x72, 0x22, 0x1a, 0x0a, 0x18, 0x53, 0x79, 0x6e, + 0x63, 0x41, 0x6c, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x18, 0x0a, 0x16, 0x53, 0x79, 0x6e, 0x63, 0x44, 0x61, 0x74, + 0x65, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x17, 0x0a, 0x15, 0x53, 0x79, 0x6e, 0x63, 0x41, 0x64, 0x64, 0x72, 0x50, 0x6f, 0x77, 0x65, 0x72, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1f, 0x0a, 0x1d, 0x53, 0x79, 0x6e, 0x63, + 0x41, 0x6c, 0x6c, 0x44, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x57, 0x65, 0x69, 0x67, + 0x68, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x20, 0x0a, 0x1e, 0x53, 0x79, 0x6e, + 0x63, 0x41, 0x6c, 0x6c, 0x44, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x57, 0x65, 0x69, + 0x67, 0x68, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x37, 0x0a, 0x1a, 0x53, + 0x79, 0x6e, 0x63, 0x44, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x57, 0x65, 0x69, 0x67, + 0x68, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x64, 0x61, 0x74, + 0x65, 0x5f, 0x73, 0x74, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x64, 0x61, 0x74, + 0x65, 0x53, 0x74, 0x72, 0x22, 0x1d, 0x0a, 0x1b, 0x53, 0x79, 0x6e, 0x63, 0x44, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x37, 0x0a, 0x1a, 0x53, 0x79, 0x6e, 0x63, 0x44, 0x65, 0x76, 0x65, 0x6c, - 0x6f, 0x70, 0x65, 0x72, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x19, 0x0a, 0x08, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x73, 0x74, 0x72, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x07, 0x64, 0x61, 0x74, 0x65, 0x53, 0x74, 0x72, 0x22, 0x1d, 0x0a, 0x1b, - 0x53, 0x79, 0x6e, 0x63, 0x44, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x57, 0x65, 0x69, - 0x67, 0x68, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xbb, 0x04, 0x0a, 0x08, - 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x12, 0x52, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x41, - 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x12, 0x1d, 0x2e, 0x73, 0x6e, + 0x6e, 0x73, 0x65, 0x32, 0xd0, 0x06, 0x0a, 0x08, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, + 0x12, 0x52, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x50, 0x6f, + 0x77, 0x65, 0x72, 0x12, 0x1d, 0x2e, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x2e, 0x41, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x2e, 0x41, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x00, 0x12, 0x55, 0x0a, 0x0e, 0x53, 0x79, 0x6e, 0x63, 0x44, 0x61, 0x74, 0x65, + 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x1f, 0x2e, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, + 0x74, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x44, 0x61, 0x74, 0x65, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, + 0x6f, 0x74, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x44, 0x61, 0x74, 0x65, 0x48, 0x65, 0x69, 0x67, 0x68, + 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x52, 0x0a, 0x0d, 0x53, + 0x79, 0x6e, 0x63, 0x41, 0x64, 0x64, 0x72, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x12, 0x1e, 0x2e, 0x73, + 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x41, 0x64, 0x64, 0x72, + 0x50, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x73, + 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x41, 0x64, 0x64, 0x72, + 0x50, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, + 0x5b, 0x0a, 0x10, 0x53, 0x79, 0x6e, 0x63, 0x41, 0x6c, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x50, 0x6f, + 0x77, 0x65, 0x72, 0x12, 0x21, 0x2e, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x2e, 0x53, + 0x79, 0x6e, 0x63, 0x41, 0x6c, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, + 0x74, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x41, 0x6c, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x50, 0x6f, 0x77, + 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x6d, 0x0a, 0x16, + 0x53, 0x79, 0x6e, 0x63, 0x41, 0x6c, 0x6c, 0x44, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, + 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x27, 0x2e, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, + 0x74, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x41, 0x6c, 0x6c, 0x44, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, + 0x65, 0x72, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x28, 0x2e, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x41, + 0x6c, 0x6c, 0x44, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x57, 0x65, 0x69, 0x67, 0x68, + 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x64, 0x0a, 0x13, 0x53, + 0x79, 0x6e, 0x63, 0x44, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x57, 0x65, 0x69, 0x67, + 0x68, 0x74, 0x12, 0x24, 0x2e, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x2e, 0x53, 0x79, + 0x6e, 0x63, 0x44, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x57, 0x65, 0x69, 0x67, 0x68, + 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x73, 0x6e, 0x61, 0x70, 0x73, + 0x68, 0x6f, 0x74, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x44, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, + 0x72, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x00, 0x12, 0x4c, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x44, 0x61, 0x74, 0x61, 0x48, 0x65, 0x69, 0x67, + 0x68, 0x74, 0x12, 0x1b, 0x2e, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x2e, 0x44, 0x61, + 0x74, 0x61, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x1c, 0x2e, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x48, + 0x65, 0x69, 0x67, 0x68, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, + 0x5c, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x50, 0x6f, 0x77, + 0x65, 0x72, 0x42, 0x79, 0x44, 0x61, 0x79, 0x12, 0x22, 0x2e, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, + 0x6f, 0x74, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x42, + 0x79, 0x44, 0x61, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x50, 0x6f, - 0x77, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x73, 0x6e, 0x61, - 0x70, 0x73, 0x68, 0x6f, 0x74, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x50, 0x6f, 0x77, - 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x55, 0x0a, 0x0e, - 0x53, 0x79, 0x6e, 0x63, 0x44, 0x61, 0x74, 0x65, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x1f, - 0x2e, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x44, 0x61, - 0x74, 0x65, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x20, 0x2e, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x44, - 0x61, 0x74, 0x65, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x00, 0x12, 0x52, 0x0a, 0x0d, 0x53, 0x79, 0x6e, 0x63, 0x41, 0x64, 0x64, 0x72, 0x50, - 0x6f, 0x77, 0x65, 0x72, 0x12, 0x1e, 0x2e, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x2e, - 0x53, 0x79, 0x6e, 0x63, 0x41, 0x64, 0x64, 0x72, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x2e, - 0x53, 0x79, 0x6e, 0x63, 0x41, 0x64, 0x64, 0x72, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x5b, 0x0a, 0x10, 0x53, 0x79, 0x6e, 0x63, 0x41, - 0x6c, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x12, 0x21, 0x2e, 0x73, 0x6e, - 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x41, 0x6c, 0x6c, 0x41, 0x64, - 0x64, 0x72, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, - 0x2e, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x41, 0x6c, - 0x6c, 0x41, 0x64, 0x64, 0x72, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x00, 0x12, 0x6d, 0x0a, 0x16, 0x53, 0x79, 0x6e, 0x63, 0x41, 0x6c, 0x6c, 0x44, - 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x27, - 0x2e, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x41, 0x6c, - 0x6c, 0x44, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, - 0x6f, 0x74, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x41, 0x6c, 0x6c, 0x44, 0x65, 0x76, 0x65, 0x6c, 0x6f, - 0x70, 0x65, 0x72, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x00, 0x12, 0x64, 0x0a, 0x13, 0x53, 0x79, 0x6e, 0x63, 0x44, 0x65, 0x76, 0x65, 0x6c, - 0x6f, 0x70, 0x65, 0x72, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x24, 0x2e, 0x73, 0x6e, 0x61, - 0x70, 0x73, 0x68, 0x6f, 0x74, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x44, 0x65, 0x76, 0x65, 0x6c, 0x6f, - 0x70, 0x65, 0x72, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x25, 0x2e, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x2e, 0x53, 0x79, 0x6e, 0x63, - 0x44, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x12, 0x5a, 0x10, 0x2e, 0x2f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x3b, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x77, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x67, 0x0a, + 0x14, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x50, 0x6f, 0x77, 0x65, 0x72, + 0x42, 0x79, 0x44, 0x61, 0x79, 0x12, 0x25, 0x2e, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, + 0x2e, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x50, 0x6f, 0x77, 0x65, 0x72, + 0x42, 0x79, 0x44, 0x61, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x73, + 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x41, 0x64, + 0x64, 0x72, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x42, 0x79, 0x44, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x12, 0x5a, 0x10, 0x2e, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x3b, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( - file_proto_query_proto_rawDescOnce sync.Once - file_proto_query_proto_rawDescData = file_proto_query_proto_rawDesc + file_query_proto_rawDescOnce sync.Once + file_query_proto_rawDescData = file_query_proto_rawDesc ) -func file_proto_query_proto_rawDescGZIP() []byte { - file_proto_query_proto_rawDescOnce.Do(func() { - file_proto_query_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_query_proto_rawDescData) +func file_query_proto_rawDescGZIP() []byte { + file_query_proto_rawDescOnce.Do(func() { + file_query_proto_rawDescData = protoimpl.X.CompressGZIP(file_query_proto_rawDescData) }) - return file_proto_query_proto_rawDescData -} - -var file_proto_query_proto_msgTypes = make([]protoimpl.MessageInfo, 12) -var file_proto_query_proto_goTypes = []any{ - (*SyncAllAddrPowerRequest)(nil), // 0: snapshot.SyncAllAddrPowerRequest - (*AddressPowerRequest)(nil), // 1: snapshot.AddressPowerRequest - (*SyncDateHeightRequest)(nil), // 2: snapshot.SyncDateHeightRequest - (*SyncAddrPowerRequest)(nil), // 3: snapshot.SyncAddrPowerRequest - (*AddressPowerResponse)(nil), // 4: snapshot.AddressPowerResponse - (*SyncAllAddrPowerResponse)(nil), // 5: snapshot.SyncAllAddrPowerResponse - (*SyncDateHeightResponse)(nil), // 6: snapshot.SyncDateHeightResponse - (*SyncAddrPowerResponse)(nil), // 7: snapshot.SyncAddrPowerResponse - (*SyncAllDeveloperWeightRequest)(nil), // 8: snapshot.SyncAllDeveloperWeightRequest - (*SyncAllDeveloperWeightResponse)(nil), // 9: snapshot.SyncAllDeveloperWeightResponse - (*SyncDeveloperWeightRequest)(nil), // 10: snapshot.SyncDeveloperWeightRequest - (*SyncDeveloperWeightResponse)(nil), // 11: snapshot.SyncDeveloperWeightResponse -} -var file_proto_query_proto_depIdxs = []int32{ - 1, // 0: snapshot.Snapshot.GetAddressPower:input_type -> snapshot.AddressPowerRequest - 2, // 1: snapshot.Snapshot.SyncDateHeight:input_type -> snapshot.SyncDateHeightRequest - 3, // 2: snapshot.Snapshot.SyncAddrPower:input_type -> snapshot.SyncAddrPowerRequest - 0, // 3: snapshot.Snapshot.SyncAllAddrPower:input_type -> snapshot.SyncAllAddrPowerRequest - 8, // 4: snapshot.Snapshot.SyncAllDeveloperWeight:input_type -> snapshot.SyncAllDeveloperWeightRequest - 10, // 5: snapshot.Snapshot.SyncDeveloperWeight:input_type -> snapshot.SyncDeveloperWeightRequest - 4, // 6: snapshot.Snapshot.GetAddressPower:output_type -> snapshot.AddressPowerResponse - 6, // 7: snapshot.Snapshot.SyncDateHeight:output_type -> snapshot.SyncDateHeightResponse - 7, // 8: snapshot.Snapshot.SyncAddrPower:output_type -> snapshot.SyncAddrPowerResponse - 5, // 9: snapshot.Snapshot.SyncAllAddrPower:output_type -> snapshot.SyncAllAddrPowerResponse - 9, // 10: snapshot.Snapshot.SyncAllDeveloperWeight:output_type -> snapshot.SyncAllDeveloperWeightResponse - 11, // 11: snapshot.Snapshot.SyncDeveloperWeight:output_type -> snapshot.SyncDeveloperWeightResponse - 6, // [6:12] is the sub-list for method output_type - 0, // [0:6] is the sub-list for method input_type + return file_query_proto_rawDescData +} + +var file_query_proto_msgTypes = make([]protoimpl.MessageInfo, 17) +var file_query_proto_goTypes = []any{ + (*GetAllAddrPowerByDayRequest)(nil), // 0: snapshot.GetAllAddrPowerByDayRequest + (*GetAllAddrPowerByDayResponse)(nil), // 1: snapshot.GetAllAddrPowerByDayResponse + (*SyncAllAddrPowerRequest)(nil), // 2: snapshot.SyncAllAddrPowerRequest + (*AddressPowerRequest)(nil), // 3: snapshot.AddressPowerRequest + (*SyncDateHeightRequest)(nil), // 4: snapshot.SyncDateHeightRequest + (*SyncAddrPowerRequest)(nil), // 5: snapshot.SyncAddrPowerRequest + (*DataHeightRequest)(nil), // 6: snapshot.DataHeightRequest + (*AddressPowerByDayRequest)(nil), // 7: snapshot.AddressPowerByDayRequest + (*DataHeightResponse)(nil), // 8: snapshot.DataHeightResponse + (*AddressPowerResponse)(nil), // 9: snapshot.AddressPowerResponse + (*SyncAllAddrPowerResponse)(nil), // 10: snapshot.SyncAllAddrPowerResponse + (*SyncDateHeightResponse)(nil), // 11: snapshot.SyncDateHeightResponse + (*SyncAddrPowerResponse)(nil), // 12: snapshot.SyncAddrPowerResponse + (*SyncAllDeveloperWeightRequest)(nil), // 13: snapshot.SyncAllDeveloperWeightRequest + (*SyncAllDeveloperWeightResponse)(nil), // 14: snapshot.SyncAllDeveloperWeightResponse + (*SyncDeveloperWeightRequest)(nil), // 15: snapshot.SyncDeveloperWeightRequest + (*SyncDeveloperWeightResponse)(nil), // 16: snapshot.SyncDeveloperWeightResponse +} +var file_query_proto_depIdxs = []int32{ + 3, // 0: snapshot.Snapshot.GetAddressPower:input_type -> snapshot.AddressPowerRequest + 4, // 1: snapshot.Snapshot.SyncDateHeight:input_type -> snapshot.SyncDateHeightRequest + 5, // 2: snapshot.Snapshot.SyncAddrPower:input_type -> snapshot.SyncAddrPowerRequest + 2, // 3: snapshot.Snapshot.SyncAllAddrPower:input_type -> snapshot.SyncAllAddrPowerRequest + 13, // 4: snapshot.Snapshot.SyncAllDeveloperWeight:input_type -> snapshot.SyncAllDeveloperWeightRequest + 15, // 5: snapshot.Snapshot.SyncDeveloperWeight:input_type -> snapshot.SyncDeveloperWeightRequest + 6, // 6: snapshot.Snapshot.GetDataHeight:input_type -> snapshot.DataHeightRequest + 7, // 7: snapshot.Snapshot.GetAddressPowerByDay:input_type -> snapshot.AddressPowerByDayRequest + 0, // 8: snapshot.Snapshot.GetAllAddrPowerByDay:input_type -> snapshot.GetAllAddrPowerByDayRequest + 9, // 9: snapshot.Snapshot.GetAddressPower:output_type -> snapshot.AddressPowerResponse + 11, // 10: snapshot.Snapshot.SyncDateHeight:output_type -> snapshot.SyncDateHeightResponse + 12, // 11: snapshot.Snapshot.SyncAddrPower:output_type -> snapshot.SyncAddrPowerResponse + 10, // 12: snapshot.Snapshot.SyncAllAddrPower:output_type -> snapshot.SyncAllAddrPowerResponse + 14, // 13: snapshot.Snapshot.SyncAllDeveloperWeight:output_type -> snapshot.SyncAllDeveloperWeightResponse + 16, // 14: snapshot.Snapshot.SyncDeveloperWeight:output_type -> snapshot.SyncDeveloperWeightResponse + 8, // 15: snapshot.Snapshot.GetDataHeight:output_type -> snapshot.DataHeightResponse + 9, // 16: snapshot.Snapshot.GetAddressPowerByDay:output_type -> snapshot.AddressPowerResponse + 1, // 17: snapshot.Snapshot.GetAllAddrPowerByDay:output_type -> snapshot.GetAllAddrPowerByDayResponse + 9, // [9:18] is the sub-list for method output_type + 0, // [0:9] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name 0, // [0:0] is the sub-list for extension extendee 0, // [0:0] is the sub-list for field type_name } -func init() { file_proto_query_proto_init() } -func file_proto_query_proto_init() { - if File_proto_query_proto != nil { +func init() { file_query_proto_init() } +func file_query_proto_init() { + if File_query_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_proto_query_proto_msgTypes[0].Exporter = func(v any, i int) any { - switch v := v.(*SyncAllAddrPowerRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_query_proto_msgTypes[1].Exporter = func(v any, i int) any { - switch v := v.(*AddressPowerRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_query_proto_msgTypes[2].Exporter = func(v any, i int) any { - switch v := v.(*SyncDateHeightRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_query_proto_msgTypes[3].Exporter = func(v any, i int) any { - switch v := v.(*SyncAddrPowerRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_query_proto_msgTypes[4].Exporter = func(v any, i int) any { - switch v := v.(*AddressPowerResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_query_proto_msgTypes[5].Exporter = func(v any, i int) any { - switch v := v.(*SyncAllAddrPowerResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_query_proto_msgTypes[6].Exporter = func(v any, i int) any { - switch v := v.(*SyncDateHeightResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_query_proto_msgTypes[7].Exporter = func(v any, i int) any { - switch v := v.(*SyncAddrPowerResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_query_proto_msgTypes[8].Exporter = func(v any, i int) any { - switch v := v.(*SyncAllDeveloperWeightRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_query_proto_msgTypes[9].Exporter = func(v any, i int) any { - switch v := v.(*SyncAllDeveloperWeightResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_query_proto_msgTypes[10].Exporter = func(v any, i int) any { - switch v := v.(*SyncDeveloperWeightRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_proto_query_proto_msgTypes[11].Exporter = func(v any, i int) any { - switch v := v.(*SyncDeveloperWeightResponse); 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{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_proto_query_proto_rawDesc, + RawDescriptor: file_query_proto_rawDesc, NumEnums: 0, - NumMessages: 12, + NumMessages: 17, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_proto_query_proto_goTypes, - DependencyIndexes: file_proto_query_proto_depIdxs, - MessageInfos: file_proto_query_proto_msgTypes, + GoTypes: file_query_proto_goTypes, + DependencyIndexes: file_query_proto_depIdxs, + MessageInfos: file_query_proto_msgTypes, }.Build() - File_proto_query_proto = out.File - file_proto_query_proto_rawDesc = nil - file_proto_query_proto_goTypes = nil - file_proto_query_proto_depIdxs = nil + File_query_proto = out.File + file_query_proto_rawDesc = nil + file_query_proto_goTypes = nil + file_query_proto_depIdxs = nil } diff --git a/power-snapshot/api/proto/query.proto b/power-snapshot/api/proto/query.proto index 44eaa8c..184142b 100644 --- a/power-snapshot/api/proto/query.proto +++ b/power-snapshot/api/proto/query.proto @@ -25,6 +25,20 @@ service Snapshot { rpc SyncAllAddrPower(SyncAllAddrPowerRequest) returns (SyncAllAddrPowerResponse){} rpc SyncAllDeveloperWeight(SyncAllDeveloperWeightRequest) returns (SyncAllDeveloperWeightResponse) {} rpc SyncDeveloperWeight(SyncDeveloperWeightRequest) returns (SyncDeveloperWeightResponse) {} + rpc GetDataHeight(DataHeightRequest) returns (DataHeightResponse) {} + rpc GetAddressPowerByDay(AddressPowerByDayRequest) returns (AddressPowerResponse) {} + rpc GetAllAddrPowerByDay(GetAllAddrPowerByDayRequest) returns (GetAllAddrPowerByDayResponse) {} +} + +message GetAllAddrPowerByDayRequest { + string day = 1; + int64 netId = 2; +} + +message GetAllAddrPowerByDayResponse { + string day = 1; + string info = 3; + int64 netId = 4; } message SyncAllAddrPowerRequest { @@ -46,6 +60,22 @@ message SyncAddrPowerRequest { string address = 2; } +message DataHeightRequest{ + int64 netId = 1; + string day = 2; +} + +message AddressPowerByDayRequest{ + int64 netId = 1; + string address = 2; + string day = 3; +} + +message DataHeightResponse { + string day = 1; + int64 height = 2; +} + message AddressPowerResponse { string address = 1; string sp_power = 2; diff --git a/power-snapshot/api/proto/query_grpc.pb.go b/power-snapshot/api/proto/query_grpc.pb.go index ecb1273..6d93f38 100644 --- a/power-snapshot/api/proto/query_grpc.pb.go +++ b/power-snapshot/api/proto/query_grpc.pb.go @@ -12,6 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc v5.28.2 +// source: query.proto + package snapshot import ( @@ -23,8 +29,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( Snapshot_GetAddressPower_FullMethodName = "/snapshot.Snapshot/GetAddressPower" @@ -33,6 +39,9 @@ const ( Snapshot_SyncAllAddrPower_FullMethodName = "/snapshot.Snapshot/SyncAllAddrPower" Snapshot_SyncAllDeveloperWeight_FullMethodName = "/snapshot.Snapshot/SyncAllDeveloperWeight" Snapshot_SyncDeveloperWeight_FullMethodName = "/snapshot.Snapshot/SyncDeveloperWeight" + Snapshot_GetDataHeight_FullMethodName = "/snapshot.Snapshot/GetDataHeight" + Snapshot_GetAddressPowerByDay_FullMethodName = "/snapshot.Snapshot/GetAddressPowerByDay" + Snapshot_GetAllAddrPowerByDay_FullMethodName = "/snapshot.Snapshot/GetAllAddrPowerByDay" ) // SnapshotClient is the client API for Snapshot service. @@ -45,6 +54,9 @@ type SnapshotClient interface { SyncAllAddrPower(ctx context.Context, in *SyncAllAddrPowerRequest, opts ...grpc.CallOption) (*SyncAllAddrPowerResponse, error) SyncAllDeveloperWeight(ctx context.Context, in *SyncAllDeveloperWeightRequest, opts ...grpc.CallOption) (*SyncAllDeveloperWeightResponse, error) SyncDeveloperWeight(ctx context.Context, in *SyncDeveloperWeightRequest, opts ...grpc.CallOption) (*SyncDeveloperWeightResponse, error) + GetDataHeight(ctx context.Context, in *DataHeightRequest, opts ...grpc.CallOption) (*DataHeightResponse, error) + GetAddressPowerByDay(ctx context.Context, in *AddressPowerByDayRequest, opts ...grpc.CallOption) (*AddressPowerResponse, error) + GetAllAddrPowerByDay(ctx context.Context, in *GetAllAddrPowerByDayRequest, opts ...grpc.CallOption) (*GetAllAddrPowerByDayResponse, error) } type snapshotClient struct { @@ -115,9 +127,39 @@ func (c *snapshotClient) SyncDeveloperWeight(ctx context.Context, in *SyncDevelo return out, nil } +func (c *snapshotClient) GetDataHeight(ctx context.Context, in *DataHeightRequest, opts ...grpc.CallOption) (*DataHeightResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(DataHeightResponse) + err := c.cc.Invoke(ctx, Snapshot_GetDataHeight_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *snapshotClient) GetAddressPowerByDay(ctx context.Context, in *AddressPowerByDayRequest, opts ...grpc.CallOption) (*AddressPowerResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(AddressPowerResponse) + err := c.cc.Invoke(ctx, Snapshot_GetAddressPowerByDay_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *snapshotClient) GetAllAddrPowerByDay(ctx context.Context, in *GetAllAddrPowerByDayRequest, opts ...grpc.CallOption) (*GetAllAddrPowerByDayResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetAllAddrPowerByDayResponse) + err := c.cc.Invoke(ctx, Snapshot_GetAllAddrPowerByDay_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + // SnapshotServer is the server API for Snapshot service. // All implementations must embed UnimplementedSnapshotServer -// for forward compatibility +// for forward compatibility. type SnapshotServer interface { GetAddressPower(context.Context, *AddressPowerRequest) (*AddressPowerResponse, error) SyncDateHeight(context.Context, *SyncDateHeightRequest) (*SyncDateHeightResponse, error) @@ -125,12 +167,18 @@ type SnapshotServer interface { SyncAllAddrPower(context.Context, *SyncAllAddrPowerRequest) (*SyncAllAddrPowerResponse, error) SyncAllDeveloperWeight(context.Context, *SyncAllDeveloperWeightRequest) (*SyncAllDeveloperWeightResponse, error) SyncDeveloperWeight(context.Context, *SyncDeveloperWeightRequest) (*SyncDeveloperWeightResponse, error) + GetDataHeight(context.Context, *DataHeightRequest) (*DataHeightResponse, error) + GetAddressPowerByDay(context.Context, *AddressPowerByDayRequest) (*AddressPowerResponse, error) + GetAllAddrPowerByDay(context.Context, *GetAllAddrPowerByDayRequest) (*GetAllAddrPowerByDayResponse, error) mustEmbedUnimplementedSnapshotServer() } -// UnimplementedSnapshotServer must be embedded to have forward compatible implementations. -type UnimplementedSnapshotServer struct { -} +// UnimplementedSnapshotServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedSnapshotServer struct{} func (UnimplementedSnapshotServer) GetAddressPower(context.Context, *AddressPowerRequest) (*AddressPowerResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetAddressPower not implemented") @@ -150,6 +198,15 @@ func (UnimplementedSnapshotServer) SyncAllDeveloperWeight(context.Context, *Sync func (UnimplementedSnapshotServer) SyncDeveloperWeight(context.Context, *SyncDeveloperWeightRequest) (*SyncDeveloperWeightResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method SyncDeveloperWeight not implemented") } +func (UnimplementedSnapshotServer) GetDataHeight(context.Context, *DataHeightRequest) (*DataHeightResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetDataHeight not implemented") +} +func (UnimplementedSnapshotServer) GetAddressPowerByDay(context.Context, *AddressPowerByDayRequest) (*AddressPowerResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetAddressPowerByDay not implemented") +} +func (UnimplementedSnapshotServer) GetAllAddrPowerByDay(context.Context, *GetAllAddrPowerByDayRequest) (*GetAllAddrPowerByDayResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetAllAddrPowerByDay not implemented") +} func (UnimplementedSnapshotServer) mustEmbedUnimplementedSnapshotServer() {} // UnsafeSnapshotServer may be embedded to opt out of forward compatibility for this service. @@ -271,6 +328,60 @@ func _Snapshot_SyncDeveloperWeight_Handler(srv interface{}, ctx context.Context, return interceptor(ctx, in, info, handler) } +func _Snapshot_GetDataHeight_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DataHeightRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SnapshotServer).GetDataHeight(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Snapshot_GetDataHeight_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SnapshotServer).GetDataHeight(ctx, req.(*DataHeightRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Snapshot_GetAddressPowerByDay_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AddressPowerByDayRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SnapshotServer).GetAddressPowerByDay(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Snapshot_GetAddressPowerByDay_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SnapshotServer).GetAddressPowerByDay(ctx, req.(*AddressPowerByDayRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Snapshot_GetAllAddrPowerByDay_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetAllAddrPowerByDayRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SnapshotServer).GetAllAddrPowerByDay(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Snapshot_GetAllAddrPowerByDay_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SnapshotServer).GetAllAddrPowerByDay(ctx, req.(*GetAllAddrPowerByDayRequest)) + } + return interceptor(ctx, in, info, handler) +} + // Snapshot_ServiceDesc is the grpc.ServiceDesc for Snapshot service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -302,7 +413,19 @@ var Snapshot_ServiceDesc = grpc.ServiceDesc{ MethodName: "SyncDeveloperWeight", Handler: _Snapshot_SyncDeveloperWeight_Handler, }, + { + MethodName: "GetDataHeight", + Handler: _Snapshot_GetDataHeight_Handler, + }, + { + MethodName: "GetAddressPowerByDay", + Handler: _Snapshot_GetAddressPowerByDay_Handler, + }, + { + MethodName: "GetAllAddrPowerByDay", + Handler: _Snapshot_GetAllAddrPowerByDay_Handler, + }, }, Streams: []grpc.StreamDesc{}, - Metadata: "proto/query.proto", + Metadata: "query.proto", } diff --git a/power-snapshot/go.mod b/power-snapshot/go.mod index aba7f54..fbd0e3b 100644 --- a/power-snapshot/go.mod +++ b/power-snapshot/go.mod @@ -78,7 +78,6 @@ require ( github.com/spf13/afero v1.11.0 // indirect github.com/spf13/cast v1.6.0 // indirect github.com/spf13/pflag v1.0.5 // indirect - github.com/stretchr/objx v0.5.2 // indirect github.com/subosito/gotenv v1.6.0 // indirect github.com/supranational/blst v0.3.11 // indirect github.com/tklauser/go-sysconf v0.3.12 // indirect diff --git a/power-snapshot/handler/snapshot.go b/power-snapshot/handler/snapshot.go index 711aee3..ce6090e 100644 --- a/power-snapshot/handler/snapshot.go +++ b/power-snapshot/handler/snapshot.go @@ -16,6 +16,9 @@ package handler import ( "context" + "encoding/json" + + "github.com/golang-module/carbon" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -53,6 +56,55 @@ func (s *Snapshot) GetAddressPower(ctx context.Context, req *pb.AddressPowerRequ }, nil } +func (s *Snapshot) GetAddressPowerByDay(ctx context.Context, req *pb.AddressPowerByDayRequest) (*pb.AddressPowerResponse, error) { + day := req.GetDay() + dayTime := carbon.Parse(day).EndOfDay().ToStdTime() + m, err := s.querySrv.GetAddressPowerByDay(ctx, req.GetNetId(), req.GetAddress(), day, dayTime) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &pb.AddressPowerResponse{ + Address: m.Address, + SpPower: m.SpPower.String(), + ClientPower: m.ClientPower.String(), + TokenHolderPower: m.TokenHolderPower.String(), + DeveloperPower: m.DeveloperPower.String(), + BlockHeight: m.BlockHeight, + DateStr: m.DateStr, + }, nil +} + +func (s *Snapshot) GetDataHeight(_ context.Context, req *pb.DataHeightRequest) (*pb.DataHeightResponse, error) { + height, err := s.querySrv.GetDataHeight(context.Background(), req.GetNetId(), req.GetDay()) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &pb.DataHeightResponse{ + Day: req.GetDay(), + Height: height, + }, nil +} + +func (s *Snapshot) GetAllAddrPowerByDay(_ context.Context, req *pb.GetAllAddrPowerByDayRequest) (*pb.GetAllAddrPowerByDayResponse, error) { + addrPowers, err := s.querySrv.GetAllAddressPowerByDay(context.Background(), req.GetNetId(), req.GetDay()) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + jsonRes, err := json.Marshal(addrPowers) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &pb.GetAllAddrPowerByDayResponse{ + Day: req.Day, + Info: string(jsonRes), + NetId: req.NetId, + }, nil +} + func (s *Snapshot) SyncDateHeight(_ context.Context, req *pb.SyncDateHeightRequest) (*pb.SyncDateHeightResponse, error) { err := s.syncSrv.SyncDateHeight(context.Background(), req.GetNetId()) if err != nil { @@ -89,7 +141,7 @@ func (s *Snapshot) SyncAllDeveloperWeight(context.Context, *pb.SyncAllDeveloperW return &pb.SyncAllDeveloperWeightResponse{}, nil } -func (s *Snapshot) SyncDeveloperPower(ctx context.Context, req *pb.SyncDeveloperWeightRequest) (*pb.SyncDeveloperWeightResponse, error) { +func (s *Snapshot) SyncDeveloperWeight(ctx context.Context, req *pb.SyncDeveloperWeightRequest) (*pb.SyncDeveloperWeightResponse, error) { err := s.syncSrv.SyncDeveloperWeight(context.Background(), req.GetDateStr()) if err != nil { return nil, status.Error(codes.Internal, err.Error()) diff --git a/power-snapshot/internal/model/sync_power.go b/power-snapshot/internal/model/sync_power.go index 850db43..2adbcec 100644 --- a/power-snapshot/internal/model/sync_power.go +++ b/power-snapshot/internal/model/sync_power.go @@ -34,3 +34,8 @@ type AddrInfo struct { MinerIDs []uint64 `json:"minerIDs"` GithubAccount string `json:"githubAccount"` } + +type DayHeight struct { + Day string `json:"day"` + Height int64 `json:"height"` +} diff --git a/power-snapshot/internal/service/query.go b/power-snapshot/internal/service/query.go index 4ef9d10..d485a4e 100644 --- a/power-snapshot/internal/service/query.go +++ b/power-snapshot/internal/service/query.go @@ -16,13 +16,16 @@ package service import ( "context" + "encoding/json" "errors" "fmt" "math/big" "power-snapshot/constant" models "power-snapshot/internal/model" + "time" "github.com/golang-module/carbon" + "github.com/redis/go-redis/v9" "go.uber.org/zap" ) @@ -35,13 +38,15 @@ type QueryService struct { baseRepo BaseRepo queryRepo QueryRepo syncSrv *SyncService + redis *redis.Client } -func NewQueryService(baseRepo BaseRepo, queryRepo QueryRepo, sync *SyncService) *QueryService { +func NewQueryService(baseRepo BaseRepo, queryRepo QueryRepo, sync *SyncService, redis *redis.Client) *QueryService { return &QueryService{ baseRepo: baseRepo, queryRepo: queryRepo, syncSrv: sync, + redis: redis, } } @@ -51,6 +56,14 @@ func (q *QueryService) GetAddressPower(ctx context.Context, netId int64, address } dayStr := carbon.Now().SubDays(int(dayCount)).EndOfDay().ToShortDateString() dayTime := carbon.Now().SubDays(int(dayCount)).EndOfDay().ToStdTime() + res, err := q.GetAddressPowerByDay(ctx, netId, address, dayStr, dayTime) + if err != nil { + return nil, err + } + return res, nil +} + +func (q *QueryService) GetAddressPowerByDay(ctx context.Context, netId int64, address string, dayStr string, dayTime time.Time) (*models.SyncPower, error) { power, err := q.queryRepo.GetAddressPower(ctx, netId, address, dayStr) if err != nil { zap.L().Error("error getting address power ", zap.Error(err)) @@ -186,3 +199,64 @@ func (q *QueryService) GetAddressPower(ctx context.Context, netId int64, address return power, nil } + +func (q *QueryService) GetDataHeight(ctx context.Context, netId int64, dayStr string) (int64, error) { + dh, err := q.baseRepo.GetDateHeightMap(ctx, netId) + if err != nil { + zap.L().Error("error getting date height map", zap.Error(err)) + return 0, err + } + + height, ok := dh[dayStr] + if !ok { + zap.L().Error("fail to get the day height", zap.Error(err)) + return 0, err + } + + return height, nil +} + +func (q *QueryService) GetAllAddressPowerByDay(ctx context.Context, netId int64, dayStr string) (map[string]any, error) { + prefix := fmt.Sprintf("%d_POWER_", netId) + keys, err := q.redis.Keys(ctx, prefix+"*").Result() + if err != nil { + zap.L().Error("fail to get keys", zap.Error(err)) + return nil, err + } + + zap.L().Info("getAllAddressPowerByDay get keys", zap.Any("keys", keys)) + res := make(map[string]any) + + var addrPower []models.SyncPower + for _, key := range keys { + hashValues, err := q.redis.HGetAll(ctx, key).Result() + if err != nil { + zap.L().Error("fail to get power", zap.Error(err)) + return nil, err + } + + for field, value := range hashValues { + if field == dayStr { + power := models.SyncPower{} + err := json.Unmarshal([]byte(value), &power) + if err != nil { + zap.L().Error("fail to get power", zap.Error(err)) + return nil, err + } + + zap.L().Info("getAllAddressPowerByDay get power", zap.Any("power", power)) + addrPower = append(addrPower, power) + } + } + } + + res["addrPower"] = addrPower + devPower, err := q.redis.HGet(ctx, constant.RedisDeveloperPower, dayStr).Result() + if err != nil { + zap.L().Error("fail to get DEV_POWER", zap.Error(err)) + return nil, err + } + + res["devPower"] = devPower + return res, nil +} diff --git a/power-snapshot/main.go b/power-snapshot/main.go index 60646ec..f688d81 100644 --- a/power-snapshot/main.go +++ b/power-snapshot/main.go @@ -103,7 +103,7 @@ func main() { }() } - querySrv := service.NewQueryService(baseRepo, queryRepo, syncSrv) + querySrv := service.NewQueryService(baseRepo, queryRepo, syncSrv, redisClient) // init job jobs := []scheduler.JobInfo{ { diff --git a/powervoting-backend/api/Block.go b/powervoting-backend/api/Block.go new file mode 100644 index 0000000..b51eec0 --- /dev/null +++ b/powervoting-backend/api/Block.go @@ -0,0 +1,47 @@ +package api + +import ( + "math/rand" + "powervoting-server/client" + "powervoting-server/constant" + "powervoting-server/request" + "powervoting-server/response" + + "github.com/gin-gonic/gin" + "github.com/golang-module/carbon" + "go.uber.org/zap" +) + +func GetHeight(c *gin.Context) { + var req request.GetHeightReq + if err := c.ShouldBindQuery(&req); err != nil { + zap.L().Error("get height : ", zap.Error(err)) + response.SystemError(c) + return + } + + num := rand.Intn(int(constant.Period)) + num += 1 + + dayStr := carbon.Now().SubDays(num).EndOfDay().ToShortDateString() + height, err := client.GetDataHeight(req.NetId, dayStr) + if err != nil { + zap.L().Error("get dataheight error : ", zap.Error(err)) + response.SystemError(c) + return + } + + if height == 0 { + zap.L().Error("fail to get dataheight") + response.SystemError(c) + return + } + + res := response.DataHeightRep{ + Day: dayStr, + Height: height, + NetId: req.NetId, + } + + response.SuccessWithData(res, c) +} diff --git a/powervoting-backend/api/Power.go b/powervoting-backend/api/Power.go new file mode 100644 index 0000000..aacc8b9 --- /dev/null +++ b/powervoting-backend/api/Power.go @@ -0,0 +1,37 @@ +package api + +import ( + "powervoting-server/request" + "powervoting-server/response" + + "powervoting-server/client" + + "github.com/gin-gonic/gin" + "go.uber.org/zap" +) + +func GetPower(c *gin.Context) { + var req request.GetPower + if err := c.ShouldBindQuery(&req); err != nil { + zap.L().Error("get req error: ", zap.Error(err)) + response.SystemError(c) + return + } + + power, err := client.GetAddressPowerByDay(req.NetId, req.Address, req.Day) + if err != nil { + zap.L().Error("get req error: ", zap.Error(err)) + response.SystemError(c) + return + } + + res := response.Power{ + DeveloperPower: power.DeveloperPower.String(), + SpPower: power.SpPower.String(), + ClientPower: power.ClientPower.String(), + TokenHolderPower: power.TokenHolderPower.String(), + BlockHeight: power.BlockHeight.String(), + } + + response.SuccessWithData(res, c) +} diff --git a/powervoting-backend/api/proposal.go b/powervoting-backend/api/proposal.go index 91fb0e8..b111413 100644 --- a/powervoting-backend/api/proposal.go +++ b/powervoting-backend/api/proposal.go @@ -127,7 +127,7 @@ func AddDraft(c *gin.Context) { return } } else { - result := db.Engine.Model(model.ProposalDraft{}).Where("chain_id", draft.ChainId).Where("address", draft.Address).Select("Timezone", "Time", "Name", "Descriptions", "Option").Updates(&draft) + result := db.Engine.Model(model.ProposalDraft{}).Where("chain_id", draft.ChainId).Where("address", draft.Address).Select("timezone", "time", "name", "descriptions", "option", "start_time", "exp_time").Updates(&draft) if result.Error != nil { zap.L().Error("update draft error: ", zap.Error(result.Error)) response.SystemError(c) @@ -141,7 +141,7 @@ func AddDraft(c *gin.Context) { func AddProposal(c *gin.Context) { var proposalReq request.Proposal if err := c.ShouldBindJSON(&proposalReq); err != nil { - zap.L().Error("add draft error: ", zap.Error(err)) + zap.L().Error("add proposal error: ", zap.Error(err)) response.SystemError(c) return } @@ -167,15 +167,42 @@ func AddProposal(c *gin.Context) { StartTime: proposalReq.StartTime, ExpTime: proposalReq.ExpTime, CurrentTime: proposalReq.CurrentTime, + VoteCountDay: proposalReq.VoteCountDay, + Height: proposalReq.Height, } result := db.Engine.Model(model.Proposal{}).Create(&proposal) if result.Error != nil { - zap.L().Error("insert draft error: ", zap.Error(result.Error)) + zap.L().Error("insert proposal error: ", zap.Error(result.Error)) response.SystemError(c) return } + // db.Engine.Model(model.SnapshotByDay{}).Where("day", proposal.VoteCountDay).Delete(&model.SnapshotByDay{}) + var existSnapshot model.SnapshotByDay + tx := db.Engine.Model(model.SnapshotByDay{}).Where("day", proposal.VoteCountDay).Find(&existSnapshot) + if tx.Error != nil { + zap.L().Error("fail to get exist power snapshot: ", zap.Error(result.Error)) + response.SystemError(c) + return + } + + if existSnapshot.Id == 0 { + snapshotTask := model.SnapshotByDay{ + Day: proposal.VoteCountDay, + NetId: proposal.Network, + Height: proposal.Height, + } + + res := db.Engine.Model(model.SnapshotByDay{}).Create(&snapshotTask) + if res.Error != nil { + zap.L().Error("add snapshotTask error: ", zap.Error(result.Error)) + response.SystemError(c) + return + } + + } + response.SuccessWithData(true, c) } @@ -300,6 +327,8 @@ func ProposalList(c *gin.Context) { ShowTime: []string{}, Status: v.Status, VoteCount: v.VoteCount, + VoteCountDay: v.VoteCountDay, + Height: v.Height, } startTimeFormat := time.Unix(v.StartTime, 0).In(time.UTC).Format(time.RFC3339) diff --git a/powervoting-backend/client/client.go b/powervoting-backend/client/client.go index 0cbe6e0..9ae39a9 100644 --- a/powervoting-backend/client/client.go +++ b/powervoting-backend/client/client.go @@ -10,6 +10,7 @@ import ( "sync" "time" + "go.uber.org/zap" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" @@ -87,3 +88,67 @@ func ParseAddressPowerResponse(res *pb.AddressPowerResponse) (model.Power, error return power, nil } + +func GetDataHeight(netId int64, day string) (int64, error) { + ctx, cancel := context.WithTimeout(context.Background(), time.Second) + defer cancel() + + req := &pb.DataHeightRequest{ + NetId: netId, + Day: day, + } + + res, err := getClient().GetDataHeight(ctx, req) + if err != nil { + return 0, fmt.Errorf("failed to get address power: %v", err) + } + + return res.Height, nil +} + +func GetAddressPowerByDay(netId int64, address string, day string) (model.Power, error) { + ctx, cancel := context.WithTimeout(context.Background(), time.Second) + defer cancel() + + grpcReq := &pb.AddressPowerByDayRequest{ + NetId: netId, + Address: address, + Day: day, + } + + grpcRes, err := getClient().GetAddressPowerByDay(ctx, grpcReq) + if err != nil { + return model.Power{}, fmt.Errorf("failed to get address power: %v", err) + } + + power, err := ParseAddressPowerResponse(grpcRes) + if err != nil { + return model.Power{}, fmt.Errorf("failed to parse address power response: %v", err) + } + + return power, nil +} + +func GetAllAddressPowerByDay(netId int64, day string) (model.AllPowerByDay, error) { + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) + defer cancel() + + grpcReq := &pb.GetAllAddrPowerByDayRequest{ + NetId: netId, + Day: day, + } + + grpcRes, err := getClient().GetAllAddrPowerByDay(ctx, grpcReq) + if err != nil { + zap.L().Error("failed to get all address power: ", zap.Error(err)) + return model.AllPowerByDay{}, err + } + + powerInfos := model.AllPowerByDay{ + Id: netId, + Day: day, + PowerInfo: grpcRes.Info, + } + + return powerInfos, nil +} diff --git a/powervoting-backend/client/proto/query.pb.go b/powervoting-backend/client/proto/query.pb.go index a4e1e5b..0bfa817 100644 --- a/powervoting-backend/client/proto/query.pb.go +++ b/powervoting-backend/client/proto/query.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.32.0 -// protoc v3.21.7 +// protoc-gen-go v1.35.1 +// protoc v5.28.2 // source: query.proto package snapshot @@ -20,6 +20,287 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +type GetAllAddrPowerByDayRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Day string `protobuf:"bytes,1,opt,name=day,proto3" json:"day,omitempty"` + NetId int64 `protobuf:"varint,2,opt,name=netId,proto3" json:"netId,omitempty"` +} + +func (x *GetAllAddrPowerByDayRequest) Reset() { + *x = GetAllAddrPowerByDayRequest{} + mi := &file_query_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetAllAddrPowerByDayRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetAllAddrPowerByDayRequest) ProtoMessage() {} + +func (x *GetAllAddrPowerByDayRequest) ProtoReflect() protoreflect.Message { + mi := &file_query_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetAllAddrPowerByDayRequest.ProtoReflect.Descriptor instead. +func (*GetAllAddrPowerByDayRequest) Descriptor() ([]byte, []int) { + return file_query_proto_rawDescGZIP(), []int{0} +} + +func (x *GetAllAddrPowerByDayRequest) GetDay() string { + if x != nil { + return x.Day + } + return "" +} + +func (x *GetAllAddrPowerByDayRequest) GetNetId() int64 { + if x != nil { + return x.NetId + } + return 0 +} + +type GetAllAddrPowerByDayResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Day string `protobuf:"bytes,1,opt,name=day,proto3" json:"day,omitempty"` + Info string `protobuf:"bytes,3,opt,name=info,proto3" json:"info,omitempty"` + NetId int64 `protobuf:"varint,4,opt,name=netId,proto3" json:"netId,omitempty"` +} + +func (x *GetAllAddrPowerByDayResponse) Reset() { + *x = GetAllAddrPowerByDayResponse{} + mi := &file_query_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetAllAddrPowerByDayResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetAllAddrPowerByDayResponse) ProtoMessage() {} + +func (x *GetAllAddrPowerByDayResponse) ProtoReflect() protoreflect.Message { + mi := &file_query_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetAllAddrPowerByDayResponse.ProtoReflect.Descriptor instead. +func (*GetAllAddrPowerByDayResponse) Descriptor() ([]byte, []int) { + return file_query_proto_rawDescGZIP(), []int{1} +} + +func (x *GetAllAddrPowerByDayResponse) GetDay() string { + if x != nil { + return x.Day + } + return "" +} + +func (x *GetAllAddrPowerByDayResponse) GetInfo() string { + if x != nil { + return x.Info + } + return "" +} + +func (x *GetAllAddrPowerByDayResponse) GetNetId() int64 { + if x != nil { + return x.NetId + } + return 0 +} + +type DataHeightRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NetId int64 `protobuf:"varint,1,opt,name=netId,proto3" json:"netId,omitempty"` + Day string `protobuf:"bytes,2,opt,name=day,proto3" json:"day,omitempty"` +} + +func (x *DataHeightRequest) Reset() { + *x = DataHeightRequest{} + mi := &file_query_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DataHeightRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DataHeightRequest) ProtoMessage() {} + +func (x *DataHeightRequest) ProtoReflect() protoreflect.Message { + mi := &file_query_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DataHeightRequest.ProtoReflect.Descriptor instead. +func (*DataHeightRequest) Descriptor() ([]byte, []int) { + return file_query_proto_rawDescGZIP(), []int{2} +} + +func (x *DataHeightRequest) GetNetId() int64 { + if x != nil { + return x.NetId + } + return 0 +} + +func (x *DataHeightRequest) GetDay() string { + if x != nil { + return x.Day + } + return "" +} + +type AddressPowerByDayRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NetId int64 `protobuf:"varint,1,opt,name=netId,proto3" json:"netId,omitempty"` + Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` + Day string `protobuf:"bytes,3,opt,name=day,proto3" json:"day,omitempty"` +} + +func (x *AddressPowerByDayRequest) Reset() { + *x = AddressPowerByDayRequest{} + mi := &file_query_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AddressPowerByDayRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddressPowerByDayRequest) ProtoMessage() {} + +func (x *AddressPowerByDayRequest) ProtoReflect() protoreflect.Message { + mi := &file_query_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AddressPowerByDayRequest.ProtoReflect.Descriptor instead. +func (*AddressPowerByDayRequest) Descriptor() ([]byte, []int) { + return file_query_proto_rawDescGZIP(), []int{3} +} + +func (x *AddressPowerByDayRequest) GetNetId() int64 { + if x != nil { + return x.NetId + } + return 0 +} + +func (x *AddressPowerByDayRequest) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +func (x *AddressPowerByDayRequest) GetDay() string { + if x != nil { + return x.Day + } + return "" +} + +type DataHeightResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Day string `protobuf:"bytes,1,opt,name=day,proto3" json:"day,omitempty"` + Height int64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"` +} + +func (x *DataHeightResponse) Reset() { + *x = DataHeightResponse{} + mi := &file_query_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DataHeightResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DataHeightResponse) ProtoMessage() {} + +func (x *DataHeightResponse) ProtoReflect() protoreflect.Message { + mi := &file_query_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DataHeightResponse.ProtoReflect.Descriptor instead. +func (*DataHeightResponse) Descriptor() ([]byte, []int) { + return file_query_proto_rawDescGZIP(), []int{4} +} + +func (x *DataHeightResponse) GetDay() string { + if x != nil { + return x.Day + } + return "" +} + +func (x *DataHeightResponse) GetHeight() int64 { + if x != nil { + return x.Height + } + return 0 +} + type SyncAllAddrPowerRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -30,11 +311,9 @@ type SyncAllAddrPowerRequest struct { func (x *SyncAllAddrPowerRequest) Reset() { *x = SyncAllAddrPowerRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_query_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_query_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *SyncAllAddrPowerRequest) String() string { @@ -44,8 +323,8 @@ func (x *SyncAllAddrPowerRequest) String() string { func (*SyncAllAddrPowerRequest) ProtoMessage() {} func (x *SyncAllAddrPowerRequest) ProtoReflect() protoreflect.Message { - mi := &file_query_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + mi := &file_query_proto_msgTypes[5] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -57,7 +336,7 @@ func (x *SyncAllAddrPowerRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use SyncAllAddrPowerRequest.ProtoReflect.Descriptor instead. func (*SyncAllAddrPowerRequest) Descriptor() ([]byte, []int) { - return file_query_proto_rawDescGZIP(), []int{0} + return file_query_proto_rawDescGZIP(), []int{5} } func (x *SyncAllAddrPowerRequest) GetNetId() int64 { @@ -79,11 +358,9 @@ type AddressPowerRequest struct { func (x *AddressPowerRequest) Reset() { *x = AddressPowerRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_query_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_query_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *AddressPowerRequest) String() string { @@ -93,8 +370,8 @@ func (x *AddressPowerRequest) String() string { func (*AddressPowerRequest) ProtoMessage() {} func (x *AddressPowerRequest) ProtoReflect() protoreflect.Message { - mi := &file_query_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + mi := &file_query_proto_msgTypes[6] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -106,7 +383,7 @@ func (x *AddressPowerRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use AddressPowerRequest.ProtoReflect.Descriptor instead. func (*AddressPowerRequest) Descriptor() ([]byte, []int) { - return file_query_proto_rawDescGZIP(), []int{1} + return file_query_proto_rawDescGZIP(), []int{6} } func (x *AddressPowerRequest) GetNetId() int64 { @@ -140,11 +417,9 @@ type SyncDateHeightRequest struct { func (x *SyncDateHeightRequest) Reset() { *x = SyncDateHeightRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_query_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_query_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *SyncDateHeightRequest) String() string { @@ -154,8 +429,8 @@ func (x *SyncDateHeightRequest) String() string { func (*SyncDateHeightRequest) ProtoMessage() {} func (x *SyncDateHeightRequest) ProtoReflect() protoreflect.Message { - mi := &file_query_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { + mi := &file_query_proto_msgTypes[7] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -167,7 +442,7 @@ func (x *SyncDateHeightRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use SyncDateHeightRequest.ProtoReflect.Descriptor instead. func (*SyncDateHeightRequest) Descriptor() ([]byte, []int) { - return file_query_proto_rawDescGZIP(), []int{2} + return file_query_proto_rawDescGZIP(), []int{7} } func (x *SyncDateHeightRequest) GetNetId() int64 { @@ -188,11 +463,9 @@ type SyncAddrPowerRequest struct { func (x *SyncAddrPowerRequest) Reset() { *x = SyncAddrPowerRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_query_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_query_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *SyncAddrPowerRequest) String() string { @@ -202,8 +475,8 @@ func (x *SyncAddrPowerRequest) String() string { func (*SyncAddrPowerRequest) ProtoMessage() {} func (x *SyncAddrPowerRequest) ProtoReflect() protoreflect.Message { - mi := &file_query_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { + mi := &file_query_proto_msgTypes[8] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -215,7 +488,7 @@ func (x *SyncAddrPowerRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use SyncAddrPowerRequest.ProtoReflect.Descriptor instead. func (*SyncAddrPowerRequest) Descriptor() ([]byte, []int) { - return file_query_proto_rawDescGZIP(), []int{3} + return file_query_proto_rawDescGZIP(), []int{8} } func (x *SyncAddrPowerRequest) GetNetId() int64 { @@ -248,11 +521,9 @@ type AddressPowerResponse struct { func (x *AddressPowerResponse) Reset() { *x = AddressPowerResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_query_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_query_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *AddressPowerResponse) String() string { @@ -262,8 +533,8 @@ func (x *AddressPowerResponse) String() string { func (*AddressPowerResponse) ProtoMessage() {} func (x *AddressPowerResponse) ProtoReflect() protoreflect.Message { - mi := &file_query_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { + mi := &file_query_proto_msgTypes[9] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -275,7 +546,7 @@ func (x *AddressPowerResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use AddressPowerResponse.ProtoReflect.Descriptor instead. func (*AddressPowerResponse) Descriptor() ([]byte, []int) { - return file_query_proto_rawDescGZIP(), []int{4} + return file_query_proto_rawDescGZIP(), []int{9} } func (x *AddressPowerResponse) GetAddress() string { @@ -335,11 +606,9 @@ type SyncAllAddrPowerResponse struct { func (x *SyncAllAddrPowerResponse) Reset() { *x = SyncAllAddrPowerResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_query_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_query_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *SyncAllAddrPowerResponse) String() string { @@ -349,8 +618,8 @@ func (x *SyncAllAddrPowerResponse) String() string { func (*SyncAllAddrPowerResponse) ProtoMessage() {} func (x *SyncAllAddrPowerResponse) ProtoReflect() protoreflect.Message { - mi := &file_query_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { + mi := &file_query_proto_msgTypes[10] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -362,7 +631,7 @@ func (x *SyncAllAddrPowerResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use SyncAllAddrPowerResponse.ProtoReflect.Descriptor instead. func (*SyncAllAddrPowerResponse) Descriptor() ([]byte, []int) { - return file_query_proto_rawDescGZIP(), []int{5} + return file_query_proto_rawDescGZIP(), []int{10} } type SyncDateHeightResponse struct { @@ -373,11 +642,9 @@ type SyncDateHeightResponse struct { func (x *SyncDateHeightResponse) Reset() { *x = SyncDateHeightResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_query_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_query_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *SyncDateHeightResponse) String() string { @@ -387,8 +654,8 @@ func (x *SyncDateHeightResponse) String() string { func (*SyncDateHeightResponse) ProtoMessage() {} func (x *SyncDateHeightResponse) ProtoReflect() protoreflect.Message { - mi := &file_query_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { + mi := &file_query_proto_msgTypes[11] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -400,7 +667,7 @@ func (x *SyncDateHeightResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use SyncDateHeightResponse.ProtoReflect.Descriptor instead. func (*SyncDateHeightResponse) Descriptor() ([]byte, []int) { - return file_query_proto_rawDescGZIP(), []int{6} + return file_query_proto_rawDescGZIP(), []int{11} } type SyncAddrPowerResponse struct { @@ -411,11 +678,9 @@ type SyncAddrPowerResponse struct { func (x *SyncAddrPowerResponse) Reset() { *x = SyncAddrPowerResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_query_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_query_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *SyncAddrPowerResponse) String() string { @@ -425,8 +690,8 @@ func (x *SyncAddrPowerResponse) String() string { func (*SyncAddrPowerResponse) ProtoMessage() {} func (x *SyncAddrPowerResponse) ProtoReflect() protoreflect.Message { - mi := &file_query_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { + mi := &file_query_proto_msgTypes[12] + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -438,76 +703,118 @@ func (x *SyncAddrPowerResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use SyncAddrPowerResponse.ProtoReflect.Descriptor instead. func (*SyncAddrPowerResponse) Descriptor() ([]byte, []int) { - return file_query_proto_rawDescGZIP(), []int{7} + return file_query_proto_rawDescGZIP(), []int{12} } var File_query_proto protoreflect.FileDescriptor var file_query_proto_rawDesc = []byte{ 0x0a, 0x0b, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x73, - 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x22, 0x2f, 0x0a, 0x17, 0x53, 0x79, 0x6e, 0x63, 0x41, - 0x6c, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x65, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x05, 0x6e, 0x65, 0x74, 0x49, 0x64, 0x22, 0x64, 0x0a, 0x13, 0x41, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x22, 0x45, 0x0a, 0x1b, 0x47, 0x65, 0x74, 0x41, 0x6c, + 0x6c, 0x41, 0x64, 0x64, 0x72, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x42, 0x79, 0x44, 0x61, 0x79, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x64, 0x61, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x03, 0x64, 0x61, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x65, 0x74, 0x49, + 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6e, 0x65, 0x74, 0x49, 0x64, 0x22, 0x5a, + 0x0a, 0x1c, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x50, 0x6f, 0x77, 0x65, + 0x72, 0x42, 0x79, 0x44, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x10, + 0x0a, 0x03, 0x64, 0x61, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x64, 0x61, 0x79, + 0x12, 0x12, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x69, 0x6e, 0x66, 0x6f, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x65, 0x74, 0x49, 0x64, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x05, 0x6e, 0x65, 0x74, 0x49, 0x64, 0x22, 0x3b, 0x0a, 0x11, 0x44, 0x61, + 0x74, 0x61, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x65, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, - 0x6e, 0x65, 0x74, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, - 0x1d, 0x0a, 0x0a, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x5f, 0x6e, 0x75, 0x6d, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x09, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x4e, 0x75, 0x6d, 0x22, 0x2d, - 0x0a, 0x15, 0x53, 0x79, 0x6e, 0x63, 0x44, 0x61, 0x74, 0x65, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x65, 0x74, 0x49, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6e, 0x65, 0x74, 0x49, 0x64, 0x22, 0x46, 0x0a, - 0x14, 0x53, 0x79, 0x6e, 0x63, 0x41, 0x64, 0x64, 0x72, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, + 0x6e, 0x65, 0x74, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x64, 0x61, 0x79, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x03, 0x64, 0x61, 0x79, 0x22, 0x5c, 0x0a, 0x18, 0x41, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x42, 0x79, 0x44, 0x61, 0x79, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x65, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x05, 0x6e, 0x65, 0x74, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x64, 0x61, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x03, 0x64, 0x61, 0x79, 0x22, 0x3e, 0x0a, 0x12, 0x44, 0x61, 0x74, 0x61, 0x48, 0x65, 0x69, + 0x67, 0x68, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x64, + 0x61, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x64, 0x61, 0x79, 0x12, 0x16, 0x0a, + 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x68, + 0x65, 0x69, 0x67, 0x68, 0x74, 0x22, 0x2f, 0x0a, 0x17, 0x53, 0x79, 0x6e, 0x63, 0x41, 0x6c, 0x6c, + 0x41, 0x64, 0x64, 0x72, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x65, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x05, 0x6e, 0x65, 0x74, 0x49, 0x64, 0x22, 0x64, 0x0a, 0x13, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, + 0x05, 0x6e, 0x65, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6e, 0x65, + 0x74, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1d, 0x0a, + 0x0a, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x5f, 0x6e, 0x75, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x09, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x4e, 0x75, 0x6d, 0x22, 0x2d, 0x0a, 0x15, + 0x53, 0x79, 0x6e, 0x63, 0x44, 0x61, 0x74, 0x65, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x65, 0x74, 0x49, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6e, 0x65, 0x74, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x61, - 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x83, 0x02, 0x0a, 0x14, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, - 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x70, 0x5f, 0x70, - 0x6f, 0x77, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x70, 0x50, 0x6f, - 0x77, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x70, 0x6f, - 0x77, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6c, 0x69, 0x65, 0x6e, - 0x74, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x12, 0x2c, 0x0a, 0x12, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, - 0x68, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x5f, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x10, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x48, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x50, - 0x6f, 0x77, 0x65, 0x72, 0x12, 0x27, 0x0a, 0x0f, 0x64, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, - 0x72, 0x5f, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x64, - 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x12, 0x21, 0x0a, - 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, - 0x12, 0x19, 0x0a, 0x08, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x73, 0x74, 0x72, 0x18, 0x07, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x07, 0x64, 0x61, 0x74, 0x65, 0x53, 0x74, 0x72, 0x22, 0x1a, 0x0a, 0x18, 0x53, - 0x79, 0x6e, 0x63, 0x41, 0x6c, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x18, 0x0a, 0x16, 0x53, 0x79, 0x6e, 0x63, 0x44, - 0x61, 0x74, 0x65, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x17, 0x0a, 0x15, 0x53, 0x79, 0x6e, 0x63, 0x41, 0x64, 0x64, 0x72, 0x50, 0x6f, 0x77, - 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xe6, 0x02, 0x0a, 0x08, 0x53, - 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x12, 0x52, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x41, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x12, 0x1d, 0x2e, 0x73, 0x6e, 0x61, - 0x70, 0x73, 0x68, 0x6f, 0x74, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x50, 0x6f, 0x77, - 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x73, 0x6e, 0x61, 0x70, - 0x73, 0x68, 0x6f, 0x74, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x50, 0x6f, 0x77, 0x65, - 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x55, 0x0a, 0x0e, 0x53, - 0x79, 0x6e, 0x63, 0x44, 0x61, 0x74, 0x65, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x1f, 0x2e, - 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x44, 0x61, 0x74, - 0x65, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, - 0x2e, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x44, 0x61, - 0x74, 0x65, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x00, 0x12, 0x52, 0x0a, 0x0d, 0x53, 0x79, 0x6e, 0x63, 0x41, 0x64, 0x64, 0x72, 0x50, 0x6f, - 0x77, 0x65, 0x72, 0x12, 0x1e, 0x2e, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x2e, 0x53, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6e, 0x65, 0x74, 0x49, 0x64, 0x22, 0x46, 0x0a, 0x14, 0x53, 0x79, 0x6e, 0x63, 0x41, 0x64, 0x64, 0x72, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x2e, 0x53, - 0x79, 0x6e, 0x63, 0x41, 0x64, 0x64, 0x72, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x5b, 0x0a, 0x10, 0x53, 0x79, 0x6e, 0x63, 0x41, 0x6c, - 0x6c, 0x41, 0x64, 0x64, 0x72, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x12, 0x21, 0x2e, 0x73, 0x6e, 0x61, - 0x70, 0x73, 0x68, 0x6f, 0x74, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x41, 0x6c, 0x6c, 0x41, 0x64, 0x64, - 0x72, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, - 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x41, 0x6c, 0x6c, - 0x41, 0x64, 0x64, 0x72, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x00, 0x42, 0x12, 0x5a, 0x10, 0x2e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x3b, 0x73, - 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x65, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x05, 0x6e, 0x65, 0x74, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x22, 0x83, 0x02, 0x0a, 0x14, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x50, + 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, + 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x70, 0x5f, 0x70, 0x6f, 0x77, + 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x70, 0x50, 0x6f, 0x77, 0x65, + 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x70, 0x6f, 0x77, 0x65, + 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x50, + 0x6f, 0x77, 0x65, 0x72, 0x12, 0x2c, 0x0a, 0x12, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x68, 0x6f, + 0x6c, 0x64, 0x65, 0x72, 0x5f, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x10, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x48, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x50, 0x6f, 0x77, + 0x65, 0x72, 0x12, 0x27, 0x0a, 0x0f, 0x64, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x5f, + 0x70, 0x6f, 0x77, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x64, 0x65, 0x76, + 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x72, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x62, + 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x19, + 0x0a, 0x08, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x73, 0x74, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x07, 0x64, 0x61, 0x74, 0x65, 0x53, 0x74, 0x72, 0x22, 0x1a, 0x0a, 0x18, 0x53, 0x79, 0x6e, + 0x63, 0x41, 0x6c, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x18, 0x0a, 0x16, 0x53, 0x79, 0x6e, 0x63, 0x44, 0x61, 0x74, + 0x65, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x17, 0x0a, 0x15, 0x53, 0x79, 0x6e, 0x63, 0x41, 0x64, 0x64, 0x72, 0x50, 0x6f, 0x77, 0x65, 0x72, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xfb, 0x04, 0x0a, 0x08, 0x53, 0x6e, 0x61, + 0x70, 0x73, 0x68, 0x6f, 0x74, 0x12, 0x52, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x41, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x12, 0x1d, 0x2e, 0x73, 0x6e, 0x61, 0x70, 0x73, + 0x68, 0x6f, 0x74, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x50, 0x6f, 0x77, 0x65, 0x72, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, + 0x6f, 0x74, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x55, 0x0a, 0x0e, 0x53, 0x79, 0x6e, + 0x63, 0x44, 0x61, 0x74, 0x65, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x1f, 0x2e, 0x73, 0x6e, + 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x44, 0x61, 0x74, 0x65, 0x48, + 0x65, 0x69, 0x67, 0x68, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x73, + 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x44, 0x61, 0x74, 0x65, + 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, + 0x12, 0x52, 0x0a, 0x0d, 0x53, 0x79, 0x6e, 0x63, 0x41, 0x64, 0x64, 0x72, 0x50, 0x6f, 0x77, 0x65, + 0x72, 0x12, 0x1e, 0x2e, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x2e, 0x53, 0x79, 0x6e, + 0x63, 0x41, 0x64, 0x64, 0x72, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x1f, 0x2e, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x2e, 0x53, 0x79, 0x6e, + 0x63, 0x41, 0x64, 0x64, 0x72, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x00, 0x12, 0x5b, 0x0a, 0x10, 0x53, 0x79, 0x6e, 0x63, 0x41, 0x6c, 0x6c, 0x41, + 0x64, 0x64, 0x72, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x12, 0x21, 0x2e, 0x73, 0x6e, 0x61, 0x70, 0x73, + 0x68, 0x6f, 0x74, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x41, 0x6c, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x50, + 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x73, 0x6e, + 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x41, 0x6c, 0x6c, 0x41, 0x64, + 0x64, 0x72, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x00, 0x12, 0x4c, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x44, 0x61, 0x74, 0x61, 0x48, 0x65, 0x69, 0x67, + 0x68, 0x74, 0x12, 0x1b, 0x2e, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x2e, 0x44, 0x61, + 0x74, 0x61, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x1c, 0x2e, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x48, + 0x65, 0x69, 0x67, 0x68, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, + 0x5c, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x50, 0x6f, 0x77, + 0x65, 0x72, 0x42, 0x79, 0x44, 0x61, 0x79, 0x12, 0x22, 0x2e, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, + 0x6f, 0x74, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x42, + 0x79, 0x44, 0x61, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x73, 0x6e, + 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x50, 0x6f, + 0x77, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x67, 0x0a, + 0x14, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x50, 0x6f, 0x77, 0x65, 0x72, + 0x42, 0x79, 0x44, 0x61, 0x79, 0x12, 0x25, 0x2e, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, + 0x2e, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x50, 0x6f, 0x77, 0x65, 0x72, + 0x42, 0x79, 0x44, 0x61, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x73, + 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x41, 0x64, + 0x64, 0x72, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x42, 0x79, 0x44, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x12, 0x5a, 0x10, 0x2e, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x3b, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( @@ -522,31 +829,42 @@ func file_query_proto_rawDescGZIP() []byte { return file_query_proto_rawDescData } -var file_query_proto_msgTypes = make([]protoimpl.MessageInfo, 8) -var file_query_proto_goTypes = []interface{}{ - (*SyncAllAddrPowerRequest)(nil), // 0: snapshot.SyncAllAddrPowerRequest - (*AddressPowerRequest)(nil), // 1: snapshot.AddressPowerRequest - (*SyncDateHeightRequest)(nil), // 2: snapshot.SyncDateHeightRequest - (*SyncAddrPowerRequest)(nil), // 3: snapshot.SyncAddrPowerRequest - (*AddressPowerResponse)(nil), // 4: snapshot.AddressPowerResponse - (*SyncAllAddrPowerResponse)(nil), // 5: snapshot.SyncAllAddrPowerResponse - (*SyncDateHeightResponse)(nil), // 6: snapshot.SyncDateHeightResponse - (*SyncAddrPowerResponse)(nil), // 7: snapshot.SyncAddrPowerResponse +var file_query_proto_msgTypes = make([]protoimpl.MessageInfo, 13) +var file_query_proto_goTypes = []any{ + (*GetAllAddrPowerByDayRequest)(nil), // 0: snapshot.GetAllAddrPowerByDayRequest + (*GetAllAddrPowerByDayResponse)(nil), // 1: snapshot.GetAllAddrPowerByDayResponse + (*DataHeightRequest)(nil), // 2: snapshot.DataHeightRequest + (*AddressPowerByDayRequest)(nil), // 3: snapshot.AddressPowerByDayRequest + (*DataHeightResponse)(nil), // 4: snapshot.DataHeightResponse + (*SyncAllAddrPowerRequest)(nil), // 5: snapshot.SyncAllAddrPowerRequest + (*AddressPowerRequest)(nil), // 6: snapshot.AddressPowerRequest + (*SyncDateHeightRequest)(nil), // 7: snapshot.SyncDateHeightRequest + (*SyncAddrPowerRequest)(nil), // 8: snapshot.SyncAddrPowerRequest + (*AddressPowerResponse)(nil), // 9: snapshot.AddressPowerResponse + (*SyncAllAddrPowerResponse)(nil), // 10: snapshot.SyncAllAddrPowerResponse + (*SyncDateHeightResponse)(nil), // 11: snapshot.SyncDateHeightResponse + (*SyncAddrPowerResponse)(nil), // 12: snapshot.SyncAddrPowerResponse } var file_query_proto_depIdxs = []int32{ - 1, // 0: snapshot.Snapshot.GetAddressPower:input_type -> snapshot.AddressPowerRequest - 2, // 1: snapshot.Snapshot.SyncDateHeight:input_type -> snapshot.SyncDateHeightRequest - 3, // 2: snapshot.Snapshot.SyncAddrPower:input_type -> snapshot.SyncAddrPowerRequest - 0, // 3: snapshot.Snapshot.SyncAllAddrPower:input_type -> snapshot.SyncAllAddrPowerRequest - 4, // 4: snapshot.Snapshot.GetAddressPower:output_type -> snapshot.AddressPowerResponse - 6, // 5: snapshot.Snapshot.SyncDateHeight:output_type -> snapshot.SyncDateHeightResponse - 7, // 6: snapshot.Snapshot.SyncAddrPower:output_type -> snapshot.SyncAddrPowerResponse - 5, // 7: snapshot.Snapshot.SyncAllAddrPower:output_type -> snapshot.SyncAllAddrPowerResponse - 4, // [4:8] is the sub-list for method output_type - 0, // [0:4] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name + 6, // 0: snapshot.Snapshot.GetAddressPower:input_type -> snapshot.AddressPowerRequest + 7, // 1: snapshot.Snapshot.SyncDateHeight:input_type -> snapshot.SyncDateHeightRequest + 8, // 2: snapshot.Snapshot.SyncAddrPower:input_type -> snapshot.SyncAddrPowerRequest + 5, // 3: snapshot.Snapshot.SyncAllAddrPower:input_type -> snapshot.SyncAllAddrPowerRequest + 2, // 4: snapshot.Snapshot.GetDataHeight:input_type -> snapshot.DataHeightRequest + 3, // 5: snapshot.Snapshot.GetAddressPowerByDay:input_type -> snapshot.AddressPowerByDayRequest + 0, // 6: snapshot.Snapshot.GetAllAddrPowerByDay:input_type -> snapshot.GetAllAddrPowerByDayRequest + 9, // 7: snapshot.Snapshot.GetAddressPower:output_type -> snapshot.AddressPowerResponse + 11, // 8: snapshot.Snapshot.SyncDateHeight:output_type -> snapshot.SyncDateHeightResponse + 12, // 9: snapshot.Snapshot.SyncAddrPower:output_type -> snapshot.SyncAddrPowerResponse + 10, // 10: snapshot.Snapshot.SyncAllAddrPower:output_type -> snapshot.SyncAllAddrPowerResponse + 4, // 11: snapshot.Snapshot.GetDataHeight:output_type -> snapshot.DataHeightResponse + 9, // 12: snapshot.Snapshot.GetAddressPowerByDay:output_type -> snapshot.AddressPowerResponse + 1, // 13: snapshot.Snapshot.GetAllAddrPowerByDay:output_type -> snapshot.GetAllAddrPowerByDayResponse + 7, // [7:14] is the sub-list for method output_type + 0, // [0:7] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name } func init() { file_query_proto_init() } @@ -554,111 +872,13 @@ func file_query_proto_init() { if File_query_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_query_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SyncAllAddrPowerRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_query_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AddressPowerRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_query_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SyncDateHeightRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_query_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SyncAddrPowerRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_query_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AddressPowerResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_query_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SyncAllAddrPowerResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_query_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SyncDateHeightResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_query_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SyncAddrPowerResponse); 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{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_query_proto_rawDesc, NumEnums: 0, - NumMessages: 8, + NumMessages: 13, NumExtensions: 0, NumServices: 1, }, diff --git a/powervoting-backend/client/proto/query_grpc.pb.go b/powervoting-backend/client/proto/query_grpc.pb.go index b4e2d1c..722e35f 100644 --- a/powervoting-backend/client/proto/query_grpc.pb.go +++ b/powervoting-backend/client/proto/query_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 v3.21.7 +// - protoc-gen-go-grpc v1.5.1 +// - protoc v5.28.2 // source: query.proto package snapshot @@ -15,14 +15,17 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. +// Requires gRPC-Go v1.64.0 or later. const _ = grpc.SupportPackageIsVersion7 const ( - Snapshot_GetAddressPower_FullMethodName = "/snapshot.Snapshot/GetAddressPower" - Snapshot_SyncDateHeight_FullMethodName = "/snapshot.Snapshot/SyncDateHeight" - Snapshot_SyncAddrPower_FullMethodName = "/snapshot.Snapshot/SyncAddrPower" - Snapshot_SyncAllAddrPower_FullMethodName = "/snapshot.Snapshot/SyncAllAddrPower" + Snapshot_GetAddressPower_FullMethodName = "/snapshot.Snapshot/GetAddressPower" + Snapshot_SyncDateHeight_FullMethodName = "/snapshot.Snapshot/SyncDateHeight" + Snapshot_SyncAddrPower_FullMethodName = "/snapshot.Snapshot/SyncAddrPower" + Snapshot_SyncAllAddrPower_FullMethodName = "/snapshot.Snapshot/SyncAllAddrPower" + Snapshot_GetDataHeight_FullMethodName = "/snapshot.Snapshot/GetDataHeight" + Snapshot_GetAddressPowerByDay_FullMethodName = "/snapshot.Snapshot/GetAddressPowerByDay" + Snapshot_GetAllAddrPowerByDay_FullMethodName = "/snapshot.Snapshot/GetAllAddrPowerByDay" ) // SnapshotClient is the client API for Snapshot service. @@ -33,6 +36,9 @@ type SnapshotClient interface { SyncDateHeight(ctx context.Context, in *SyncDateHeightRequest, opts ...grpc.CallOption) (*SyncDateHeightResponse, error) SyncAddrPower(ctx context.Context, in *SyncAddrPowerRequest, opts ...grpc.CallOption) (*SyncAddrPowerResponse, error) SyncAllAddrPower(ctx context.Context, in *SyncAllAddrPowerRequest, opts ...grpc.CallOption) (*SyncAllAddrPowerResponse, error) + GetDataHeight(ctx context.Context, in *DataHeightRequest, opts ...grpc.CallOption) (*DataHeightResponse, error) + GetAddressPowerByDay(ctx context.Context, in *AddressPowerByDayRequest, opts ...grpc.CallOption) (*AddressPowerResponse, error) + GetAllAddrPowerByDay(ctx context.Context, in *GetAllAddrPowerByDayRequest, opts ...grpc.CallOption) (*GetAllAddrPowerByDayResponse, error) } type snapshotClient struct { @@ -79,20 +85,53 @@ func (c *snapshotClient) SyncAllAddrPower(ctx context.Context, in *SyncAllAddrPo return out, nil } +func (c *snapshotClient) GetDataHeight(ctx context.Context, in *DataHeightRequest, opts ...grpc.CallOption) (*DataHeightResponse, error) { + out := new(DataHeightResponse) + err := c.cc.Invoke(ctx, Snapshot_GetDataHeight_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *snapshotClient) GetAddressPowerByDay(ctx context.Context, in *AddressPowerByDayRequest, opts ...grpc.CallOption) (*AddressPowerResponse, error) { + out := new(AddressPowerResponse) + err := c.cc.Invoke(ctx, Snapshot_GetAddressPowerByDay_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *snapshotClient) GetAllAddrPowerByDay(ctx context.Context, in *GetAllAddrPowerByDayRequest, opts ...grpc.CallOption) (*GetAllAddrPowerByDayResponse, error) { + out := new(GetAllAddrPowerByDayResponse) + err := c.cc.Invoke(ctx, Snapshot_GetAllAddrPowerByDay_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // SnapshotServer is the server API for Snapshot service. // All implementations must embed UnimplementedSnapshotServer -// for forward compatibility +// for forward compatibility. type SnapshotServer interface { GetAddressPower(context.Context, *AddressPowerRequest) (*AddressPowerResponse, error) SyncDateHeight(context.Context, *SyncDateHeightRequest) (*SyncDateHeightResponse, error) SyncAddrPower(context.Context, *SyncAddrPowerRequest) (*SyncAddrPowerResponse, error) SyncAllAddrPower(context.Context, *SyncAllAddrPowerRequest) (*SyncAllAddrPowerResponse, error) + GetDataHeight(context.Context, *DataHeightRequest) (*DataHeightResponse, error) + GetAddressPowerByDay(context.Context, *AddressPowerByDayRequest) (*AddressPowerResponse, error) + GetAllAddrPowerByDay(context.Context, *GetAllAddrPowerByDayRequest) (*GetAllAddrPowerByDayResponse, error) mustEmbedUnimplementedSnapshotServer() } -// UnimplementedSnapshotServer must be embedded to have forward compatible implementations. -type UnimplementedSnapshotServer struct { -} +// UnimplementedSnapshotServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedSnapshotServer struct{} func (UnimplementedSnapshotServer) GetAddressPower(context.Context, *AddressPowerRequest) (*AddressPowerResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetAddressPower not implemented") @@ -106,7 +145,17 @@ func (UnimplementedSnapshotServer) SyncAddrPower(context.Context, *SyncAddrPower func (UnimplementedSnapshotServer) SyncAllAddrPower(context.Context, *SyncAllAddrPowerRequest) (*SyncAllAddrPowerResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method SyncAllAddrPower not implemented") } +func (UnimplementedSnapshotServer) GetDataHeight(context.Context, *DataHeightRequest) (*DataHeightResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetDataHeight not implemented") +} +func (UnimplementedSnapshotServer) GetAddressPowerByDay(context.Context, *AddressPowerByDayRequest) (*AddressPowerResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetAddressPowerByDay not implemented") +} +func (UnimplementedSnapshotServer) GetAllAddrPowerByDay(context.Context, *GetAllAddrPowerByDayRequest) (*GetAllAddrPowerByDayResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetAllAddrPowerByDay not implemented") +} func (UnimplementedSnapshotServer) mustEmbedUnimplementedSnapshotServer() {} +func (UnimplementedSnapshotServer) testEmbeddedByValue() {} // UnsafeSnapshotServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to SnapshotServer will @@ -116,6 +165,13 @@ type UnsafeSnapshotServer interface { } func RegisterSnapshotServer(s grpc.ServiceRegistrar, srv SnapshotServer) { + // If the following call pancis, it indicates UnimplementedSnapshotServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&Snapshot_ServiceDesc, srv) } @@ -191,6 +247,60 @@ func _Snapshot_SyncAllAddrPower_Handler(srv interface{}, ctx context.Context, de return interceptor(ctx, in, info, handler) } +func _Snapshot_GetDataHeight_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DataHeightRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SnapshotServer).GetDataHeight(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Snapshot_GetDataHeight_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SnapshotServer).GetDataHeight(ctx, req.(*DataHeightRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Snapshot_GetAddressPowerByDay_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AddressPowerByDayRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SnapshotServer).GetAddressPowerByDay(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Snapshot_GetAddressPowerByDay_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SnapshotServer).GetAddressPowerByDay(ctx, req.(*AddressPowerByDayRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Snapshot_GetAllAddrPowerByDay_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetAllAddrPowerByDayRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SnapshotServer).GetAllAddrPowerByDay(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Snapshot_GetAllAddrPowerByDay_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SnapshotServer).GetAllAddrPowerByDay(ctx, req.(*GetAllAddrPowerByDayRequest)) + } + return interceptor(ctx, in, info, handler) +} + // Snapshot_ServiceDesc is the grpc.ServiceDesc for Snapshot service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -214,6 +324,18 @@ var Snapshot_ServiceDesc = grpc.ServiceDesc{ MethodName: "SyncAllAddrPower", Handler: _Snapshot_SyncAllAddrPower_Handler, }, + { + MethodName: "GetDataHeight", + Handler: _Snapshot_GetDataHeight_Handler, + }, + { + MethodName: "GetAddressPowerByDay", + Handler: _Snapshot_GetAddressPowerByDay_Handler, + }, + { + MethodName: "GetAllAddrPowerByDay", + Handler: _Snapshot_GetAllAddrPowerByDay_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "query.proto", diff --git a/powervoting-backend/client/query.proto b/powervoting-backend/client/query.proto index 6216781..a0e3704 100644 --- a/powervoting-backend/client/query.proto +++ b/powervoting-backend/client/query.proto @@ -9,6 +9,36 @@ service Snapshot { rpc SyncDateHeight(SyncDateHeightRequest) returns (SyncDateHeightResponse) {} rpc SyncAddrPower(SyncAddrPowerRequest) returns (SyncAddrPowerResponse) {} rpc SyncAllAddrPower(SyncAllAddrPowerRequest) returns (SyncAllAddrPowerResponse){} + rpc GetDataHeight(DataHeightRequest) returns (DataHeightResponse) {} + rpc GetAddressPowerByDay(AddressPowerByDayRequest) returns (AddressPowerResponse) {} + rpc GetAllAddrPowerByDay(GetAllAddrPowerByDayRequest) returns (GetAllAddrPowerByDayResponse) {} +} + +message GetAllAddrPowerByDayRequest { + string day = 1; + int64 netId = 2; +} + +message GetAllAddrPowerByDayResponse { + string day = 1; + string info = 3; + int64 netId = 4; +} + +message DataHeightRequest{ + int64 netId = 1; + string day = 2; +} + +message AddressPowerByDayRequest{ + int64 netId = 1; + string address = 2; + string day = 3; +} + +message DataHeightResponse { + string day = 1; + int64 height = 2; } message SyncAllAddrPowerRequest { diff --git a/powervoting-backend/client/w3client.go b/powervoting-backend/client/w3client.go index 6128656..0e76eb8 100644 --- a/powervoting-backend/client/w3client.go +++ b/powervoting-backend/client/w3client.go @@ -89,3 +89,33 @@ func (w *W3Client) Upload(path string) (string, error) { return link.String(), nil } + +func (w *W3Client) UploadByte(data []byte) (string, error) { + + // generate the CID for the CAR + mh, _ := multihash.Sum(data, multihash.SHA2_256, -1) + link := cidlink.Link{Cid: cid.NewCidV1(0x0202, mh)} + rcpt, _ := client.StoreAdd( + w.Issuer, + w.Space, + &storeadd.Caveat{Link: link, Size: uint64(len(data))}, + client.WithProofs([]delegation.Delegation{w.Proof}), + ) + + if rcpt.Out().Ok().Status == "upload" { + hr, _ := http.NewRequest("PUT", *rcpt.Out().Ok().Url, bytes.NewReader(data)) + + hdr := map[string][]string{} + for k, v := range rcpt.Out().Ok().Headers.Values { + hdr[k] = []string{v} + } + + hr.Header = hdr + hr.ContentLength = int64(len(data)) + httpClient := http.Client{} + res, _ := httpClient.Do(hr) + res.Body.Close() + } + + return link.String(), nil +} diff --git a/powervoting-backend/configuration.yaml b/powervoting-backend/configuration.yaml index 1d41475..8e8a5d1 100644 --- a/powervoting-backend/configuration.yaml +++ b/powervoting-backend/configuration.yaml @@ -28,9 +28,15 @@ network: oracleAbi: oracle.json powerVotingContract: oracleContract: + privateKey: + # wallet address + walletAddress: + # gas limit + gasLimit: w3client: did: privateKey: # proof.ucan path - proof: \ No newline at end of file + proof: + space: diff --git a/powervoting-backend/constant/constant.go b/powervoting-backend/constant/constant.go index e96a97b..8592770 100644 --- a/powervoting-backend/constant/constant.go +++ b/powervoting-backend/constant/constant.go @@ -34,4 +34,6 @@ const ( ProposalStatusCompleted = 4 ProposalStatusRejected = 5 ProposalStatusPassed = 6 + + Period = 60 ) diff --git a/powervoting-backend/contract/contract.go b/powervoting-backend/contract/contract.go index d9920e8..cbd70d5 100644 --- a/powervoting-backend/contract/contract.go +++ b/powervoting-backend/contract/contract.go @@ -15,15 +15,17 @@ package contract import ( - "go.uber.org/zap" "os" "powervoting-server/config" "powervoting-server/model" "strconv" "sync" + "go.uber.org/zap" + "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethclient" ) @@ -57,6 +59,9 @@ func GetClient(id int64) (model.GoEthClient, error) { OracleContract: network.OracleContract, PowerVotingAbi: network.PowerVotingAbi, OracleAbi: network.OracleAbi, + GasLimit: network.GasLimit, + PrivateKey: network.PrivateKey, + WalletAddress: network.WalletAddress, } break } @@ -81,6 +86,7 @@ func getGoEthClient(clientConfig model.ClientConfig) (model.GoEthClient, error) // contract address, wallet private key , wallet address powerVotingContract := common.HexToAddress(clientConfig.PowerVotingContract) oracleContract := common.HexToAddress(clientConfig.OracleContract) + privateKey, err := crypto.HexToECDSA(clientConfig.PrivateKey) // open abi file and parse json powerVotingFile, err := os.Open(clientConfig.PowerVotingAbi) @@ -115,6 +121,9 @@ func getGoEthClient(clientConfig model.ClientConfig) (model.GoEthClient, error) OracleAbi: oracleAbi, PowerVotingContract: powerVotingContract, OracleContract: oracleContract, + PrivateKey: privateKey, + WalletAddress: common.HexToAddress(clientConfig.WalletAddress), + GasLimit: uint64(clientConfig.GasLimit), } return goEthClient, nil } diff --git a/powervoting-backend/db/mysql.go b/powervoting-backend/db/mysql.go index c7492f9..e4c4af3 100644 --- a/powervoting-backend/db/mysql.go +++ b/powervoting-backend/db/mysql.go @@ -66,6 +66,7 @@ func InitMysql() { db.AutoMigrate(&model.Dict{}) db.AutoMigrate(&model.VotePower{}) db.AutoMigrate(&model.ProposalDraft{}) + db.AutoMigrate(&model.SnapshotByDay{}) var count int64 db.Model(model.Dict{}).Where("name", constant.ProposalStartKey).Count(&count) @@ -222,3 +223,18 @@ func (m *Mysql) UpdateProposal(in *model.Proposal) (int64, error) { } return in.Id, nil } + +func (m *Mysql) GetSnapshotList(netId int64) ([]model.SnapshotByDay, error) { + var snapshotList []model.SnapshotByDay + tx := m.Model(model.SnapshotByDay{}).Where("net_id = ? and (cid is null or cid = '')", netId).Find(&snapshotList) + return snapshotList, tx.Error +} + +func (m *Mysql) UpdateSnapshot(in model.SnapshotByDay) error { + err := m.Model(in).Updates(model.SnapshotByDay{Cid: in.Cid, PowerInfo: in.PowerInfo}).Error + if err != nil { + zap.L().Error("update snapshot backup error: ", zap.Error(err)) + return err + } + return nil +} diff --git a/powervoting-backend/db/repo.go b/powervoting-backend/db/repo.go index a0d008f..da9d050 100644 --- a/powervoting-backend/db/repo.go +++ b/powervoting-backend/db/repo.go @@ -18,4 +18,7 @@ type DataRepo interface { CountProposal(filter map[string]any) (int64, error) CreateProposal(in *model.Proposal) (int64, error) UpdateProposal(in *model.Proposal) (int64, error) + + GetSnapshotList(netId int64) ([]model.SnapshotByDay, error) + UpdateSnapshot(in model.SnapshotByDay) error } diff --git a/powervoting-backend/model/config.go b/powervoting-backend/model/config.go index 61af4be..ed3e307 100644 --- a/powervoting-backend/model/config.go +++ b/powervoting-backend/model/config.go @@ -51,6 +51,9 @@ type Network struct { OracleAbi string // ABI for Oracle contract PowerVotingContract string // Contract address for PowerVoting OracleContract string // Contract address for Oracle + PrivateKey string // Private key for the network wallet + WalletAddress string // Wallet address for the network + GasLimit int64 // gasLimit } type Snapshot struct { diff --git a/powervoting-backend/model/contract.go b/powervoting-backend/model/contract.go index 1ffa471..fdf8ddf 100644 --- a/powervoting-backend/model/contract.go +++ b/powervoting-backend/model/contract.go @@ -15,6 +15,9 @@ package model import ( + "crypto/ecdsa" + "math/big" + "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/ethclient" @@ -29,6 +32,11 @@ type GoEthClient struct { OracleAbi abi.ABI // ABI for Oracle contract PowerVotingContract common.Address // Contract address for PowerVoting OracleContract common.Address // Contract address for Oracle + ChainID *big.Int // Chain ID for Ethereum network. + PrivateKey *ecdsa.PrivateKey // Private key for the wallet. + WalletAddress common.Address // Address of the wallet. + GasLimit uint64 // Gas limit for transactions. + Amount *big.Int // Amount for transactions. } // ClientConfig represents the configuration for creating a GoEthClient instance. @@ -40,4 +48,7 @@ type ClientConfig struct { OracleContract string // Contract address for Oracle PowerVotingAbi string // ABI for PowerVoting contract (as a string) OracleAbi string // ABI for Oracle contract (as a string) + GasLimit int64 // Gas limit for transactions. + PrivateKey string // Private key for the wallet. + WalletAddress string // Address of the wallet. } diff --git a/powervoting-backend/model/power.go b/powervoting-backend/model/power.go index 55183ce..5cdee0a 100644 --- a/powervoting-backend/model/power.go +++ b/powervoting-backend/model/power.go @@ -14,7 +14,10 @@ package model -import "math/big" +import ( + "math/big" + "time" +) // Power represents the power information. type Power struct { @@ -39,3 +42,20 @@ type VoterToPowerStatus struct { DayId *big.Int `json:"dayId"` // Day ID HasFullRound *big.Int `json:"hasFullRound"` // Has full round } + +type SnapshotByDay struct { + Id int64 `json:"id"` + Day string `gorm:"not null;uniqueIndex:uniq_day" json:"day"` + PowerInfo string `gorm:"type:longtext" json:"powerInfo"` //The power set of all addresses for the day + NetId int64 `gorm:"not null" json:"netId"` // Block id + Cid string `gorm:"" json:"cid"` //File ID uploaded to W3Storage + Height int64 `gorm:"not null" json:"height"` // Block height + CreatedAt time.Time `gorm:"not null,autoCreateTime" json:"createdAt"` + UpdatedAt time.Time `gorm:"not null,autoUpdateTime" json:"updatedAt"` +} + +type AllPowerByDay struct { + Id int64 `json:"id"` + Day string `json:"day"` + PowerInfo string `json:"powerInfo"` +} diff --git a/powervoting-backend/model/proposal.go b/powervoting-backend/model/proposal.go index 41e595c..5e18b4c 100644 --- a/powervoting-backend/model/proposal.go +++ b/powervoting-backend/model/proposal.go @@ -24,25 +24,35 @@ import ( // Proposal represents the structure of a proposal. type Proposal struct { - Id int64 `json:"id"` // Unique identifier - ProposalId int64 `json:"proposalId" gorm:"default:0;"` // Proposal ID - Cid string `json:"cid" gorm:"not null;index:uniq_cid,unique"` // CID - ProposalType int64 `json:"proposalType" gorm:"not null,default:0"` // Proposal type - Creator string `json:"creator" gorm:"not null"` // Creator address - StartTime int64 `json:"startTime" gorm:"not null"` // Start time - ExpTime int64 `json:"expTime" gorm:"not null"` // Expiry time - VoteCount int64 `json:"voteCount" gorm:"not null,default:0"` // Vote count - Status int `json:"status" gorm:"not null,default:0"` // Proposal status - Network int64 `json:"network" gorm:"not null"` // Network ID - Name string `json:"name" gorm:"not null,default:''"` // Name - Timezone string `json:"timezone" gorm:"not null"` // Timezone - Descriptions string `json:"descriptions" gorm:"not null,default:'';type:longtext"` // Descriptions - GithubName string `json:"githubName" gorm:"not null,default:''"` // Github name - GithubAvatar string `json:"githubAvatar" gorm:"not null,default:''"` // Github avatar - GMTOffset string `json:"gmtOffset" gorm:"not null,default:''"` // GMT offset - CurrentTime int64 `json:"currentTime" gorm:"not null,default:0"` // Current time - CreatedAt time.Time `json:"createdAt" gorm:"not null,autoCreateTime"` // Created time - UpdatedAt time.Time `json:"updatedAt" gorm:"not null,autoUpdateTime"` // Updated time + Id int64 `json:"id"` // Unique identifier + ProposalId int64 `json:"proposalId" gorm:"default:0;"` // Proposal ID + Cid string `json:"cid" gorm:"not null;index:uniq_cid,unique"` // CID + ProposalType int64 `json:"proposalType" gorm:"not null,default:0"` // Proposal type + Creator string `json:"creator" gorm:"not null"` // Creator address + StartTime int64 `json:"startTime" gorm:"not null"` // Start time + ExpTime int64 `json:"expTime" gorm:"not null"` // Expiry time + VoteCount int64 `json:"voteCount" gorm:"not null,default:0"` // Vote count + Status int `json:"status" gorm:"not null,default:0"` // Proposal status + Network int64 `json:"network" gorm:"not null"` // Network ID + Name string `json:"name" gorm:"not null,default:''"` // Name + Timezone string `json:"timezone" gorm:"not null"` // Timezone + Descriptions string `json:"descriptions" gorm:"not null,default:''"` // Descriptions + GithubName string `json:"githubName" gorm:"not null,default:''"` // Github name + GithubAvatar string `json:"githubAvatar" gorm:"not null,default:''"` // Github avatar + GMTOffset string `json:"gmtOffset" gorm:"not null,default:''"` // GMT offset + CurrentTime int64 `json:"currentTime" gorm:"not null,default:0"` // Current time + CreatedAt time.Time `json:"createdAt" gorm:"not null,autoCreateTime"` // Created time + UpdatedAt time.Time `json:"updatedAt" gorm:"not null,autoUpdateTime"` // Updated time + VoteCountDay string `json:"voteCountDay" gorm:"not null"` // Vote counting on this day + Height int64 `json:"height" gorm:"not null"` // Vote counting on this height +} + +type DayToPowerInfo struct { + Id int64 `json:"id"` + Day string `json:"day" gorm:"not null"` + PowerInfo string `json:"powerInfo" gorm:"not null"` + CreatedAt time.Time `json:"createdAt" gorm:"not null,autoCreateTime"` + UpdatedAt time.Time `json:"updatedAt" gorm:"not null,autoUpdateTime"` } type ProposalList struct { diff --git a/powervoting-backend/request/power.go b/powervoting-backend/request/power.go new file mode 100644 index 0000000..7b85650 --- /dev/null +++ b/powervoting-backend/request/power.go @@ -0,0 +1,5 @@ +package request + +type GetHeightReq struct { + NetId int64 `form:"chainId" binding:"required"` +} diff --git a/powervoting-backend/request/proposal.go b/powervoting-backend/request/proposal.go index 9d13597..e537476 100644 --- a/powervoting-backend/request/proposal.go +++ b/powervoting-backend/request/proposal.go @@ -25,9 +25,17 @@ type Proposal struct { GithubAvatar string `json:"githubAvatar"` // Github avatar GMTOffset string `json:"gmtOffset"` // GMT offset CurrentTime int64 `json:"currentTime"` // Current time + VoteCountDay string `json:"voteCountDay" binding:"required"` // Vote counting on this day + Height int64 `json:"height" binding:"required"` // Vote counting on this height } type GetDraft struct { ChainId string `form:"chainId" binding:"required"` Address string `form:"address" binding:"required"` } + +type GetPower struct { + Address string `form:"address" binding:"required"` + Day string `form:"day" binding:"required"` + NetId int64 `form:"chainId" binding:"required"` +} diff --git a/powervoting-backend/response/power.go b/powervoting-backend/response/power.go new file mode 100644 index 0000000..0a442f1 --- /dev/null +++ b/powervoting-backend/response/power.go @@ -0,0 +1,15 @@ +package response + +type Power struct { + DeveloperPower string `json:"developerPower"` // Developer power + SpPower string `json:"spPower"` // SP power + ClientPower string `json:"clientPower"` // Client power + TokenHolderPower string `json:"tokenHolderPower"` // Token holder power + BlockHeight string `json:"blockHeight"` // Block height +} + +type DataHeightRep struct { + Day string `json:"day"` + Height int64 `json:"blockHeight"` + NetId int64 `json:"chainId"` +} diff --git a/powervoting-backend/response/proposal.go b/powervoting-backend/response/proposal.go index dd47f89..89a7805 100644 --- a/powervoting-backend/response/proposal.go +++ b/powervoting-backend/response/proposal.go @@ -26,4 +26,6 @@ type Proposal struct { ShowTime []string `json:"showTime"` Status int `json:"status"` VoteCount int64 `json:"voteCount"` + VoteCountDay string `json:"voteCountDay"` + Height int64 `json:"height"` } diff --git a/powervoting-backend/routers/router.go b/powervoting-backend/routers/router.go index 54530c0..f996709 100644 --- a/powervoting-backend/routers/router.go +++ b/powervoting-backend/routers/router.go @@ -42,4 +42,8 @@ func InitRouters(r *gin.Engine) { powerVotingRouter.GET("/proposal/draft/get", api.GetDraft) powerVotingRouter.POST("/w3storage/upload", api.W3Upload) + + powerVotingRouter.GET("/filecoin/height", api.GetHeight) + + powerVotingRouter.GET("/power/getPower", api.GetPower) } diff --git a/powervoting-backend/scheduler/scheduler.go b/powervoting-backend/scheduler/scheduler.go index 187a1ec..82d5c68 100644 --- a/powervoting-backend/scheduler/scheduler.go +++ b/powervoting-backend/scheduler/scheduler.go @@ -15,9 +15,10 @@ package scheduler import ( + "powervoting-server/task" + "github.com/robfig/cron/v3" "go.uber.org/zap" - "powervoting-server/task" ) // TaskScheduler initializes and starts the task scheduler. @@ -36,27 +37,38 @@ func TaskScheduler() { votingCountTask := task.VotingCountHandler syncProposalTask := task.SyncProposalHandler syncVoteTask := task.SyncVoteHandler + backupPowerTask := task.BackupPowerHandler // 5 minutes votingCountSpec := "0 0/5 * * * ?" // 1 minutes syncSpec := "0/30 * * * * ?" + backupSnapshot := "0 0/10 * * * ?" + _, err := crontab.AddFunc(syncSpec, syncProposalTask) if err != nil { zap.L().Error("add proposal sync task failed: ", zap.Error(err)) return } + _, err = crontab.AddFunc(syncSpec, syncVoteTask) if err != nil { zap.L().Error("add vote sync task failed: ", zap.Error(err)) return } + _, err = crontab.AddFunc(votingCountSpec, votingCountTask) if err != nil { zap.L().Error("add voting count task failed: ", zap.Error(err)) return } + + _, err = crontab.AddFunc(backupSnapshot, backupPowerTask) + if err != nil { + zap.L().Error("add voting count task failed: ", zap.Error(err)) + return + } // start crontab.Start() diff --git a/powervoting-backend/task/proposal.go b/powervoting-backend/task/proposal.go index a8ad186..e2d0bc2 100644 --- a/powervoting-backend/task/proposal.go +++ b/powervoting-backend/task/proposal.go @@ -79,6 +79,8 @@ func SyncProposal(ethClient model.GoEthClient, db db.DataRepo) error { zap.L().Error("get proposal latest id error: ", zap.Error(err)) return err } + + zap.L().Info("Sync proposal end: ", zap.Int("end", end)) for start <= end { contractProposal, err := utils.GetProposal(ethClient, int64(start)) if err != nil { @@ -86,6 +88,8 @@ func SyncProposal(ethClient model.GoEthClient, db db.DataRepo) error { start++ break } + + zap.L().Info("contract proposal: ", zap.Any("contractProposal", contractProposal)) if len(contractProposal.Cid) == 0 { start++ continue @@ -102,7 +106,7 @@ func SyncProposal(ethClient model.GoEthClient, db db.DataRepo) error { Status: constant.ProposalStatusPending, } - zap.L().Info("proposal: ", zap.Any("proposal", proposal)) + zap.L().Info("update proposal info: ", zap.Any("proposal", proposal)) _, err = db.UpdateProposal(&proposal) if err != nil { diff --git a/powervoting-backend/task/snapshot.go b/powervoting-backend/task/snapshot.go new file mode 100644 index 0000000..218ac31 --- /dev/null +++ b/powervoting-backend/task/snapshot.go @@ -0,0 +1,106 @@ +package task + +import ( + "encoding/json" + "powervoting-server/client" + "powervoting-server/config" + "powervoting-server/contract" + "powervoting-server/db" + "powervoting-server/model" + "powervoting-server/utils" + "sync" + "time" + + "go.uber.org/zap" +) + +func BackupPowerHandler() { + zap.L().Info("backup power start: ", zap.Int64("timestamp", time.Now().Unix())) + wg := sync.WaitGroup{} + errList := make([]error, 0, len(config.Client.Network)) + mu := &sync.Mutex{} + + for _, network := range config.Client.Network { + network := network + ethClient, err := contract.GetClient(network.Id) + if err != nil { + zap.L().Error("get go-eth client error:", zap.Error(err)) + continue + } + wg.Add(1) + go func() { + defer wg.Done() + if err := BackupPower(ethClient, db.Engine); err != nil { + mu.Lock() + errList = append(errList, err) + mu.Unlock() + } + }() + } + + wg.Wait() + if len(errList) != 0 { + zap.L().Error("backup power finished with err:", zap.Errors("errors", errList)) + } + zap.L().Info("backup power finished: ", zap.Int64("timestamp", time.Now().Unix())) +} + +func BackupPower(ethClient model.GoEthClient, db db.DataRepo) error { + list, err := db.GetSnapshotList(ethClient.Id) + if err != nil { + zap.L().Error("fail to get snapshot list ", zap.Error(err)) + return err + } + + zap.L().Info("snapshot list: ", zap.Any("list", list)) + for _, item := range list { + zap.L().Info("backup snapshot start", zap.Any("info", item)) + + allPower, err := client.GetAllAddressPowerByDay(ethClient.Id, item.Day) + if err != nil { + zap.L().Error("failed to get all power: ", zap.Error(err), zap.Any("day", item.Day)) + continue + } + + zap.L().Info("all power: ", zap.Any("allPower", allPower.PowerInfo)) + item.PowerInfo = allPower.PowerInfo + + jsonData, err := json.Marshal(allPower.PowerInfo) + if err != nil { + zap.L().Error("failed to marshal content to JSON: ", zap.Error(err)) + continue + } + + zap.L().Info("power jsonData: ", zap.String("jsonData", string(jsonData))) + + zap.L().Info("upload with w3 start") + + cid, err := client.W3.UploadByte(jsonData) + if err != nil { + zap.L().Error("failed to upload file: ", zap.Error(err)) + continue + } + + zap.L().Info("upload with w3 successfully, cid:", zap.String("cid", cid)) + item.Cid = cid + + err = utils.AddSnapshot(ethClient, item.Cid, item.Day) + if err != nil { + zap.L().Error("BackupPowerHandler failed to upload file: ", zap.Error(err)) + continue + } + + zap.L().Info("BackupPowerHandler update snapshot ", zap.Any("id", item.Id)) + if err = db.UpdateSnapshot(item); err != nil { + if err != nil { + zap.L().Error("failed to remove file: ", zap.Error(err)) + continue + } + zap.L().Error("update snapshot error: ", zap.Error(err)) + continue + } + + } + + return nil +} diff --git a/powervoting-backend/task/snapshot_test.go b/powervoting-backend/task/snapshot_test.go new file mode 100644 index 0000000..d8f8652 --- /dev/null +++ b/powervoting-backend/task/snapshot_test.go @@ -0,0 +1,20 @@ +package task + +import ( + "powervoting-server/client" + "powervoting-server/config" + "powervoting-server/db" + "testing" + + "go.uber.org/zap" +) + +func TestBackupPowerHandler(t *testing.T) { + logger, _ := zap.NewDevelopment() + zap.ReplaceGlobals(logger) + config.InitConfig("../") + client.InitW3Client() + db.InitMysql() + + BackupPowerHandler() +} diff --git a/powervoting-backend/task/vote_counting.go b/powervoting-backend/task/vote_counting.go index d877bbe..aa69332 100644 --- a/powervoting-backend/task/vote_counting.go +++ b/powervoting-backend/task/vote_counting.go @@ -15,7 +15,6 @@ package task import ( - "crypto/rand" "math/big" "powervoting-server/client" "powervoting-server/config" @@ -142,13 +141,6 @@ func VotingCount(ethClient model.GoEthClient, db db.DataRepo) error { zap.L().Info("voteList: ", zap.Any("proposalId", proposal.ProposalId), zap.Reflect("voteList", voteList)) - num, err := rand.Int(rand.Reader, big.NewInt(61)) - if err != nil { - zap.L().Error("Generate random number error: ", zap.Error(err)) - zap.L().Info("single vote counting end : ", zap.Any("proposalId", proposal.ProposalId)) - continue - } - var votePowerList []model.VotePower // calc total power totalSpPower := new(big.Int) @@ -158,7 +150,7 @@ func VotingCount(ethClient model.GoEthClient, db db.DataRepo) error { powerMap := make(map[string]model.Power) addressIsCount := make(map[string]bool) for _, vote := range voteList { - power, err := client.GetAddressPower(ethClient.Id, vote.Address, int32(num.Int64())) + power, err := client.GetAddressPowerByDay(ethClient.Id, vote.Address, proposal.VoteCountDay) if err != nil { zap.L().Error("get power error: ", zap.Error(err)) hasErr = true diff --git a/powervoting-backend/utils/contract.go b/powervoting-backend/utils/contract.go index d45aea8..ab7d86c 100644 --- a/powervoting-backend/utils/contract.go +++ b/powervoting-backend/utils/contract.go @@ -17,15 +17,22 @@ package utils import ( "context" "encoding/json" + "fmt" "math/big" "powervoting-server/model" "strconv" + "sync" "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" "go.uber.org/zap" ) +var ( + lock sync.Mutex +) + // GetTimestamp retrieves the current timestamp from the Ethereum blockchain using the provided Ethereum client. // It fetches the latest block number and then retrieves the block information to obtain the timestamp. // The function returns the current timestamp as an int64 or an error if the operation fails. @@ -161,3 +168,55 @@ func GetVoterToPowerStatus(address string, client model.GoEthClient) (model.Vote } return voterToPowerStatus, nil } + +func AddSnapshot(client model.GoEthClient, cid, day string) error { + lock.Lock() + defer lock.Unlock() + + data, err := client.OracleAbi.Pack("addSnapshot", day, cid) + if err != nil { + zap.L().Error("AddSnapshot Pack method and param error: ", zap.Error(err)) + return err + } + + nonce, err := client.Client.PendingNonceAt(context.Background(), client.WalletAddress) + if err != nil { + zap.L().Error("addSnapshot pending nonce at abi pack error", zap.Error(err)) + return err + } + + gasPrice, err := client.Client.SuggestGasPrice(context.Background()) + if err != nil { + zap.L().Error("addSnapshot client suggest gas price error", zap.Error(err)) + return err + } + zap.L().Info("addSnapshot nonce", zap.Uint64("nonce", nonce)) + zap.L().Info("addSnapshot gas price", zap.String("gas price", gasPrice.String())) + + tx := types.NewTx(&types.LegacyTx{ + Nonce: nonce, + GasPrice: gasPrice, + Gas: client.GasLimit, + To: &client.OracleContract, + Value: client.Amount, + Data: data, + }) + + zap.L().Info("AddSnapshot data: ", zap.String("data", string(day))) + + signedTx, err := types.SignTx(tx, types.LatestSignerForChainID(client.ChainID), client.PrivateKey) + if err != nil { + zap.L().Error("addSnapshot types sign tx error", zap.Error(err)) + return err + } + + err = client.Client.SendTransaction(context.Background(), signedTx) + if err != nil { + zap.L().Error("addSnapshot client send transaction error", zap.Error(err)) + return err + } + + zap.S().Info(fmt.Sprintf("addSnapshot Successfully, network: %s, transaction id: %s", client.Name, signedTx.Hash().Hex())) + + return nil +} diff --git a/powervoting-backend/utils/contract_test.go b/powervoting-backend/utils/contract_test.go index 2e736db..5e3e30c 100644 --- a/powervoting-backend/utils/contract_test.go +++ b/powervoting-backend/utils/contract_test.go @@ -16,10 +16,11 @@ package utils import ( "fmt" - "go.uber.org/zap" "powervoting-server/config" "powervoting-server/contract" "testing" + + "go.uber.org/zap" ) func TestGetProposal(t *testing.T) {