From 4fb999788336bdd318137eb7e7029d268ba146c3 Mon Sep 17 00:00:00 2001 From: likhita-809 Date: Thu, 3 Nov 2022 12:00:12 +0530 Subject: [PATCH 1/4] add proto files --- api/cosmos/evidence/v1beta1/query.pulsar.go | 202 ++++++++++++++------ proto/cosmos/evidence/v1beta1/query.proto | 8 +- x/evidence/types/query.pb.go | 119 ++++++++---- x/evidence/types/query.pb.gw.go | 36 +++- 4 files changed, 260 insertions(+), 105 deletions(-) diff --git a/api/cosmos/evidence/v1beta1/query.pulsar.go b/api/cosmos/evidence/v1beta1/query.pulsar.go index ec37067af6e..35e4df7aaa4 100644 --- a/api/cosmos/evidence/v1beta1/query.pulsar.go +++ b/api/cosmos/evidence/v1beta1/query.pulsar.go @@ -19,12 +19,14 @@ import ( var ( md_QueryEvidenceRequest protoreflect.MessageDescriptor fd_QueryEvidenceRequest_evidence_hash protoreflect.FieldDescriptor + fd_QueryEvidenceRequest_hash protoreflect.FieldDescriptor ) func init() { file_cosmos_evidence_v1beta1_query_proto_init() md_QueryEvidenceRequest = File_cosmos_evidence_v1beta1_query_proto.Messages().ByName("QueryEvidenceRequest") fd_QueryEvidenceRequest_evidence_hash = md_QueryEvidenceRequest.Fields().ByName("evidence_hash") + fd_QueryEvidenceRequest_hash = md_QueryEvidenceRequest.Fields().ByName("hash") } var _ protoreflect.Message = (*fastReflection_QueryEvidenceRequest)(nil) @@ -98,6 +100,12 @@ func (x *fastReflection_QueryEvidenceRequest) Range(f func(protoreflect.FieldDes return } } + if x.Hash != "" { + value := protoreflect.ValueOfString(x.Hash) + if !f(fd_QueryEvidenceRequest_hash, value) { + return + } + } } // Has reports whether a field is populated. @@ -115,6 +123,8 @@ func (x *fastReflection_QueryEvidenceRequest) Has(fd protoreflect.FieldDescripto switch fd.FullName() { case "cosmos.evidence.v1beta1.QueryEvidenceRequest.evidence_hash": return len(x.EvidenceHash) != 0 + case "cosmos.evidence.v1beta1.QueryEvidenceRequest.hash": + return x.Hash != "" default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evidence.v1beta1.QueryEvidenceRequest")) @@ -133,6 +143,8 @@ func (x *fastReflection_QueryEvidenceRequest) Clear(fd protoreflect.FieldDescrip switch fd.FullName() { case "cosmos.evidence.v1beta1.QueryEvidenceRequest.evidence_hash": x.EvidenceHash = nil + case "cosmos.evidence.v1beta1.QueryEvidenceRequest.hash": + x.Hash = "" default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evidence.v1beta1.QueryEvidenceRequest")) @@ -152,6 +164,9 @@ func (x *fastReflection_QueryEvidenceRequest) Get(descriptor protoreflect.FieldD case "cosmos.evidence.v1beta1.QueryEvidenceRequest.evidence_hash": value := x.EvidenceHash return protoreflect.ValueOfBytes(value) + case "cosmos.evidence.v1beta1.QueryEvidenceRequest.hash": + value := x.Hash + return protoreflect.ValueOfString(value) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evidence.v1beta1.QueryEvidenceRequest")) @@ -174,6 +189,8 @@ func (x *fastReflection_QueryEvidenceRequest) Set(fd protoreflect.FieldDescripto switch fd.FullName() { case "cosmos.evidence.v1beta1.QueryEvidenceRequest.evidence_hash": x.EvidenceHash = value.Bytes() + case "cosmos.evidence.v1beta1.QueryEvidenceRequest.hash": + x.Hash = value.Interface().(string) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evidence.v1beta1.QueryEvidenceRequest")) @@ -196,6 +213,8 @@ func (x *fastReflection_QueryEvidenceRequest) Mutable(fd protoreflect.FieldDescr switch fd.FullName() { case "cosmos.evidence.v1beta1.QueryEvidenceRequest.evidence_hash": panic(fmt.Errorf("field evidence_hash of message cosmos.evidence.v1beta1.QueryEvidenceRequest is not mutable")) + case "cosmos.evidence.v1beta1.QueryEvidenceRequest.hash": + panic(fmt.Errorf("field hash of message cosmos.evidence.v1beta1.QueryEvidenceRequest is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evidence.v1beta1.QueryEvidenceRequest")) @@ -211,6 +230,8 @@ func (x *fastReflection_QueryEvidenceRequest) NewField(fd protoreflect.FieldDesc switch fd.FullName() { case "cosmos.evidence.v1beta1.QueryEvidenceRequest.evidence_hash": return protoreflect.ValueOfBytes(nil) + case "cosmos.evidence.v1beta1.QueryEvidenceRequest.hash": + return protoreflect.ValueOfString("") default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.evidence.v1beta1.QueryEvidenceRequest")) @@ -284,6 +305,10 @@ func (x *fastReflection_QueryEvidenceRequest) ProtoMethods() *protoiface.Methods if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } + l = len(x.Hash) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -313,6 +338,13 @@ func (x *fastReflection_QueryEvidenceRequest) ProtoMethods() *protoiface.Methods i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if len(x.Hash) > 0 { + i -= len(x.Hash) + copy(dAtA[i:], x.Hash) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Hash))) + i-- + dAtA[i] = 0x12 + } if len(x.EvidenceHash) > 0 { i -= len(x.EvidenceHash) copy(dAtA[i:], x.EvidenceHash) @@ -403,6 +435,38 @@ func (x *fastReflection_QueryEvidenceRequest) ProtoMethods() *protoiface.Methods x.EvidenceHash = []byte{} } iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Hash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -1900,8 +1964,13 @@ type QueryEvidenceRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + // Deprecated: Prefer to use hash instead. // evidence_hash defines the hash of the requested evidence. + // + // Deprecated: Do not use. EvidenceHash []byte `protobuf:"bytes,1,opt,name=evidence_hash,json=evidenceHash,proto3" json:"evidence_hash,omitempty"` + // hash defines the evidence hash of the requested evidence. + Hash string `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"` } func (x *QueryEvidenceRequest) Reset() { @@ -1924,6 +1993,7 @@ func (*QueryEvidenceRequest) Descriptor() ([]byte, []int) { return file_cosmos_evidence_v1beta1_query_proto_rawDescGZIP(), []int{0} } +// Deprecated: Do not use. func (x *QueryEvidenceRequest) GetEvidenceHash() []byte { if x != nil { return x.EvidenceHash @@ -1931,6 +2001,13 @@ func (x *QueryEvidenceRequest) GetEvidenceHash() []byte { return nil } +func (x *QueryEvidenceRequest) GetHash() string { + if x != nil { + return x.Hash + } + return "" +} + // QueryEvidenceResponse is the response type for the Query/Evidence RPC method. type QueryEvidenceResponse struct { state protoimpl.MessageState @@ -2067,71 +2144,72 @@ var file_cosmos_evidence_v1beta1_query_proto_rawDesc = []byte{ 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x75, 0x0a, 0x14, 0x51, 0x75, 0x65, - 0x72, 0x79, 0x45, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x5d, 0x0a, 0x0d, 0x65, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x5f, 0x68, 0x61, - 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x38, 0xfa, 0xde, 0x1f, 0x34, 0x67, 0x69, - 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x6d, - 0x69, 0x6e, 0x74, 0x2f, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x74, 0x2f, 0x6c, - 0x69, 0x62, 0x73, 0x2f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x2e, 0x48, 0x65, 0x78, 0x42, 0x79, 0x74, - 0x65, 0x73, 0x52, 0x0c, 0x65, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x48, 0x61, 0x73, 0x68, - 0x22, 0x49, 0x0a, 0x15, 0x51, 0x75, 0x65, 0x72, 0x79, 0x45, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, - 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x08, 0x65, 0x76, 0x69, - 0x64, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, - 0x79, 0x52, 0x08, 0x65, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x22, 0x61, 0x0a, 0x17, 0x51, - 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x45, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x46, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x76, - 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x95, - 0x01, 0x0a, 0x18, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x45, 0x76, 0x69, 0x64, 0x65, - 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x08, 0x65, - 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x41, 0x6e, 0x79, 0x52, 0x08, 0x65, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x47, 0x0a, - 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, + 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x8b, 0x01, 0x0a, 0x14, 0x51, 0x75, + 0x65, 0x72, 0x79, 0x45, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x5f, 0x0a, 0x0d, 0x65, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x5f, 0x68, + 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x3a, 0x18, 0x01, 0xfa, 0xde, 0x1f, + 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x65, 0x6e, 0x64, + 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x74, 0x2f, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x6d, 0x69, 0x6e, + 0x74, 0x2f, 0x6c, 0x69, 0x62, 0x73, 0x2f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x2e, 0x48, 0x65, 0x78, + 0x42, 0x79, 0x74, 0x65, 0x73, 0x52, 0x0c, 0x65, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x48, + 0x61, 0x73, 0x68, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x22, 0x49, 0x0a, 0x15, 0x51, 0x75, 0x65, 0x72, 0x79, + 0x45, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x30, 0x0a, 0x08, 0x65, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x08, 0x65, 0x76, 0x69, 0x64, 0x65, 0x6e, + 0x63, 0x65, 0x22, 0x61, 0x0a, 0x17, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x45, 0x76, + 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x46, 0x0a, + 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x26, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, - 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, - 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x32, 0xce, 0x02, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, - 0x12, 0xa4, 0x01, 0x0a, 0x08, 0x45, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x2d, 0x2e, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x2e, - 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x45, 0x76, 0x69, - 0x64, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x2e, 0x76, - 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x45, 0x76, 0x69, 0x64, - 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x39, 0x82, 0xd3, - 0xe4, 0x93, 0x02, 0x33, 0x12, 0x31, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x65, 0x76, - 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x65, - 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x2f, 0x7b, 0x65, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, - 0x65, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x7d, 0x12, 0x9d, 0x01, 0x0a, 0x0b, 0x41, 0x6c, 0x6c, 0x45, - 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x30, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x95, 0x01, 0x0a, 0x18, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, + 0x6c, 0x6c, 0x45, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x30, 0x0a, 0x08, 0x65, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x08, 0x65, 0x76, 0x69, 0x64, + 0x65, 0x6e, 0x63, 0x65, 0x12, 0x47, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x62, + 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x32, 0xc5, 0x02, + 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x9b, 0x01, 0x0a, 0x08, 0x45, 0x76, 0x69, 0x64, + 0x65, 0x6e, 0x63, 0x65, 0x12, 0x2d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, + 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, + 0x75, 0x65, 0x72, 0x79, 0x45, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x69, + 0x64, 0x65, 0x6e, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, + 0x65, 0x72, 0x79, 0x45, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x30, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2a, 0x12, 0x28, 0x2f, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x65, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x2f, 0x76, 0x31, + 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x65, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x2f, 0x7b, + 0x68, 0x61, 0x73, 0x68, 0x7d, 0x12, 0x9d, 0x01, 0x0a, 0x0b, 0x41, 0x6c, 0x6c, 0x45, 0x76, 0x69, + 0x64, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x30, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, + 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, + 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x45, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x45, 0x76, 0x69, 0x64, 0x65, 0x6e, - 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x45, 0x76, 0x69, 0x64, - 0x65, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x29, 0x82, 0xd3, - 0xe4, 0x93, 0x02, 0x23, 0x12, 0x21, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x65, 0x76, - 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x65, - 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x42, 0xe1, 0x01, 0x0a, 0x1b, 0x63, 0x6f, 0x6d, 0x2e, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x2e, - 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x38, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, - 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x65, - 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, - 0x65, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, - 0x02, 0x03, 0x43, 0x45, 0x58, 0xaa, 0x02, 0x17, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x45, - 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, - 0x02, 0x17, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x45, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, - 0x65, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x23, 0x43, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x5c, 0x45, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x5c, 0x56, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, - 0x02, 0x19, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x45, 0x76, 0x69, 0x64, 0x65, 0x6e, - 0x63, 0x65, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x29, 0x82, 0xd3, 0xe4, 0x93, + 0x02, 0x23, 0x12, 0x21, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x65, 0x76, 0x69, 0x64, + 0x65, 0x6e, 0x63, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x65, 0x76, 0x69, + 0x64, 0x65, 0x6e, 0x63, 0x65, 0x42, 0xe1, 0x01, 0x0a, 0x1b, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x65, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x2e, 0x76, 0x31, + 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, + 0x6f, 0x50, 0x01, 0x5a, 0x38, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, + 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x65, 0x76, 0x69, + 0x64, 0x65, 0x6e, 0x63, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x65, 0x76, + 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, + 0x43, 0x45, 0x58, 0xaa, 0x02, 0x17, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x45, 0x76, 0x69, + 0x64, 0x65, 0x6e, 0x63, 0x65, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x17, + 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x45, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x5c, + 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x23, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x5c, 0x45, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x19, + 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x45, 0x76, 0x69, 0x64, 0x65, 0x6e, 0x63, 0x65, + 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( diff --git a/proto/cosmos/evidence/v1beta1/query.proto b/proto/cosmos/evidence/v1beta1/query.proto index eda00544c72..85967f622cb 100644 --- a/proto/cosmos/evidence/v1beta1/query.proto +++ b/proto/cosmos/evidence/v1beta1/query.proto @@ -12,7 +12,7 @@ option go_package = "github.com/cosmos/cosmos-sdk/x/evidence/types"; service Query { // Evidence queries evidence based on evidence hash. rpc Evidence(QueryEvidenceRequest) returns (QueryEvidenceResponse) { - option (google.api.http).get = "/cosmos/evidence/v1beta1/evidence/{evidence_hash}"; + option (google.api.http).get = "/cosmos/evidence/v1beta1/evidence/{hash}"; } // AllEvidence queries all evidence. @@ -23,8 +23,12 @@ service Query { // QueryEvidenceRequest is the request type for the Query/Evidence RPC method. message QueryEvidenceRequest { + // Deprecated: Prefer to use hash instead. // evidence_hash defines the hash of the requested evidence. - bytes evidence_hash = 1 [(gogoproto.casttype) = "github.com/tendermint/tendermint/libs/bytes.HexBytes"]; + bytes evidence_hash = 1 [deprecated = true, (gogoproto.casttype) = "github.com/tendermint/tendermint/libs/bytes.HexBytes"]; + + // hash defines the evidence hash of the requested evidence. + string hash = 2; } // QueryEvidenceResponse is the response type for the Query/Evidence RPC method. diff --git a/x/evidence/types/query.pb.go b/x/evidence/types/query.pb.go index aababa92cbd..d342aeeb2c3 100644 --- a/x/evidence/types/query.pb.go +++ b/x/evidence/types/query.pb.go @@ -34,8 +34,11 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // QueryEvidenceRequest is the request type for the Query/Evidence RPC method. type QueryEvidenceRequest struct { + // Deprecated: Prefer to use hash instead. // evidence_hash defines the hash of the requested evidence. - EvidenceHash github_com_tendermint_tendermint_libs_bytes.HexBytes `protobuf:"bytes,1,opt,name=evidence_hash,json=evidenceHash,proto3,casttype=github.com/tendermint/tendermint/libs/bytes.HexBytes" json:"evidence_hash,omitempty"` + EvidenceHash github_com_tendermint_tendermint_libs_bytes.HexBytes `protobuf:"bytes,1,opt,name=evidence_hash,json=evidenceHash,proto3,casttype=github.com/tendermint/tendermint/libs/bytes.HexBytes" json:"evidence_hash,omitempty"` // Deprecated: Do not use. + // hash defines the evidence hash of the requested evidence. + Hash string `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"` } func (m *QueryEvidenceRequest) Reset() { *m = QueryEvidenceRequest{} } @@ -71,6 +74,7 @@ func (m *QueryEvidenceRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryEvidenceRequest proto.InternalMessageInfo +// Deprecated: Do not use. func (m *QueryEvidenceRequest) GetEvidenceHash() github_com_tendermint_tendermint_libs_bytes.HexBytes { if m != nil { return m.EvidenceHash @@ -78,6 +82,13 @@ func (m *QueryEvidenceRequest) GetEvidenceHash() github_com_tendermint_tendermin return nil } +func (m *QueryEvidenceRequest) GetHash() string { + if m != nil { + return m.Hash + } + return "" +} + // QueryEvidenceResponse is the response type for the Query/Evidence RPC method. type QueryEvidenceResponse struct { // evidence returns the requested evidence. @@ -239,37 +250,38 @@ func init() { } var fileDescriptor_07043de1a84d215a = []byte{ - // 468 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0xcf, 0x6f, 0xd3, 0x30, - 0x14, 0xc7, 0xeb, 0x22, 0xd0, 0xe4, 0x8d, 0x8b, 0x55, 0xb4, 0x11, 0xa1, 0x00, 0x99, 0xc4, 0x2f, - 0xa9, 0xf6, 0xb2, 0x71, 0x80, 0xe3, 0x2a, 0xc1, 0xc6, 0x0d, 0x72, 0x44, 0x42, 0xc8, 0x69, 0x4d, - 0x12, 0x91, 0xda, 0x59, 0xed, 0x4c, 0x8d, 0x10, 0x17, 0xfe, 0x02, 0x24, 0xc4, 0x91, 0x1b, 0x7f, - 0x0c, 0x27, 0x54, 0x89, 0x0b, 0x27, 0x84, 0x5a, 0xfe, 0x0a, 0x4e, 0x28, 0xb6, 0xd3, 0xa6, 0xbf, - 0x28, 0x9c, 0xf2, 0x62, 0xbf, 0xf7, 0xfd, 0x7e, 0xfc, 0xde, 0x83, 0xfb, 0x5d, 0x21, 0xfb, 0x42, - 0x12, 0x76, 0x9e, 0xf4, 0x18, 0xef, 0x32, 0x72, 0xee, 0x87, 0x4c, 0x51, 0x9f, 0x9c, 0xe5, 0x6c, - 0x50, 0xe0, 0x6c, 0x20, 0x94, 0x40, 0xbb, 0x26, 0x09, 0x57, 0x49, 0xd8, 0x26, 0x39, 0xf7, 0x6c, - 0x75, 0x48, 0x25, 0x33, 0x15, 0xd3, 0xfa, 0x8c, 0x46, 0x09, 0xa7, 0x2a, 0x11, 0xdc, 0x88, 0x38, - 0xad, 0x48, 0x44, 0x42, 0x87, 0xa4, 0x8c, 0xec, 0xe9, 0xd5, 0x48, 0x88, 0x28, 0x65, 0x44, 0xff, - 0x85, 0xf9, 0x2b, 0x42, 0xb9, 0x75, 0x75, 0xae, 0xd9, 0x2b, 0x9a, 0x25, 0x84, 0x72, 0x2e, 0x94, - 0x56, 0x93, 0xe6, 0xd6, 0xcb, 0x61, 0xeb, 0x59, 0x69, 0xf8, 0xc8, 0x32, 0x05, 0xec, 0x2c, 0x67, - 0x52, 0xa1, 0x17, 0xf0, 0x72, 0x85, 0xf9, 0x32, 0xa6, 0x32, 0xde, 0x03, 0x37, 0xc0, 0x9d, 0x9d, - 0xce, 0x83, 0xdf, 0x3f, 0xae, 0xdf, 0x8f, 0x12, 0x15, 0xe7, 0x21, 0xee, 0x8a, 0x3e, 0x51, 0x8c, - 0xf7, 0xd8, 0xa0, 0x9f, 0x70, 0x55, 0x0f, 0xd3, 0x24, 0x94, 0x24, 0x2c, 0x14, 0x93, 0xf8, 0x94, - 0x0d, 0x3b, 0x65, 0x10, 0xec, 0x54, 0x72, 0xa7, 0x54, 0xc6, 0xde, 0x13, 0x78, 0x65, 0xc1, 0x56, - 0x66, 0x82, 0x4b, 0x86, 0x0e, 0xe0, 0x56, 0x95, 0xa8, 0x2d, 0xb7, 0x0f, 0x5b, 0xd8, 0x3c, 0x00, - 0x57, 0x6f, 0xc3, 0xc7, 0xbc, 0x08, 0xa6, 0x59, 0x1e, 0x85, 0xbb, 0x5a, 0xea, 0x38, 0x4d, 0x17, - 0x1f, 0xf1, 0x18, 0xc2, 0x59, 0xff, 0xac, 0xdc, 0x2d, 0x6c, 0xa7, 0x50, 0x36, 0x1b, 0x9b, 0xf1, - 0xd8, 0x66, 0xe3, 0xa7, 0x34, 0xaa, 0x6a, 0x83, 0x5a, 0xa5, 0xf7, 0x11, 0xc0, 0xbd, 0x65, 0x8f, - 0x95, 0xc4, 0x17, 0x36, 0x13, 0xa3, 0x93, 0x39, 0xac, 0xa6, 0xc6, 0xba, 0xbd, 0x11, 0xcb, 0xd8, - 0xd5, 0xb9, 0x0e, 0xbf, 0x36, 0xe1, 0x45, 0xcd, 0x85, 0x3e, 0x03, 0xb8, 0x55, 0x91, 0xa1, 0x36, - 0x5e, 0xb3, 0x68, 0x78, 0xd5, 0xa8, 0x1d, 0xfc, 0xaf, 0xe9, 0x86, 0xc0, 0x7b, 0xf8, 0xee, 0xdb, - 0xaf, 0x0f, 0xcd, 0x23, 0xe4, 0x93, 0x75, 0x4b, 0x3f, 0x3d, 0x78, 0x33, 0xb7, 0x43, 0x6f, 0xd1, - 0x27, 0x00, 0xb7, 0x6b, 0x3d, 0x44, 0x07, 0x7f, 0xb7, 0x5e, 0x1e, 0xa9, 0xe3, 0xff, 0x47, 0x85, - 0xe5, 0xbd, 0xab, 0x79, 0xf7, 0xd1, 0xcd, 0x8d, 0xbc, 0x9d, 0x93, 0x2f, 0x63, 0x17, 0x8c, 0xc6, - 0x2e, 0xf8, 0x39, 0x76, 0xc1, 0xfb, 0x89, 0xdb, 0x18, 0x4d, 0xdc, 0xc6, 0xf7, 0x89, 0xdb, 0x78, - 0xde, 0xae, 0x2d, 0xbd, 0x95, 0x31, 0x9f, 0xb6, 0xec, 0xbd, 0x26, 0xc3, 0x99, 0xa6, 0x2a, 0x32, - 0x26, 0xc3, 0x4b, 0x7a, 0xf4, 0x47, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x50, 0xfb, 0x8a, 0x39, - 0x18, 0x04, 0x00, 0x00, + // 481 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x93, 0x4f, 0x6f, 0xd3, 0x30, + 0x18, 0xc6, 0xeb, 0xf0, 0x47, 0xc3, 0x1b, 0x17, 0xab, 0x68, 0x25, 0x42, 0x61, 0x64, 0x12, 0x94, + 0x49, 0xb5, 0xdb, 0xc1, 0x89, 0xdb, 0x2a, 0xc1, 0xc6, 0x0d, 0x72, 0xe4, 0x32, 0x39, 0xad, 0x49, + 0x22, 0x52, 0x3b, 0xab, 0x9d, 0x69, 0x11, 0xe2, 0xc2, 0x95, 0x0b, 0x12, 0xe2, 0x84, 0xf8, 0x38, + 0x48, 0x1c, 0x27, 0x71, 0xe1, 0x84, 0x50, 0xcb, 0xa7, 0xe0, 0x84, 0x62, 0x3b, 0x5d, 0x58, 0x5b, + 0xca, 0x4e, 0x7d, 0x1b, 0xbf, 0xcf, 0xf3, 0xfe, 0xec, 0xc7, 0x86, 0xdb, 0x03, 0x21, 0x47, 0x42, + 0x12, 0x76, 0x9c, 0x0c, 0x19, 0x1f, 0x30, 0x72, 0xdc, 0x0b, 0x99, 0xa2, 0x3d, 0x72, 0x94, 0xb3, + 0x71, 0x81, 0xb3, 0xb1, 0x50, 0x02, 0x6d, 0x9a, 0x26, 0x5c, 0x35, 0x61, 0xdb, 0xe4, 0xee, 0x58, + 0x75, 0x48, 0x25, 0x33, 0x8a, 0x99, 0x3e, 0xa3, 0x51, 0xc2, 0xa9, 0x4a, 0x04, 0x37, 0x26, 0x6e, + 0x33, 0x12, 0x91, 0xd0, 0x25, 0x29, 0x2b, 0xfb, 0xf5, 0x66, 0x24, 0x44, 0x94, 0x32, 0xa2, 0xff, + 0x85, 0xf9, 0x4b, 0x42, 0xb9, 0x9d, 0xea, 0xde, 0xb2, 0x4b, 0x34, 0x4b, 0x08, 0xe5, 0x5c, 0x28, + 0xed, 0x26, 0xcd, 0xaa, 0xff, 0x0e, 0xc0, 0xe6, 0xf3, 0x72, 0xe2, 0x63, 0x0b, 0x15, 0xb0, 0xa3, + 0x9c, 0x49, 0x85, 0x0e, 0xe1, 0xf5, 0x8a, 0xf3, 0x30, 0xa6, 0x32, 0x6e, 0x81, 0x2d, 0xd0, 0xde, + 0xe8, 0x3f, 0xfa, 0xfd, 0xe3, 0xf6, 0xc3, 0x28, 0x51, 0x71, 0x1e, 0xe2, 0x81, 0x18, 0x11, 0xc5, + 0xf8, 0x90, 0x8d, 0x47, 0x09, 0x57, 0xf5, 0x32, 0x4d, 0x42, 0x49, 0xc2, 0x42, 0x31, 0x89, 0x0f, + 0xd8, 0x49, 0xbf, 0x2c, 0x5a, 0x20, 0xd8, 0xa8, 0x0c, 0x0f, 0xa8, 0x8c, 0x11, 0x82, 0x97, 0xb5, + 0xaf, 0xb3, 0x05, 0xda, 0xd7, 0x02, 0x5d, 0xfb, 0x4f, 0xe1, 0x8d, 0x73, 0x30, 0x32, 0x13, 0x5c, + 0x32, 0xd4, 0x85, 0x6b, 0x95, 0x58, 0x83, 0xac, 0xef, 0x36, 0xb1, 0xd9, 0x17, 0xae, 0xb6, 0x8c, + 0xf7, 0x78, 0x11, 0xcc, 0xba, 0x7c, 0x0a, 0x37, 0xb5, 0xd5, 0x5e, 0x9a, 0x9e, 0xdf, 0xda, 0x13, + 0x08, 0xcf, 0x8e, 0xd5, 0xda, 0xdd, 0xc5, 0x36, 0x9c, 0x32, 0x03, 0x6c, 0x52, 0xb3, 0x19, 0xe0, + 0x67, 0x34, 0xaa, 0xb4, 0x41, 0x4d, 0xe9, 0x7f, 0x04, 0xb0, 0x35, 0x3f, 0x63, 0x21, 0xf1, 0xa5, + 0xd5, 0xc4, 0x68, 0xff, 0x2f, 0x2c, 0x47, 0x63, 0xdd, 0x5b, 0x89, 0x65, 0xc6, 0xd5, 0xb9, 0x76, + 0xbf, 0x38, 0xf0, 0x8a, 0xe6, 0x42, 0x9f, 0x00, 0x5c, 0xab, 0xc8, 0x50, 0x07, 0x2f, 0xb9, 0x7f, + 0x78, 0xd1, 0x05, 0x70, 0xf1, 0xff, 0xb6, 0x1b, 0x02, 0xbf, 0xfb, 0xf6, 0xdb, 0xaf, 0x0f, 0xce, + 0x0e, 0x6a, 0x93, 0x65, 0x6f, 0x61, 0xf6, 0xe1, 0x75, 0x19, 0xf6, 0x1b, 0xf4, 0x19, 0xc0, 0xf5, + 0xda, 0xd1, 0xa1, 0xee, 0xbf, 0x27, 0xce, 0x27, 0xe9, 0xf6, 0x2e, 0xa0, 0xb0, 0x98, 0xf7, 0x35, + 0xe6, 0x36, 0xba, 0xb3, 0x12, 0xb3, 0xbf, 0xff, 0x75, 0xe2, 0x81, 0xd3, 0x89, 0x07, 0x7e, 0x4e, + 0x3c, 0xf0, 0x7e, 0xea, 0x35, 0x4e, 0xa7, 0x5e, 0xe3, 0xfb, 0xd4, 0x6b, 0xbc, 0xe8, 0xd4, 0x5e, + 0x80, 0xb5, 0x31, 0x3f, 0x1d, 0x39, 0x7c, 0x45, 0x4e, 0xce, 0x3c, 0x55, 0x91, 0x31, 0x19, 0x5e, + 0xd5, 0x89, 0x3f, 0xf8, 0x13, 0x00, 0x00, 0xff, 0xff, 0x6a, 0xa4, 0xdd, 0x01, 0x26, 0x04, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -412,6 +424,13 @@ func (m *QueryEvidenceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.Hash) > 0 { + i -= len(m.Hash) + copy(dAtA[i:], m.Hash) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Hash))) + i-- + dAtA[i] = 0x12 + } if len(m.EvidenceHash) > 0 { i -= len(m.EvidenceHash) copy(dAtA[i:], m.EvidenceHash) @@ -562,6 +581,10 @@ func (m *QueryEvidenceRequest) Size() (n int) { if l > 0 { n += 1 + l + sovQuery(uint64(l)) } + l = len(m.Hash) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } return n } @@ -679,6 +702,38 @@ func (m *QueryEvidenceRequest) Unmarshal(dAtA []byte) error { m.EvidenceHash = []byte{} } iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Hash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) diff --git a/x/evidence/types/query.pb.gw.go b/x/evidence/types/query.pb.gw.go index 77a7be86d1d..fb112060574 100644 --- a/x/evidence/types/query.pb.gw.go +++ b/x/evidence/types/query.pb.gw.go @@ -33,6 +33,10 @@ var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage var _ = metadata.Join +var ( + filter_Query_Evidence_0 = &utilities.DoubleArray{Encoding: map[string]int{"hash": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + func request_Query_Evidence_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryEvidenceRequest var metadata runtime.ServerMetadata @@ -44,15 +48,22 @@ func request_Query_Evidence_0(ctx context.Context, marshaler runtime.Marshaler, _ = err ) - val, ok = pathParams["evidence_hash"] + val, ok = pathParams["hash"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "evidence_hash") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "hash") } - protoReq.EvidenceHash, err = runtime.Bytes(val) + protoReq.Hash, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "evidence_hash", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "hash", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Evidence_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := client.Evidence(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -71,15 +82,22 @@ func local_request_Query_Evidence_0(ctx context.Context, marshaler runtime.Marsh _ = err ) - val, ok = pathParams["evidence_hash"] + val, ok = pathParams["hash"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "evidence_hash") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "hash") } - protoReq.EvidenceHash, err = runtime.Bytes(val) + protoReq.Hash, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "evidence_hash", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "hash", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Evidence_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } msg, err := server.Evidence(ctx, &protoReq) @@ -260,7 +278,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } var ( - pattern_Query_Evidence_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 1, 1, 0, 4, 1, 5, 3}, []string{"cosmos", "evidence", "v1beta1", "evidence_hash"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_Evidence_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 1, 1, 0, 4, 1, 5, 3}, []string{"cosmos", "evidence", "v1beta1", "hash"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_AllEvidence_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 1}, []string{"cosmos", "evidence", "v1beta1"}, "", runtime.AssumeColonVerbOpt(false))) ) From 0ef71fa2dcb459a4c564f2e5fc5a95accbd3be46 Mon Sep 17 00:00:00 2001 From: likhita-809 Date: Thu, 3 Nov 2022 13:23:32 +0530 Subject: [PATCH 2/4] wip: handle evidence --- x/evidence/client/cli/query.go | 8 +------- x/evidence/keeper/grpc_query.go | 15 +++++++++++---- x/evidence/keeper/grpc_query_test.go | 6 ++---- x/evidence/keeper/keeper.go | 2 +- x/evidence/types/querier.go | 6 ++---- 5 files changed, 17 insertions(+), 20 deletions(-) diff --git a/x/evidence/client/cli/query.go b/x/evidence/client/cli/query.go index e40465a84b9..f204e324626 100644 --- a/x/evidence/client/cli/query.go +++ b/x/evidence/client/cli/query.go @@ -2,7 +2,6 @@ package cli import ( "context" - "encoding/hex" "fmt" "strings" @@ -64,14 +63,9 @@ func QueryEvidenceCmd() func(*cobra.Command, []string) error { } func queryEvidence(clientCtx client.Context, hash string) error { - decodedHash, err := hex.DecodeString(hash) - if err != nil { - return fmt.Errorf("invalid evidence hash: %w", err) - } - queryClient := types.NewQueryClient(clientCtx) - params := &types.QueryEvidenceRequest{EvidenceHash: decodedHash} + params := &types.QueryEvidenceRequest{Hash: hash} res, err := queryClient.Evidence(context.Background(), params) if err != nil { return err diff --git a/x/evidence/keeper/grpc_query.go b/x/evidence/keeper/grpc_query.go index 480273707ce..19c3b26cb8e 100644 --- a/x/evidence/keeper/grpc_query.go +++ b/x/evidence/keeper/grpc_query.go @@ -2,6 +2,8 @@ package keeper import ( "context" + "encoding/hex" + "fmt" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -24,15 +26,20 @@ func (k Keeper) Evidence(c context.Context, req *types.QueryEvidenceRequest) (*t return nil, status.Errorf(codes.InvalidArgument, "empty request") } - if req.EvidenceHash == nil { - return nil, status.Errorf(codes.InvalidArgument, "invalid hash") + if req.Hash == "" { + return nil, status.Errorf(codes.InvalidArgument, "invalid request\nhash is empty") } ctx := sdk.UnwrapSDKContext(c) - evidence, _ := k.GetEvidence(ctx, req.EvidenceHash) + decodedHash, err := hex.DecodeString(req.Hash) + if err != nil { + return nil, fmt.Errorf("invalid evidence hash: %w", err) + } + + evidence, _ := k.GetEvidence(ctx, decodedHash) if evidence == nil { - return nil, status.Errorf(codes.NotFound, "evidence %s not found", req.EvidenceHash) + return nil, status.Errorf(codes.NotFound, "evidence %s not found", req.Hash) } msg, ok := evidence.(proto.Message) diff --git a/x/evidence/keeper/grpc_query_test.go b/x/evidence/keeper/grpc_query_test.go index 0fb87bbfca0..47b31137312 100644 --- a/x/evidence/keeper/grpc_query_test.go +++ b/x/evidence/keeper/grpc_query_test.go @@ -7,8 +7,6 @@ import ( "github.com/cosmos/cosmos-sdk/types/query" "github.com/cosmos/cosmos-sdk/x/evidence/exported" "github.com/cosmos/cosmos-sdk/x/evidence/types" - - tmbytes "github.com/tendermint/tendermint/libs/bytes" ) func (suite *KeeperTestSuite) TestQueryEvidence() { @@ -34,7 +32,7 @@ func (suite *KeeperTestSuite) TestQueryEvidence() { { "invalid request with empty evidence hash", func() { - req = &types.QueryEvidenceRequest{EvidenceHash: tmbytes.HexBytes{}} + req = &types.QueryEvidenceRequest{Hash: ""} }, false, func(res *types.QueryEvidenceResponse) {}, @@ -44,7 +42,7 @@ func (suite *KeeperTestSuite) TestQueryEvidence() { func() { numEvidence := 100 evidence = suite.populateEvidence(suite.ctx, numEvidence) - req = types.NewQueryEvidenceRequest(evidence[0].Hash()) + req = types.NewQueryEvidenceRequest(evidence[0].Hash().String()) }, true, func(res *types.QueryEvidenceResponse) { diff --git a/x/evidence/keeper/keeper.go b/x/evidence/keeper/keeper.go index cbab55320d3..cf9640662e3 100644 --- a/x/evidence/keeper/keeper.go +++ b/x/evidence/keeper/keeper.go @@ -3,12 +3,12 @@ package keeper import ( "fmt" - storetypes "github.com/cosmos/cosmos-sdk/store/types" tmbytes "github.com/tendermint/tendermint/libs/bytes" "github.com/tendermint/tendermint/libs/log" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/store/prefix" + storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/evidence/exported" diff --git a/x/evidence/types/querier.go b/x/evidence/types/querier.go index 72f8a604d3e..5c069a040f0 100644 --- a/x/evidence/types/querier.go +++ b/x/evidence/types/querier.go @@ -1,8 +1,6 @@ package types import ( - tmbytes "github.com/tendermint/tendermint/libs/bytes" - query "github.com/cosmos/cosmos-sdk/types/query" ) @@ -13,8 +11,8 @@ const ( ) // NewQueryEvidenceRequest creates a new instance of QueryEvidenceRequest. -func NewQueryEvidenceRequest(hash tmbytes.HexBytes) *QueryEvidenceRequest { - return &QueryEvidenceRequest{EvidenceHash: hash} +func NewQueryEvidenceRequest(hash string) *QueryEvidenceRequest { + return &QueryEvidenceRequest{Hash: hash} } // NewQueryAllEvidenceRequest creates a new instance of QueryAllEvidenceRequest. From 20821bad8bd713367b9683ea4e65925804c94fce Mon Sep 17 00:00:00 2001 From: likhita-809 Date: Thu, 3 Nov 2022 21:06:53 +0530 Subject: [PATCH 3/4] address review comments --- api/cosmos/evidence/v1beta1/query.pulsar.go | 4 +++- proto/cosmos/evidence/v1beta1/query.proto | 4 +++- x/evidence/types/query.pb.go | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/api/cosmos/evidence/v1beta1/query.pulsar.go b/api/cosmos/evidence/v1beta1/query.pulsar.go index 35e4df7aaa4..caaf87ae77d 100644 --- a/api/cosmos/evidence/v1beta1/query.pulsar.go +++ b/api/cosmos/evidence/v1beta1/query.pulsar.go @@ -1964,12 +1964,14 @@ type QueryEvidenceRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Deprecated: Prefer to use hash instead. // evidence_hash defines the hash of the requested evidence. + // Deprecated: Use hash, a HEX encoded string, instead. // // Deprecated: Do not use. EvidenceHash []byte `protobuf:"bytes,1,opt,name=evidence_hash,json=evidenceHash,proto3" json:"evidence_hash,omitempty"` // hash defines the evidence hash of the requested evidence. + // + // Since: cosmos-sdk 0.47 Hash string `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"` } diff --git a/proto/cosmos/evidence/v1beta1/query.proto b/proto/cosmos/evidence/v1beta1/query.proto index 85967f622cb..4f380f84a5e 100644 --- a/proto/cosmos/evidence/v1beta1/query.proto +++ b/proto/cosmos/evidence/v1beta1/query.proto @@ -23,11 +23,13 @@ service Query { // QueryEvidenceRequest is the request type for the Query/Evidence RPC method. message QueryEvidenceRequest { - // Deprecated: Prefer to use hash instead. // evidence_hash defines the hash of the requested evidence. + // Deprecated: Use hash, a HEX encoded string, instead. bytes evidence_hash = 1 [deprecated = true, (gogoproto.casttype) = "github.com/tendermint/tendermint/libs/bytes.HexBytes"]; // hash defines the evidence hash of the requested evidence. + // + // Since: cosmos-sdk 0.47 string hash = 2; } diff --git a/x/evidence/types/query.pb.go b/x/evidence/types/query.pb.go index d342aeeb2c3..62e5bb919ac 100644 --- a/x/evidence/types/query.pb.go +++ b/x/evidence/types/query.pb.go @@ -34,10 +34,12 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // QueryEvidenceRequest is the request type for the Query/Evidence RPC method. type QueryEvidenceRequest struct { - // Deprecated: Prefer to use hash instead. // evidence_hash defines the hash of the requested evidence. + // Deprecated: Use hash, a HEX encoded string, instead. EvidenceHash github_com_tendermint_tendermint_libs_bytes.HexBytes `protobuf:"bytes,1,opt,name=evidence_hash,json=evidenceHash,proto3,casttype=github.com/tendermint/tendermint/libs/bytes.HexBytes" json:"evidence_hash,omitempty"` // Deprecated: Do not use. // hash defines the evidence hash of the requested evidence. + // + // Since: cosmos-sdk 0.47 Hash string `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"` } From a10506b0962bb1e0802ec6a0edc9ee3625467308 Mon Sep 17 00:00:00 2001 From: likhita-809 Date: Fri, 4 Nov 2022 11:39:19 +0530 Subject: [PATCH 4/4] add changelog and requested changes --- CHANGELOG.md | 4 ++++ x/evidence/keeper/grpc_query.go | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9931e9ea6e7..7b1aa957ac7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Features +* (x/evidence) [#13740](https://github.com/cosmos/cosmos-sdk/pull/13740) Add new proto field `hash` of type `string` to `QueryEvidenceRequest` which helps to decode the hash properly while using query API. * (core) [#13306](https://github.com/cosmos/cosmos-sdk/pull/13306) Add a `FormatCoins` function to in `core/coins` to format sdk Coins following the Value Renderers spec. * (math) [#13306](https://github.com/cosmos/cosmos-sdk/pull/13306) Add `FormatInt` and `FormatDec` functiosn in `math` to format integers and decimals following the Value Renderers spec. * (x/staking) [#13122](https://github.com/cosmos/cosmos-sdk/pull/13122) Add `UnbondingCanComplete` and `PutUnbondingOnHold` to `x/staking` module. @@ -107,6 +108,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### API Breaking Changes +* (x/evidence) [#13740](https://github.com/cosmos/cosmos-sdk/pull/13740) The `NewQueryEvidenceRequest` function now takes `hash` as a HEX encoded `string`. * (server) [#13485](https://github.com/cosmos/cosmos-sdk/pull/13485) The `Application` service now requires the `RegisterNodeService` method to be implemented. * (x/slashing, x/staking) [#13122](https://github.com/cosmos/cosmos-sdk/pull/13122) Add the infraction a validator commited type as an argument to the `Slash` keeper method. * [#13437](https://github.com/cosmos/cosmos-sdk/pull/13437) Add a list of modules to export argument in `ExportAppStateAndValidators`. @@ -162,6 +164,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Bug Fixes +* (x/evidence) [#13740](https://github.com/cosmos/cosmos-sdk/pull/13740) Fix evidence query API to decode the hash properly. * [#13553](https://github.com/cosmos/cosmos-sdk/pull/13553) Ensure all parameter validation for decimal types handles nil decimal values. * [#13145](https://github.com/cosmos/cosmos-sdk/pull/13145) Fix panic when calling `String()` to a Record struct type. * [#13116](https://github.com/cosmos/cosmos-sdk/pull/13116) Fix a dead-lock in the `Group-TotalWeight` `x/group` invariant. @@ -179,6 +182,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Deprecated +* (x/evidence) [#13740](https://github.com/cosmos/cosmos-sdk/pull/13740) The `evidence_hash` field of `QueryEvidenceRequest` has been deprecated and now contains a new field `hash` with type `string`. * (x/bank) [#11859](https://github.com/cosmos/cosmos-sdk/pull/11859) The Params.SendEnabled field is deprecated and unusable. The information can now be accessed using the BankKeeper. Setting can be done using MsgSetSendEnabled as a governance proposal. diff --git a/x/evidence/keeper/grpc_query.go b/x/evidence/keeper/grpc_query.go index 19c3b26cb8e..369b38eab77 100644 --- a/x/evidence/keeper/grpc_query.go +++ b/x/evidence/keeper/grpc_query.go @@ -27,7 +27,7 @@ func (k Keeper) Evidence(c context.Context, req *types.QueryEvidenceRequest) (*t } if req.Hash == "" { - return nil, status.Errorf(codes.InvalidArgument, "invalid request\nhash is empty") + return nil, status.Errorf(codes.InvalidArgument, "invalid request; hash is empty") } ctx := sdk.UnwrapSDKContext(c)