diff --git a/api/layer/oracle/aggregate_reporter.pulsar.go b/api/layer/oracle/aggregate_reporter.pulsar.go index b342309e7..3c455c796 100644 --- a/api/layer/oracle/aggregate_reporter.pulsar.go +++ b/api/layer/oracle/aggregate_reporter.pulsar.go @@ -13,9 +13,10 @@ import ( ) var ( - md_AggregateReporter protoreflect.MessageDescriptor - fd_AggregateReporter_reporter protoreflect.FieldDescriptor - fd_AggregateReporter_power protoreflect.FieldDescriptor + md_AggregateReporter protoreflect.MessageDescriptor + fd_AggregateReporter_reporter protoreflect.FieldDescriptor + fd_AggregateReporter_power protoreflect.FieldDescriptor + fd_AggregateReporter_block_number protoreflect.FieldDescriptor ) func init() { @@ -23,6 +24,7 @@ func init() { md_AggregateReporter = File_layer_oracle_aggregate_reporter_proto.Messages().ByName("AggregateReporter") fd_AggregateReporter_reporter = md_AggregateReporter.Fields().ByName("reporter") fd_AggregateReporter_power = md_AggregateReporter.Fields().ByName("power") + fd_AggregateReporter_block_number = md_AggregateReporter.Fields().ByName("block_number") } var _ protoreflect.Message = (*fastReflection_AggregateReporter)(nil) @@ -102,6 +104,12 @@ func (x *fastReflection_AggregateReporter) Range(f func(protoreflect.FieldDescri return } } + if x.BlockNumber != int64(0) { + value := protoreflect.ValueOfInt64(x.BlockNumber) + if !f(fd_AggregateReporter_block_number, value) { + return + } + } } // Has reports whether a field is populated. @@ -121,6 +129,8 @@ func (x *fastReflection_AggregateReporter) Has(fd protoreflect.FieldDescriptor) return x.Reporter != "" case "layer.oracle.AggregateReporter.power": return x.Power != int64(0) + case "layer.oracle.AggregateReporter.block_number": + return x.BlockNumber != int64(0) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.AggregateReporter")) @@ -141,6 +151,8 @@ func (x *fastReflection_AggregateReporter) Clear(fd protoreflect.FieldDescriptor x.Reporter = "" case "layer.oracle.AggregateReporter.power": x.Power = int64(0) + case "layer.oracle.AggregateReporter.block_number": + x.BlockNumber = int64(0) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.AggregateReporter")) @@ -163,6 +175,9 @@ func (x *fastReflection_AggregateReporter) Get(descriptor protoreflect.FieldDesc case "layer.oracle.AggregateReporter.power": value := x.Power return protoreflect.ValueOfInt64(value) + case "layer.oracle.AggregateReporter.block_number": + value := x.BlockNumber + return protoreflect.ValueOfInt64(value) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.AggregateReporter")) @@ -187,6 +202,8 @@ func (x *fastReflection_AggregateReporter) Set(fd protoreflect.FieldDescriptor, x.Reporter = value.Interface().(string) case "layer.oracle.AggregateReporter.power": x.Power = value.Int() + case "layer.oracle.AggregateReporter.block_number": + x.BlockNumber = value.Int() default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.AggregateReporter")) @@ -211,6 +228,8 @@ func (x *fastReflection_AggregateReporter) Mutable(fd protoreflect.FieldDescript panic(fmt.Errorf("field reporter of message layer.oracle.AggregateReporter is not mutable")) case "layer.oracle.AggregateReporter.power": panic(fmt.Errorf("field power of message layer.oracle.AggregateReporter is not mutable")) + case "layer.oracle.AggregateReporter.block_number": + panic(fmt.Errorf("field block_number of message layer.oracle.AggregateReporter is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.AggregateReporter")) @@ -228,6 +247,8 @@ func (x *fastReflection_AggregateReporter) NewField(fd protoreflect.FieldDescrip return protoreflect.ValueOfString("") case "layer.oracle.AggregateReporter.power": return protoreflect.ValueOfInt64(int64(0)) + case "layer.oracle.AggregateReporter.block_number": + return protoreflect.ValueOfInt64(int64(0)) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.oracle.AggregateReporter")) @@ -304,6 +325,9 @@ func (x *fastReflection_AggregateReporter) ProtoMethods() *protoiface.Methods { if x.Power != 0 { n += 1 + runtime.Sov(uint64(x.Power)) } + if x.BlockNumber != 0 { + n += 1 + runtime.Sov(uint64(x.BlockNumber)) + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -333,6 +357,11 @@ func (x *fastReflection_AggregateReporter) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if x.BlockNumber != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.BlockNumber)) + i-- + dAtA[i] = 0x18 + } if x.Power != 0 { i = runtime.EncodeVarint(dAtA, i, uint64(x.Power)) i-- @@ -445,6 +474,25 @@ func (x *fastReflection_AggregateReporter) ProtoMethods() *protoiface.Methods { break } } + case 3: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field BlockNumber", wireType) + } + x.BlockNumber = 0 + 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++ + x.BlockNumber |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -498,8 +546,9 @@ type AggregateReporter struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Reporter string `protobuf:"bytes,1,opt,name=reporter,proto3" json:"reporter,omitempty"` - Power int64 `protobuf:"varint,2,opt,name=power,proto3" json:"power,omitempty"` + Reporter string `protobuf:"bytes,1,opt,name=reporter,proto3" json:"reporter,omitempty"` + Power int64 `protobuf:"varint,2,opt,name=power,proto3" json:"power,omitempty"` + BlockNumber int64 `protobuf:"varint,3,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` } func (x *AggregateReporter) Reset() { @@ -536,28 +585,38 @@ func (x *AggregateReporter) GetPower() int64 { return 0 } +func (x *AggregateReporter) GetBlockNumber() int64 { + if x != nil { + return x.BlockNumber + } + return 0 +} + var File_layer_oracle_aggregate_reporter_proto protoreflect.FileDescriptor var file_layer_oracle_aggregate_reporter_proto_rawDesc = []byte{ 0x0a, 0x25, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2f, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x5f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, - 0x72, 0x61, 0x63, 0x6c, 0x65, 0x22, 0x45, 0x0a, 0x11, 0x41, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, + 0x72, 0x61, 0x63, 0x6c, 0x65, 0x22, 0x68, 0x0a, 0x11, 0x41, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x42, 0xa8, 0x01, 0x0a, - 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, - 0x65, 0x42, 0x16, 0x41, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, - 0x72, 0x74, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2b, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, - 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, - 0x72, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xa2, 0x02, 0x03, 0x4c, 0x4f, 0x58, 0xaa, 0x02, - 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xca, 0x02, 0x0c, - 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xe2, 0x02, 0x18, 0x4c, - 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0d, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, - 0x3a, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x0c, + 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x42, + 0xa8, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x6f, 0x72, + 0x61, 0x63, 0x6c, 0x65, 0x42, 0x16, 0x41, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x65, 0x52, + 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2b, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, + 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, + 0x61, 0x79, 0x65, 0x72, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xa2, 0x02, 0x03, 0x4c, 0x4f, + 0x58, 0xaa, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, + 0xca, 0x02, 0x0c, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0xe2, + 0x02, 0x18, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x5c, 0x47, + 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0d, 0x4c, 0x61, 0x79, + 0x65, 0x72, 0x3a, 0x3a, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( diff --git a/api/layer/reporter/delegation.pulsar.go b/api/layer/reporter/delegation.pulsar.go index f10eb0f8c..944617a07 100644 --- a/api/layer/reporter/delegation.pulsar.go +++ b/api/layer/reporter/delegation.pulsar.go @@ -16,9 +16,10 @@ import ( ) var ( - md_Delegation protoreflect.MessageDescriptor - fd_Delegation_reporter protoreflect.FieldDescriptor - fd_Delegation_amount protoreflect.FieldDescriptor + md_Delegation protoreflect.MessageDescriptor + fd_Delegation_reporter protoreflect.FieldDescriptor + fd_Delegation_amount protoreflect.FieldDescriptor + fd_Delegation_delegation_count protoreflect.FieldDescriptor ) func init() { @@ -26,6 +27,7 @@ func init() { md_Delegation = File_layer_reporter_delegation_proto.Messages().ByName("Delegation") fd_Delegation_reporter = md_Delegation.Fields().ByName("reporter") fd_Delegation_amount = md_Delegation.Fields().ByName("amount") + fd_Delegation_delegation_count = md_Delegation.Fields().ByName("delegation_count") } var _ protoreflect.Message = (*fastReflection_Delegation)(nil) @@ -105,6 +107,12 @@ func (x *fastReflection_Delegation) Range(f func(protoreflect.FieldDescriptor, p return } } + if x.DelegationCount != uint64(0) { + value := protoreflect.ValueOfUint64(x.DelegationCount) + if !f(fd_Delegation_delegation_count, value) { + return + } + } } // Has reports whether a field is populated. @@ -124,6 +132,8 @@ func (x *fastReflection_Delegation) Has(fd protoreflect.FieldDescriptor) bool { return len(x.Reporter) != 0 case "layer.reporter.Delegation.amount": return x.Amount != "" + case "layer.reporter.Delegation.delegation_count": + return x.DelegationCount != uint64(0) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.Delegation")) @@ -144,6 +154,8 @@ func (x *fastReflection_Delegation) Clear(fd protoreflect.FieldDescriptor) { x.Reporter = nil case "layer.reporter.Delegation.amount": x.Amount = "" + case "layer.reporter.Delegation.delegation_count": + x.DelegationCount = uint64(0) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.Delegation")) @@ -166,6 +178,9 @@ func (x *fastReflection_Delegation) Get(descriptor protoreflect.FieldDescriptor) case "layer.reporter.Delegation.amount": value := x.Amount return protoreflect.ValueOfString(value) + case "layer.reporter.Delegation.delegation_count": + value := x.DelegationCount + return protoreflect.ValueOfUint64(value) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.Delegation")) @@ -190,6 +205,8 @@ func (x *fastReflection_Delegation) Set(fd protoreflect.FieldDescriptor, value p x.Reporter = value.Bytes() case "layer.reporter.Delegation.amount": x.Amount = value.Interface().(string) + case "layer.reporter.Delegation.delegation_count": + x.DelegationCount = value.Uint() default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.Delegation")) @@ -214,6 +231,8 @@ func (x *fastReflection_Delegation) Mutable(fd protoreflect.FieldDescriptor) pro panic(fmt.Errorf("field reporter of message layer.reporter.Delegation is not mutable")) case "layer.reporter.Delegation.amount": panic(fmt.Errorf("field amount of message layer.reporter.Delegation is not mutable")) + case "layer.reporter.Delegation.delegation_count": + panic(fmt.Errorf("field delegation_count of message layer.reporter.Delegation is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.Delegation")) @@ -231,6 +250,8 @@ func (x *fastReflection_Delegation) NewField(fd protoreflect.FieldDescriptor) pr return protoreflect.ValueOfBytes(nil) case "layer.reporter.Delegation.amount": return protoreflect.ValueOfString("") + case "layer.reporter.Delegation.delegation_count": + return protoreflect.ValueOfUint64(uint64(0)) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.Delegation")) @@ -308,6 +329,9 @@ func (x *fastReflection_Delegation) ProtoMethods() *protoiface.Methods { if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } + if x.DelegationCount != 0 { + n += 1 + runtime.Sov(uint64(x.DelegationCount)) + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -337,6 +361,11 @@ func (x *fastReflection_Delegation) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if x.DelegationCount != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.DelegationCount)) + i-- + dAtA[i] = 0x18 + } if len(x.Amount) > 0 { i -= len(x.Amount) copy(dAtA[i:], x.Amount) @@ -466,6 +495,25 @@ func (x *fastReflection_Delegation) ProtoMethods() *protoiface.Methods { } x.Amount = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 3: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field DelegationCount", wireType) + } + x.DelegationCount = 0 + 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++ + x.DelegationCount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -523,7 +571,8 @@ type Delegation struct { // reporter is the address of the reporter being delegated to Reporter []byte `protobuf:"bytes,1,opt,name=reporter,proto3" json:"reporter,omitempty"` // amount is the amount of tokens delegated - Amount string `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount,omitempty"` + Amount string `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount,omitempty"` + DelegationCount uint64 `protobuf:"varint,3,opt,name=delegation_count,json=delegationCount,proto3" json:"delegation_count,omitempty"` } func (x *Delegation) Reset() { @@ -560,6 +609,13 @@ func (x *Delegation) GetAmount() string { return "" } +func (x *Delegation) GetDelegationCount() uint64 { + if x != nil { + return x.DelegationCount + } + return 0 +} + var File_layer_reporter_delegation_proto protoreflect.FileDescriptor var file_layer_reporter_delegation_proto_rawDesc = []byte{ @@ -570,25 +626,28 @@ var file_layer_reporter_delegation_proto_rawDesc = []byte{ 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x6d, 0x0a, 0x0a, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x12, - 0x43, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, - 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, - 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xd2, 0xb4, - 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x06, 0x61, 0x6d, - 0x6f, 0x75, 0x6e, 0x74, 0x42, 0xad, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, - 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x42, 0x0f, 0x44, 0x65, 0x6c, - 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2d, - 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, - 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, - 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xa2, 0x02, 0x03, - 0x4c, 0x52, 0x58, 0xaa, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x70, 0x6f, - 0x72, 0x74, 0x65, 0x72, 0xca, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, - 0x6f, 0x72, 0x74, 0x65, 0x72, 0xe2, 0x02, 0x1a, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, - 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0xea, 0x02, 0x0f, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x52, 0x65, 0x70, 0x6f, - 0x72, 0x74, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x98, 0x01, 0x0a, 0x0a, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, + 0x12, 0x43, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xd2, + 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x06, 0x61, + 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x29, 0x0a, 0x10, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, + 0x0f, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, + 0x42, 0xad, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, + 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x42, 0x0f, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, + 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, + 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xa2, 0x02, 0x03, 0x4c, 0x52, 0x58, 0xaa, + 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, + 0xca, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, + 0x72, 0xe2, 0x02, 0x1a, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, + 0x65, 0x72, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, + 0x0f, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/layer/reporter/oracle_reporter.pulsar.go b/api/layer/reporter/oracle_reporter.pulsar.go index 7009700f7..f9c8f582c 100644 --- a/api/layer/reporter/oracle_reporter.pulsar.go +++ b/api/layer/reporter/oracle_reporter.pulsar.go @@ -19,7 +19,6 @@ import ( var ( md_OracleReporter protoreflect.MessageDescriptor - fd_OracleReporter_reporter protoreflect.FieldDescriptor fd_OracleReporter_total_tokens protoreflect.FieldDescriptor fd_OracleReporter_commission protoreflect.FieldDescriptor fd_OracleReporter_jailed protoreflect.FieldDescriptor @@ -29,7 +28,6 @@ var ( func init() { file_layer_reporter_oracle_reporter_proto_init() md_OracleReporter = File_layer_reporter_oracle_reporter_proto.Messages().ByName("OracleReporter") - fd_OracleReporter_reporter = md_OracleReporter.Fields().ByName("reporter") fd_OracleReporter_total_tokens = md_OracleReporter.Fields().ByName("total_tokens") fd_OracleReporter_commission = md_OracleReporter.Fields().ByName("commission") fd_OracleReporter_jailed = md_OracleReporter.Fields().ByName("jailed") @@ -101,12 +99,6 @@ func (x *fastReflection_OracleReporter) Interface() protoreflect.ProtoMessage { // While iterating, mutating operations may only be performed // on the current field descriptor. func (x *fastReflection_OracleReporter) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if len(x.Reporter) != 0 { - value := protoreflect.ValueOfBytes(x.Reporter) - if !f(fd_OracleReporter_reporter, value) { - return - } - } if x.TotalTokens != "" { value := protoreflect.ValueOfString(x.TotalTokens) if !f(fd_OracleReporter_total_tokens, value) { @@ -146,8 +138,6 @@ func (x *fastReflection_OracleReporter) Range(f func(protoreflect.FieldDescripto // a repeated field is populated if it is non-empty. func (x *fastReflection_OracleReporter) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "layer.reporter.OracleReporter.reporter": - return len(x.Reporter) != 0 case "layer.reporter.OracleReporter.total_tokens": return x.TotalTokens != "" case "layer.reporter.OracleReporter.commission": @@ -172,8 +162,6 @@ func (x *fastReflection_OracleReporter) Has(fd protoreflect.FieldDescriptor) boo // Clear is a mutating operation and unsafe for concurrent use. func (x *fastReflection_OracleReporter) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "layer.reporter.OracleReporter.reporter": - x.Reporter = nil case "layer.reporter.OracleReporter.total_tokens": x.TotalTokens = "" case "layer.reporter.OracleReporter.commission": @@ -198,9 +186,6 @@ func (x *fastReflection_OracleReporter) Clear(fd protoreflect.FieldDescriptor) { // of the value; to obtain a mutable reference, use Mutable. func (x *fastReflection_OracleReporter) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "layer.reporter.OracleReporter.reporter": - value := x.Reporter - return protoreflect.ValueOfBytes(value) case "layer.reporter.OracleReporter.total_tokens": value := x.TotalTokens return protoreflect.ValueOfString(value) @@ -233,8 +218,6 @@ func (x *fastReflection_OracleReporter) Get(descriptor protoreflect.FieldDescrip // Set is a mutating operation and unsafe for concurrent use. func (x *fastReflection_OracleReporter) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "layer.reporter.OracleReporter.reporter": - x.Reporter = value.Bytes() case "layer.reporter.OracleReporter.total_tokens": x.TotalTokens = value.Interface().(string) case "layer.reporter.OracleReporter.commission": @@ -273,8 +256,6 @@ func (x *fastReflection_OracleReporter) Mutable(fd protoreflect.FieldDescriptor) x.JailedUntil = new(timestamppb.Timestamp) } return protoreflect.ValueOfMessage(x.JailedUntil.ProtoReflect()) - case "layer.reporter.OracleReporter.reporter": - panic(fmt.Errorf("field reporter of message layer.reporter.OracleReporter is not mutable")) case "layer.reporter.OracleReporter.total_tokens": panic(fmt.Errorf("field total_tokens of message layer.reporter.OracleReporter is not mutable")) case "layer.reporter.OracleReporter.jailed": @@ -292,8 +273,6 @@ func (x *fastReflection_OracleReporter) Mutable(fd protoreflect.FieldDescriptor) // For lists, maps, and messages, this returns a new, empty, mutable value. func (x *fastReflection_OracleReporter) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "layer.reporter.OracleReporter.reporter": - return protoreflect.ValueOfBytes(nil) case "layer.reporter.OracleReporter.total_tokens": return protoreflect.ValueOfString("") case "layer.reporter.OracleReporter.commission": @@ -373,10 +352,6 @@ func (x *fastReflection_OracleReporter) ProtoMethods() *protoiface.Methods { var n int var l int _ = l - l = len(x.Reporter) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } l = len(x.TotalTokens) if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) @@ -433,7 +408,7 @@ func (x *fastReflection_OracleReporter) ProtoMethods() *protoiface.Methods { copy(dAtA[i:], encoded) i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) i-- - dAtA[i] = 0x2a + dAtA[i] = 0x22 } if x.Jailed { i-- @@ -443,7 +418,7 @@ func (x *fastReflection_OracleReporter) ProtoMethods() *protoiface.Methods { dAtA[i] = 0 } i-- - dAtA[i] = 0x20 + dAtA[i] = 0x18 } if x.Commission != nil { encoded, err := options.Marshal(x.Commission) @@ -457,20 +432,13 @@ func (x *fastReflection_OracleReporter) ProtoMethods() *protoiface.Methods { copy(dAtA[i:], encoded) i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) i-- - dAtA[i] = 0x1a + dAtA[i] = 0x12 } if len(x.TotalTokens) > 0 { i -= len(x.TotalTokens) copy(dAtA[i:], x.TotalTokens) i = runtime.EncodeVarint(dAtA, i, uint64(len(x.TotalTokens))) i-- - dAtA[i] = 0x12 - } - if len(x.Reporter) > 0 { - i -= len(x.Reporter) - copy(dAtA[i:], x.Reporter) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Reporter))) - i-- dAtA[i] = 0xa } if input.Buf != nil { @@ -523,40 +491,6 @@ func (x *fastReflection_OracleReporter) ProtoMethods() *protoiface.Methods { } switch fieldNum { case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Reporter", wireType) - } - var byteLen int - 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++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + byteLen - 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.Reporter = append(x.Reporter[:0], dAtA[iNdEx:postIndex]...) - if x.Reporter == nil { - x.Reporter = []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 TotalTokens", wireType) } @@ -588,7 +522,7 @@ func (x *fastReflection_OracleReporter) ProtoMethods() *protoiface.Methods { } x.TotalTokens = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 2: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Commission", wireType) } @@ -624,7 +558,7 @@ func (x *fastReflection_OracleReporter) ProtoMethods() *protoiface.Methods { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err } iNdEx = postIndex - case 4: + case 3: if wireType != 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Jailed", wireType) } @@ -644,7 +578,7 @@ func (x *fastReflection_OracleReporter) ProtoMethods() *protoiface.Methods { } } x.Jailed = bool(v != 0) - case 5: + case 4: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field JailedUntil", wireType) } @@ -734,16 +668,14 @@ type OracleReporter struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // reporter is the address of the reporter - Reporter []byte `protobuf:"bytes,1,opt,name=reporter,proto3" json:"reporter,omitempty"` // tokens is the amount of tokens the reporter has - TotalTokens string `protobuf:"bytes,2,opt,name=total_tokens,json=totalTokens,proto3" json:"total_tokens,omitempty"` + TotalTokens string `protobuf:"bytes,1,opt,name=total_tokens,json=totalTokens,proto3" json:"total_tokens,omitempty"` // commission for the reporter - Commission *v1beta1.Commission `protobuf:"bytes,3,opt,name=commission,proto3" json:"commission,omitempty"` + Commission *v1beta1.Commission `protobuf:"bytes,2,opt,name=commission,proto3" json:"commission,omitempty"` // jailed is a bool whether the reporter is jailed or not - Jailed bool `protobuf:"varint,4,opt,name=jailed,proto3" json:"jailed,omitempty"` + Jailed bool `protobuf:"varint,3,opt,name=jailed,proto3" json:"jailed,omitempty"` // jailed_until is the time the reporter is jailed until - JailedUntil *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=jailed_until,json=jailedUntil,proto3" json:"jailed_until,omitempty"` + JailedUntil *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=jailed_until,json=jailedUntil,proto3" json:"jailed_until,omitempty"` } func (x *OracleReporter) Reset() { @@ -766,13 +698,6 @@ func (*OracleReporter) Descriptor() ([]byte, []int) { return file_layer_reporter_oracle_reporter_proto_rawDescGZIP(), []int{0} } -func (x *OracleReporter) GetReporter() []byte { - if x != nil { - return x.Reporter - } - return nil -} - func (x *OracleReporter) GetTotalTokens() string { if x != nil { return x.TotalTokens @@ -816,37 +741,35 @@ var file_layer_reporter_oracle_reporter_proto_rawDesc = []byte{ 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x22, 0xa6, 0x02, 0x0a, 0x0e, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x52, 0x65, 0x70, 0x6f, - 0x72, 0x74, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, - 0x12, 0x4e, 0x0a, 0x0c, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, - 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, - 0x49, 0x6e, 0x74, 0x52, 0x0b, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, - 0x12, 0x42, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, - 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, - 0x6d, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x73, - 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x6a, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x6a, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x12, 0x4c, 0x0a, 0x0c, - 0x6a, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x5f, 0x75, 0x6e, 0x74, 0x69, 0x6c, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x0d, - 0xc8, 0xde, 0x1f, 0x00, 0x90, 0xdf, 0x1f, 0x01, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x0b, 0x6a, - 0x61, 0x69, 0x6c, 0x65, 0x64, 0x55, 0x6e, 0x74, 0x69, 0x6c, 0x42, 0xb1, 0x01, 0x0a, 0x12, 0x63, - 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, - 0x72, 0x42, 0x13, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, - 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, - 0x61, 0x79, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, - 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xa2, 0x02, 0x03, 0x4c, 0x52, 0x58, 0xaa, 0x02, 0x0e, - 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xca, 0x02, - 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xe2, - 0x02, 0x1a, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, - 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x4c, - 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6f, 0x22, 0x8a, 0x02, 0x0a, 0x0e, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x52, 0x65, 0x70, 0x6f, + 0x72, 0x74, 0x65, 0x72, 0x12, 0x4e, 0x0a, 0x0c, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x74, 0x6f, + 0x6b, 0x65, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, + 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, + 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x0b, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x54, 0x6f, + 0x6b, 0x65, 0x6e, 0x73, 0x12, 0x42, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x63, 0x6f, + 0x6d, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x6a, 0x61, 0x69, 0x6c, + 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x6a, 0x61, 0x69, 0x6c, 0x65, 0x64, + 0x12, 0x4c, 0x0a, 0x0c, 0x6a, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x5f, 0x75, 0x6e, 0x74, 0x69, 0x6c, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, + 0x6d, 0x70, 0x42, 0x0d, 0xc8, 0xde, 0x1f, 0x00, 0x90, 0xdf, 0x1f, 0x01, 0xa8, 0xe7, 0xb0, 0x2a, + 0x01, 0x52, 0x0b, 0x6a, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x55, 0x6e, 0x74, 0x69, 0x6c, 0x42, 0xb1, + 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, + 0x6f, 0x72, 0x74, 0x65, 0x72, 0x42, 0x13, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x52, 0x65, 0x70, + 0x6f, 0x72, 0x74, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2d, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, + 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, + 0x65, 0x72, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xa2, 0x02, 0x03, 0x4c, 0x52, + 0x58, 0xaa, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, + 0x65, 0x72, 0xca, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, + 0x74, 0x65, 0x72, 0xe2, 0x02, 0x1a, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, 0x6f, + 0x72, 0x74, 0x65, 0x72, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0xea, 0x02, 0x0f, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, + 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/layer/reporter/query.pulsar.go b/api/layer/reporter/query.pulsar.go index 11752bea4..42af42f2c 100644 --- a/api/layer/reporter/query.pulsar.go +++ b/api/layer/reporter/query.pulsar.go @@ -4,7 +4,7 @@ package reporter import ( _ "cosmossdk.io/api/amino" _ "cosmossdk.io/api/cosmos/base/query/v1beta1" - v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" + _ "cosmossdk.io/api/cosmos/base/v1beta1" fmt "fmt" _ "github.com/cosmos/cosmos-proto" runtime "github.com/cosmos/cosmos-proto/runtime" @@ -810,25 +810,23 @@ func (x *fastReflection_QueryParamsResponse) ProtoMethods() *protoiface.Methods } var ( - md_QueryReporterRequest protoreflect.MessageDescriptor - fd_QueryReporterRequest_reporter_address protoreflect.FieldDescriptor + md_QueryReportersRequest protoreflect.MessageDescriptor ) func init() { file_layer_reporter_query_proto_init() - md_QueryReporterRequest = File_layer_reporter_query_proto.Messages().ByName("QueryReporterRequest") - fd_QueryReporterRequest_reporter_address = md_QueryReporterRequest.Fields().ByName("reporter_address") + md_QueryReportersRequest = File_layer_reporter_query_proto.Messages().ByName("QueryReportersRequest") } -var _ protoreflect.Message = (*fastReflection_QueryReporterRequest)(nil) +var _ protoreflect.Message = (*fastReflection_QueryReportersRequest)(nil) -type fastReflection_QueryReporterRequest QueryReporterRequest +type fastReflection_QueryReportersRequest QueryReportersRequest -func (x *QueryReporterRequest) ProtoReflect() protoreflect.Message { - return (*fastReflection_QueryReporterRequest)(x) +func (x *QueryReportersRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryReportersRequest)(x) } -func (x *QueryReporterRequest) slowProtoReflect() protoreflect.Message { +func (x *QueryReportersRequest) slowProtoReflect() protoreflect.Message { mi := &file_layer_reporter_query_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -840,43 +838,43 @@ func (x *QueryReporterRequest) slowProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -var _fastReflection_QueryReporterRequest_messageType fastReflection_QueryReporterRequest_messageType -var _ protoreflect.MessageType = fastReflection_QueryReporterRequest_messageType{} +var _fastReflection_QueryReportersRequest_messageType fastReflection_QueryReportersRequest_messageType +var _ protoreflect.MessageType = fastReflection_QueryReportersRequest_messageType{} -type fastReflection_QueryReporterRequest_messageType struct{} +type fastReflection_QueryReportersRequest_messageType struct{} -func (x fastReflection_QueryReporterRequest_messageType) Zero() protoreflect.Message { - return (*fastReflection_QueryReporterRequest)(nil) +func (x fastReflection_QueryReportersRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryReportersRequest)(nil) } -func (x fastReflection_QueryReporterRequest_messageType) New() protoreflect.Message { - return new(fastReflection_QueryReporterRequest) +func (x fastReflection_QueryReportersRequest_messageType) New() protoreflect.Message { + return new(fastReflection_QueryReportersRequest) } -func (x fastReflection_QueryReporterRequest_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_QueryReporterRequest +func (x fastReflection_QueryReportersRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryReportersRequest } // Descriptor returns message descriptor, which contains only the protobuf // type information for the message. -func (x *fastReflection_QueryReporterRequest) Descriptor() protoreflect.MessageDescriptor { - return md_QueryReporterRequest +func (x *fastReflection_QueryReportersRequest) Descriptor() protoreflect.MessageDescriptor { + return md_QueryReportersRequest } // Type returns the message type, which encapsulates both Go and protobuf // type information. If the Go type information is not needed, // it is recommended that the message descriptor be used instead. -func (x *fastReflection_QueryReporterRequest) Type() protoreflect.MessageType { - return _fastReflection_QueryReporterRequest_messageType +func (x *fastReflection_QueryReportersRequest) Type() protoreflect.MessageType { + return _fastReflection_QueryReportersRequest_messageType } // New returns a newly allocated and mutable empty message. -func (x *fastReflection_QueryReporterRequest) New() protoreflect.Message { - return new(fastReflection_QueryReporterRequest) +func (x *fastReflection_QueryReportersRequest) New() protoreflect.Message { + return new(fastReflection_QueryReportersRequest) } // Interface unwraps the message reflection interface and // returns the underlying ProtoMessage interface. -func (x *fastReflection_QueryReporterRequest) Interface() protoreflect.ProtoMessage { - return (*QueryReporterRequest)(x) +func (x *fastReflection_QueryReportersRequest) Interface() protoreflect.ProtoMessage { + return (*QueryReportersRequest)(x) } // Range iterates over every populated field in an undefined order, @@ -884,13 +882,7 @@ func (x *fastReflection_QueryReporterRequest) Interface() protoreflect.ProtoMess // Range returns immediately if f returns false. // While iterating, mutating operations may only be performed // on the current field descriptor. -func (x *fastReflection_QueryReporterRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.ReporterAddress != "" { - value := protoreflect.ValueOfString(x.ReporterAddress) - if !f(fd_QueryReporterRequest_reporter_address, value) { - return - } - } +func (x *fastReflection_QueryReportersRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { } // Has reports whether a field is populated. @@ -904,15 +896,13 @@ func (x *fastReflection_QueryReporterRequest) Range(f func(protoreflect.FieldDes // In other cases (aside from the nullable cases above), // a proto3 scalar field is populated if it contains a non-zero value, and // a repeated field is populated if it is non-empty. -func (x *fastReflection_QueryReporterRequest) Has(fd protoreflect.FieldDescriptor) bool { +func (x *fastReflection_QueryReportersRequest) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "layer.reporter.QueryReporterRequest.reporter_address": - return x.ReporterAddress != "" default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReporterRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReportersRequest")) } - panic(fmt.Errorf("message layer.reporter.QueryReporterRequest does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.QueryReportersRequest does not contain field %s", fd.FullName())) } } @@ -922,15 +912,13 @@ func (x *fastReflection_QueryReporterRequest) Has(fd protoreflect.FieldDescripto // associated with the given field number. // // Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryReporterRequest) Clear(fd protoreflect.FieldDescriptor) { +func (x *fastReflection_QueryReportersRequest) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "layer.reporter.QueryReporterRequest.reporter_address": - x.ReporterAddress = "" default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReporterRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReportersRequest")) } - panic(fmt.Errorf("message layer.reporter.QueryReporterRequest does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.QueryReportersRequest does not contain field %s", fd.FullName())) } } @@ -940,16 +928,13 @@ func (x *fastReflection_QueryReporterRequest) Clear(fd protoreflect.FieldDescrip // the default value of a bytes scalar is guaranteed to be a copy. // For unpopulated composite types, it returns an empty, read-only view // of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_QueryReporterRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_QueryReportersRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "layer.reporter.QueryReporterRequest.reporter_address": - value := x.ReporterAddress - return protoreflect.ValueOfString(value) default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReporterRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReportersRequest")) } - panic(fmt.Errorf("message layer.reporter.QueryReporterRequest does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message layer.reporter.QueryReportersRequest does not contain field %s", descriptor.FullName())) } } @@ -963,15 +948,13 @@ func (x *fastReflection_QueryReporterRequest) Get(descriptor protoreflect.FieldD // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryReporterRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_QueryReportersRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "layer.reporter.QueryReporterRequest.reporter_address": - x.ReporterAddress = value.Interface().(string) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReporterRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReportersRequest")) } - panic(fmt.Errorf("message layer.reporter.QueryReporterRequest does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.QueryReportersRequest does not contain field %s", fd.FullName())) } } @@ -985,40 +968,36 @@ func (x *fastReflection_QueryReporterRequest) Set(fd protoreflect.FieldDescripto // It panics if the field does not contain a composite type. // // Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryReporterRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_QueryReportersRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "layer.reporter.QueryReporterRequest.reporter_address": - panic(fmt.Errorf("field reporter_address of message layer.reporter.QueryReporterRequest is not mutable")) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReporterRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReportersRequest")) } - panic(fmt.Errorf("message layer.reporter.QueryReporterRequest does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.QueryReportersRequest does not contain field %s", fd.FullName())) } } // NewField returns a new value that is assignable to the field // for the given descriptor. For scalars, this returns the default value. // For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_QueryReporterRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_QueryReportersRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "layer.reporter.QueryReporterRequest.reporter_address": - return protoreflect.ValueOfString("") default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReporterRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReportersRequest")) } - panic(fmt.Errorf("message layer.reporter.QueryReporterRequest does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.QueryReportersRequest does not contain field %s", fd.FullName())) } } // WhichOneof reports which field within the oneof is populated, // returning nil if none are populated. // It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_QueryReporterRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { +func (x *fastReflection_QueryReportersRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in layer.reporter.QueryReporterRequest", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in layer.reporter.QueryReportersRequest", d.FullName())) } panic("unreachable") } @@ -1026,7 +1005,7 @@ func (x *fastReflection_QueryReporterRequest) WhichOneof(d protoreflect.OneofDes // GetUnknown retrieves the entire list of unknown fields. // The caller may only mutate the contents of the RawFields // if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_QueryReporterRequest) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_QueryReportersRequest) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -1037,7 +1016,7 @@ func (x *fastReflection_QueryReporterRequest) GetUnknown() protoreflect.RawField // An empty RawFields may be passed to clear the fields. // // SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryReporterRequest) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_QueryReportersRequest) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -1049,7 +1028,7 @@ func (x *fastReflection_QueryReporterRequest) SetUnknown(fields protoreflect.Raw // message type, but the details are implementation dependent. // Validity is not part of the protobuf data model, and may not // be preserved in marshaling or other operations. -func (x *fastReflection_QueryReporterRequest) IsValid() bool { +func (x *fastReflection_QueryReportersRequest) IsValid() bool { return x != nil } @@ -1059,9 +1038,9 @@ func (x *fastReflection_QueryReporterRequest) IsValid() bool { // The returned methods type is identical to // "google.golang.org/protobuf/runtime/protoiface".Methods. // Consult the protoiface package documentation for details. -func (x *fastReflection_QueryReporterRequest) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_QueryReportersRequest) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*QueryReporterRequest) + x := input.Message.Interface().(*QueryReportersRequest) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1073,10 +1052,6 @@ func (x *fastReflection_QueryReporterRequest) ProtoMethods() *protoiface.Methods var n int var l int _ = l - l = len(x.ReporterAddress) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -1087,7 +1062,7 @@ func (x *fastReflection_QueryReporterRequest) ProtoMethods() *protoiface.Methods } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*QueryReporterRequest) + x := input.Message.Interface().(*QueryReportersRequest) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1106,13 +1081,6 @@ func (x *fastReflection_QueryReporterRequest) ProtoMethods() *protoiface.Methods i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if len(x.ReporterAddress) > 0 { - i -= len(x.ReporterAddress) - copy(dAtA[i:], x.ReporterAddress) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ReporterAddress))) - i-- - dAtA[i] = 0xa - } if input.Buf != nil { input.Buf = append(input.Buf, dAtA...) } else { @@ -1124,7 +1092,7 @@ func (x *fastReflection_QueryReporterRequest) ProtoMethods() *protoiface.Methods }, nil } unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*QueryReporterRequest) + x := input.Message.Interface().(*QueryReportersRequest) if x == nil { return protoiface.UnmarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1156,44 +1124,12 @@ func (x *fastReflection_QueryReporterRequest) ProtoMethods() *protoiface.Methods fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryReporterRequest: wiretype end group for non-group") + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryReportersRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryReporterRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryReportersRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ReporterAddress", 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.ReporterAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -1229,26 +1165,77 @@ func (x *fastReflection_QueryReporterRequest) ProtoMethods() *protoiface.Methods } } +var _ protoreflect.List = (*_QueryReportersResponse_1_list)(nil) + +type _QueryReportersResponse_1_list struct { + list *[]*OracleReporter +} + +func (x *_QueryReportersResponse_1_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_QueryReportersResponse_1_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_QueryReportersResponse_1_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*OracleReporter) + (*x.list)[i] = concreteValue +} + +func (x *_QueryReportersResponse_1_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*OracleReporter) + *x.list = append(*x.list, concreteValue) +} + +func (x *_QueryReportersResponse_1_list) AppendMutable() protoreflect.Value { + v := new(OracleReporter) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_QueryReportersResponse_1_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_QueryReportersResponse_1_list) NewElement() protoreflect.Value { + v := new(OracleReporter) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_QueryReportersResponse_1_list) IsValid() bool { + return x.list != nil +} + var ( - md_QueryReporterResponse protoreflect.MessageDescriptor - fd_QueryReporterResponse_reporter protoreflect.FieldDescriptor + md_QueryReportersResponse protoreflect.MessageDescriptor + fd_QueryReportersResponse_reporters protoreflect.FieldDescriptor ) func init() { file_layer_reporter_query_proto_init() - md_QueryReporterResponse = File_layer_reporter_query_proto.Messages().ByName("QueryReporterResponse") - fd_QueryReporterResponse_reporter = md_QueryReporterResponse.Fields().ByName("reporter") + md_QueryReportersResponse = File_layer_reporter_query_proto.Messages().ByName("QueryReportersResponse") + fd_QueryReportersResponse_reporters = md_QueryReportersResponse.Fields().ByName("reporters") } -var _ protoreflect.Message = (*fastReflection_QueryReporterResponse)(nil) +var _ protoreflect.Message = (*fastReflection_QueryReportersResponse)(nil) -type fastReflection_QueryReporterResponse QueryReporterResponse +type fastReflection_QueryReportersResponse QueryReportersResponse -func (x *QueryReporterResponse) ProtoReflect() protoreflect.Message { - return (*fastReflection_QueryReporterResponse)(x) +func (x *QueryReportersResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryReportersResponse)(x) } -func (x *QueryReporterResponse) slowProtoReflect() protoreflect.Message { +func (x *QueryReportersResponse) slowProtoReflect() protoreflect.Message { mi := &file_layer_reporter_query_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1260,43 +1247,43 @@ func (x *QueryReporterResponse) slowProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -var _fastReflection_QueryReporterResponse_messageType fastReflection_QueryReporterResponse_messageType -var _ protoreflect.MessageType = fastReflection_QueryReporterResponse_messageType{} +var _fastReflection_QueryReportersResponse_messageType fastReflection_QueryReportersResponse_messageType +var _ protoreflect.MessageType = fastReflection_QueryReportersResponse_messageType{} -type fastReflection_QueryReporterResponse_messageType struct{} +type fastReflection_QueryReportersResponse_messageType struct{} -func (x fastReflection_QueryReporterResponse_messageType) Zero() protoreflect.Message { - return (*fastReflection_QueryReporterResponse)(nil) +func (x fastReflection_QueryReportersResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryReportersResponse)(nil) } -func (x fastReflection_QueryReporterResponse_messageType) New() protoreflect.Message { - return new(fastReflection_QueryReporterResponse) +func (x fastReflection_QueryReportersResponse_messageType) New() protoreflect.Message { + return new(fastReflection_QueryReportersResponse) } -func (x fastReflection_QueryReporterResponse_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_QueryReporterResponse +func (x fastReflection_QueryReportersResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryReportersResponse } // Descriptor returns message descriptor, which contains only the protobuf // type information for the message. -func (x *fastReflection_QueryReporterResponse) Descriptor() protoreflect.MessageDescriptor { - return md_QueryReporterResponse +func (x *fastReflection_QueryReportersResponse) Descriptor() protoreflect.MessageDescriptor { + return md_QueryReportersResponse } // Type returns the message type, which encapsulates both Go and protobuf // type information. If the Go type information is not needed, // it is recommended that the message descriptor be used instead. -func (x *fastReflection_QueryReporterResponse) Type() protoreflect.MessageType { - return _fastReflection_QueryReporterResponse_messageType +func (x *fastReflection_QueryReportersResponse) Type() protoreflect.MessageType { + return _fastReflection_QueryReportersResponse_messageType } // New returns a newly allocated and mutable empty message. -func (x *fastReflection_QueryReporterResponse) New() protoreflect.Message { - return new(fastReflection_QueryReporterResponse) +func (x *fastReflection_QueryReportersResponse) New() protoreflect.Message { + return new(fastReflection_QueryReportersResponse) } // Interface unwraps the message reflection interface and // returns the underlying ProtoMessage interface. -func (x *fastReflection_QueryReporterResponse) Interface() protoreflect.ProtoMessage { - return (*QueryReporterResponse)(x) +func (x *fastReflection_QueryReportersResponse) Interface() protoreflect.ProtoMessage { + return (*QueryReportersResponse)(x) } // Range iterates over every populated field in an undefined order, @@ -1304,10 +1291,10 @@ func (x *fastReflection_QueryReporterResponse) Interface() protoreflect.ProtoMes // Range returns immediately if f returns false. // While iterating, mutating operations may only be performed // on the current field descriptor. -func (x *fastReflection_QueryReporterResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Reporter != nil { - value := protoreflect.ValueOfMessage(x.Reporter.ProtoReflect()) - if !f(fd_QueryReporterResponse_reporter, value) { +func (x *fastReflection_QueryReportersResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if len(x.Reporters) != 0 { + value := protoreflect.ValueOfList(&_QueryReportersResponse_1_list{list: &x.Reporters}) + if !f(fd_QueryReportersResponse_reporters, value) { return } } @@ -1324,15 +1311,15 @@ func (x *fastReflection_QueryReporterResponse) Range(f func(protoreflect.FieldDe // In other cases (aside from the nullable cases above), // a proto3 scalar field is populated if it contains a non-zero value, and // a repeated field is populated if it is non-empty. -func (x *fastReflection_QueryReporterResponse) Has(fd protoreflect.FieldDescriptor) bool { +func (x *fastReflection_QueryReportersResponse) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "layer.reporter.QueryReporterResponse.reporter": - return x.Reporter != nil + case "layer.reporter.QueryReportersResponse.reporters": + return len(x.Reporters) != 0 default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReporterResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReportersResponse")) } - panic(fmt.Errorf("message layer.reporter.QueryReporterResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.QueryReportersResponse does not contain field %s", fd.FullName())) } } @@ -1342,15 +1329,15 @@ func (x *fastReflection_QueryReporterResponse) Has(fd protoreflect.FieldDescript // associated with the given field number. // // Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryReporterResponse) Clear(fd protoreflect.FieldDescriptor) { +func (x *fastReflection_QueryReportersResponse) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "layer.reporter.QueryReporterResponse.reporter": - x.Reporter = nil + case "layer.reporter.QueryReportersResponse.reporters": + x.Reporters = nil default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReporterResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReportersResponse")) } - panic(fmt.Errorf("message layer.reporter.QueryReporterResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.QueryReportersResponse does not contain field %s", fd.FullName())) } } @@ -1360,16 +1347,19 @@ func (x *fastReflection_QueryReporterResponse) Clear(fd protoreflect.FieldDescri // the default value of a bytes scalar is guaranteed to be a copy. // For unpopulated composite types, it returns an empty, read-only view // of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_QueryReporterResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_QueryReportersResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "layer.reporter.QueryReporterResponse.reporter": - value := x.Reporter - return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "layer.reporter.QueryReportersResponse.reporters": + if len(x.Reporters) == 0 { + return protoreflect.ValueOfList(&_QueryReportersResponse_1_list{}) + } + listValue := &_QueryReportersResponse_1_list{list: &x.Reporters} + return protoreflect.ValueOfList(listValue) default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReporterResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReportersResponse")) } - panic(fmt.Errorf("message layer.reporter.QueryReporterResponse does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message layer.reporter.QueryReportersResponse does not contain field %s", descriptor.FullName())) } } @@ -1383,15 +1373,17 @@ func (x *fastReflection_QueryReporterResponse) Get(descriptor protoreflect.Field // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryReporterResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_QueryReportersResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "layer.reporter.QueryReporterResponse.reporter": - x.Reporter = value.Message().Interface().(*OracleReporter) + case "layer.reporter.QueryReportersResponse.reporters": + lv := value.List() + clv := lv.(*_QueryReportersResponse_1_list) + x.Reporters = *clv.list default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReporterResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReportersResponse")) } - panic(fmt.Errorf("message layer.reporter.QueryReporterResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.QueryReportersResponse does not contain field %s", fd.FullName())) } } @@ -1405,44 +1397,45 @@ func (x *fastReflection_QueryReporterResponse) Set(fd protoreflect.FieldDescript // It panics if the field does not contain a composite type. // // Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryReporterResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_QueryReportersResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "layer.reporter.QueryReporterResponse.reporter": - if x.Reporter == nil { - x.Reporter = new(OracleReporter) + case "layer.reporter.QueryReportersResponse.reporters": + if x.Reporters == nil { + x.Reporters = []*OracleReporter{} } - return protoreflect.ValueOfMessage(x.Reporter.ProtoReflect()) + value := &_QueryReportersResponse_1_list{list: &x.Reporters} + return protoreflect.ValueOfList(value) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReporterResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReportersResponse")) } - panic(fmt.Errorf("message layer.reporter.QueryReporterResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.QueryReportersResponse does not contain field %s", fd.FullName())) } } // NewField returns a new value that is assignable to the field // for the given descriptor. For scalars, this returns the default value. // For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_QueryReporterResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_QueryReportersResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "layer.reporter.QueryReporterResponse.reporter": - m := new(OracleReporter) - return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "layer.reporter.QueryReportersResponse.reporters": + list := []*OracleReporter{} + return protoreflect.ValueOfList(&_QueryReportersResponse_1_list{list: &list}) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReporterResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReportersResponse")) } - panic(fmt.Errorf("message layer.reporter.QueryReporterResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.QueryReportersResponse does not contain field %s", fd.FullName())) } } // WhichOneof reports which field within the oneof is populated, // returning nil if none are populated. // It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_QueryReporterResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { +func (x *fastReflection_QueryReportersResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in layer.reporter.QueryReporterResponse", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in layer.reporter.QueryReportersResponse", d.FullName())) } panic("unreachable") } @@ -1450,7 +1443,7 @@ func (x *fastReflection_QueryReporterResponse) WhichOneof(d protoreflect.OneofDe // GetUnknown retrieves the entire list of unknown fields. // The caller may only mutate the contents of the RawFields // if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_QueryReporterResponse) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_QueryReportersResponse) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -1461,7 +1454,7 @@ func (x *fastReflection_QueryReporterResponse) GetUnknown() protoreflect.RawFiel // An empty RawFields may be passed to clear the fields. // // SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryReporterResponse) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_QueryReportersResponse) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -1473,7 +1466,7 @@ func (x *fastReflection_QueryReporterResponse) SetUnknown(fields protoreflect.Ra // message type, but the details are implementation dependent. // Validity is not part of the protobuf data model, and may not // be preserved in marshaling or other operations. -func (x *fastReflection_QueryReporterResponse) IsValid() bool { +func (x *fastReflection_QueryReportersResponse) IsValid() bool { return x != nil } @@ -1483,9 +1476,9 @@ func (x *fastReflection_QueryReporterResponse) IsValid() bool { // The returned methods type is identical to // "google.golang.org/protobuf/runtime/protoiface".Methods. // Consult the protoiface package documentation for details. -func (x *fastReflection_QueryReporterResponse) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_QueryReportersResponse) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*QueryReporterResponse) + x := input.Message.Interface().(*QueryReportersResponse) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1497,9 +1490,11 @@ func (x *fastReflection_QueryReporterResponse) ProtoMethods() *protoiface.Method var n int var l int _ = l - if x.Reporter != nil { - l = options.Size(x.Reporter) - n += 1 + l + runtime.Sov(uint64(l)) + if len(x.Reporters) > 0 { + for _, e := range x.Reporters { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } } if x.unknownFields != nil { n += len(x.unknownFields) @@ -1511,7 +1506,7 @@ func (x *fastReflection_QueryReporterResponse) ProtoMethods() *protoiface.Method } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*QueryReporterResponse) + x := input.Message.Interface().(*QueryReportersResponse) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1530,19 +1525,21 @@ func (x *fastReflection_QueryReporterResponse) ProtoMethods() *protoiface.Method i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if x.Reporter != nil { - encoded, err := options.Marshal(x.Reporter) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err + if len(x.Reporters) > 0 { + for iNdEx := len(x.Reporters) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.Reporters[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0xa } if input.Buf != nil { input.Buf = append(input.Buf, dAtA...) @@ -1555,7 +1552,7 @@ func (x *fastReflection_QueryReporterResponse) ProtoMethods() *protoiface.Method }, nil } unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*QueryReporterResponse) + x := input.Message.Interface().(*QueryReportersResponse) if x == nil { return protoiface.UnmarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1587,15 +1584,15 @@ func (x *fastReflection_QueryReporterResponse) ProtoMethods() *protoiface.Method fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryReporterResponse: wiretype end group for non-group") + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryReportersResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryReporterResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryReportersResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Reporter", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Reporters", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1622,10 +1619,8 @@ func (x *fastReflection_QueryReporterResponse) ProtoMethods() *protoiface.Method if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - if x.Reporter == nil { - x.Reporter = &OracleReporter{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Reporter); err != nil { + x.Reporters = append(x.Reporters, &OracleReporter{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Reporters[len(x.Reporters)-1]); err != nil { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err } iNdEx = postIndex @@ -1665,23 +1660,25 @@ func (x *fastReflection_QueryReporterResponse) ProtoMethods() *protoiface.Method } var ( - md_QueryReportersRequest protoreflect.MessageDescriptor + md_QueryDelegatorReporterRequest protoreflect.MessageDescriptor + fd_QueryDelegatorReporterRequest_delegator_address protoreflect.FieldDescriptor ) func init() { file_layer_reporter_query_proto_init() - md_QueryReportersRequest = File_layer_reporter_query_proto.Messages().ByName("QueryReportersRequest") + md_QueryDelegatorReporterRequest = File_layer_reporter_query_proto.Messages().ByName("QueryDelegatorReporterRequest") + fd_QueryDelegatorReporterRequest_delegator_address = md_QueryDelegatorReporterRequest.Fields().ByName("delegator_address") } -var _ protoreflect.Message = (*fastReflection_QueryReportersRequest)(nil) +var _ protoreflect.Message = (*fastReflection_QueryDelegatorReporterRequest)(nil) -type fastReflection_QueryReportersRequest QueryReportersRequest +type fastReflection_QueryDelegatorReporterRequest QueryDelegatorReporterRequest -func (x *QueryReportersRequest) ProtoReflect() protoreflect.Message { - return (*fastReflection_QueryReportersRequest)(x) +func (x *QueryDelegatorReporterRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryDelegatorReporterRequest)(x) } -func (x *QueryReportersRequest) slowProtoReflect() protoreflect.Message { +func (x *QueryDelegatorReporterRequest) slowProtoReflect() protoreflect.Message { mi := &file_layer_reporter_query_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1693,43 +1690,43 @@ func (x *QueryReportersRequest) slowProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -var _fastReflection_QueryReportersRequest_messageType fastReflection_QueryReportersRequest_messageType -var _ protoreflect.MessageType = fastReflection_QueryReportersRequest_messageType{} +var _fastReflection_QueryDelegatorReporterRequest_messageType fastReflection_QueryDelegatorReporterRequest_messageType +var _ protoreflect.MessageType = fastReflection_QueryDelegatorReporterRequest_messageType{} -type fastReflection_QueryReportersRequest_messageType struct{} +type fastReflection_QueryDelegatorReporterRequest_messageType struct{} -func (x fastReflection_QueryReportersRequest_messageType) Zero() protoreflect.Message { - return (*fastReflection_QueryReportersRequest)(nil) +func (x fastReflection_QueryDelegatorReporterRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryDelegatorReporterRequest)(nil) } -func (x fastReflection_QueryReportersRequest_messageType) New() protoreflect.Message { - return new(fastReflection_QueryReportersRequest) +func (x fastReflection_QueryDelegatorReporterRequest_messageType) New() protoreflect.Message { + return new(fastReflection_QueryDelegatorReporterRequest) } -func (x fastReflection_QueryReportersRequest_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_QueryReportersRequest +func (x fastReflection_QueryDelegatorReporterRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryDelegatorReporterRequest } // Descriptor returns message descriptor, which contains only the protobuf // type information for the message. -func (x *fastReflection_QueryReportersRequest) Descriptor() protoreflect.MessageDescriptor { - return md_QueryReportersRequest +func (x *fastReflection_QueryDelegatorReporterRequest) Descriptor() protoreflect.MessageDescriptor { + return md_QueryDelegatorReporterRequest } // Type returns the message type, which encapsulates both Go and protobuf // type information. If the Go type information is not needed, // it is recommended that the message descriptor be used instead. -func (x *fastReflection_QueryReportersRequest) Type() protoreflect.MessageType { - return _fastReflection_QueryReportersRequest_messageType +func (x *fastReflection_QueryDelegatorReporterRequest) Type() protoreflect.MessageType { + return _fastReflection_QueryDelegatorReporterRequest_messageType } // New returns a newly allocated and mutable empty message. -func (x *fastReflection_QueryReportersRequest) New() protoreflect.Message { - return new(fastReflection_QueryReportersRequest) +func (x *fastReflection_QueryDelegatorReporterRequest) New() protoreflect.Message { + return new(fastReflection_QueryDelegatorReporterRequest) } // Interface unwraps the message reflection interface and // returns the underlying ProtoMessage interface. -func (x *fastReflection_QueryReportersRequest) Interface() protoreflect.ProtoMessage { - return (*QueryReportersRequest)(x) +func (x *fastReflection_QueryDelegatorReporterRequest) Interface() protoreflect.ProtoMessage { + return (*QueryDelegatorReporterRequest)(x) } // Range iterates over every populated field in an undefined order, @@ -1737,7 +1734,13 @@ func (x *fastReflection_QueryReportersRequest) Interface() protoreflect.ProtoMes // Range returns immediately if f returns false. // While iterating, mutating operations may only be performed // on the current field descriptor. -func (x *fastReflection_QueryReportersRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +func (x *fastReflection_QueryDelegatorReporterRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.DelegatorAddress != "" { + value := protoreflect.ValueOfString(x.DelegatorAddress) + if !f(fd_QueryDelegatorReporterRequest_delegator_address, value) { + return + } + } } // Has reports whether a field is populated. @@ -1751,13 +1754,15 @@ func (x *fastReflection_QueryReportersRequest) Range(f func(protoreflect.FieldDe // In other cases (aside from the nullable cases above), // a proto3 scalar field is populated if it contains a non-zero value, and // a repeated field is populated if it is non-empty. -func (x *fastReflection_QueryReportersRequest) Has(fd protoreflect.FieldDescriptor) bool { +func (x *fastReflection_QueryDelegatorReporterRequest) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { + case "layer.reporter.QueryDelegatorReporterRequest.delegator_address": + return x.DelegatorAddress != "" default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReportersRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryDelegatorReporterRequest")) } - panic(fmt.Errorf("message layer.reporter.QueryReportersRequest does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.QueryDelegatorReporterRequest does not contain field %s", fd.FullName())) } } @@ -1767,13 +1772,15 @@ func (x *fastReflection_QueryReportersRequest) Has(fd protoreflect.FieldDescript // associated with the given field number. // // Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryReportersRequest) Clear(fd protoreflect.FieldDescriptor) { +func (x *fastReflection_QueryDelegatorReporterRequest) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { + case "layer.reporter.QueryDelegatorReporterRequest.delegator_address": + x.DelegatorAddress = "" default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReportersRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryDelegatorReporterRequest")) } - panic(fmt.Errorf("message layer.reporter.QueryReportersRequest does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.QueryDelegatorReporterRequest does not contain field %s", fd.FullName())) } } @@ -1783,13 +1790,16 @@ func (x *fastReflection_QueryReportersRequest) Clear(fd protoreflect.FieldDescri // the default value of a bytes scalar is guaranteed to be a copy. // For unpopulated composite types, it returns an empty, read-only view // of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_QueryReportersRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_QueryDelegatorReporterRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { + case "layer.reporter.QueryDelegatorReporterRequest.delegator_address": + value := x.DelegatorAddress + return protoreflect.ValueOfString(value) default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReportersRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryDelegatorReporterRequest")) } - panic(fmt.Errorf("message layer.reporter.QueryReportersRequest does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message layer.reporter.QueryDelegatorReporterRequest does not contain field %s", descriptor.FullName())) } } @@ -1803,13 +1813,15 @@ func (x *fastReflection_QueryReportersRequest) Get(descriptor protoreflect.Field // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryReportersRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_QueryDelegatorReporterRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { + case "layer.reporter.QueryDelegatorReporterRequest.delegator_address": + x.DelegatorAddress = value.Interface().(string) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReportersRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryDelegatorReporterRequest")) } - panic(fmt.Errorf("message layer.reporter.QueryReportersRequest does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.QueryDelegatorReporterRequest does not contain field %s", fd.FullName())) } } @@ -1823,36 +1835,40 @@ func (x *fastReflection_QueryReportersRequest) Set(fd protoreflect.FieldDescript // It panics if the field does not contain a composite type. // // Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryReportersRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_QueryDelegatorReporterRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { + case "layer.reporter.QueryDelegatorReporterRequest.delegator_address": + panic(fmt.Errorf("field delegator_address of message layer.reporter.QueryDelegatorReporterRequest is not mutable")) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReportersRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryDelegatorReporterRequest")) } - panic(fmt.Errorf("message layer.reporter.QueryReportersRequest does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.QueryDelegatorReporterRequest does not contain field %s", fd.FullName())) } } // NewField returns a new value that is assignable to the field // for the given descriptor. For scalars, this returns the default value. // For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_QueryReportersRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_QueryDelegatorReporterRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { + case "layer.reporter.QueryDelegatorReporterRequest.delegator_address": + return protoreflect.ValueOfString("") default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReportersRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryDelegatorReporterRequest")) } - panic(fmt.Errorf("message layer.reporter.QueryReportersRequest does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.QueryDelegatorReporterRequest does not contain field %s", fd.FullName())) } } // WhichOneof reports which field within the oneof is populated, // returning nil if none are populated. // It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_QueryReportersRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { +func (x *fastReflection_QueryDelegatorReporterRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in layer.reporter.QueryReportersRequest", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in layer.reporter.QueryDelegatorReporterRequest", d.FullName())) } panic("unreachable") } @@ -1860,7 +1876,7 @@ func (x *fastReflection_QueryReportersRequest) WhichOneof(d protoreflect.OneofDe // GetUnknown retrieves the entire list of unknown fields. // The caller may only mutate the contents of the RawFields // if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_QueryReportersRequest) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_QueryDelegatorReporterRequest) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -1871,7 +1887,7 @@ func (x *fastReflection_QueryReportersRequest) GetUnknown() protoreflect.RawFiel // An empty RawFields may be passed to clear the fields. // // SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryReportersRequest) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_QueryDelegatorReporterRequest) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -1883,7 +1899,7 @@ func (x *fastReflection_QueryReportersRequest) SetUnknown(fields protoreflect.Ra // message type, but the details are implementation dependent. // Validity is not part of the protobuf data model, and may not // be preserved in marshaling or other operations. -func (x *fastReflection_QueryReportersRequest) IsValid() bool { +func (x *fastReflection_QueryDelegatorReporterRequest) IsValid() bool { return x != nil } @@ -1893,9 +1909,9 @@ func (x *fastReflection_QueryReportersRequest) IsValid() bool { // The returned methods type is identical to // "google.golang.org/protobuf/runtime/protoiface".Methods. // Consult the protoiface package documentation for details. -func (x *fastReflection_QueryReportersRequest) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_QueryDelegatorReporterRequest) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*QueryReportersRequest) + x := input.Message.Interface().(*QueryDelegatorReporterRequest) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1907,6 +1923,10 @@ func (x *fastReflection_QueryReportersRequest) ProtoMethods() *protoiface.Method var n int var l int _ = l + l = len(x.DelegatorAddress) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -1917,7 +1937,7 @@ func (x *fastReflection_QueryReportersRequest) ProtoMethods() *protoiface.Method } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*QueryReportersRequest) + x := input.Message.Interface().(*QueryDelegatorReporterRequest) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1936,6 +1956,13 @@ func (x *fastReflection_QueryReportersRequest) ProtoMethods() *protoiface.Method i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if len(x.DelegatorAddress) > 0 { + i -= len(x.DelegatorAddress) + copy(dAtA[i:], x.DelegatorAddress) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } if input.Buf != nil { input.Buf = append(input.Buf, dAtA...) } else { @@ -1947,7 +1974,7 @@ func (x *fastReflection_QueryReportersRequest) ProtoMethods() *protoiface.Method }, nil } unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*QueryReportersRequest) + x := input.Message.Interface().(*QueryDelegatorReporterRequest) if x == nil { return protoiface.UnmarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1979,12 +2006,44 @@ func (x *fastReflection_QueryReportersRequest) ProtoMethods() *protoiface.Method fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryReportersRequest: wiretype end group for non-group") + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryDelegatorReporterRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryReportersRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryDelegatorReporterRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", 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.DelegatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -2020,77 +2079,26 @@ func (x *fastReflection_QueryReportersRequest) ProtoMethods() *protoiface.Method } } -var _ protoreflect.List = (*_QueryReportersResponse_1_list)(nil) - -type _QueryReportersResponse_1_list struct { - list *[]*OracleReporter -} - -func (x *_QueryReportersResponse_1_list) Len() int { - if x.list == nil { - return 0 - } - return len(*x.list) -} - -func (x *_QueryReportersResponse_1_list) Get(i int) protoreflect.Value { - return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) -} - -func (x *_QueryReportersResponse_1_list) Set(i int, value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*OracleReporter) - (*x.list)[i] = concreteValue -} - -func (x *_QueryReportersResponse_1_list) Append(value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*OracleReporter) - *x.list = append(*x.list, concreteValue) -} - -func (x *_QueryReportersResponse_1_list) AppendMutable() protoreflect.Value { - v := new(OracleReporter) - *x.list = append(*x.list, v) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_QueryReportersResponse_1_list) Truncate(n int) { - for i := n; i < len(*x.list); i++ { - (*x.list)[i] = nil - } - *x.list = (*x.list)[:n] -} - -func (x *_QueryReportersResponse_1_list) NewElement() protoreflect.Value { - v := new(OracleReporter) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_QueryReportersResponse_1_list) IsValid() bool { - return x.list != nil -} - var ( - md_QueryReportersResponse protoreflect.MessageDescriptor - fd_QueryReportersResponse_reporters protoreflect.FieldDescriptor + md_QueryDelegatorReporterResponse protoreflect.MessageDescriptor + fd_QueryDelegatorReporterResponse_reporter protoreflect.FieldDescriptor ) func init() { file_layer_reporter_query_proto_init() - md_QueryReportersResponse = File_layer_reporter_query_proto.Messages().ByName("QueryReportersResponse") - fd_QueryReportersResponse_reporters = md_QueryReportersResponse.Fields().ByName("reporters") + md_QueryDelegatorReporterResponse = File_layer_reporter_query_proto.Messages().ByName("QueryDelegatorReporterResponse") + fd_QueryDelegatorReporterResponse_reporter = md_QueryDelegatorReporterResponse.Fields().ByName("reporter") } -var _ protoreflect.Message = (*fastReflection_QueryReportersResponse)(nil) +var _ protoreflect.Message = (*fastReflection_QueryDelegatorReporterResponse)(nil) -type fastReflection_QueryReportersResponse QueryReportersResponse +type fastReflection_QueryDelegatorReporterResponse QueryDelegatorReporterResponse -func (x *QueryReportersResponse) ProtoReflect() protoreflect.Message { - return (*fastReflection_QueryReportersResponse)(x) +func (x *QueryDelegatorReporterResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryDelegatorReporterResponse)(x) } -func (x *QueryReportersResponse) slowProtoReflect() protoreflect.Message { +func (x *QueryDelegatorReporterResponse) slowProtoReflect() protoreflect.Message { mi := &file_layer_reporter_query_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -2102,43 +2110,43 @@ func (x *QueryReportersResponse) slowProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -var _fastReflection_QueryReportersResponse_messageType fastReflection_QueryReportersResponse_messageType -var _ protoreflect.MessageType = fastReflection_QueryReportersResponse_messageType{} +var _fastReflection_QueryDelegatorReporterResponse_messageType fastReflection_QueryDelegatorReporterResponse_messageType +var _ protoreflect.MessageType = fastReflection_QueryDelegatorReporterResponse_messageType{} -type fastReflection_QueryReportersResponse_messageType struct{} +type fastReflection_QueryDelegatorReporterResponse_messageType struct{} -func (x fastReflection_QueryReportersResponse_messageType) Zero() protoreflect.Message { - return (*fastReflection_QueryReportersResponse)(nil) +func (x fastReflection_QueryDelegatorReporterResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryDelegatorReporterResponse)(nil) } -func (x fastReflection_QueryReportersResponse_messageType) New() protoreflect.Message { - return new(fastReflection_QueryReportersResponse) +func (x fastReflection_QueryDelegatorReporterResponse_messageType) New() protoreflect.Message { + return new(fastReflection_QueryDelegatorReporterResponse) } -func (x fastReflection_QueryReportersResponse_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_QueryReportersResponse +func (x fastReflection_QueryDelegatorReporterResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryDelegatorReporterResponse } // Descriptor returns message descriptor, which contains only the protobuf // type information for the message. -func (x *fastReflection_QueryReportersResponse) Descriptor() protoreflect.MessageDescriptor { - return md_QueryReportersResponse +func (x *fastReflection_QueryDelegatorReporterResponse) Descriptor() protoreflect.MessageDescriptor { + return md_QueryDelegatorReporterResponse } // Type returns the message type, which encapsulates both Go and protobuf // type information. If the Go type information is not needed, // it is recommended that the message descriptor be used instead. -func (x *fastReflection_QueryReportersResponse) Type() protoreflect.MessageType { - return _fastReflection_QueryReportersResponse_messageType +func (x *fastReflection_QueryDelegatorReporterResponse) Type() protoreflect.MessageType { + return _fastReflection_QueryDelegatorReporterResponse_messageType } // New returns a newly allocated and mutable empty message. -func (x *fastReflection_QueryReportersResponse) New() protoreflect.Message { - return new(fastReflection_QueryReportersResponse) +func (x *fastReflection_QueryDelegatorReporterResponse) New() protoreflect.Message { + return new(fastReflection_QueryDelegatorReporterResponse) } // Interface unwraps the message reflection interface and // returns the underlying ProtoMessage interface. -func (x *fastReflection_QueryReportersResponse) Interface() protoreflect.ProtoMessage { - return (*QueryReportersResponse)(x) +func (x *fastReflection_QueryDelegatorReporterResponse) Interface() protoreflect.ProtoMessage { + return (*QueryDelegatorReporterResponse)(x) } // Range iterates over every populated field in an undefined order, @@ -2146,10 +2154,10 @@ func (x *fastReflection_QueryReportersResponse) Interface() protoreflect.ProtoMe // Range returns immediately if f returns false. // While iterating, mutating operations may only be performed // on the current field descriptor. -func (x *fastReflection_QueryReportersResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if len(x.Reporters) != 0 { - value := protoreflect.ValueOfList(&_QueryReportersResponse_1_list{list: &x.Reporters}) - if !f(fd_QueryReportersResponse_reporters, value) { +func (x *fastReflection_QueryDelegatorReporterResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Reporter != "" { + value := protoreflect.ValueOfString(x.Reporter) + if !f(fd_QueryDelegatorReporterResponse_reporter, value) { return } } @@ -2166,15 +2174,15 @@ func (x *fastReflection_QueryReportersResponse) Range(f func(protoreflect.FieldD // In other cases (aside from the nullable cases above), // a proto3 scalar field is populated if it contains a non-zero value, and // a repeated field is populated if it is non-empty. -func (x *fastReflection_QueryReportersResponse) Has(fd protoreflect.FieldDescriptor) bool { +func (x *fastReflection_QueryDelegatorReporterResponse) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "layer.reporter.QueryReportersResponse.reporters": - return len(x.Reporters) != 0 + case "layer.reporter.QueryDelegatorReporterResponse.reporter": + return x.Reporter != "" default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReportersResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryDelegatorReporterResponse")) } - panic(fmt.Errorf("message layer.reporter.QueryReportersResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.QueryDelegatorReporterResponse does not contain field %s", fd.FullName())) } } @@ -2184,15 +2192,15 @@ func (x *fastReflection_QueryReportersResponse) Has(fd protoreflect.FieldDescrip // associated with the given field number. // // Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryReportersResponse) Clear(fd protoreflect.FieldDescriptor) { +func (x *fastReflection_QueryDelegatorReporterResponse) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "layer.reporter.QueryReportersResponse.reporters": - x.Reporters = nil + case "layer.reporter.QueryDelegatorReporterResponse.reporter": + x.Reporter = "" default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReportersResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryDelegatorReporterResponse")) } - panic(fmt.Errorf("message layer.reporter.QueryReportersResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.QueryDelegatorReporterResponse does not contain field %s", fd.FullName())) } } @@ -2202,19 +2210,16 @@ func (x *fastReflection_QueryReportersResponse) Clear(fd protoreflect.FieldDescr // the default value of a bytes scalar is guaranteed to be a copy. // For unpopulated composite types, it returns an empty, read-only view // of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_QueryReportersResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_QueryDelegatorReporterResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "layer.reporter.QueryReportersResponse.reporters": - if len(x.Reporters) == 0 { - return protoreflect.ValueOfList(&_QueryReportersResponse_1_list{}) - } - listValue := &_QueryReportersResponse_1_list{list: &x.Reporters} - return protoreflect.ValueOfList(listValue) + case "layer.reporter.QueryDelegatorReporterResponse.reporter": + value := x.Reporter + return protoreflect.ValueOfString(value) default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReportersResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryDelegatorReporterResponse")) } - panic(fmt.Errorf("message layer.reporter.QueryReportersResponse does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message layer.reporter.QueryDelegatorReporterResponse does not contain field %s", descriptor.FullName())) } } @@ -2228,17 +2233,15 @@ func (x *fastReflection_QueryReportersResponse) Get(descriptor protoreflect.Fiel // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryReportersResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_QueryDelegatorReporterResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "layer.reporter.QueryReportersResponse.reporters": - lv := value.List() - clv := lv.(*_QueryReportersResponse_1_list) - x.Reporters = *clv.list + case "layer.reporter.QueryDelegatorReporterResponse.reporter": + x.Reporter = value.Interface().(string) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReportersResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryDelegatorReporterResponse")) } - panic(fmt.Errorf("message layer.reporter.QueryReportersResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.QueryDelegatorReporterResponse does not contain field %s", fd.FullName())) } } @@ -2252,45 +2255,40 @@ func (x *fastReflection_QueryReportersResponse) Set(fd protoreflect.FieldDescrip // It panics if the field does not contain a composite type. // // Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryReportersResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_QueryDelegatorReporterResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "layer.reporter.QueryReportersResponse.reporters": - if x.Reporters == nil { - x.Reporters = []*OracleReporter{} - } - value := &_QueryReportersResponse_1_list{list: &x.Reporters} - return protoreflect.ValueOfList(value) + case "layer.reporter.QueryDelegatorReporterResponse.reporter": + panic(fmt.Errorf("field reporter of message layer.reporter.QueryDelegatorReporterResponse is not mutable")) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReportersResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryDelegatorReporterResponse")) } - panic(fmt.Errorf("message layer.reporter.QueryReportersResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.QueryDelegatorReporterResponse does not contain field %s", fd.FullName())) } } // NewField returns a new value that is assignable to the field // for the given descriptor. For scalars, this returns the default value. // For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_QueryReportersResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_QueryDelegatorReporterResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "layer.reporter.QueryReportersResponse.reporters": - list := []*OracleReporter{} - return protoreflect.ValueOfList(&_QueryReportersResponse_1_list{list: &list}) + case "layer.reporter.QueryDelegatorReporterResponse.reporter": + return protoreflect.ValueOfString("") default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReportersResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryDelegatorReporterResponse")) } - panic(fmt.Errorf("message layer.reporter.QueryReportersResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.QueryDelegatorReporterResponse does not contain field %s", fd.FullName())) } } // WhichOneof reports which field within the oneof is populated, // returning nil if none are populated. // It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_QueryReportersResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { +func (x *fastReflection_QueryDelegatorReporterResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in layer.reporter.QueryReportersResponse", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in layer.reporter.QueryDelegatorReporterResponse", d.FullName())) } panic("unreachable") } @@ -2298,7 +2296,7 @@ func (x *fastReflection_QueryReportersResponse) WhichOneof(d protoreflect.OneofD // GetUnknown retrieves the entire list of unknown fields. // The caller may only mutate the contents of the RawFields // if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_QueryReportersResponse) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_QueryDelegatorReporterResponse) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -2309,7 +2307,7 @@ func (x *fastReflection_QueryReportersResponse) GetUnknown() protoreflect.RawFie // An empty RawFields may be passed to clear the fields. // // SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryReportersResponse) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_QueryDelegatorReporterResponse) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -2321,7 +2319,7 @@ func (x *fastReflection_QueryReportersResponse) SetUnknown(fields protoreflect.R // message type, but the details are implementation dependent. // Validity is not part of the protobuf data model, and may not // be preserved in marshaling or other operations. -func (x *fastReflection_QueryReportersResponse) IsValid() bool { +func (x *fastReflection_QueryDelegatorReporterResponse) IsValid() bool { return x != nil } @@ -2331,9 +2329,9 @@ func (x *fastReflection_QueryReportersResponse) IsValid() bool { // The returned methods type is identical to // "google.golang.org/protobuf/runtime/protoiface".Methods. // Consult the protoiface package documentation for details. -func (x *fastReflection_QueryReportersResponse) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_QueryDelegatorReporterResponse) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*QueryReportersResponse) + x := input.Message.Interface().(*QueryDelegatorReporterResponse) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2345,11 +2343,9 @@ func (x *fastReflection_QueryReportersResponse) ProtoMethods() *protoiface.Metho var n int var l int _ = l - if len(x.Reporters) > 0 { - for _, e := range x.Reporters { - l = options.Size(e) - n += 1 + l + runtime.Sov(uint64(l)) - } + l = len(x.Reporter) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) } if x.unknownFields != nil { n += len(x.unknownFields) @@ -2361,7 +2357,7 @@ func (x *fastReflection_QueryReportersResponse) ProtoMethods() *protoiface.Metho } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*QueryReportersResponse) + x := input.Message.Interface().(*QueryDelegatorReporterResponse) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2380,21 +2376,12 @@ func (x *fastReflection_QueryReportersResponse) ProtoMethods() *protoiface.Metho i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if len(x.Reporters) > 0 { - for iNdEx := len(x.Reporters) - 1; iNdEx >= 0; iNdEx-- { - encoded, err := options.Marshal(x.Reporters[iNdEx]) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0xa - } + if len(x.Reporter) > 0 { + i -= len(x.Reporter) + copy(dAtA[i:], x.Reporter) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Reporter))) + i-- + dAtA[i] = 0xa } if input.Buf != nil { input.Buf = append(input.Buf, dAtA...) @@ -2407,7 +2394,7 @@ func (x *fastReflection_QueryReportersResponse) ProtoMethods() *protoiface.Metho }, nil } unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*QueryReportersResponse) + x := input.Message.Interface().(*QueryDelegatorReporterResponse) if x == nil { return protoiface.UnmarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2439,17 +2426,17 @@ func (x *fastReflection_QueryReportersResponse) ProtoMethods() *protoiface.Metho fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryReportersResponse: wiretype end group for non-group") + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryDelegatorReporterResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryReportersResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryDelegatorReporterResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Reporters", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Reporter", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -2459,25 +2446,23 @@ func (x *fastReflection_QueryReportersResponse) ProtoMethods() *protoiface.Metho } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } - postIndex := iNdEx + msglen + 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.Reporters = append(x.Reporters, &OracleReporter{}) - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Reporters[len(x.Reporters)-1]); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } + x.Reporter = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -2514,4974 +2499,221 @@ func (x *fastReflection_QueryReportersResponse) ProtoMethods() *protoiface.Metho } } -var ( - md_QueryDelegatorReporterRequest protoreflect.MessageDescriptor - fd_QueryDelegatorReporterRequest_delegator_address protoreflect.FieldDescriptor -) - -func init() { - file_layer_reporter_query_proto_init() - md_QueryDelegatorReporterRequest = File_layer_reporter_query_proto.Messages().ByName("QueryDelegatorReporterRequest") - fd_QueryDelegatorReporterRequest_delegator_address = md_QueryDelegatorReporterRequest.Fields().ByName("delegator_address") -} - -var _ protoreflect.Message = (*fastReflection_QueryDelegatorReporterRequest)(nil) +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: layer/reporter/query.proto -type fastReflection_QueryDelegatorReporterRequest QueryDelegatorReporterRequest +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) -func (x *QueryDelegatorReporterRequest) ProtoReflect() protoreflect.Message { - return (*fastReflection_QueryDelegatorReporterRequest)(x) +// QueryParamsRequest is request type for the Query/Params RPC method. +type QueryParamsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields } -func (x *QueryDelegatorReporterRequest) slowProtoReflect() protoreflect.Message { - mi := &file_layer_reporter_query_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { +func (x *QueryParamsRequest) Reset() { + *x = QueryParamsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_layer_reporter_query_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms + ms.StoreMessageInfo(mi) } - return mi.MessageOf(x) } -var _fastReflection_QueryDelegatorReporterRequest_messageType fastReflection_QueryDelegatorReporterRequest_messageType -var _ protoreflect.MessageType = fastReflection_QueryDelegatorReporterRequest_messageType{} +func (x *QueryParamsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} -type fastReflection_QueryDelegatorReporterRequest_messageType struct{} +func (*QueryParamsRequest) ProtoMessage() {} -func (x fastReflection_QueryDelegatorReporterRequest_messageType) Zero() protoreflect.Message { - return (*fastReflection_QueryDelegatorReporterRequest)(nil) -} -func (x fastReflection_QueryDelegatorReporterRequest_messageType) New() protoreflect.Message { - return new(fastReflection_QueryDelegatorReporterRequest) -} -func (x fastReflection_QueryDelegatorReporterRequest_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_QueryDelegatorReporterRequest +// Deprecated: Use QueryParamsRequest.ProtoReflect.Descriptor instead. +func (*QueryParamsRequest) Descriptor() ([]byte, []int) { + return file_layer_reporter_query_proto_rawDescGZIP(), []int{0} } -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_QueryDelegatorReporterRequest) Descriptor() protoreflect.MessageDescriptor { - return md_QueryDelegatorReporterRequest -} +// QueryParamsResponse is response type for the Query/Params RPC method. +type QueryParamsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_QueryDelegatorReporterRequest) Type() protoreflect.MessageType { - return _fastReflection_QueryDelegatorReporterRequest_messageType + // params holds all the parameters of this module. + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` } -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_QueryDelegatorReporterRequest) New() protoreflect.Message { - return new(fastReflection_QueryDelegatorReporterRequest) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_QueryDelegatorReporterRequest) Interface() protoreflect.ProtoMessage { - return (*QueryDelegatorReporterRequest)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_QueryDelegatorReporterRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.DelegatorAddress != "" { - value := protoreflect.ValueOfString(x.DelegatorAddress) - if !f(fd_QueryDelegatorReporterRequest_delegator_address, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_QueryDelegatorReporterRequest) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "layer.reporter.QueryDelegatorReporterRequest.delegator_address": - return x.DelegatorAddress != "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryDelegatorReporterRequest")) - } - panic(fmt.Errorf("message layer.reporter.QueryDelegatorReporterRequest does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryDelegatorReporterRequest) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "layer.reporter.QueryDelegatorReporterRequest.delegator_address": - x.DelegatorAddress = "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryDelegatorReporterRequest")) - } - panic(fmt.Errorf("message layer.reporter.QueryDelegatorReporterRequest does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_QueryDelegatorReporterRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "layer.reporter.QueryDelegatorReporterRequest.delegator_address": - value := x.DelegatorAddress - return protoreflect.ValueOfString(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryDelegatorReporterRequest")) - } - panic(fmt.Errorf("message layer.reporter.QueryDelegatorReporterRequest does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryDelegatorReporterRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "layer.reporter.QueryDelegatorReporterRequest.delegator_address": - x.DelegatorAddress = value.Interface().(string) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryDelegatorReporterRequest")) - } - panic(fmt.Errorf("message layer.reporter.QueryDelegatorReporterRequest does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryDelegatorReporterRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "layer.reporter.QueryDelegatorReporterRequest.delegator_address": - panic(fmt.Errorf("field delegator_address of message layer.reporter.QueryDelegatorReporterRequest is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryDelegatorReporterRequest")) - } - panic(fmt.Errorf("message layer.reporter.QueryDelegatorReporterRequest does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_QueryDelegatorReporterRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "layer.reporter.QueryDelegatorReporterRequest.delegator_address": - return protoreflect.ValueOfString("") - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryDelegatorReporterRequest")) - } - panic(fmt.Errorf("message layer.reporter.QueryDelegatorReporterRequest does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_QueryDelegatorReporterRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in layer.reporter.QueryDelegatorReporterRequest", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_QueryDelegatorReporterRequest) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryDelegatorReporterRequest) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_QueryDelegatorReporterRequest) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_QueryDelegatorReporterRequest) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*QueryDelegatorReporterRequest) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - l = len(x.DelegatorAddress) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*QueryDelegatorReporterRequest) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if len(x.DelegatorAddress) > 0 { - i -= len(x.DelegatorAddress) - copy(dAtA[i:], x.DelegatorAddress) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.DelegatorAddress))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*QueryDelegatorReporterRequest) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire 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++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryDelegatorReporterRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryDelegatorReporterRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", 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.DelegatorAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var ( - md_QueryDelegatorReporterResponse protoreflect.MessageDescriptor - fd_QueryDelegatorReporterResponse_reporter protoreflect.FieldDescriptor -) - -func init() { - file_layer_reporter_query_proto_init() - md_QueryDelegatorReporterResponse = File_layer_reporter_query_proto.Messages().ByName("QueryDelegatorReporterResponse") - fd_QueryDelegatorReporterResponse_reporter = md_QueryDelegatorReporterResponse.Fields().ByName("reporter") -} - -var _ protoreflect.Message = (*fastReflection_QueryDelegatorReporterResponse)(nil) - -type fastReflection_QueryDelegatorReporterResponse QueryDelegatorReporterResponse - -func (x *QueryDelegatorReporterResponse) ProtoReflect() protoreflect.Message { - return (*fastReflection_QueryDelegatorReporterResponse)(x) -} - -func (x *QueryDelegatorReporterResponse) slowProtoReflect() protoreflect.Message { - mi := &file_layer_reporter_query_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_QueryDelegatorReporterResponse_messageType fastReflection_QueryDelegatorReporterResponse_messageType -var _ protoreflect.MessageType = fastReflection_QueryDelegatorReporterResponse_messageType{} - -type fastReflection_QueryDelegatorReporterResponse_messageType struct{} - -func (x fastReflection_QueryDelegatorReporterResponse_messageType) Zero() protoreflect.Message { - return (*fastReflection_QueryDelegatorReporterResponse)(nil) -} -func (x fastReflection_QueryDelegatorReporterResponse_messageType) New() protoreflect.Message { - return new(fastReflection_QueryDelegatorReporterResponse) -} -func (x fastReflection_QueryDelegatorReporterResponse_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_QueryDelegatorReporterResponse -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_QueryDelegatorReporterResponse) Descriptor() protoreflect.MessageDescriptor { - return md_QueryDelegatorReporterResponse -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_QueryDelegatorReporterResponse) Type() protoreflect.MessageType { - return _fastReflection_QueryDelegatorReporterResponse_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_QueryDelegatorReporterResponse) New() protoreflect.Message { - return new(fastReflection_QueryDelegatorReporterResponse) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_QueryDelegatorReporterResponse) Interface() protoreflect.ProtoMessage { - return (*QueryDelegatorReporterResponse)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_QueryDelegatorReporterResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Reporter != "" { - value := protoreflect.ValueOfString(x.Reporter) - if !f(fd_QueryDelegatorReporterResponse_reporter, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_QueryDelegatorReporterResponse) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "layer.reporter.QueryDelegatorReporterResponse.reporter": - return x.Reporter != "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryDelegatorReporterResponse")) - } - panic(fmt.Errorf("message layer.reporter.QueryDelegatorReporterResponse does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryDelegatorReporterResponse) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "layer.reporter.QueryDelegatorReporterResponse.reporter": - x.Reporter = "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryDelegatorReporterResponse")) - } - panic(fmt.Errorf("message layer.reporter.QueryDelegatorReporterResponse does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_QueryDelegatorReporterResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "layer.reporter.QueryDelegatorReporterResponse.reporter": - value := x.Reporter - return protoreflect.ValueOfString(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryDelegatorReporterResponse")) - } - panic(fmt.Errorf("message layer.reporter.QueryDelegatorReporterResponse does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryDelegatorReporterResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "layer.reporter.QueryDelegatorReporterResponse.reporter": - x.Reporter = value.Interface().(string) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryDelegatorReporterResponse")) - } - panic(fmt.Errorf("message layer.reporter.QueryDelegatorReporterResponse does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryDelegatorReporterResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "layer.reporter.QueryDelegatorReporterResponse.reporter": - panic(fmt.Errorf("field reporter of message layer.reporter.QueryDelegatorReporterResponse is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryDelegatorReporterResponse")) - } - panic(fmt.Errorf("message layer.reporter.QueryDelegatorReporterResponse does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_QueryDelegatorReporterResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "layer.reporter.QueryDelegatorReporterResponse.reporter": - return protoreflect.ValueOfString("") - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryDelegatorReporterResponse")) - } - panic(fmt.Errorf("message layer.reporter.QueryDelegatorReporterResponse does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_QueryDelegatorReporterResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in layer.reporter.QueryDelegatorReporterResponse", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_QueryDelegatorReporterResponse) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryDelegatorReporterResponse) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_QueryDelegatorReporterResponse) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_QueryDelegatorReporterResponse) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*QueryDelegatorReporterResponse) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - l = len(x.Reporter) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*QueryDelegatorReporterResponse) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if len(x.Reporter) > 0 { - i -= len(x.Reporter) - copy(dAtA[i:], x.Reporter) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Reporter))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*QueryDelegatorReporterResponse) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire 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++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryDelegatorReporterResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryDelegatorReporterResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Reporter", 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.Reporter = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var ( - md_QueryReporterStakeRequest protoreflect.MessageDescriptor - fd_QueryReporterStakeRequest_reporter_address protoreflect.FieldDescriptor -) - -func init() { - file_layer_reporter_query_proto_init() - md_QueryReporterStakeRequest = File_layer_reporter_query_proto.Messages().ByName("QueryReporterStakeRequest") - fd_QueryReporterStakeRequest_reporter_address = md_QueryReporterStakeRequest.Fields().ByName("reporter_address") -} - -var _ protoreflect.Message = (*fastReflection_QueryReporterStakeRequest)(nil) - -type fastReflection_QueryReporterStakeRequest QueryReporterStakeRequest - -func (x *QueryReporterStakeRequest) ProtoReflect() protoreflect.Message { - return (*fastReflection_QueryReporterStakeRequest)(x) -} - -func (x *QueryReporterStakeRequest) slowProtoReflect() protoreflect.Message { - mi := &file_layer_reporter_query_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_QueryReporterStakeRequest_messageType fastReflection_QueryReporterStakeRequest_messageType -var _ protoreflect.MessageType = fastReflection_QueryReporterStakeRequest_messageType{} - -type fastReflection_QueryReporterStakeRequest_messageType struct{} - -func (x fastReflection_QueryReporterStakeRequest_messageType) Zero() protoreflect.Message { - return (*fastReflection_QueryReporterStakeRequest)(nil) -} -func (x fastReflection_QueryReporterStakeRequest_messageType) New() protoreflect.Message { - return new(fastReflection_QueryReporterStakeRequest) -} -func (x fastReflection_QueryReporterStakeRequest_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_QueryReporterStakeRequest -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_QueryReporterStakeRequest) Descriptor() protoreflect.MessageDescriptor { - return md_QueryReporterStakeRequest -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_QueryReporterStakeRequest) Type() protoreflect.MessageType { - return _fastReflection_QueryReporterStakeRequest_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_QueryReporterStakeRequest) New() protoreflect.Message { - return new(fastReflection_QueryReporterStakeRequest) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_QueryReporterStakeRequest) Interface() protoreflect.ProtoMessage { - return (*QueryReporterStakeRequest)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_QueryReporterStakeRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.ReporterAddress != "" { - value := protoreflect.ValueOfString(x.ReporterAddress) - if !f(fd_QueryReporterStakeRequest_reporter_address, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_QueryReporterStakeRequest) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "layer.reporter.QueryReporterStakeRequest.reporter_address": - return x.ReporterAddress != "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReporterStakeRequest")) - } - panic(fmt.Errorf("message layer.reporter.QueryReporterStakeRequest does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryReporterStakeRequest) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "layer.reporter.QueryReporterStakeRequest.reporter_address": - x.ReporterAddress = "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReporterStakeRequest")) - } - panic(fmt.Errorf("message layer.reporter.QueryReporterStakeRequest does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_QueryReporterStakeRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "layer.reporter.QueryReporterStakeRequest.reporter_address": - value := x.ReporterAddress - return protoreflect.ValueOfString(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReporterStakeRequest")) - } - panic(fmt.Errorf("message layer.reporter.QueryReporterStakeRequest does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryReporterStakeRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "layer.reporter.QueryReporterStakeRequest.reporter_address": - x.ReporterAddress = value.Interface().(string) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReporterStakeRequest")) - } - panic(fmt.Errorf("message layer.reporter.QueryReporterStakeRequest does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryReporterStakeRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "layer.reporter.QueryReporterStakeRequest.reporter_address": - panic(fmt.Errorf("field reporter_address of message layer.reporter.QueryReporterStakeRequest is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReporterStakeRequest")) - } - panic(fmt.Errorf("message layer.reporter.QueryReporterStakeRequest does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_QueryReporterStakeRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "layer.reporter.QueryReporterStakeRequest.reporter_address": - return protoreflect.ValueOfString("") - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReporterStakeRequest")) - } - panic(fmt.Errorf("message layer.reporter.QueryReporterStakeRequest does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_QueryReporterStakeRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in layer.reporter.QueryReporterStakeRequest", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_QueryReporterStakeRequest) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryReporterStakeRequest) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_QueryReporterStakeRequest) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_QueryReporterStakeRequest) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*QueryReporterStakeRequest) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - l = len(x.ReporterAddress) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*QueryReporterStakeRequest) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if len(x.ReporterAddress) > 0 { - i -= len(x.ReporterAddress) - copy(dAtA[i:], x.ReporterAddress) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ReporterAddress))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*QueryReporterStakeRequest) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire 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++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryReporterStakeRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryReporterStakeRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ReporterAddress", 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.ReporterAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var ( - md_QueryReporterStakeResponse protoreflect.MessageDescriptor - fd_QueryReporterStakeResponse_stake protoreflect.FieldDescriptor -) - -func init() { - file_layer_reporter_query_proto_init() - md_QueryReporterStakeResponse = File_layer_reporter_query_proto.Messages().ByName("QueryReporterStakeResponse") - fd_QueryReporterStakeResponse_stake = md_QueryReporterStakeResponse.Fields().ByName("stake") -} - -var _ protoreflect.Message = (*fastReflection_QueryReporterStakeResponse)(nil) - -type fastReflection_QueryReporterStakeResponse QueryReporterStakeResponse - -func (x *QueryReporterStakeResponse) ProtoReflect() protoreflect.Message { - return (*fastReflection_QueryReporterStakeResponse)(x) -} - -func (x *QueryReporterStakeResponse) slowProtoReflect() protoreflect.Message { - mi := &file_layer_reporter_query_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_QueryReporterStakeResponse_messageType fastReflection_QueryReporterStakeResponse_messageType -var _ protoreflect.MessageType = fastReflection_QueryReporterStakeResponse_messageType{} - -type fastReflection_QueryReporterStakeResponse_messageType struct{} - -func (x fastReflection_QueryReporterStakeResponse_messageType) Zero() protoreflect.Message { - return (*fastReflection_QueryReporterStakeResponse)(nil) -} -func (x fastReflection_QueryReporterStakeResponse_messageType) New() protoreflect.Message { - return new(fastReflection_QueryReporterStakeResponse) -} -func (x fastReflection_QueryReporterStakeResponse_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_QueryReporterStakeResponse -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_QueryReporterStakeResponse) Descriptor() protoreflect.MessageDescriptor { - return md_QueryReporterStakeResponse -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_QueryReporterStakeResponse) Type() protoreflect.MessageType { - return _fastReflection_QueryReporterStakeResponse_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_QueryReporterStakeResponse) New() protoreflect.Message { - return new(fastReflection_QueryReporterStakeResponse) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_QueryReporterStakeResponse) Interface() protoreflect.ProtoMessage { - return (*QueryReporterStakeResponse)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_QueryReporterStakeResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Stake != "" { - value := protoreflect.ValueOfString(x.Stake) - if !f(fd_QueryReporterStakeResponse_stake, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_QueryReporterStakeResponse) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "layer.reporter.QueryReporterStakeResponse.stake": - return x.Stake != "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReporterStakeResponse")) - } - panic(fmt.Errorf("message layer.reporter.QueryReporterStakeResponse does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryReporterStakeResponse) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "layer.reporter.QueryReporterStakeResponse.stake": - x.Stake = "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReporterStakeResponse")) - } - panic(fmt.Errorf("message layer.reporter.QueryReporterStakeResponse does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_QueryReporterStakeResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "layer.reporter.QueryReporterStakeResponse.stake": - value := x.Stake - return protoreflect.ValueOfString(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReporterStakeResponse")) - } - panic(fmt.Errorf("message layer.reporter.QueryReporterStakeResponse does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryReporterStakeResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "layer.reporter.QueryReporterStakeResponse.stake": - x.Stake = value.Interface().(string) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReporterStakeResponse")) - } - panic(fmt.Errorf("message layer.reporter.QueryReporterStakeResponse does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryReporterStakeResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "layer.reporter.QueryReporterStakeResponse.stake": - panic(fmt.Errorf("field stake of message layer.reporter.QueryReporterStakeResponse is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReporterStakeResponse")) - } - panic(fmt.Errorf("message layer.reporter.QueryReporterStakeResponse does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_QueryReporterStakeResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "layer.reporter.QueryReporterStakeResponse.stake": - return protoreflect.ValueOfString("") - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReporterStakeResponse")) - } - panic(fmt.Errorf("message layer.reporter.QueryReporterStakeResponse does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_QueryReporterStakeResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in layer.reporter.QueryReporterStakeResponse", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_QueryReporterStakeResponse) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryReporterStakeResponse) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_QueryReporterStakeResponse) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_QueryReporterStakeResponse) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*QueryReporterStakeResponse) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - l = len(x.Stake) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*QueryReporterStakeResponse) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if len(x.Stake) > 0 { - i -= len(x.Stake) - copy(dAtA[i:], x.Stake) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Stake))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*QueryReporterStakeResponse) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire 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++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryReporterStakeResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryReporterStakeResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Stake", 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.Stake = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var ( - md_QueryDelegationRewardsRequest protoreflect.MessageDescriptor - fd_QueryDelegationRewardsRequest_delegator_address protoreflect.FieldDescriptor - fd_QueryDelegationRewardsRequest_reporter_address protoreflect.FieldDescriptor -) - -func init() { - file_layer_reporter_query_proto_init() - md_QueryDelegationRewardsRequest = File_layer_reporter_query_proto.Messages().ByName("QueryDelegationRewardsRequest") - fd_QueryDelegationRewardsRequest_delegator_address = md_QueryDelegationRewardsRequest.Fields().ByName("delegator_address") - fd_QueryDelegationRewardsRequest_reporter_address = md_QueryDelegationRewardsRequest.Fields().ByName("reporter_address") -} - -var _ protoreflect.Message = (*fastReflection_QueryDelegationRewardsRequest)(nil) - -type fastReflection_QueryDelegationRewardsRequest QueryDelegationRewardsRequest - -func (x *QueryDelegationRewardsRequest) ProtoReflect() protoreflect.Message { - return (*fastReflection_QueryDelegationRewardsRequest)(x) -} - -func (x *QueryDelegationRewardsRequest) slowProtoReflect() protoreflect.Message { - mi := &file_layer_reporter_query_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_QueryDelegationRewardsRequest_messageType fastReflection_QueryDelegationRewardsRequest_messageType -var _ protoreflect.MessageType = fastReflection_QueryDelegationRewardsRequest_messageType{} - -type fastReflection_QueryDelegationRewardsRequest_messageType struct{} - -func (x fastReflection_QueryDelegationRewardsRequest_messageType) Zero() protoreflect.Message { - return (*fastReflection_QueryDelegationRewardsRequest)(nil) -} -func (x fastReflection_QueryDelegationRewardsRequest_messageType) New() protoreflect.Message { - return new(fastReflection_QueryDelegationRewardsRequest) -} -func (x fastReflection_QueryDelegationRewardsRequest_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_QueryDelegationRewardsRequest -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_QueryDelegationRewardsRequest) Descriptor() protoreflect.MessageDescriptor { - return md_QueryDelegationRewardsRequest -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_QueryDelegationRewardsRequest) Type() protoreflect.MessageType { - return _fastReflection_QueryDelegationRewardsRequest_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_QueryDelegationRewardsRequest) New() protoreflect.Message { - return new(fastReflection_QueryDelegationRewardsRequest) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_QueryDelegationRewardsRequest) Interface() protoreflect.ProtoMessage { - return (*QueryDelegationRewardsRequest)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_QueryDelegationRewardsRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.DelegatorAddress != "" { - value := protoreflect.ValueOfString(x.DelegatorAddress) - if !f(fd_QueryDelegationRewardsRequest_delegator_address, value) { - return - } - } - if x.ReporterAddress != "" { - value := protoreflect.ValueOfString(x.ReporterAddress) - if !f(fd_QueryDelegationRewardsRequest_reporter_address, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_QueryDelegationRewardsRequest) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "layer.reporter.QueryDelegationRewardsRequest.delegator_address": - return x.DelegatorAddress != "" - case "layer.reporter.QueryDelegationRewardsRequest.reporter_address": - return x.ReporterAddress != "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryDelegationRewardsRequest")) - } - panic(fmt.Errorf("message layer.reporter.QueryDelegationRewardsRequest does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryDelegationRewardsRequest) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "layer.reporter.QueryDelegationRewardsRequest.delegator_address": - x.DelegatorAddress = "" - case "layer.reporter.QueryDelegationRewardsRequest.reporter_address": - x.ReporterAddress = "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryDelegationRewardsRequest")) - } - panic(fmt.Errorf("message layer.reporter.QueryDelegationRewardsRequest does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_QueryDelegationRewardsRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "layer.reporter.QueryDelegationRewardsRequest.delegator_address": - value := x.DelegatorAddress - return protoreflect.ValueOfString(value) - case "layer.reporter.QueryDelegationRewardsRequest.reporter_address": - value := x.ReporterAddress - return protoreflect.ValueOfString(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryDelegationRewardsRequest")) - } - panic(fmt.Errorf("message layer.reporter.QueryDelegationRewardsRequest does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryDelegationRewardsRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "layer.reporter.QueryDelegationRewardsRequest.delegator_address": - x.DelegatorAddress = value.Interface().(string) - case "layer.reporter.QueryDelegationRewardsRequest.reporter_address": - x.ReporterAddress = value.Interface().(string) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryDelegationRewardsRequest")) - } - panic(fmt.Errorf("message layer.reporter.QueryDelegationRewardsRequest does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryDelegationRewardsRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "layer.reporter.QueryDelegationRewardsRequest.delegator_address": - panic(fmt.Errorf("field delegator_address of message layer.reporter.QueryDelegationRewardsRequest is not mutable")) - case "layer.reporter.QueryDelegationRewardsRequest.reporter_address": - panic(fmt.Errorf("field reporter_address of message layer.reporter.QueryDelegationRewardsRequest is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryDelegationRewardsRequest")) - } - panic(fmt.Errorf("message layer.reporter.QueryDelegationRewardsRequest does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_QueryDelegationRewardsRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "layer.reporter.QueryDelegationRewardsRequest.delegator_address": - return protoreflect.ValueOfString("") - case "layer.reporter.QueryDelegationRewardsRequest.reporter_address": - return protoreflect.ValueOfString("") - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryDelegationRewardsRequest")) - } - panic(fmt.Errorf("message layer.reporter.QueryDelegationRewardsRequest does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_QueryDelegationRewardsRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in layer.reporter.QueryDelegationRewardsRequest", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_QueryDelegationRewardsRequest) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryDelegationRewardsRequest) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_QueryDelegationRewardsRequest) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_QueryDelegationRewardsRequest) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*QueryDelegationRewardsRequest) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - l = len(x.DelegatorAddress) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - l = len(x.ReporterAddress) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*QueryDelegationRewardsRequest) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if len(x.ReporterAddress) > 0 { - i -= len(x.ReporterAddress) - copy(dAtA[i:], x.ReporterAddress) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ReporterAddress))) - i-- - dAtA[i] = 0x12 - } - if len(x.DelegatorAddress) > 0 { - i -= len(x.DelegatorAddress) - copy(dAtA[i:], x.DelegatorAddress) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.DelegatorAddress))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*QueryDelegationRewardsRequest) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire 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++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryDelegationRewardsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryDelegationRewardsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", 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.DelegatorAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ReporterAddress", 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.ReporterAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var _ protoreflect.List = (*_QueryDelegationRewardsResponse_1_list)(nil) - -type _QueryDelegationRewardsResponse_1_list struct { - list *[]*v1beta1.DecCoin -} - -func (x *_QueryDelegationRewardsResponse_1_list) Len() int { - if x.list == nil { - return 0 - } - return len(*x.list) -} - -func (x *_QueryDelegationRewardsResponse_1_list) Get(i int) protoreflect.Value { - return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) -} - -func (x *_QueryDelegationRewardsResponse_1_list) Set(i int, value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*v1beta1.DecCoin) - (*x.list)[i] = concreteValue -} - -func (x *_QueryDelegationRewardsResponse_1_list) Append(value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*v1beta1.DecCoin) - *x.list = append(*x.list, concreteValue) -} - -func (x *_QueryDelegationRewardsResponse_1_list) AppendMutable() protoreflect.Value { - v := new(v1beta1.DecCoin) - *x.list = append(*x.list, v) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_QueryDelegationRewardsResponse_1_list) Truncate(n int) { - for i := n; i < len(*x.list); i++ { - (*x.list)[i] = nil - } - *x.list = (*x.list)[:n] -} - -func (x *_QueryDelegationRewardsResponse_1_list) NewElement() protoreflect.Value { - v := new(v1beta1.DecCoin) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_QueryDelegationRewardsResponse_1_list) IsValid() bool { - return x.list != nil -} - -var ( - md_QueryDelegationRewardsResponse protoreflect.MessageDescriptor - fd_QueryDelegationRewardsResponse_rewards protoreflect.FieldDescriptor -) - -func init() { - file_layer_reporter_query_proto_init() - md_QueryDelegationRewardsResponse = File_layer_reporter_query_proto.Messages().ByName("QueryDelegationRewardsResponse") - fd_QueryDelegationRewardsResponse_rewards = md_QueryDelegationRewardsResponse.Fields().ByName("rewards") -} - -var _ protoreflect.Message = (*fastReflection_QueryDelegationRewardsResponse)(nil) - -type fastReflection_QueryDelegationRewardsResponse QueryDelegationRewardsResponse - -func (x *QueryDelegationRewardsResponse) ProtoReflect() protoreflect.Message { - return (*fastReflection_QueryDelegationRewardsResponse)(x) -} - -func (x *QueryDelegationRewardsResponse) slowProtoReflect() protoreflect.Message { - mi := &file_layer_reporter_query_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_QueryDelegationRewardsResponse_messageType fastReflection_QueryDelegationRewardsResponse_messageType -var _ protoreflect.MessageType = fastReflection_QueryDelegationRewardsResponse_messageType{} - -type fastReflection_QueryDelegationRewardsResponse_messageType struct{} - -func (x fastReflection_QueryDelegationRewardsResponse_messageType) Zero() protoreflect.Message { - return (*fastReflection_QueryDelegationRewardsResponse)(nil) -} -func (x fastReflection_QueryDelegationRewardsResponse_messageType) New() protoreflect.Message { - return new(fastReflection_QueryDelegationRewardsResponse) -} -func (x fastReflection_QueryDelegationRewardsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_QueryDelegationRewardsResponse -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_QueryDelegationRewardsResponse) Descriptor() protoreflect.MessageDescriptor { - return md_QueryDelegationRewardsResponse -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_QueryDelegationRewardsResponse) Type() protoreflect.MessageType { - return _fastReflection_QueryDelegationRewardsResponse_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_QueryDelegationRewardsResponse) New() protoreflect.Message { - return new(fastReflection_QueryDelegationRewardsResponse) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_QueryDelegationRewardsResponse) Interface() protoreflect.ProtoMessage { - return (*QueryDelegationRewardsResponse)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_QueryDelegationRewardsResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if len(x.Rewards) != 0 { - value := protoreflect.ValueOfList(&_QueryDelegationRewardsResponse_1_list{list: &x.Rewards}) - if !f(fd_QueryDelegationRewardsResponse_rewards, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_QueryDelegationRewardsResponse) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "layer.reporter.QueryDelegationRewardsResponse.rewards": - return len(x.Rewards) != 0 - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryDelegationRewardsResponse")) - } - panic(fmt.Errorf("message layer.reporter.QueryDelegationRewardsResponse does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryDelegationRewardsResponse) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "layer.reporter.QueryDelegationRewardsResponse.rewards": - x.Rewards = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryDelegationRewardsResponse")) - } - panic(fmt.Errorf("message layer.reporter.QueryDelegationRewardsResponse does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_QueryDelegationRewardsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "layer.reporter.QueryDelegationRewardsResponse.rewards": - if len(x.Rewards) == 0 { - return protoreflect.ValueOfList(&_QueryDelegationRewardsResponse_1_list{}) - } - listValue := &_QueryDelegationRewardsResponse_1_list{list: &x.Rewards} - return protoreflect.ValueOfList(listValue) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryDelegationRewardsResponse")) - } - panic(fmt.Errorf("message layer.reporter.QueryDelegationRewardsResponse does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryDelegationRewardsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "layer.reporter.QueryDelegationRewardsResponse.rewards": - lv := value.List() - clv := lv.(*_QueryDelegationRewardsResponse_1_list) - x.Rewards = *clv.list - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryDelegationRewardsResponse")) - } - panic(fmt.Errorf("message layer.reporter.QueryDelegationRewardsResponse does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryDelegationRewardsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "layer.reporter.QueryDelegationRewardsResponse.rewards": - if x.Rewards == nil { - x.Rewards = []*v1beta1.DecCoin{} - } - value := &_QueryDelegationRewardsResponse_1_list{list: &x.Rewards} - return protoreflect.ValueOfList(value) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryDelegationRewardsResponse")) - } - panic(fmt.Errorf("message layer.reporter.QueryDelegationRewardsResponse does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_QueryDelegationRewardsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "layer.reporter.QueryDelegationRewardsResponse.rewards": - list := []*v1beta1.DecCoin{} - return protoreflect.ValueOfList(&_QueryDelegationRewardsResponse_1_list{list: &list}) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryDelegationRewardsResponse")) - } - panic(fmt.Errorf("message layer.reporter.QueryDelegationRewardsResponse does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_QueryDelegationRewardsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in layer.reporter.QueryDelegationRewardsResponse", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_QueryDelegationRewardsResponse) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryDelegationRewardsResponse) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_QueryDelegationRewardsResponse) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_QueryDelegationRewardsResponse) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*QueryDelegationRewardsResponse) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if len(x.Rewards) > 0 { - for _, e := range x.Rewards { - l = options.Size(e) - n += 1 + l + runtime.Sov(uint64(l)) - } - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*QueryDelegationRewardsResponse) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if len(x.Rewards) > 0 { - for iNdEx := len(x.Rewards) - 1; iNdEx >= 0; iNdEx-- { - encoded, err := options.Marshal(x.Rewards[iNdEx]) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0xa - } - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*QueryDelegationRewardsResponse) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire 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++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryDelegationRewardsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryDelegationRewardsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Rewards", wireType) - } - var msglen int - 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++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - 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.Rewards = append(x.Rewards, &v1beta1.DecCoin{}) - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Rewards[len(x.Rewards)-1]); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var ( - md_QueryReporterOutstandingRewardsRequest protoreflect.MessageDescriptor - fd_QueryReporterOutstandingRewardsRequest_reporter_address protoreflect.FieldDescriptor -) - -func init() { - file_layer_reporter_query_proto_init() - md_QueryReporterOutstandingRewardsRequest = File_layer_reporter_query_proto.Messages().ByName("QueryReporterOutstandingRewardsRequest") - fd_QueryReporterOutstandingRewardsRequest_reporter_address = md_QueryReporterOutstandingRewardsRequest.Fields().ByName("reporter_address") -} - -var _ protoreflect.Message = (*fastReflection_QueryReporterOutstandingRewardsRequest)(nil) - -type fastReflection_QueryReporterOutstandingRewardsRequest QueryReporterOutstandingRewardsRequest - -func (x *QueryReporterOutstandingRewardsRequest) ProtoReflect() protoreflect.Message { - return (*fastReflection_QueryReporterOutstandingRewardsRequest)(x) -} - -func (x *QueryReporterOutstandingRewardsRequest) slowProtoReflect() protoreflect.Message { - mi := &file_layer_reporter_query_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_QueryReporterOutstandingRewardsRequest_messageType fastReflection_QueryReporterOutstandingRewardsRequest_messageType -var _ protoreflect.MessageType = fastReflection_QueryReporterOutstandingRewardsRequest_messageType{} - -type fastReflection_QueryReporterOutstandingRewardsRequest_messageType struct{} - -func (x fastReflection_QueryReporterOutstandingRewardsRequest_messageType) Zero() protoreflect.Message { - return (*fastReflection_QueryReporterOutstandingRewardsRequest)(nil) -} -func (x fastReflection_QueryReporterOutstandingRewardsRequest_messageType) New() protoreflect.Message { - return new(fastReflection_QueryReporterOutstandingRewardsRequest) -} -func (x fastReflection_QueryReporterOutstandingRewardsRequest_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_QueryReporterOutstandingRewardsRequest -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_QueryReporterOutstandingRewardsRequest) Descriptor() protoreflect.MessageDescriptor { - return md_QueryReporterOutstandingRewardsRequest -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_QueryReporterOutstandingRewardsRequest) Type() protoreflect.MessageType { - return _fastReflection_QueryReporterOutstandingRewardsRequest_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_QueryReporterOutstandingRewardsRequest) New() protoreflect.Message { - return new(fastReflection_QueryReporterOutstandingRewardsRequest) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_QueryReporterOutstandingRewardsRequest) Interface() protoreflect.ProtoMessage { - return (*QueryReporterOutstandingRewardsRequest)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_QueryReporterOutstandingRewardsRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.ReporterAddress != "" { - value := protoreflect.ValueOfString(x.ReporterAddress) - if !f(fd_QueryReporterOutstandingRewardsRequest_reporter_address, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_QueryReporterOutstandingRewardsRequest) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "layer.reporter.QueryReporterOutstandingRewardsRequest.reporter_address": - return x.ReporterAddress != "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReporterOutstandingRewardsRequest")) - } - panic(fmt.Errorf("message layer.reporter.QueryReporterOutstandingRewardsRequest does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryReporterOutstandingRewardsRequest) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "layer.reporter.QueryReporterOutstandingRewardsRequest.reporter_address": - x.ReporterAddress = "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReporterOutstandingRewardsRequest")) - } - panic(fmt.Errorf("message layer.reporter.QueryReporterOutstandingRewardsRequest does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_QueryReporterOutstandingRewardsRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "layer.reporter.QueryReporterOutstandingRewardsRequest.reporter_address": - value := x.ReporterAddress - return protoreflect.ValueOfString(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReporterOutstandingRewardsRequest")) - } - panic(fmt.Errorf("message layer.reporter.QueryReporterOutstandingRewardsRequest does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryReporterOutstandingRewardsRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "layer.reporter.QueryReporterOutstandingRewardsRequest.reporter_address": - x.ReporterAddress = value.Interface().(string) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReporterOutstandingRewardsRequest")) - } - panic(fmt.Errorf("message layer.reporter.QueryReporterOutstandingRewardsRequest does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryReporterOutstandingRewardsRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "layer.reporter.QueryReporterOutstandingRewardsRequest.reporter_address": - panic(fmt.Errorf("field reporter_address of message layer.reporter.QueryReporterOutstandingRewardsRequest is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReporterOutstandingRewardsRequest")) - } - panic(fmt.Errorf("message layer.reporter.QueryReporterOutstandingRewardsRequest does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_QueryReporterOutstandingRewardsRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "layer.reporter.QueryReporterOutstandingRewardsRequest.reporter_address": - return protoreflect.ValueOfString("") - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReporterOutstandingRewardsRequest")) - } - panic(fmt.Errorf("message layer.reporter.QueryReporterOutstandingRewardsRequest does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_QueryReporterOutstandingRewardsRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in layer.reporter.QueryReporterOutstandingRewardsRequest", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_QueryReporterOutstandingRewardsRequest) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryReporterOutstandingRewardsRequest) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_QueryReporterOutstandingRewardsRequest) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_QueryReporterOutstandingRewardsRequest) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*QueryReporterOutstandingRewardsRequest) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - l = len(x.ReporterAddress) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*QueryReporterOutstandingRewardsRequest) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if len(x.ReporterAddress) > 0 { - i -= len(x.ReporterAddress) - copy(dAtA[i:], x.ReporterAddress) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ReporterAddress))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*QueryReporterOutstandingRewardsRequest) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire 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++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryReporterOutstandingRewardsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryReporterOutstandingRewardsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ReporterAddress", 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.ReporterAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var ( - md_QueryReporterOutstandingRewardsResponse protoreflect.MessageDescriptor - fd_QueryReporterOutstandingRewardsResponse_rewards protoreflect.FieldDescriptor -) - -func init() { - file_layer_reporter_query_proto_init() - md_QueryReporterOutstandingRewardsResponse = File_layer_reporter_query_proto.Messages().ByName("QueryReporterOutstandingRewardsResponse") - fd_QueryReporterOutstandingRewardsResponse_rewards = md_QueryReporterOutstandingRewardsResponse.Fields().ByName("rewards") -} - -var _ protoreflect.Message = (*fastReflection_QueryReporterOutstandingRewardsResponse)(nil) - -type fastReflection_QueryReporterOutstandingRewardsResponse QueryReporterOutstandingRewardsResponse - -func (x *QueryReporterOutstandingRewardsResponse) ProtoReflect() protoreflect.Message { - return (*fastReflection_QueryReporterOutstandingRewardsResponse)(x) -} - -func (x *QueryReporterOutstandingRewardsResponse) slowProtoReflect() protoreflect.Message { - mi := &file_layer_reporter_query_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_QueryReporterOutstandingRewardsResponse_messageType fastReflection_QueryReporterOutstandingRewardsResponse_messageType -var _ protoreflect.MessageType = fastReflection_QueryReporterOutstandingRewardsResponse_messageType{} - -type fastReflection_QueryReporterOutstandingRewardsResponse_messageType struct{} - -func (x fastReflection_QueryReporterOutstandingRewardsResponse_messageType) Zero() protoreflect.Message { - return (*fastReflection_QueryReporterOutstandingRewardsResponse)(nil) -} -func (x fastReflection_QueryReporterOutstandingRewardsResponse_messageType) New() protoreflect.Message { - return new(fastReflection_QueryReporterOutstandingRewardsResponse) -} -func (x fastReflection_QueryReporterOutstandingRewardsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_QueryReporterOutstandingRewardsResponse -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_QueryReporterOutstandingRewardsResponse) Descriptor() protoreflect.MessageDescriptor { - return md_QueryReporterOutstandingRewardsResponse -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_QueryReporterOutstandingRewardsResponse) Type() protoreflect.MessageType { - return _fastReflection_QueryReporterOutstandingRewardsResponse_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_QueryReporterOutstandingRewardsResponse) New() protoreflect.Message { - return new(fastReflection_QueryReporterOutstandingRewardsResponse) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_QueryReporterOutstandingRewardsResponse) Interface() protoreflect.ProtoMessage { - return (*QueryReporterOutstandingRewardsResponse)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_QueryReporterOutstandingRewardsResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Rewards != nil { - value := protoreflect.ValueOfMessage(x.Rewards.ProtoReflect()) - if !f(fd_QueryReporterOutstandingRewardsResponse_rewards, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_QueryReporterOutstandingRewardsResponse) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "layer.reporter.QueryReporterOutstandingRewardsResponse.rewards": - return x.Rewards != nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReporterOutstandingRewardsResponse")) - } - panic(fmt.Errorf("message layer.reporter.QueryReporterOutstandingRewardsResponse does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryReporterOutstandingRewardsResponse) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "layer.reporter.QueryReporterOutstandingRewardsResponse.rewards": - x.Rewards = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReporterOutstandingRewardsResponse")) - } - panic(fmt.Errorf("message layer.reporter.QueryReporterOutstandingRewardsResponse does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_QueryReporterOutstandingRewardsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "layer.reporter.QueryReporterOutstandingRewardsResponse.rewards": - value := x.Rewards - return protoreflect.ValueOfMessage(value.ProtoReflect()) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReporterOutstandingRewardsResponse")) - } - panic(fmt.Errorf("message layer.reporter.QueryReporterOutstandingRewardsResponse does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryReporterOutstandingRewardsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "layer.reporter.QueryReporterOutstandingRewardsResponse.rewards": - x.Rewards = value.Message().Interface().(*ReporterOutstandingRewards) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReporterOutstandingRewardsResponse")) - } - panic(fmt.Errorf("message layer.reporter.QueryReporterOutstandingRewardsResponse does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryReporterOutstandingRewardsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "layer.reporter.QueryReporterOutstandingRewardsResponse.rewards": - if x.Rewards == nil { - x.Rewards = new(ReporterOutstandingRewards) - } - return protoreflect.ValueOfMessage(x.Rewards.ProtoReflect()) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReporterOutstandingRewardsResponse")) - } - panic(fmt.Errorf("message layer.reporter.QueryReporterOutstandingRewardsResponse does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_QueryReporterOutstandingRewardsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "layer.reporter.QueryReporterOutstandingRewardsResponse.rewards": - m := new(ReporterOutstandingRewards) - return protoreflect.ValueOfMessage(m.ProtoReflect()) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReporterOutstandingRewardsResponse")) - } - panic(fmt.Errorf("message layer.reporter.QueryReporterOutstandingRewardsResponse does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_QueryReporterOutstandingRewardsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in layer.reporter.QueryReporterOutstandingRewardsResponse", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_QueryReporterOutstandingRewardsResponse) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryReporterOutstandingRewardsResponse) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_QueryReporterOutstandingRewardsResponse) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_QueryReporterOutstandingRewardsResponse) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*QueryReporterOutstandingRewardsResponse) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if x.Rewards != nil { - l = options.Size(x.Rewards) - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*QueryReporterOutstandingRewardsResponse) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if x.Rewards != nil { - encoded, err := options.Marshal(x.Rewards) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*QueryReporterOutstandingRewardsResponse) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire 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++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryReporterOutstandingRewardsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryReporterOutstandingRewardsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Rewards", wireType) - } - var msglen int - 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++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - 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 - } - if x.Rewards == nil { - x.Rewards = &ReporterOutstandingRewards{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Rewards); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var ( - md_QueryReporterCommissionRequest protoreflect.MessageDescriptor - fd_QueryReporterCommissionRequest_reporter_address protoreflect.FieldDescriptor -) - -func init() { - file_layer_reporter_query_proto_init() - md_QueryReporterCommissionRequest = File_layer_reporter_query_proto.Messages().ByName("QueryReporterCommissionRequest") - fd_QueryReporterCommissionRequest_reporter_address = md_QueryReporterCommissionRequest.Fields().ByName("reporter_address") -} - -var _ protoreflect.Message = (*fastReflection_QueryReporterCommissionRequest)(nil) - -type fastReflection_QueryReporterCommissionRequest QueryReporterCommissionRequest - -func (x *QueryReporterCommissionRequest) ProtoReflect() protoreflect.Message { - return (*fastReflection_QueryReporterCommissionRequest)(x) -} - -func (x *QueryReporterCommissionRequest) slowProtoReflect() protoreflect.Message { - mi := &file_layer_reporter_query_proto_msgTypes[14] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_QueryReporterCommissionRequest_messageType fastReflection_QueryReporterCommissionRequest_messageType -var _ protoreflect.MessageType = fastReflection_QueryReporterCommissionRequest_messageType{} - -type fastReflection_QueryReporterCommissionRequest_messageType struct{} - -func (x fastReflection_QueryReporterCommissionRequest_messageType) Zero() protoreflect.Message { - return (*fastReflection_QueryReporterCommissionRequest)(nil) -} -func (x fastReflection_QueryReporterCommissionRequest_messageType) New() protoreflect.Message { - return new(fastReflection_QueryReporterCommissionRequest) -} -func (x fastReflection_QueryReporterCommissionRequest_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_QueryReporterCommissionRequest -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_QueryReporterCommissionRequest) Descriptor() protoreflect.MessageDescriptor { - return md_QueryReporterCommissionRequest -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_QueryReporterCommissionRequest) Type() protoreflect.MessageType { - return _fastReflection_QueryReporterCommissionRequest_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_QueryReporterCommissionRequest) New() protoreflect.Message { - return new(fastReflection_QueryReporterCommissionRequest) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_QueryReporterCommissionRequest) Interface() protoreflect.ProtoMessage { - return (*QueryReporterCommissionRequest)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_QueryReporterCommissionRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.ReporterAddress != "" { - value := protoreflect.ValueOfString(x.ReporterAddress) - if !f(fd_QueryReporterCommissionRequest_reporter_address, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_QueryReporterCommissionRequest) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "layer.reporter.QueryReporterCommissionRequest.reporter_address": - return x.ReporterAddress != "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReporterCommissionRequest")) - } - panic(fmt.Errorf("message layer.reporter.QueryReporterCommissionRequest does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryReporterCommissionRequest) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "layer.reporter.QueryReporterCommissionRequest.reporter_address": - x.ReporterAddress = "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReporterCommissionRequest")) - } - panic(fmt.Errorf("message layer.reporter.QueryReporterCommissionRequest does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_QueryReporterCommissionRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "layer.reporter.QueryReporterCommissionRequest.reporter_address": - value := x.ReporterAddress - return protoreflect.ValueOfString(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReporterCommissionRequest")) - } - panic(fmt.Errorf("message layer.reporter.QueryReporterCommissionRequest does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryReporterCommissionRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "layer.reporter.QueryReporterCommissionRequest.reporter_address": - x.ReporterAddress = value.Interface().(string) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReporterCommissionRequest")) - } - panic(fmt.Errorf("message layer.reporter.QueryReporterCommissionRequest does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryReporterCommissionRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "layer.reporter.QueryReporterCommissionRequest.reporter_address": - panic(fmt.Errorf("field reporter_address of message layer.reporter.QueryReporterCommissionRequest is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReporterCommissionRequest")) - } - panic(fmt.Errorf("message layer.reporter.QueryReporterCommissionRequest does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_QueryReporterCommissionRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "layer.reporter.QueryReporterCommissionRequest.reporter_address": - return protoreflect.ValueOfString("") - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReporterCommissionRequest")) - } - panic(fmt.Errorf("message layer.reporter.QueryReporterCommissionRequest does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_QueryReporterCommissionRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in layer.reporter.QueryReporterCommissionRequest", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_QueryReporterCommissionRequest) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryReporterCommissionRequest) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_QueryReporterCommissionRequest) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_QueryReporterCommissionRequest) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*QueryReporterCommissionRequest) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - l = len(x.ReporterAddress) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*QueryReporterCommissionRequest) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if len(x.ReporterAddress) > 0 { - i -= len(x.ReporterAddress) - copy(dAtA[i:], x.ReporterAddress) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ReporterAddress))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*QueryReporterCommissionRequest) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire 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++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryReporterCommissionRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryReporterCommissionRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ReporterAddress", 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.ReporterAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var ( - md_QueryReporterCommissionResponse protoreflect.MessageDescriptor - fd_QueryReporterCommissionResponse_commission protoreflect.FieldDescriptor -) - -func init() { - file_layer_reporter_query_proto_init() - md_QueryReporterCommissionResponse = File_layer_reporter_query_proto.Messages().ByName("QueryReporterCommissionResponse") - fd_QueryReporterCommissionResponse_commission = md_QueryReporterCommissionResponse.Fields().ByName("commission") -} - -var _ protoreflect.Message = (*fastReflection_QueryReporterCommissionResponse)(nil) - -type fastReflection_QueryReporterCommissionResponse QueryReporterCommissionResponse - -func (x *QueryReporterCommissionResponse) ProtoReflect() protoreflect.Message { - return (*fastReflection_QueryReporterCommissionResponse)(x) -} - -func (x *QueryReporterCommissionResponse) slowProtoReflect() protoreflect.Message { - mi := &file_layer_reporter_query_proto_msgTypes[15] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_QueryReporterCommissionResponse_messageType fastReflection_QueryReporterCommissionResponse_messageType -var _ protoreflect.MessageType = fastReflection_QueryReporterCommissionResponse_messageType{} - -type fastReflection_QueryReporterCommissionResponse_messageType struct{} - -func (x fastReflection_QueryReporterCommissionResponse_messageType) Zero() protoreflect.Message { - return (*fastReflection_QueryReporterCommissionResponse)(nil) -} -func (x fastReflection_QueryReporterCommissionResponse_messageType) New() protoreflect.Message { - return new(fastReflection_QueryReporterCommissionResponse) -} -func (x fastReflection_QueryReporterCommissionResponse_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_QueryReporterCommissionResponse -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_QueryReporterCommissionResponse) Descriptor() protoreflect.MessageDescriptor { - return md_QueryReporterCommissionResponse -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_QueryReporterCommissionResponse) Type() protoreflect.MessageType { - return _fastReflection_QueryReporterCommissionResponse_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_QueryReporterCommissionResponse) New() protoreflect.Message { - return new(fastReflection_QueryReporterCommissionResponse) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_QueryReporterCommissionResponse) Interface() protoreflect.ProtoMessage { - return (*QueryReporterCommissionResponse)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_QueryReporterCommissionResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Commission != nil { - value := protoreflect.ValueOfMessage(x.Commission.ProtoReflect()) - if !f(fd_QueryReporterCommissionResponse_commission, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_QueryReporterCommissionResponse) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "layer.reporter.QueryReporterCommissionResponse.commission": - return x.Commission != nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReporterCommissionResponse")) - } - panic(fmt.Errorf("message layer.reporter.QueryReporterCommissionResponse does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryReporterCommissionResponse) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "layer.reporter.QueryReporterCommissionResponse.commission": - x.Commission = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReporterCommissionResponse")) - } - panic(fmt.Errorf("message layer.reporter.QueryReporterCommissionResponse does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_QueryReporterCommissionResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "layer.reporter.QueryReporterCommissionResponse.commission": - value := x.Commission - return protoreflect.ValueOfMessage(value.ProtoReflect()) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReporterCommissionResponse")) - } - panic(fmt.Errorf("message layer.reporter.QueryReporterCommissionResponse does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryReporterCommissionResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "layer.reporter.QueryReporterCommissionResponse.commission": - x.Commission = value.Message().Interface().(*ReporterAccumulatedCommission) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReporterCommissionResponse")) - } - panic(fmt.Errorf("message layer.reporter.QueryReporterCommissionResponse does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryReporterCommissionResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "layer.reporter.QueryReporterCommissionResponse.commission": - if x.Commission == nil { - x.Commission = new(ReporterAccumulatedCommission) - } - return protoreflect.ValueOfMessage(x.Commission.ProtoReflect()) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReporterCommissionResponse")) - } - panic(fmt.Errorf("message layer.reporter.QueryReporterCommissionResponse does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_QueryReporterCommissionResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "layer.reporter.QueryReporterCommissionResponse.commission": - m := new(ReporterAccumulatedCommission) - return protoreflect.ValueOfMessage(m.ProtoReflect()) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.QueryReporterCommissionResponse")) - } - panic(fmt.Errorf("message layer.reporter.QueryReporterCommissionResponse does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_QueryReporterCommissionResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in layer.reporter.QueryReporterCommissionResponse", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_QueryReporterCommissionResponse) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryReporterCommissionResponse) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_QueryReporterCommissionResponse) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_QueryReporterCommissionResponse) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*QueryReporterCommissionResponse) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if x.Commission != nil { - l = options.Size(x.Commission) - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*QueryReporterCommissionResponse) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if x.Commission != nil { - encoded, err := options.Marshal(x.Commission) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*QueryReporterCommissionResponse) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire 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++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryReporterCommissionResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryReporterCommissionResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Commission", wireType) - } - var msglen int - 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++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - 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 - } - if x.Commission == nil { - x.Commission = &ReporterAccumulatedCommission{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Commission); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.27.0 -// protoc (unknown) -// source: layer/reporter/query.proto - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// QueryParamsRequest is request type for the Query/Params RPC method. -type QueryParamsRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *QueryParamsRequest) Reset() { - *x = QueryParamsRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_layer_reporter_query_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *QueryParamsRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*QueryParamsRequest) ProtoMessage() {} - -// Deprecated: Use QueryParamsRequest.ProtoReflect.Descriptor instead. -func (*QueryParamsRequest) Descriptor() ([]byte, []int) { - return file_layer_reporter_query_proto_rawDescGZIP(), []int{0} -} - -// QueryParamsResponse is response type for the Query/Params RPC method. -type QueryParamsResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // params holds all the parameters of this module. - Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` -} - -func (x *QueryParamsResponse) Reset() { - *x = QueryParamsResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_layer_reporter_query_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *QueryParamsResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*QueryParamsResponse) ProtoMessage() {} - -// Deprecated: Use QueryParamsResponse.ProtoReflect.Descriptor instead. -func (*QueryParamsResponse) Descriptor() ([]byte, []int) { - return file_layer_reporter_query_proto_rawDescGZIP(), []int{1} -} - -func (x *QueryParamsResponse) GetParams() *Params { - if x != nil { - return x.Params - } - return nil -} - -// QueryReporterRequest is the request type for the Query/Reporter RPC method. -type QueryReporterRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // reporter_address defines the reporter address to query for. - ReporterAddress string `protobuf:"bytes,1,opt,name=reporter_address,json=reporterAddress,proto3" json:"reporter_address,omitempty"` -} - -func (x *QueryReporterRequest) Reset() { - *x = QueryReporterRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_layer_reporter_query_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *QueryReporterRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*QueryReporterRequest) ProtoMessage() {} - -// Deprecated: Use QueryReporterRequest.ProtoReflect.Descriptor instead. -func (*QueryReporterRequest) Descriptor() ([]byte, []int) { - return file_layer_reporter_query_proto_rawDescGZIP(), []int{2} -} - -func (x *QueryReporterRequest) GetReporterAddress() string { - if x != nil { - return x.ReporterAddress - } - return "" -} - -// QueryReporterResponse is the response type for the Query/Reporter RPC method. -type QueryReporterResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Reporter *OracleReporter `protobuf:"bytes,1,opt,name=reporter,proto3" json:"reporter,omitempty"` -} - -func (x *QueryReporterResponse) Reset() { - *x = QueryReporterResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_layer_reporter_query_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *QueryReporterResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*QueryReporterResponse) ProtoMessage() {} - -// Deprecated: Use QueryReporterResponse.ProtoReflect.Descriptor instead. -func (*QueryReporterResponse) Descriptor() ([]byte, []int) { - return file_layer_reporter_query_proto_rawDescGZIP(), []int{3} -} - -func (x *QueryReporterResponse) GetReporter() *OracleReporter { - if x != nil { - return x.Reporter - } - return nil -} - -// QueryReportersRequest is the request type for the Query/Reporters RPC method. -type QueryReportersRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *QueryReportersRequest) Reset() { - *x = QueryReportersRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_layer_reporter_query_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *QueryReportersRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*QueryReportersRequest) ProtoMessage() {} - -// Deprecated: Use QueryReportersRequest.ProtoReflect.Descriptor instead. -func (*QueryReportersRequest) Descriptor() ([]byte, []int) { - return file_layer_reporter_query_proto_rawDescGZIP(), []int{4} -} - -// QueryReportersResponse is the response type for the Query/Reporters RPC method. -type QueryReportersResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // all the reporters. - Reporters []*OracleReporter `protobuf:"bytes,1,rep,name=reporters,proto3" json:"reporters,omitempty"` -} - -func (x *QueryReportersResponse) Reset() { - *x = QueryReportersResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_layer_reporter_query_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *QueryReportersResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*QueryReportersResponse) ProtoMessage() {} - -// Deprecated: Use QueryReportersResponse.ProtoReflect.Descriptor instead. -func (*QueryReportersResponse) Descriptor() ([]byte, []int) { - return file_layer_reporter_query_proto_rawDescGZIP(), []int{5} -} - -func (x *QueryReportersResponse) GetReporters() []*OracleReporter { - if x != nil { - return x.Reporters - } - return nil -} - -// QueryDelegatorReporterRequest is the request type for the -// Query/DelegatorReporter RPC method. -type QueryDelegatorReporterRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // delegator_address defines the delegator address to query for. - DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` -} - -func (x *QueryDelegatorReporterRequest) Reset() { - *x = QueryDelegatorReporterRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_layer_reporter_query_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *QueryDelegatorReporterRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*QueryDelegatorReporterRequest) ProtoMessage() {} - -// Deprecated: Use QueryDelegatorReporterRequest.ProtoReflect.Descriptor instead. -func (*QueryDelegatorReporterRequest) Descriptor() ([]byte, []int) { - return file_layer_reporter_query_proto_rawDescGZIP(), []int{6} -} - -func (x *QueryDelegatorReporterRequest) GetDelegatorAddress() string { - if x != nil { - return x.DelegatorAddress - } - return "" -} - -// QueryDelegatorReporterResponse is the response type for the -// Query/DelegatorReporter RPC method. -type QueryDelegatorReporterResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // reporter defines the reporter of a delegator. - Reporter string `protobuf:"bytes,1,opt,name=reporter,proto3" json:"reporter,omitempty"` -} - -func (x *QueryDelegatorReporterResponse) Reset() { - *x = QueryDelegatorReporterResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_layer_reporter_query_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *QueryDelegatorReporterResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*QueryDelegatorReporterResponse) ProtoMessage() {} - -// Deprecated: Use QueryDelegatorReporterResponse.ProtoReflect.Descriptor instead. -func (*QueryDelegatorReporterResponse) Descriptor() ([]byte, []int) { - return file_layer_reporter_query_proto_rawDescGZIP(), []int{7} -} - -func (x *QueryDelegatorReporterResponse) GetReporter() string { - if x != nil { - return x.Reporter - } - return "" -} - -// QueryReporterStakeRequest is the request type for the -// Query/ReporterStake RPC method. -type QueryReporterStakeRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // reporter_address defines the reporter address to query for. - ReporterAddress string `protobuf:"bytes,1,opt,name=reporter_address,json=reporterAddress,proto3" json:"reporter_address,omitempty"` -} - -func (x *QueryReporterStakeRequest) Reset() { - *x = QueryReporterStakeRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_layer_reporter_query_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *QueryReporterStakeRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*QueryReporterStakeRequest) ProtoMessage() {} - -// Deprecated: Use QueryReporterStakeRequest.ProtoReflect.Descriptor instead. -func (*QueryReporterStakeRequest) Descriptor() ([]byte, []int) { - return file_layer_reporter_query_proto_rawDescGZIP(), []int{8} -} - -func (x *QueryReporterStakeRequest) GetReporterAddress() string { - if x != nil { - return x.ReporterAddress - } - return "" -} - -// QueryReporterStakeResponse is the response type for the -// Query/ReporterStake RPC method. -type QueryReporterStakeResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // stake defines the total tokens of a reporter. - Stake string `protobuf:"bytes,1,opt,name=stake,proto3" json:"stake,omitempty"` -} - -func (x *QueryReporterStakeResponse) Reset() { - *x = QueryReporterStakeResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_layer_reporter_query_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *QueryReporterStakeResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*QueryReporterStakeResponse) ProtoMessage() {} - -// Deprecated: Use QueryReporterStakeResponse.ProtoReflect.Descriptor instead. -func (*QueryReporterStakeResponse) Descriptor() ([]byte, []int) { - return file_layer_reporter_query_proto_rawDescGZIP(), []int{9} -} - -func (x *QueryReporterStakeResponse) GetStake() string { - if x != nil { - return x.Stake - } - return "" -} - -// QueryDelegationRewardsRequest is the request type for the -// Query/DelegationRewards RPC method. -type QueryDelegationRewardsRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // delegator_address defines the delegator address to query for. - DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` - // reporter_address defines the reporter address to query for. - ReporterAddress string `protobuf:"bytes,2,opt,name=reporter_address,json=reporterAddress,proto3" json:"reporter_address,omitempty"` -} - -func (x *QueryDelegationRewardsRequest) Reset() { - *x = QueryDelegationRewardsRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_layer_reporter_query_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *QueryDelegationRewardsRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*QueryDelegationRewardsRequest) ProtoMessage() {} - -// Deprecated: Use QueryDelegationRewardsRequest.ProtoReflect.Descriptor instead. -func (*QueryDelegationRewardsRequest) Descriptor() ([]byte, []int) { - return file_layer_reporter_query_proto_rawDescGZIP(), []int{10} -} - -func (x *QueryDelegationRewardsRequest) GetDelegatorAddress() string { - if x != nil { - return x.DelegatorAddress - } - return "" -} - -func (x *QueryDelegationRewardsRequest) GetReporterAddress() string { - if x != nil { - return x.ReporterAddress - } - return "" -} - -// QueryDelegationRewardsResponse is the response type for the -// Query/DelegationRewards RPC method. -type QueryDelegationRewardsResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // rewards defines the rewards accrued by a delegation. - Rewards []*v1beta1.DecCoin `protobuf:"bytes,1,rep,name=rewards,proto3" json:"rewards,omitempty"` -} - -func (x *QueryDelegationRewardsResponse) Reset() { - *x = QueryDelegationRewardsResponse{} +func (x *QueryParamsResponse) Reset() { + *x = QueryParamsResponse{} if protoimpl.UnsafeEnabled { - mi := &file_layer_reporter_query_proto_msgTypes[11] + mi := &file_layer_reporter_query_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *QueryDelegationRewardsResponse) String() string { +func (x *QueryParamsResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*QueryDelegationRewardsResponse) ProtoMessage() {} +func (*QueryParamsResponse) ProtoMessage() {} -// Deprecated: Use QueryDelegationRewardsResponse.ProtoReflect.Descriptor instead. -func (*QueryDelegationRewardsResponse) Descriptor() ([]byte, []int) { - return file_layer_reporter_query_proto_rawDescGZIP(), []int{11} +// Deprecated: Use QueryParamsResponse.ProtoReflect.Descriptor instead. +func (*QueryParamsResponse) Descriptor() ([]byte, []int) { + return file_layer_reporter_query_proto_rawDescGZIP(), []int{1} } -func (x *QueryDelegationRewardsResponse) GetRewards() []*v1beta1.DecCoin { +func (x *QueryParamsResponse) GetParams() *Params { if x != nil { - return x.Rewards + return x.Params } return nil } -// QueryReporterOutstandingRewardsRequest is the request type for the -// Query/ReporterOutstandingRewards RPC method. -type QueryReporterOutstandingRewardsRequest struct { +// QueryReportersRequest is the request type for the Query/Reporters RPC method. +type QueryReportersRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - - // reporter_address defines the reporter address to query for. - ReporterAddress string `protobuf:"bytes,1,opt,name=reporter_address,json=reporterAddress,proto3" json:"reporter_address,omitempty"` } -func (x *QueryReporterOutstandingRewardsRequest) Reset() { - *x = QueryReporterOutstandingRewardsRequest{} +func (x *QueryReportersRequest) Reset() { + *x = QueryReportersRequest{} if protoimpl.UnsafeEnabled { - mi := &file_layer_reporter_query_proto_msgTypes[12] + mi := &file_layer_reporter_query_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *QueryReporterOutstandingRewardsRequest) String() string { +func (x *QueryReportersRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*QueryReporterOutstandingRewardsRequest) ProtoMessage() {} - -// Deprecated: Use QueryReporterOutstandingRewardsRequest.ProtoReflect.Descriptor instead. -func (*QueryReporterOutstandingRewardsRequest) Descriptor() ([]byte, []int) { - return file_layer_reporter_query_proto_rawDescGZIP(), []int{12} -} +func (*QueryReportersRequest) ProtoMessage() {} -func (x *QueryReporterOutstandingRewardsRequest) GetReporterAddress() string { - if x != nil { - return x.ReporterAddress - } - return "" +// Deprecated: Use QueryReportersRequest.ProtoReflect.Descriptor instead. +func (*QueryReportersRequest) Descriptor() ([]byte, []int) { + return file_layer_reporter_query_proto_rawDescGZIP(), []int{2} } -// QueryReporterOutstandingRewardsResponse is the response type for the -// Query/ReporterOutstandingRewards RPC method. -type QueryReporterOutstandingRewardsResponse struct { +// QueryReportersResponse is the response type for the Query/Reporters RPC method. +type QueryReportersResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Rewards *ReporterOutstandingRewards `protobuf:"bytes,1,opt,name=rewards,proto3" json:"rewards,omitempty"` + // all the reporters. + Reporters []*OracleReporter `protobuf:"bytes,1,rep,name=reporters,proto3" json:"reporters,omitempty"` } -func (x *QueryReporterOutstandingRewardsResponse) Reset() { - *x = QueryReporterOutstandingRewardsResponse{} +func (x *QueryReportersResponse) Reset() { + *x = QueryReportersResponse{} if protoimpl.UnsafeEnabled { - mi := &file_layer_reporter_query_proto_msgTypes[13] + mi := &file_layer_reporter_query_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *QueryReporterOutstandingRewardsResponse) String() string { +func (x *QueryReportersResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*QueryReporterOutstandingRewardsResponse) ProtoMessage() {} +func (*QueryReportersResponse) ProtoMessage() {} -// Deprecated: Use QueryReporterOutstandingRewardsResponse.ProtoReflect.Descriptor instead. -func (*QueryReporterOutstandingRewardsResponse) Descriptor() ([]byte, []int) { - return file_layer_reporter_query_proto_rawDescGZIP(), []int{13} +// Deprecated: Use QueryReportersResponse.ProtoReflect.Descriptor instead. +func (*QueryReportersResponse) Descriptor() ([]byte, []int) { + return file_layer_reporter_query_proto_rawDescGZIP(), []int{3} } -func (x *QueryReporterOutstandingRewardsResponse) GetRewards() *ReporterOutstandingRewards { +func (x *QueryReportersResponse) GetReporters() []*OracleReporter { if x != nil { - return x.Rewards + return x.Reporters } return nil } -// QueryReporterCommissionRequest is the request type for the -// Query/ReporterCommission RPC method -type QueryReporterCommissionRequest struct { +// QueryDelegatorReporterRequest is the request type for the +// Query/DelegatorReporter RPC method. +type QueryDelegatorReporterRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // reporter_address defines the reporter address to query for. - ReporterAddress string `protobuf:"bytes,1,opt,name=reporter_address,json=reporterAddress,proto3" json:"reporter_address,omitempty"` + // delegator_address defines the delegator address to query for. + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` } -func (x *QueryReporterCommissionRequest) Reset() { - *x = QueryReporterCommissionRequest{} +func (x *QueryDelegatorReporterRequest) Reset() { + *x = QueryDelegatorReporterRequest{} if protoimpl.UnsafeEnabled { - mi := &file_layer_reporter_query_proto_msgTypes[14] + mi := &file_layer_reporter_query_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *QueryReporterCommissionRequest) String() string { +func (x *QueryDelegatorReporterRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*QueryReporterCommissionRequest) ProtoMessage() {} +func (*QueryDelegatorReporterRequest) ProtoMessage() {} -// Deprecated: Use QueryReporterCommissionRequest.ProtoReflect.Descriptor instead. -func (*QueryReporterCommissionRequest) Descriptor() ([]byte, []int) { - return file_layer_reporter_query_proto_rawDescGZIP(), []int{14} +// Deprecated: Use QueryDelegatorReporterRequest.ProtoReflect.Descriptor instead. +func (*QueryDelegatorReporterRequest) Descriptor() ([]byte, []int) { + return file_layer_reporter_query_proto_rawDescGZIP(), []int{4} } -func (x *QueryReporterCommissionRequest) GetReporterAddress() string { +func (x *QueryDelegatorReporterRequest) GetDelegatorAddress() string { if x != nil { - return x.ReporterAddress + return x.DelegatorAddress } return "" } -// QueryReporterCommissionResponse is the response type for the -// Query/ReporterCommission RPC method -type QueryReporterCommissionResponse struct { +// QueryDelegatorReporterResponse is the response type for the +// Query/DelegatorReporter RPC method. +type QueryDelegatorReporterResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // commission defines the commission the reporter received. - Commission *ReporterAccumulatedCommission `protobuf:"bytes,1,opt,name=commission,proto3" json:"commission,omitempty"` + // reporter defines the reporter of a delegator. + Reporter string `protobuf:"bytes,1,opt,name=reporter,proto3" json:"reporter,omitempty"` } -func (x *QueryReporterCommissionResponse) Reset() { - *x = QueryReporterCommissionResponse{} +func (x *QueryDelegatorReporterResponse) Reset() { + *x = QueryDelegatorReporterResponse{} if protoimpl.UnsafeEnabled { - mi := &file_layer_reporter_query_proto_msgTypes[15] + mi := &file_layer_reporter_query_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *QueryReporterCommissionResponse) String() string { +func (x *QueryDelegatorReporterResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*QueryReporterCommissionResponse) ProtoMessage() {} +func (*QueryDelegatorReporterResponse) ProtoMessage() {} -// Deprecated: Use QueryReporterCommissionResponse.ProtoReflect.Descriptor instead. -func (*QueryReporterCommissionResponse) Descriptor() ([]byte, []int) { - return file_layer_reporter_query_proto_rawDescGZIP(), []int{15} +// Deprecated: Use QueryDelegatorReporterResponse.ProtoReflect.Descriptor instead. +func (*QueryDelegatorReporterResponse) Descriptor() ([]byte, []int) { + return file_layer_reporter_query_proto_rawDescGZIP(), []int{5} } -func (x *QueryReporterCommissionResponse) GetCommission() *ReporterAccumulatedCommission { +func (x *QueryDelegatorReporterResponse) GetReporter() string { if x != nil { - return x.Commission + return x.Reporter } - return nil + return "" } var File_layer_reporter_query_proto protoreflect.FileDescriptor @@ -7513,199 +2745,67 @@ var file_layer_reporter_query_proto_rawDesc = []byte{ 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, - 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x5b, 0x0a, 0x14, 0x51, 0x75, 0x65, 0x72, - 0x79, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x43, 0x0a, 0x10, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, - 0x72, 0x69, 0x6e, 0x67, 0x52, 0x0f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x41, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x53, 0x0a, 0x15, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, - 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3a, - 0x0a, 0x08, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1e, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, - 0x72, 0x2e, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, - 0x52, 0x08, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x22, 0x17, 0x0a, 0x15, 0x51, 0x75, - 0x65, 0x72, 0x79, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x22, 0x56, 0x0a, 0x16, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x70, 0x6f, - 0x72, 0x74, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3c, 0x0a, - 0x09, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x1e, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, - 0x72, 0x2e, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, - 0x52, 0x09, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x73, 0x22, 0x70, 0x0a, 0x1d, 0x51, + 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x17, 0x0a, 0x15, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x22, 0x56, 0x0a, 0x16, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, + 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3c, 0x0a, 0x09, 0x72, + 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, + 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, + 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x52, 0x09, + 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x73, 0x22, 0x70, 0x0a, 0x1d, 0x51, 0x75, 0x65, + 0x72, 0x79, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x70, 0x6f, 0x72, + 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x45, 0x0a, 0x11, 0x64, 0x65, + 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, + 0x10, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x3a, 0x08, 0x88, 0xa0, 0x1f, 0x00, 0xe8, 0xa0, 0x1f, 0x00, 0x22, 0x56, 0x0a, 0x1e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x70, - 0x6f, 0x72, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x45, 0x0a, 0x11, - 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, - 0x67, 0x52, 0x10, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x3a, 0x08, 0x88, 0xa0, 0x1f, 0x00, 0xe8, 0xa0, 0x1f, 0x00, 0x22, 0x56, 0x0a, - 0x1e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x52, - 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x34, 0x0a, 0x08, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x08, 0x72, 0x65, 0x70, - 0x6f, 0x72, 0x74, 0x65, 0x72, 0x22, 0x6a, 0x0a, 0x19, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, - 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x43, 0x0a, 0x10, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5f, 0x61, - 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, - 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x0f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, - 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x3a, 0x08, 0x88, 0xa0, 0x1f, 0x00, 0xe8, 0xa0, 0x1f, - 0x00, 0x22, 0x5f, 0x0a, 0x1a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, - 0x65, 0x72, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x41, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2b, - 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, - 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xd2, 0xb4, 0x2d, - 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x05, 0x73, 0x74, 0x61, - 0x6b, 0x65, 0x22, 0xb5, 0x01, 0x0a, 0x1d, 0x51, 0x75, 0x65, 0x72, 0x79, 0x44, 0x65, 0x6c, 0x65, - 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x73, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x45, 0x0a, 0x11, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, - 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x6f, 0x72, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x34, 0x0a, + 0x08, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x10, 0x64, 0x65, 0x6c, 0x65, 0x67, - 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x43, 0x0a, 0x10, 0x72, - 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, - 0x0f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x3a, 0x08, 0x88, 0xa0, 0x1f, 0x00, 0xe8, 0xa0, 0x1f, 0x00, 0x22, 0x92, 0x01, 0x0a, 0x1e, 0x51, - 0x75, 0x65, 0x72, 0x79, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, - 0x77, 0x61, 0x72, 0x64, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x70, 0x0a, - 0x07, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, - 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, - 0x65, 0x74, 0x61, 0x31, 0x2e, 0x44, 0x65, 0x63, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x38, 0xc8, 0xde, - 0x1f, 0x00, 0xaa, 0xdf, 0x1f, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, - 0x64, 0x6b, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x43, 0x6f, 0x69, 0x6e, - 0x73, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x07, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x73, 0x22, - 0x6d, 0x0a, 0x26, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, - 0x4f, 0x75, 0x74, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x77, 0x61, 0x72, - 0x64, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x43, 0x0a, 0x10, 0x72, 0x65, 0x70, - 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, - 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x0f, 0x72, - 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x7a, - 0x0a, 0x27, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x4f, - 0x75, 0x74, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, - 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4f, 0x0a, 0x07, 0x72, 0x65, 0x77, - 0x61, 0x72, 0x64, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6c, 0x61, 0x79, - 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x70, 0x6f, - 0x72, 0x74, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x52, - 0x65, 0x77, 0x61, 0x72, 0x64, 0x73, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, - 0x01, 0x52, 0x07, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x73, 0x22, 0x65, 0x0a, 0x1e, 0x51, 0x75, - 0x65, 0x72, 0x79, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6d, 0x6d, 0x69, - 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x43, 0x0a, 0x10, - 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, - 0x52, 0x0f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x22, 0x7b, 0x0a, 0x1f, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, - 0x65, 0x72, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x58, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x73, 0x73, 0x69, - 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, - 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, - 0x65, 0x72, 0x41, 0x63, 0x63, 0x75, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x6d, - 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, - 0x2a, 0x01, 0x52, 0x0a, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x32, 0xf0, - 0x0a, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x7b, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x12, 0x22, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, - 0x74, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, - 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x28, 0x82, 0xd3, 0xe4, - 0x93, 0x02, 0x22, 0x12, 0x20, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, - 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2f, 0x70, - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x8d, 0x01, 0x0a, 0x08, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, - 0x65, 0x72, 0x12, 0x24, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, - 0x74, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, - 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, - 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, - 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x34, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2e, 0x12, 0x2c, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, - 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, - 0x65, 0x72, 0x2f, 0x7b, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x7d, 0x12, 0x87, 0x01, 0x0a, 0x09, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, - 0x65, 0x72, 0x73, 0x12, 0x25, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, - 0x72, 0x74, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, - 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x6c, 0x61, 0x79, - 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, - 0x79, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x2b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x25, 0x12, 0x23, 0x2f, 0x74, 0x65, 0x6c, - 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x70, - 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x73, 0x12, - 0xbc, 0x01, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x70, - 0x6f, 0x72, 0x74, 0x65, 0x72, 0x12, 0x2d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, - 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x44, 0x65, 0x6c, 0x65, - 0x67, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, - 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x44, 0x65, 0x6c, 0x65, 0x67, - 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x48, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x42, 0x12, 0x40, 0x2f, 0x74, - 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, - 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2f, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, - 0x72, 0x2d, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2f, 0x7b, 0x64, 0x65, 0x6c, 0x65, - 0x67, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x7d, 0x12, 0xab, - 0x01, 0x0a, 0x0d, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x53, 0x74, 0x61, 0x6b, 0x65, - 0x12, 0x29, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, - 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x53, - 0x74, 0x61, 0x6b, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x6c, 0x61, + 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x08, 0x72, 0x65, 0x70, 0x6f, 0x72, + 0x74, 0x65, 0x72, 0x32, 0xcd, 0x03, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x7b, 0x0a, + 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x22, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, + 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, - 0x72, 0x79, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x43, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x3d, 0x12, - 0x3b, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, - 0x72, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x72, - 0x74, 0x65, 0x72, 0x2d, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x2f, 0x7b, 0x72, 0x65, 0x70, 0x6f, 0x72, - 0x74, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x7d, 0x12, 0xcf, 0x01, 0x0a, - 0x11, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x77, 0x61, 0x72, - 0x64, 0x73, 0x12, 0x2d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, - 0x74, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x2e, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, - 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x5b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x55, 0x12, 0x53, 0x2f, 0x74, 0x65, 0x6c, 0x6c, - 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x70, 0x6f, - 0x72, 0x74, 0x65, 0x72, 0x2f, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2d, - 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x73, 0x2f, 0x7b, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, - 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x7d, 0x2f, 0x7b, 0x72, 0x65, 0x70, - 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x7d, 0x12, 0xd7, - 0x01, 0x0a, 0x1a, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x73, 0x74, - 0x61, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x73, 0x12, 0x36, 0x2e, - 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x51, - 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x73, - 0x74, 0x61, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x73, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x37, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, - 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x70, 0x6f, - 0x72, 0x74, 0x65, 0x72, 0x4f, 0x75, 0x74, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x52, - 0x65, 0x77, 0x61, 0x72, 0x64, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x48, - 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x42, 0x12, 0x40, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, - 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, - 0x72, 0x2f, 0x6f, 0x75, 0x74, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x2d, 0x72, 0x65, - 0x77, 0x61, 0x72, 0x64, 0x73, 0x2f, 0x7b, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5f, - 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x7d, 0x12, 0xb6, 0x01, 0x0a, 0x12, 0x52, 0x65, 0x70, - 0x6f, 0x72, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, - 0x2e, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, - 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x43, 0x6f, - 0x6d, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x2f, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, - 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x43, 0x6f, - 0x6d, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x3f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x39, 0x12, 0x37, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, + 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x28, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x22, 0x12, 0x20, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x72, - 0x74, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2f, 0x7b, - 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x7d, 0x42, 0xa8, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, - 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, - 0x6f, 0x6d, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, - 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x70, - 0x6f, 0x72, 0x74, 0x65, 0x72, 0xa2, 0x02, 0x03, 0x4c, 0x52, 0x58, 0xaa, 0x02, 0x0e, 0x4c, 0x61, - 0x79, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xca, 0x02, 0x0e, 0x4c, - 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xe2, 0x02, 0x1a, - 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5c, 0x47, - 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x4c, 0x61, 0x79, - 0x65, 0x72, 0x3a, 0x3a, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x74, 0x65, 0x72, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x87, 0x01, 0x0a, 0x09, 0x52, + 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x73, 0x12, 0x25, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, + 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, + 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x26, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, + 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x25, 0x12, + 0x23, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, + 0x72, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x72, + 0x74, 0x65, 0x72, 0x73, 0x12, 0xbc, 0x01, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, + 0x6f, 0x72, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x12, 0x2d, 0x2e, 0x6c, 0x61, 0x79, + 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, + 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x6c, 0x61, 0x79, 0x65, + 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, + 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, + 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x48, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x42, 0x12, 0x40, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, + 0x79, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2f, 0x64, 0x65, 0x6c, + 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x2d, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2f, + 0x7b, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x7d, 0x42, 0xa8, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, + 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, + 0x61, 0x79, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, + 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xa2, 0x02, 0x03, 0x4c, 0x52, 0x58, 0xaa, 0x02, 0x0e, + 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xca, 0x02, + 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xe2, + 0x02, 0x1a, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, + 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x4c, + 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -7720,58 +2820,31 @@ func file_layer_reporter_query_proto_rawDescGZIP() []byte { return file_layer_reporter_query_proto_rawDescData } -var file_layer_reporter_query_proto_msgTypes = make([]protoimpl.MessageInfo, 16) +var file_layer_reporter_query_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_layer_reporter_query_proto_goTypes = []interface{}{ - (*QueryParamsRequest)(nil), // 0: layer.reporter.QueryParamsRequest - (*QueryParamsResponse)(nil), // 1: layer.reporter.QueryParamsResponse - (*QueryReporterRequest)(nil), // 2: layer.reporter.QueryReporterRequest - (*QueryReporterResponse)(nil), // 3: layer.reporter.QueryReporterResponse - (*QueryReportersRequest)(nil), // 4: layer.reporter.QueryReportersRequest - (*QueryReportersResponse)(nil), // 5: layer.reporter.QueryReportersResponse - (*QueryDelegatorReporterRequest)(nil), // 6: layer.reporter.QueryDelegatorReporterRequest - (*QueryDelegatorReporterResponse)(nil), // 7: layer.reporter.QueryDelegatorReporterResponse - (*QueryReporterStakeRequest)(nil), // 8: layer.reporter.QueryReporterStakeRequest - (*QueryReporterStakeResponse)(nil), // 9: layer.reporter.QueryReporterStakeResponse - (*QueryDelegationRewardsRequest)(nil), // 10: layer.reporter.QueryDelegationRewardsRequest - (*QueryDelegationRewardsResponse)(nil), // 11: layer.reporter.QueryDelegationRewardsResponse - (*QueryReporterOutstandingRewardsRequest)(nil), // 12: layer.reporter.QueryReporterOutstandingRewardsRequest - (*QueryReporterOutstandingRewardsResponse)(nil), // 13: layer.reporter.QueryReporterOutstandingRewardsResponse - (*QueryReporterCommissionRequest)(nil), // 14: layer.reporter.QueryReporterCommissionRequest - (*QueryReporterCommissionResponse)(nil), // 15: layer.reporter.QueryReporterCommissionResponse - (*Params)(nil), // 16: layer.reporter.Params - (*OracleReporter)(nil), // 17: layer.reporter.OracleReporter - (*v1beta1.DecCoin)(nil), // 18: cosmos.base.v1beta1.DecCoin - (*ReporterOutstandingRewards)(nil), // 19: layer.reporter.ReporterOutstandingRewards - (*ReporterAccumulatedCommission)(nil), // 20: layer.reporter.ReporterAccumulatedCommission + (*QueryParamsRequest)(nil), // 0: layer.reporter.QueryParamsRequest + (*QueryParamsResponse)(nil), // 1: layer.reporter.QueryParamsResponse + (*QueryReportersRequest)(nil), // 2: layer.reporter.QueryReportersRequest + (*QueryReportersResponse)(nil), // 3: layer.reporter.QueryReportersResponse + (*QueryDelegatorReporterRequest)(nil), // 4: layer.reporter.QueryDelegatorReporterRequest + (*QueryDelegatorReporterResponse)(nil), // 5: layer.reporter.QueryDelegatorReporterResponse + (*Params)(nil), // 6: layer.reporter.Params + (*OracleReporter)(nil), // 7: layer.reporter.OracleReporter } var file_layer_reporter_query_proto_depIdxs = []int32{ - 16, // 0: layer.reporter.QueryParamsResponse.params:type_name -> layer.reporter.Params - 17, // 1: layer.reporter.QueryReporterResponse.reporter:type_name -> layer.reporter.OracleReporter - 17, // 2: layer.reporter.QueryReportersResponse.reporters:type_name -> layer.reporter.OracleReporter - 18, // 3: layer.reporter.QueryDelegationRewardsResponse.rewards:type_name -> cosmos.base.v1beta1.DecCoin - 19, // 4: layer.reporter.QueryReporterOutstandingRewardsResponse.rewards:type_name -> layer.reporter.ReporterOutstandingRewards - 20, // 5: layer.reporter.QueryReporterCommissionResponse.commission:type_name -> layer.reporter.ReporterAccumulatedCommission - 0, // 6: layer.reporter.Query.Params:input_type -> layer.reporter.QueryParamsRequest - 2, // 7: layer.reporter.Query.Reporter:input_type -> layer.reporter.QueryReporterRequest - 4, // 8: layer.reporter.Query.Reporters:input_type -> layer.reporter.QueryReportersRequest - 6, // 9: layer.reporter.Query.DelegatorReporter:input_type -> layer.reporter.QueryDelegatorReporterRequest - 8, // 10: layer.reporter.Query.ReporterStake:input_type -> layer.reporter.QueryReporterStakeRequest - 10, // 11: layer.reporter.Query.DelegationRewards:input_type -> layer.reporter.QueryDelegationRewardsRequest - 12, // 12: layer.reporter.Query.ReporterOutstandingRewards:input_type -> layer.reporter.QueryReporterOutstandingRewardsRequest - 14, // 13: layer.reporter.Query.ReporterCommission:input_type -> layer.reporter.QueryReporterCommissionRequest - 1, // 14: layer.reporter.Query.Params:output_type -> layer.reporter.QueryParamsResponse - 3, // 15: layer.reporter.Query.Reporter:output_type -> layer.reporter.QueryReporterResponse - 5, // 16: layer.reporter.Query.Reporters:output_type -> layer.reporter.QueryReportersResponse - 7, // 17: layer.reporter.Query.DelegatorReporter:output_type -> layer.reporter.QueryDelegatorReporterResponse - 9, // 18: layer.reporter.Query.ReporterStake:output_type -> layer.reporter.QueryReporterStakeResponse - 11, // 19: layer.reporter.Query.DelegationRewards:output_type -> layer.reporter.QueryDelegationRewardsResponse - 13, // 20: layer.reporter.Query.ReporterOutstandingRewards:output_type -> layer.reporter.QueryReporterOutstandingRewardsResponse - 15, // 21: layer.reporter.Query.ReporterCommission:output_type -> layer.reporter.QueryReporterCommissionResponse - 14, // [14:22] is the sub-list for method output_type - 6, // [6:14] is the sub-list for method input_type - 6, // [6:6] is the sub-list for extension type_name - 6, // [6:6] is the sub-list for extension extendee - 0, // [0:6] is the sub-list for field type_name + 6, // 0: layer.reporter.QueryParamsResponse.params:type_name -> layer.reporter.Params + 7, // 1: layer.reporter.QueryReportersResponse.reporters:type_name -> layer.reporter.OracleReporter + 0, // 2: layer.reporter.Query.Params:input_type -> layer.reporter.QueryParamsRequest + 2, // 3: layer.reporter.Query.Reporters:input_type -> layer.reporter.QueryReportersRequest + 4, // 4: layer.reporter.Query.DelegatorReporter:input_type -> layer.reporter.QueryDelegatorReporterRequest + 1, // 5: layer.reporter.Query.Params:output_type -> layer.reporter.QueryParamsResponse + 3, // 6: layer.reporter.Query.Reporters:output_type -> layer.reporter.QueryReportersResponse + 5, // 7: layer.reporter.Query.DelegatorReporter:output_type -> layer.reporter.QueryDelegatorReporterResponse + 5, // [5:8] is the sub-list for method output_type + 2, // [2:5] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name } func init() { file_layer_reporter_query_proto_init() } @@ -7808,30 +2881,6 @@ func file_layer_reporter_query_proto_init() { } } file_layer_reporter_query_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryReporterRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_layer_reporter_query_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryReporterResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_layer_reporter_query_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*QueryReportersRequest); i { case 0: return &v.state @@ -7843,7 +2892,7 @@ func file_layer_reporter_query_proto_init() { return nil } } - file_layer_reporter_query_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_layer_reporter_query_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*QueryReportersResponse); i { case 0: return &v.state @@ -7855,7 +2904,7 @@ func file_layer_reporter_query_proto_init() { return nil } } - file_layer_reporter_query_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_layer_reporter_query_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*QueryDelegatorReporterRequest); i { case 0: return &v.state @@ -7867,7 +2916,7 @@ func file_layer_reporter_query_proto_init() { return nil } } - file_layer_reporter_query_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + file_layer_reporter_query_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*QueryDelegatorReporterResponse); i { case 0: return &v.state @@ -7879,102 +2928,6 @@ func file_layer_reporter_query_proto_init() { return nil } } - file_layer_reporter_query_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryReporterStakeRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_layer_reporter_query_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryReporterStakeResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_layer_reporter_query_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryDelegationRewardsRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_layer_reporter_query_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryDelegationRewardsResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_layer_reporter_query_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryReporterOutstandingRewardsRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_layer_reporter_query_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryReporterOutstandingRewardsResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_layer_reporter_query_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryReporterCommissionRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_layer_reporter_query_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryReporterCommissionResponse); 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{ @@ -7982,7 +2935,7 @@ func file_layer_reporter_query_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_layer_reporter_query_proto_rawDesc, NumEnums: 0, - NumMessages: 16, + NumMessages: 6, NumExtensions: 0, NumServices: 1, }, diff --git a/api/layer/reporter/query_grpc.pb.go b/api/layer/reporter/query_grpc.pb.go index 9f3a3e9b5..18125bb1f 100644 --- a/api/layer/reporter/query_grpc.pb.go +++ b/api/layer/reporter/query_grpc.pb.go @@ -20,20 +20,10 @@ const _ = grpc.SupportPackageIsVersion7 type QueryClient interface { // Parameters queries the parameters of the module. Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) - // Reporter queries the reporter of a reporter address. - Reporter(ctx context.Context, in *QueryReporterRequest, opts ...grpc.CallOption) (*QueryReporterResponse, error) // Reporters queries all the staked reporters. Reporters(ctx context.Context, in *QueryReportersRequest, opts ...grpc.CallOption) (*QueryReportersResponse, error) // DelegatorReporter queries the reporter of a delegator. DelegatorReporter(ctx context.Context, in *QueryDelegatorReporterRequest, opts ...grpc.CallOption) (*QueryDelegatorReporterResponse, error) - // ReporterStake queries the total tokens of a reporter. - ReporterStake(ctx context.Context, in *QueryReporterStakeRequest, opts ...grpc.CallOption) (*QueryReporterStakeResponse, error) - // DelegationRewards queries the total rewards accrued by a delegation. - DelegationRewards(ctx context.Context, in *QueryDelegationRewardsRequest, opts ...grpc.CallOption) (*QueryDelegationRewardsResponse, error) - // ReporterOutstandingRewards queries rewards of a reporter address. - ReporterOutstandingRewards(ctx context.Context, in *QueryReporterOutstandingRewardsRequest, opts ...grpc.CallOption) (*QueryReporterOutstandingRewardsResponse, error) - // ReporterCommission queries accumulated commission for a reporter. - ReporterCommission(ctx context.Context, in *QueryReporterCommissionRequest, opts ...grpc.CallOption) (*QueryReporterCommissionResponse, error) } type queryClient struct { @@ -53,15 +43,6 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts . return out, nil } -func (c *queryClient) Reporter(ctx context.Context, in *QueryReporterRequest, opts ...grpc.CallOption) (*QueryReporterResponse, error) { - out := new(QueryReporterResponse) - err := c.cc.Invoke(ctx, "/layer.reporter.Query/Reporter", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *queryClient) Reporters(ctx context.Context, in *QueryReportersRequest, opts ...grpc.CallOption) (*QueryReportersResponse, error) { out := new(QueryReportersResponse) err := c.cc.Invoke(ctx, "/layer.reporter.Query/Reporters", in, out, opts...) @@ -80,62 +61,16 @@ func (c *queryClient) DelegatorReporter(ctx context.Context, in *QueryDelegatorR return out, nil } -func (c *queryClient) ReporterStake(ctx context.Context, in *QueryReporterStakeRequest, opts ...grpc.CallOption) (*QueryReporterStakeResponse, error) { - out := new(QueryReporterStakeResponse) - err := c.cc.Invoke(ctx, "/layer.reporter.Query/ReporterStake", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) DelegationRewards(ctx context.Context, in *QueryDelegationRewardsRequest, opts ...grpc.CallOption) (*QueryDelegationRewardsResponse, error) { - out := new(QueryDelegationRewardsResponse) - err := c.cc.Invoke(ctx, "/layer.reporter.Query/DelegationRewards", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) ReporterOutstandingRewards(ctx context.Context, in *QueryReporterOutstandingRewardsRequest, opts ...grpc.CallOption) (*QueryReporterOutstandingRewardsResponse, error) { - out := new(QueryReporterOutstandingRewardsResponse) - err := c.cc.Invoke(ctx, "/layer.reporter.Query/ReporterOutstandingRewards", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) ReporterCommission(ctx context.Context, in *QueryReporterCommissionRequest, opts ...grpc.CallOption) (*QueryReporterCommissionResponse, error) { - out := new(QueryReporterCommissionResponse) - err := c.cc.Invoke(ctx, "/layer.reporter.Query/ReporterCommission", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - // QueryServer is the server API for Query service. // All implementations must embed UnimplementedQueryServer // for forward compatibility type QueryServer interface { // Parameters queries the parameters of the module. Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) - // Reporter queries the reporter of a reporter address. - Reporter(context.Context, *QueryReporterRequest) (*QueryReporterResponse, error) // Reporters queries all the staked reporters. Reporters(context.Context, *QueryReportersRequest) (*QueryReportersResponse, error) // DelegatorReporter queries the reporter of a delegator. DelegatorReporter(context.Context, *QueryDelegatorReporterRequest) (*QueryDelegatorReporterResponse, error) - // ReporterStake queries the total tokens of a reporter. - ReporterStake(context.Context, *QueryReporterStakeRequest) (*QueryReporterStakeResponse, error) - // DelegationRewards queries the total rewards accrued by a delegation. - DelegationRewards(context.Context, *QueryDelegationRewardsRequest) (*QueryDelegationRewardsResponse, error) - // ReporterOutstandingRewards queries rewards of a reporter address. - ReporterOutstandingRewards(context.Context, *QueryReporterOutstandingRewardsRequest) (*QueryReporterOutstandingRewardsResponse, error) - // ReporterCommission queries accumulated commission for a reporter. - ReporterCommission(context.Context, *QueryReporterCommissionRequest) (*QueryReporterCommissionResponse, error) mustEmbedUnimplementedQueryServer() } @@ -146,27 +81,12 @@ type UnimplementedQueryServer struct { func (UnimplementedQueryServer) Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") } -func (UnimplementedQueryServer) Reporter(context.Context, *QueryReporterRequest) (*QueryReporterResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Reporter not implemented") -} func (UnimplementedQueryServer) Reporters(context.Context, *QueryReportersRequest) (*QueryReportersResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Reporters not implemented") } func (UnimplementedQueryServer) DelegatorReporter(context.Context, *QueryDelegatorReporterRequest) (*QueryDelegatorReporterResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method DelegatorReporter not implemented") } -func (UnimplementedQueryServer) ReporterStake(context.Context, *QueryReporterStakeRequest) (*QueryReporterStakeResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ReporterStake not implemented") -} -func (UnimplementedQueryServer) DelegationRewards(context.Context, *QueryDelegationRewardsRequest) (*QueryDelegationRewardsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DelegationRewards not implemented") -} -func (UnimplementedQueryServer) ReporterOutstandingRewards(context.Context, *QueryReporterOutstandingRewardsRequest) (*QueryReporterOutstandingRewardsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ReporterOutstandingRewards not implemented") -} -func (UnimplementedQueryServer) ReporterCommission(context.Context, *QueryReporterCommissionRequest) (*QueryReporterCommissionResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ReporterCommission not implemented") -} func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {} // UnsafeQueryServer may be embedded to opt out of forward compatibility for this service. @@ -198,24 +118,6 @@ func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interf return interceptor(ctx, in, info, handler) } -func _Query_Reporter_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryReporterRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Reporter(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/layer.reporter.Query/Reporter", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Reporter(ctx, req.(*QueryReporterRequest)) - } - return interceptor(ctx, in, info, handler) -} - func _Query_Reporters_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryReportersRequest) if err := dec(in); err != nil { @@ -252,78 +154,6 @@ func _Query_DelegatorReporter_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } -func _Query_ReporterStake_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryReporterStakeRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).ReporterStake(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/layer.reporter.Query/ReporterStake", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).ReporterStake(ctx, req.(*QueryReporterStakeRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_DelegationRewards_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryDelegationRewardsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).DelegationRewards(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/layer.reporter.Query/DelegationRewards", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).DelegationRewards(ctx, req.(*QueryDelegationRewardsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_ReporterOutstandingRewards_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryReporterOutstandingRewardsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).ReporterOutstandingRewards(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/layer.reporter.Query/ReporterOutstandingRewards", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).ReporterOutstandingRewards(ctx, req.(*QueryReporterOutstandingRewardsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_ReporterCommission_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryReporterCommissionRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).ReporterCommission(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/layer.reporter.Query/ReporterCommission", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).ReporterCommission(ctx, req.(*QueryReporterCommissionRequest)) - } - return interceptor(ctx, in, info, handler) -} - // Query_ServiceDesc is the grpc.ServiceDesc for Query service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -335,10 +165,6 @@ var Query_ServiceDesc = grpc.ServiceDesc{ MethodName: "Params", Handler: _Query_Params_Handler, }, - { - MethodName: "Reporter", - Handler: _Query_Reporter_Handler, - }, { MethodName: "Reporters", Handler: _Query_Reporters_Handler, @@ -347,22 +173,6 @@ var Query_ServiceDesc = grpc.ServiceDesc{ MethodName: "DelegatorReporter", Handler: _Query_DelegatorReporter_Handler, }, - { - MethodName: "ReporterStake", - Handler: _Query_ReporterStake_Handler, - }, - { - MethodName: "DelegationRewards", - Handler: _Query_DelegationRewards_Handler, - }, - { - MethodName: "ReporterOutstandingRewards", - Handler: _Query_ReporterOutstandingRewards_Handler, - }, - { - MethodName: "ReporterCommission", - Handler: _Query_ReporterCommission_Handler, - }, }, Streams: []grpc.StreamDesc{}, Metadata: "layer/reporter/query.proto", diff --git a/api/layer/reporter/token_origin.pulsar.go b/api/layer/reporter/token_origin.pulsar.go index 6cf2b86f1..8e7b8d67b 100644 --- a/api/layer/reporter/token_origin.pulsar.go +++ b/api/layer/reporter/token_origin.pulsar.go @@ -15,492 +15,6 @@ import ( sync "sync" ) -var ( - md_TokenOrigin protoreflect.MessageDescriptor - fd_TokenOrigin_validator_address protoreflect.FieldDescriptor - fd_TokenOrigin_amount protoreflect.FieldDescriptor -) - -func init() { - file_layer_reporter_token_origin_proto_init() - md_TokenOrigin = File_layer_reporter_token_origin_proto.Messages().ByName("TokenOrigin") - fd_TokenOrigin_validator_address = md_TokenOrigin.Fields().ByName("validator_address") - fd_TokenOrigin_amount = md_TokenOrigin.Fields().ByName("amount") -} - -var _ protoreflect.Message = (*fastReflection_TokenOrigin)(nil) - -type fastReflection_TokenOrigin TokenOrigin - -func (x *TokenOrigin) ProtoReflect() protoreflect.Message { - return (*fastReflection_TokenOrigin)(x) -} - -func (x *TokenOrigin) slowProtoReflect() protoreflect.Message { - mi := &file_layer_reporter_token_origin_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_TokenOrigin_messageType fastReflection_TokenOrigin_messageType -var _ protoreflect.MessageType = fastReflection_TokenOrigin_messageType{} - -type fastReflection_TokenOrigin_messageType struct{} - -func (x fastReflection_TokenOrigin_messageType) Zero() protoreflect.Message { - return (*fastReflection_TokenOrigin)(nil) -} -func (x fastReflection_TokenOrigin_messageType) New() protoreflect.Message { - return new(fastReflection_TokenOrigin) -} -func (x fastReflection_TokenOrigin_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_TokenOrigin -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_TokenOrigin) Descriptor() protoreflect.MessageDescriptor { - return md_TokenOrigin -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_TokenOrigin) Type() protoreflect.MessageType { - return _fastReflection_TokenOrigin_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_TokenOrigin) New() protoreflect.Message { - return new(fastReflection_TokenOrigin) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_TokenOrigin) Interface() protoreflect.ProtoMessage { - return (*TokenOrigin)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_TokenOrigin) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if len(x.ValidatorAddress) != 0 { - value := protoreflect.ValueOfBytes(x.ValidatorAddress) - if !f(fd_TokenOrigin_validator_address, value) { - return - } - } - if x.Amount != "" { - value := protoreflect.ValueOfString(x.Amount) - if !f(fd_TokenOrigin_amount, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_TokenOrigin) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "layer.reporter.TokenOrigin.validator_address": - return len(x.ValidatorAddress) != 0 - case "layer.reporter.TokenOrigin.amount": - return x.Amount != "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.TokenOrigin")) - } - panic(fmt.Errorf("message layer.reporter.TokenOrigin does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_TokenOrigin) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "layer.reporter.TokenOrigin.validator_address": - x.ValidatorAddress = nil - case "layer.reporter.TokenOrigin.amount": - x.Amount = "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.TokenOrigin")) - } - panic(fmt.Errorf("message layer.reporter.TokenOrigin does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_TokenOrigin) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "layer.reporter.TokenOrigin.validator_address": - value := x.ValidatorAddress - return protoreflect.ValueOfBytes(value) - case "layer.reporter.TokenOrigin.amount": - value := x.Amount - return protoreflect.ValueOfString(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.TokenOrigin")) - } - panic(fmt.Errorf("message layer.reporter.TokenOrigin does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_TokenOrigin) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "layer.reporter.TokenOrigin.validator_address": - x.ValidatorAddress = value.Bytes() - case "layer.reporter.TokenOrigin.amount": - x.Amount = value.Interface().(string) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.TokenOrigin")) - } - panic(fmt.Errorf("message layer.reporter.TokenOrigin does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_TokenOrigin) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "layer.reporter.TokenOrigin.validator_address": - panic(fmt.Errorf("field validator_address of message layer.reporter.TokenOrigin is not mutable")) - case "layer.reporter.TokenOrigin.amount": - panic(fmt.Errorf("field amount of message layer.reporter.TokenOrigin is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.TokenOrigin")) - } - panic(fmt.Errorf("message layer.reporter.TokenOrigin does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_TokenOrigin) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "layer.reporter.TokenOrigin.validator_address": - return protoreflect.ValueOfBytes(nil) - case "layer.reporter.TokenOrigin.amount": - return protoreflect.ValueOfString("") - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.TokenOrigin")) - } - panic(fmt.Errorf("message layer.reporter.TokenOrigin does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_TokenOrigin) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in layer.reporter.TokenOrigin", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_TokenOrigin) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_TokenOrigin) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_TokenOrigin) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_TokenOrigin) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*TokenOrigin) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - l = len(x.ValidatorAddress) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - l = len(x.Amount) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*TokenOrigin) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if len(x.Amount) > 0 { - i -= len(x.Amount) - copy(dAtA[i:], x.Amount) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Amount))) - i-- - dAtA[i] = 0x12 - } - if len(x.ValidatorAddress) > 0 { - i -= len(x.ValidatorAddress) - copy(dAtA[i:], x.ValidatorAddress) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ValidatorAddress))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*TokenOrigin) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire 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++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: TokenOrigin: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: TokenOrigin: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) - } - var byteLen int - 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++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + byteLen - 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.ValidatorAddress = append(x.ValidatorAddress[:0], dAtA[iNdEx:postIndex]...) - if x.ValidatorAddress == nil { - x.ValidatorAddress = []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 Amount", 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.Amount = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - var ( md_TokenOriginInfo protoreflect.MessageDescriptor fd_TokenOriginInfo_delegator_address protoreflect.FieldDescriptor @@ -525,7 +39,7 @@ func (x *TokenOriginInfo) ProtoReflect() protoreflect.Message { } func (x *TokenOriginInfo) slowProtoReflect() protoreflect.Message { - mi := &file_layer_reporter_token_origin_proto_msgTypes[1] + mi := &file_layer_reporter_token_origin_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1053,78 +567,80 @@ func (x *fastReflection_TokenOriginInfo) ProtoMethods() *protoiface.Methods { } } -var _ protoreflect.List = (*_DelegationsPreUpdate_1_list)(nil) +var _ protoreflect.List = (*_DelegationsAmounts_1_list)(nil) -type _DelegationsPreUpdate_1_list struct { +type _DelegationsAmounts_1_list struct { list *[]*TokenOriginInfo } -func (x *_DelegationsPreUpdate_1_list) Len() int { +func (x *_DelegationsAmounts_1_list) Len() int { if x.list == nil { return 0 } return len(*x.list) } -func (x *_DelegationsPreUpdate_1_list) Get(i int) protoreflect.Value { +func (x *_DelegationsAmounts_1_list) Get(i int) protoreflect.Value { return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) } -func (x *_DelegationsPreUpdate_1_list) Set(i int, value protoreflect.Value) { +func (x *_DelegationsAmounts_1_list) Set(i int, value protoreflect.Value) { valueUnwrapped := value.Message() concreteValue := valueUnwrapped.Interface().(*TokenOriginInfo) (*x.list)[i] = concreteValue } -func (x *_DelegationsPreUpdate_1_list) Append(value protoreflect.Value) { +func (x *_DelegationsAmounts_1_list) Append(value protoreflect.Value) { valueUnwrapped := value.Message() concreteValue := valueUnwrapped.Interface().(*TokenOriginInfo) *x.list = append(*x.list, concreteValue) } -func (x *_DelegationsPreUpdate_1_list) AppendMutable() protoreflect.Value { +func (x *_DelegationsAmounts_1_list) AppendMutable() protoreflect.Value { v := new(TokenOriginInfo) *x.list = append(*x.list, v) return protoreflect.ValueOfMessage(v.ProtoReflect()) } -func (x *_DelegationsPreUpdate_1_list) Truncate(n int) { +func (x *_DelegationsAmounts_1_list) Truncate(n int) { for i := n; i < len(*x.list); i++ { (*x.list)[i] = nil } *x.list = (*x.list)[:n] } -func (x *_DelegationsPreUpdate_1_list) NewElement() protoreflect.Value { +func (x *_DelegationsAmounts_1_list) NewElement() protoreflect.Value { v := new(TokenOriginInfo) return protoreflect.ValueOfMessage(v.ProtoReflect()) } -func (x *_DelegationsPreUpdate_1_list) IsValid() bool { +func (x *_DelegationsAmounts_1_list) IsValid() bool { return x.list != nil } var ( - md_DelegationsPreUpdate protoreflect.MessageDescriptor - fd_DelegationsPreUpdate_token_origins protoreflect.FieldDescriptor + md_DelegationsAmounts protoreflect.MessageDescriptor + fd_DelegationsAmounts_token_origins protoreflect.FieldDescriptor + fd_DelegationsAmounts_total protoreflect.FieldDescriptor ) func init() { file_layer_reporter_token_origin_proto_init() - md_DelegationsPreUpdate = File_layer_reporter_token_origin_proto.Messages().ByName("DelegationsPreUpdate") - fd_DelegationsPreUpdate_token_origins = md_DelegationsPreUpdate.Fields().ByName("token_origins") + md_DelegationsAmounts = File_layer_reporter_token_origin_proto.Messages().ByName("DelegationsAmounts") + fd_DelegationsAmounts_token_origins = md_DelegationsAmounts.Fields().ByName("token_origins") + fd_DelegationsAmounts_total = md_DelegationsAmounts.Fields().ByName("total") } -var _ protoreflect.Message = (*fastReflection_DelegationsPreUpdate)(nil) +var _ protoreflect.Message = (*fastReflection_DelegationsAmounts)(nil) -type fastReflection_DelegationsPreUpdate DelegationsPreUpdate +type fastReflection_DelegationsAmounts DelegationsAmounts -func (x *DelegationsPreUpdate) ProtoReflect() protoreflect.Message { - return (*fastReflection_DelegationsPreUpdate)(x) +func (x *DelegationsAmounts) ProtoReflect() protoreflect.Message { + return (*fastReflection_DelegationsAmounts)(x) } -func (x *DelegationsPreUpdate) slowProtoReflect() protoreflect.Message { - mi := &file_layer_reporter_token_origin_proto_msgTypes[2] +func (x *DelegationsAmounts) slowProtoReflect() protoreflect.Message { + mi := &file_layer_reporter_token_origin_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1135,43 +651,43 @@ func (x *DelegationsPreUpdate) slowProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -var _fastReflection_DelegationsPreUpdate_messageType fastReflection_DelegationsPreUpdate_messageType -var _ protoreflect.MessageType = fastReflection_DelegationsPreUpdate_messageType{} +var _fastReflection_DelegationsAmounts_messageType fastReflection_DelegationsAmounts_messageType +var _ protoreflect.MessageType = fastReflection_DelegationsAmounts_messageType{} -type fastReflection_DelegationsPreUpdate_messageType struct{} +type fastReflection_DelegationsAmounts_messageType struct{} -func (x fastReflection_DelegationsPreUpdate_messageType) Zero() protoreflect.Message { - return (*fastReflection_DelegationsPreUpdate)(nil) +func (x fastReflection_DelegationsAmounts_messageType) Zero() protoreflect.Message { + return (*fastReflection_DelegationsAmounts)(nil) } -func (x fastReflection_DelegationsPreUpdate_messageType) New() protoreflect.Message { - return new(fastReflection_DelegationsPreUpdate) +func (x fastReflection_DelegationsAmounts_messageType) New() protoreflect.Message { + return new(fastReflection_DelegationsAmounts) } -func (x fastReflection_DelegationsPreUpdate_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_DelegationsPreUpdate +func (x fastReflection_DelegationsAmounts_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_DelegationsAmounts } // Descriptor returns message descriptor, which contains only the protobuf // type information for the message. -func (x *fastReflection_DelegationsPreUpdate) Descriptor() protoreflect.MessageDescriptor { - return md_DelegationsPreUpdate +func (x *fastReflection_DelegationsAmounts) Descriptor() protoreflect.MessageDescriptor { + return md_DelegationsAmounts } // Type returns the message type, which encapsulates both Go and protobuf // type information. If the Go type information is not needed, // it is recommended that the message descriptor be used instead. -func (x *fastReflection_DelegationsPreUpdate) Type() protoreflect.MessageType { - return _fastReflection_DelegationsPreUpdate_messageType +func (x *fastReflection_DelegationsAmounts) Type() protoreflect.MessageType { + return _fastReflection_DelegationsAmounts_messageType } // New returns a newly allocated and mutable empty message. -func (x *fastReflection_DelegationsPreUpdate) New() protoreflect.Message { - return new(fastReflection_DelegationsPreUpdate) +func (x *fastReflection_DelegationsAmounts) New() protoreflect.Message { + return new(fastReflection_DelegationsAmounts) } // Interface unwraps the message reflection interface and // returns the underlying ProtoMessage interface. -func (x *fastReflection_DelegationsPreUpdate) Interface() protoreflect.ProtoMessage { - return (*DelegationsPreUpdate)(x) +func (x *fastReflection_DelegationsAmounts) Interface() protoreflect.ProtoMessage { + return (*DelegationsAmounts)(x) } // Range iterates over every populated field in an undefined order, @@ -1179,10 +695,16 @@ func (x *fastReflection_DelegationsPreUpdate) Interface() protoreflect.ProtoMess // Range returns immediately if f returns false. // While iterating, mutating operations may only be performed // on the current field descriptor. -func (x *fastReflection_DelegationsPreUpdate) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +func (x *fastReflection_DelegationsAmounts) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { if len(x.TokenOrigins) != 0 { - value := protoreflect.ValueOfList(&_DelegationsPreUpdate_1_list{list: &x.TokenOrigins}) - if !f(fd_DelegationsPreUpdate_token_origins, value) { + value := protoreflect.ValueOfList(&_DelegationsAmounts_1_list{list: &x.TokenOrigins}) + if !f(fd_DelegationsAmounts_token_origins, value) { + return + } + } + if x.Total != "" { + value := protoreflect.ValueOfString(x.Total) + if !f(fd_DelegationsAmounts_total, value) { return } } @@ -1199,15 +721,17 @@ func (x *fastReflection_DelegationsPreUpdate) Range(f func(protoreflect.FieldDes // In other cases (aside from the nullable cases above), // a proto3 scalar field is populated if it contains a non-zero value, and // a repeated field is populated if it is non-empty. -func (x *fastReflection_DelegationsPreUpdate) Has(fd protoreflect.FieldDescriptor) bool { +func (x *fastReflection_DelegationsAmounts) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "layer.reporter.DelegationsPreUpdate.token_origins": + case "layer.reporter.DelegationsAmounts.token_origins": return len(x.TokenOrigins) != 0 + case "layer.reporter.DelegationsAmounts.total": + return x.Total != "" default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.DelegationsPreUpdate")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.DelegationsAmounts")) } - panic(fmt.Errorf("message layer.reporter.DelegationsPreUpdate does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.DelegationsAmounts does not contain field %s", fd.FullName())) } } @@ -1217,15 +741,17 @@ func (x *fastReflection_DelegationsPreUpdate) Has(fd protoreflect.FieldDescripto // associated with the given field number. // // Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_DelegationsPreUpdate) Clear(fd protoreflect.FieldDescriptor) { +func (x *fastReflection_DelegationsAmounts) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "layer.reporter.DelegationsPreUpdate.token_origins": + case "layer.reporter.DelegationsAmounts.token_origins": x.TokenOrigins = nil + case "layer.reporter.DelegationsAmounts.total": + x.Total = "" default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.DelegationsPreUpdate")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.DelegationsAmounts")) } - panic(fmt.Errorf("message layer.reporter.DelegationsPreUpdate does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.DelegationsAmounts does not contain field %s", fd.FullName())) } } @@ -1235,19 +761,22 @@ func (x *fastReflection_DelegationsPreUpdate) Clear(fd protoreflect.FieldDescrip // the default value of a bytes scalar is guaranteed to be a copy. // For unpopulated composite types, it returns an empty, read-only view // of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_DelegationsPreUpdate) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_DelegationsAmounts) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "layer.reporter.DelegationsPreUpdate.token_origins": + case "layer.reporter.DelegationsAmounts.token_origins": if len(x.TokenOrigins) == 0 { - return protoreflect.ValueOfList(&_DelegationsPreUpdate_1_list{}) + return protoreflect.ValueOfList(&_DelegationsAmounts_1_list{}) } - listValue := &_DelegationsPreUpdate_1_list{list: &x.TokenOrigins} + listValue := &_DelegationsAmounts_1_list{list: &x.TokenOrigins} return protoreflect.ValueOfList(listValue) + case "layer.reporter.DelegationsAmounts.total": + value := x.Total + return protoreflect.ValueOfString(value) default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.DelegationsPreUpdate")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.DelegationsAmounts")) } - panic(fmt.Errorf("message layer.reporter.DelegationsPreUpdate does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message layer.reporter.DelegationsAmounts does not contain field %s", descriptor.FullName())) } } @@ -1261,17 +790,19 @@ func (x *fastReflection_DelegationsPreUpdate) Get(descriptor protoreflect.FieldD // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_DelegationsPreUpdate) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_DelegationsAmounts) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "layer.reporter.DelegationsPreUpdate.token_origins": + case "layer.reporter.DelegationsAmounts.token_origins": lv := value.List() - clv := lv.(*_DelegationsPreUpdate_1_list) + clv := lv.(*_DelegationsAmounts_1_list) x.TokenOrigins = *clv.list + case "layer.reporter.DelegationsAmounts.total": + x.Total = value.Interface().(string) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.DelegationsPreUpdate")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.DelegationsAmounts")) } - panic(fmt.Errorf("message layer.reporter.DelegationsPreUpdate does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.DelegationsAmounts does not contain field %s", fd.FullName())) } } @@ -1285,45 +816,49 @@ func (x *fastReflection_DelegationsPreUpdate) Set(fd protoreflect.FieldDescripto // It panics if the field does not contain a composite type. // // Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_DelegationsPreUpdate) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_DelegationsAmounts) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "layer.reporter.DelegationsPreUpdate.token_origins": + case "layer.reporter.DelegationsAmounts.token_origins": if x.TokenOrigins == nil { x.TokenOrigins = []*TokenOriginInfo{} } - value := &_DelegationsPreUpdate_1_list{list: &x.TokenOrigins} + value := &_DelegationsAmounts_1_list{list: &x.TokenOrigins} return protoreflect.ValueOfList(value) + case "layer.reporter.DelegationsAmounts.total": + panic(fmt.Errorf("field total of message layer.reporter.DelegationsAmounts is not mutable")) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.DelegationsPreUpdate")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.DelegationsAmounts")) } - panic(fmt.Errorf("message layer.reporter.DelegationsPreUpdate does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.DelegationsAmounts does not contain field %s", fd.FullName())) } } // NewField returns a new value that is assignable to the field // for the given descriptor. For scalars, this returns the default value. // For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_DelegationsPreUpdate) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_DelegationsAmounts) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "layer.reporter.DelegationsPreUpdate.token_origins": + case "layer.reporter.DelegationsAmounts.token_origins": list := []*TokenOriginInfo{} - return protoreflect.ValueOfList(&_DelegationsPreUpdate_1_list{list: &list}) + return protoreflect.ValueOfList(&_DelegationsAmounts_1_list{list: &list}) + case "layer.reporter.DelegationsAmounts.total": + return protoreflect.ValueOfString("") default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.DelegationsPreUpdate")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.DelegationsAmounts")) } - panic(fmt.Errorf("message layer.reporter.DelegationsPreUpdate does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.DelegationsAmounts does not contain field %s", fd.FullName())) } } // WhichOneof reports which field within the oneof is populated, // returning nil if none are populated. // It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_DelegationsPreUpdate) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { +func (x *fastReflection_DelegationsAmounts) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in layer.reporter.DelegationsPreUpdate", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in layer.reporter.DelegationsAmounts", d.FullName())) } panic("unreachable") } @@ -1331,7 +866,7 @@ func (x *fastReflection_DelegationsPreUpdate) WhichOneof(d protoreflect.OneofDes // GetUnknown retrieves the entire list of unknown fields. // The caller may only mutate the contents of the RawFields // if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_DelegationsPreUpdate) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_DelegationsAmounts) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -1342,7 +877,7 @@ func (x *fastReflection_DelegationsPreUpdate) GetUnknown() protoreflect.RawField // An empty RawFields may be passed to clear the fields. // // SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_DelegationsPreUpdate) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_DelegationsAmounts) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -1354,7 +889,7 @@ func (x *fastReflection_DelegationsPreUpdate) SetUnknown(fields protoreflect.Raw // message type, but the details are implementation dependent. // Validity is not part of the protobuf data model, and may not // be preserved in marshaling or other operations. -func (x *fastReflection_DelegationsPreUpdate) IsValid() bool { +func (x *fastReflection_DelegationsAmounts) IsValid() bool { return x != nil } @@ -1364,9 +899,9 @@ func (x *fastReflection_DelegationsPreUpdate) IsValid() bool { // The returned methods type is identical to // "google.golang.org/protobuf/runtime/protoiface".Methods. // Consult the protoiface package documentation for details. -func (x *fastReflection_DelegationsPreUpdate) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_DelegationsAmounts) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*DelegationsPreUpdate) + x := input.Message.Interface().(*DelegationsAmounts) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1384,6 +919,10 @@ func (x *fastReflection_DelegationsPreUpdate) ProtoMethods() *protoiface.Methods n += 1 + l + runtime.Sov(uint64(l)) } } + l = len(x.Total) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -1394,7 +933,7 @@ func (x *fastReflection_DelegationsPreUpdate) ProtoMethods() *protoiface.Methods } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*DelegationsPreUpdate) + x := input.Message.Interface().(*DelegationsAmounts) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1413,6 +952,13 @@ func (x *fastReflection_DelegationsPreUpdate) ProtoMethods() *protoiface.Methods i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if len(x.Total) > 0 { + i -= len(x.Total) + copy(dAtA[i:], x.Total) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Total))) + i-- + dAtA[i] = 0x12 + } if len(x.TokenOrigins) > 0 { for iNdEx := len(x.TokenOrigins) - 1; iNdEx >= 0; iNdEx-- { encoded, err := options.Marshal(x.TokenOrigins[iNdEx]) @@ -1440,7 +986,7 @@ func (x *fastReflection_DelegationsPreUpdate) ProtoMethods() *protoiface.Methods }, nil } unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*DelegationsPreUpdate) + x := input.Message.Interface().(*DelegationsAmounts) if x == nil { return protoiface.UnmarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1472,10 +1018,10 @@ func (x *fastReflection_DelegationsPreUpdate) ProtoMethods() *protoiface.Methods fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: DelegationsPreUpdate: wiretype end group for non-group") + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: DelegationsAmounts: wiretype end group for non-group") } if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: DelegationsPreUpdate: illegal tag %d (wire type %d)", fieldNum, wire) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: DelegationsAmounts: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1512,6 +1058,38 @@ func (x *fastReflection_DelegationsPreUpdate) ProtoMethods() *protoiface.Methods return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err } iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Total", 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.Total = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -1560,66 +1138,24 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// TokenOrigin is a message to store the origin of a token -type TokenOrigin struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // validator_address is the address of the validator that tokens in staking are delegated to - ValidatorAddress []byte `protobuf:"bytes,1,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` - // amount is the amount of tokens to be delegated to a reporter from a delegation in staking - Amount string `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount,omitempty"` -} - -func (x *TokenOrigin) Reset() { - *x = TokenOrigin{} - if protoimpl.UnsafeEnabled { - mi := &file_layer_reporter_token_origin_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TokenOrigin) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TokenOrigin) ProtoMessage() {} - -// Deprecated: Use TokenOrigin.ProtoReflect.Descriptor instead. -func (*TokenOrigin) Descriptor() ([]byte, []int) { - return file_layer_reporter_token_origin_proto_rawDescGZIP(), []int{0} -} - -func (x *TokenOrigin) GetValidatorAddress() []byte { - if x != nil { - return x.ValidatorAddress - } - return nil -} - -func (x *TokenOrigin) GetAmount() string { - if x != nil { - return x.Amount - } - return "" -} - +// TokenOriginInfo is the struct that holds the data of where tokens are staked type TokenOriginInfo struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + // delegator_address is the address of the delegator DelegatorAddress []byte `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` + // validator_address is the address of the validator ValidatorAddress []byte `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` - Amount string `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount,omitempty"` + // amount is the amount of tokens staked + Amount string `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount,omitempty"` } func (x *TokenOriginInfo) Reset() { *x = TokenOriginInfo{} if protoimpl.UnsafeEnabled { - mi := &file_layer_reporter_token_origin_proto_msgTypes[1] + mi := &file_layer_reporter_token_origin_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1633,7 +1169,7 @@ func (*TokenOriginInfo) ProtoMessage() {} // Deprecated: Use TokenOriginInfo.ProtoReflect.Descriptor instead. func (*TokenOriginInfo) Descriptor() ([]byte, []int) { - return file_layer_reporter_token_origin_proto_rawDescGZIP(), []int{1} + return file_layer_reporter_token_origin_proto_rawDescGZIP(), []int{0} } func (x *TokenOriginInfo) GetDelegatorAddress() []byte { @@ -1657,43 +1193,52 @@ func (x *TokenOriginInfo) GetAmount() string { return "" } -// reporter's snapshot of delegators' sources pre unbonding -type DelegationsPreUpdate struct { +// DelegationsAmounts is the struct that holds the data of delegations and amounts and the total +type DelegationsAmounts struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // token_origin is the origin of the tokens that are about to be updated + // token_origins is the list of token origins for and where the amounts are staked TokenOrigins []*TokenOriginInfo `protobuf:"bytes,1,rep,name=token_origins,json=tokenOrigins,proto3" json:"token_origins,omitempty"` + // total amount of tokens in the list + Total string `protobuf:"bytes,2,opt,name=total,proto3" json:"total,omitempty"` } -func (x *DelegationsPreUpdate) Reset() { - *x = DelegationsPreUpdate{} +func (x *DelegationsAmounts) Reset() { + *x = DelegationsAmounts{} if protoimpl.UnsafeEnabled { - mi := &file_layer_reporter_token_origin_proto_msgTypes[2] + mi := &file_layer_reporter_token_origin_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *DelegationsPreUpdate) String() string { +func (x *DelegationsAmounts) String() string { return protoimpl.X.MessageStringOf(x) } -func (*DelegationsPreUpdate) ProtoMessage() {} +func (*DelegationsAmounts) ProtoMessage() {} -// Deprecated: Use DelegationsPreUpdate.ProtoReflect.Descriptor instead. -func (*DelegationsPreUpdate) Descriptor() ([]byte, []int) { - return file_layer_reporter_token_origin_proto_rawDescGZIP(), []int{2} +// Deprecated: Use DelegationsAmounts.ProtoReflect.Descriptor instead. +func (*DelegationsAmounts) Descriptor() ([]byte, []int) { + return file_layer_reporter_token_origin_proto_rawDescGZIP(), []int{1} } -func (x *DelegationsPreUpdate) GetTokenOrigins() []*TokenOriginInfo { +func (x *DelegationsAmounts) GetTokenOrigins() []*TokenOriginInfo { if x != nil { return x.TokenOrigins } return nil } +func (x *DelegationsAmounts) GetTotal() string { + if x != nil { + return x.Total + } + return "" +} + var File_layer_reporter_token_origin_proto protoreflect.FileDescriptor var file_layer_reporter_token_origin_proto_rawDesc = []byte{ @@ -1704,44 +1249,40 @@ var file_layer_reporter_token_origin_proto_rawDesc = []byte{ 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, - 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x7f, 0x0a, 0x0b, 0x54, 0x6f, 0x6b, 0x65, 0x6e, - 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x12, 0x2b, 0x0a, 0x11, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, - 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x10, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x12, 0x43, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, - 0x6e, 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, - 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xb0, 0x01, 0x0a, 0x0f, 0x54, 0x6f, 0x6b, - 0x65, 0x6e, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2b, 0x0a, 0x11, - 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x10, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, - 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x76, 0x61, 0x6c, - 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x10, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x41, - 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x43, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, + 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb0, 0x01, 0x0a, 0x0f, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2b, 0x0a, 0x11, 0x64, + 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x10, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, + 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x76, 0x61, 0x6c, 0x69, + 0x64, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x10, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x43, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, + 0x2e, 0x49, 0x6e, 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, + 0x6e, 0x74, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x9d, 0x01, 0x0a, 0x12, 0x44, + 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, + 0x73, 0x12, 0x44, 0x0a, 0x0d, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x6f, 0x72, 0x69, 0x67, 0x69, + 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, + 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4f, + 0x72, 0x69, 0x67, 0x69, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0c, 0x74, 0x6f, 0x6b, 0x65, 0x6e, + 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x73, 0x12, 0x41, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, - 0x49, 0x6e, 0x74, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x5c, 0x0a, 0x14, 0x44, - 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x50, 0x72, 0x65, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x12, 0x44, 0x0a, 0x0d, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x6f, 0x72, 0x69, - 0x67, 0x69, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6c, 0x61, 0x79, - 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x54, 0x6f, 0x6b, 0x65, - 0x6e, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0c, 0x74, 0x6f, 0x6b, - 0x65, 0x6e, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x73, 0x42, 0xae, 0x01, 0x0a, 0x12, 0x63, 0x6f, - 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, - 0x42, 0x10, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, - 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x72, - 0x74, 0x65, 0x72, 0xa2, 0x02, 0x03, 0x4c, 0x52, 0x58, 0xaa, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, - 0x72, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xca, 0x02, 0x0e, 0x4c, 0x61, 0x79, - 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xe2, 0x02, 0x1a, 0x4c, 0x61, - 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5c, 0x47, 0x50, 0x42, - 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x4c, 0x61, 0x79, 0x65, 0x72, - 0x3a, 0x3a, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, + 0x49, 0x6e, 0x74, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x42, 0xae, 0x01, 0x0a, 0x12, 0x63, + 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, + 0x72, 0x42, 0x10, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, + 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x70, 0x6f, + 0x72, 0x74, 0x65, 0x72, 0xa2, 0x02, 0x03, 0x4c, 0x52, 0x58, 0xaa, 0x02, 0x0e, 0x4c, 0x61, 0x79, + 0x65, 0x72, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xca, 0x02, 0x0e, 0x4c, 0x61, + 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xe2, 0x02, 0x1a, 0x4c, + 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5c, 0x47, 0x50, + 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x4c, 0x61, 0x79, 0x65, + 0x72, 0x3a, 0x3a, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( @@ -1756,14 +1297,13 @@ func file_layer_reporter_token_origin_proto_rawDescGZIP() []byte { return file_layer_reporter_token_origin_proto_rawDescData } -var file_layer_reporter_token_origin_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_layer_reporter_token_origin_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var file_layer_reporter_token_origin_proto_goTypes = []interface{}{ - (*TokenOrigin)(nil), // 0: layer.reporter.TokenOrigin - (*TokenOriginInfo)(nil), // 1: layer.reporter.TokenOriginInfo - (*DelegationsPreUpdate)(nil), // 2: layer.reporter.DelegationsPreUpdate + (*TokenOriginInfo)(nil), // 0: layer.reporter.TokenOriginInfo + (*DelegationsAmounts)(nil), // 1: layer.reporter.DelegationsAmounts } var file_layer_reporter_token_origin_proto_depIdxs = []int32{ - 1, // 0: layer.reporter.DelegationsPreUpdate.token_origins:type_name -> layer.reporter.TokenOriginInfo + 0, // 0: layer.reporter.DelegationsAmounts.token_origins:type_name -> layer.reporter.TokenOriginInfo 1, // [1:1] is the sub-list for method output_type 1, // [1:1] is the sub-list for method input_type 1, // [1:1] is the sub-list for extension type_name @@ -1778,18 +1318,6 @@ func file_layer_reporter_token_origin_proto_init() { } if !protoimpl.UnsafeEnabled { file_layer_reporter_token_origin_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TokenOrigin); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_layer_reporter_token_origin_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*TokenOriginInfo); i { case 0: return &v.state @@ -1801,8 +1329,8 @@ func file_layer_reporter_token_origin_proto_init() { return nil } } - file_layer_reporter_token_origin_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DelegationsPreUpdate); i { + file_layer_reporter_token_origin_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DelegationsAmounts); i { case 0: return &v.state case 1: @@ -1820,7 +1348,7 @@ func file_layer_reporter_token_origin_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_layer_reporter_token_origin_proto_rawDesc, NumEnums: 0, - NumMessages: 3, + NumMessages: 2, NumExtensions: 0, NumServices: 0, }, diff --git a/api/layer/reporter/tx.pulsar.go b/api/layer/reporter/tx.pulsar.go index 2d66e4a5a..2876f9f56 100644 --- a/api/layer/reporter/tx.pulsar.go +++ b/api/layer/reporter/tx.pulsar.go @@ -3,7 +3,7 @@ package reporter import ( _ "cosmossdk.io/api/amino" - v1beta11 "cosmossdk.io/api/cosmos/base/v1beta1" + _ "cosmossdk.io/api/cosmos/base/v1beta1" _ "cosmossdk.io/api/cosmos/msg/v1" v1beta1 "cosmossdk.io/api/cosmos/staking/v1beta1" fmt "fmt" @@ -873,71 +873,16 @@ func (x *fastReflection_MsgUpdateParamsResponse) ProtoMethods() *protoiface.Meth } } -var _ protoreflect.List = (*_MsgCreateReporter_3_list)(nil) - -type _MsgCreateReporter_3_list struct { - list *[]*TokenOrigin -} - -func (x *_MsgCreateReporter_3_list) Len() int { - if x.list == nil { - return 0 - } - return len(*x.list) -} - -func (x *_MsgCreateReporter_3_list) Get(i int) protoreflect.Value { - return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) -} - -func (x *_MsgCreateReporter_3_list) Set(i int, value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*TokenOrigin) - (*x.list)[i] = concreteValue -} - -func (x *_MsgCreateReporter_3_list) Append(value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*TokenOrigin) - *x.list = append(*x.list, concreteValue) -} - -func (x *_MsgCreateReporter_3_list) AppendMutable() protoreflect.Value { - v := new(TokenOrigin) - *x.list = append(*x.list, v) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_MsgCreateReporter_3_list) Truncate(n int) { - for i := n; i < len(*x.list); i++ { - (*x.list)[i] = nil - } - *x.list = (*x.list)[:n] -} - -func (x *_MsgCreateReporter_3_list) NewElement() protoreflect.Value { - v := new(TokenOrigin) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_MsgCreateReporter_3_list) IsValid() bool { - return x.list != nil -} - var ( - md_MsgCreateReporter protoreflect.MessageDescriptor - fd_MsgCreateReporter_reporter protoreflect.FieldDescriptor - fd_MsgCreateReporter_amount protoreflect.FieldDescriptor - fd_MsgCreateReporter_token_origins protoreflect.FieldDescriptor - fd_MsgCreateReporter_commission protoreflect.FieldDescriptor + md_MsgCreateReporter protoreflect.MessageDescriptor + fd_MsgCreateReporter_reporter_address protoreflect.FieldDescriptor + fd_MsgCreateReporter_commission protoreflect.FieldDescriptor ) func init() { file_layer_reporter_tx_proto_init() md_MsgCreateReporter = File_layer_reporter_tx_proto.Messages().ByName("MsgCreateReporter") - fd_MsgCreateReporter_reporter = md_MsgCreateReporter.Fields().ByName("reporter") - fd_MsgCreateReporter_amount = md_MsgCreateReporter.Fields().ByName("amount") - fd_MsgCreateReporter_token_origins = md_MsgCreateReporter.Fields().ByName("token_origins") + fd_MsgCreateReporter_reporter_address = md_MsgCreateReporter.Fields().ByName("reporter_address") fd_MsgCreateReporter_commission = md_MsgCreateReporter.Fields().ByName("commission") } @@ -1006,21 +951,9 @@ func (x *fastReflection_MsgCreateReporter) Interface() protoreflect.ProtoMessage // While iterating, mutating operations may only be performed // on the current field descriptor. func (x *fastReflection_MsgCreateReporter) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Reporter != "" { - value := protoreflect.ValueOfString(x.Reporter) - if !f(fd_MsgCreateReporter_reporter, value) { - return - } - } - if x.Amount != "" { - value := protoreflect.ValueOfString(x.Amount) - if !f(fd_MsgCreateReporter_amount, value) { - return - } - } - if len(x.TokenOrigins) != 0 { - value := protoreflect.ValueOfList(&_MsgCreateReporter_3_list{list: &x.TokenOrigins}) - if !f(fd_MsgCreateReporter_token_origins, value) { + if x.ReporterAddress != "" { + value := protoreflect.ValueOfString(x.ReporterAddress) + if !f(fd_MsgCreateReporter_reporter_address, value) { return } } @@ -1045,12 +978,8 @@ func (x *fastReflection_MsgCreateReporter) Range(f func(protoreflect.FieldDescri // a repeated field is populated if it is non-empty. func (x *fastReflection_MsgCreateReporter) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "layer.reporter.MsgCreateReporter.reporter": - return x.Reporter != "" - case "layer.reporter.MsgCreateReporter.amount": - return x.Amount != "" - case "layer.reporter.MsgCreateReporter.token_origins": - return len(x.TokenOrigins) != 0 + case "layer.reporter.MsgCreateReporter.reporter_address": + return x.ReporterAddress != "" case "layer.reporter.MsgCreateReporter.commission": return x.Commission != nil default: @@ -1069,12 +998,8 @@ func (x *fastReflection_MsgCreateReporter) Has(fd protoreflect.FieldDescriptor) // Clear is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MsgCreateReporter) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "layer.reporter.MsgCreateReporter.reporter": - x.Reporter = "" - case "layer.reporter.MsgCreateReporter.amount": - x.Amount = "" - case "layer.reporter.MsgCreateReporter.token_origins": - x.TokenOrigins = nil + case "layer.reporter.MsgCreateReporter.reporter_address": + x.ReporterAddress = "" case "layer.reporter.MsgCreateReporter.commission": x.Commission = nil default: @@ -1093,18 +1018,9 @@ func (x *fastReflection_MsgCreateReporter) Clear(fd protoreflect.FieldDescriptor // of the value; to obtain a mutable reference, use Mutable. func (x *fastReflection_MsgCreateReporter) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "layer.reporter.MsgCreateReporter.reporter": - value := x.Reporter - return protoreflect.ValueOfString(value) - case "layer.reporter.MsgCreateReporter.amount": - value := x.Amount + case "layer.reporter.MsgCreateReporter.reporter_address": + value := x.ReporterAddress return protoreflect.ValueOfString(value) - case "layer.reporter.MsgCreateReporter.token_origins": - if len(x.TokenOrigins) == 0 { - return protoreflect.ValueOfList(&_MsgCreateReporter_3_list{}) - } - listValue := &_MsgCreateReporter_3_list{list: &x.TokenOrigins} - return protoreflect.ValueOfList(listValue) case "layer.reporter.MsgCreateReporter.commission": value := x.Commission return protoreflect.ValueOfMessage(value.ProtoReflect()) @@ -1128,14 +1044,8 @@ func (x *fastReflection_MsgCreateReporter) Get(descriptor protoreflect.FieldDesc // Set is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MsgCreateReporter) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "layer.reporter.MsgCreateReporter.reporter": - x.Reporter = value.Interface().(string) - case "layer.reporter.MsgCreateReporter.amount": - x.Amount = value.Interface().(string) - case "layer.reporter.MsgCreateReporter.token_origins": - lv := value.List() - clv := lv.(*_MsgCreateReporter_3_list) - x.TokenOrigins = *clv.list + case "layer.reporter.MsgCreateReporter.reporter_address": + x.ReporterAddress = value.Interface().(string) case "layer.reporter.MsgCreateReporter.commission": x.Commission = value.Message().Interface().(*v1beta1.Commission) default: @@ -1158,21 +1068,13 @@ func (x *fastReflection_MsgCreateReporter) Set(fd protoreflect.FieldDescriptor, // Mutable is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MsgCreateReporter) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "layer.reporter.MsgCreateReporter.token_origins": - if x.TokenOrigins == nil { - x.TokenOrigins = []*TokenOrigin{} - } - value := &_MsgCreateReporter_3_list{list: &x.TokenOrigins} - return protoreflect.ValueOfList(value) case "layer.reporter.MsgCreateReporter.commission": if x.Commission == nil { x.Commission = new(v1beta1.Commission) } return protoreflect.ValueOfMessage(x.Commission.ProtoReflect()) - case "layer.reporter.MsgCreateReporter.reporter": - panic(fmt.Errorf("field reporter of message layer.reporter.MsgCreateReporter is not mutable")) - case "layer.reporter.MsgCreateReporter.amount": - panic(fmt.Errorf("field amount of message layer.reporter.MsgCreateReporter is not mutable")) + case "layer.reporter.MsgCreateReporter.reporter_address": + panic(fmt.Errorf("field reporter_address of message layer.reporter.MsgCreateReporter is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgCreateReporter")) @@ -1186,13 +1088,8 @@ func (x *fastReflection_MsgCreateReporter) Mutable(fd protoreflect.FieldDescript // For lists, maps, and messages, this returns a new, empty, mutable value. func (x *fastReflection_MsgCreateReporter) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "layer.reporter.MsgCreateReporter.reporter": + case "layer.reporter.MsgCreateReporter.reporter_address": return protoreflect.ValueOfString("") - case "layer.reporter.MsgCreateReporter.amount": - return protoreflect.ValueOfString("") - case "layer.reporter.MsgCreateReporter.token_origins": - list := []*TokenOrigin{} - return protoreflect.ValueOfList(&_MsgCreateReporter_3_list{list: &list}) case "layer.reporter.MsgCreateReporter.commission": m := new(v1beta1.Commission) return protoreflect.ValueOfMessage(m.ProtoReflect()) @@ -1265,20 +1162,10 @@ func (x *fastReflection_MsgCreateReporter) ProtoMethods() *protoiface.Methods { var n int var l int _ = l - l = len(x.Reporter) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - l = len(x.Amount) + l = len(x.ReporterAddress) if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } - if len(x.TokenOrigins) > 0 { - for _, e := range x.TokenOrigins { - l = options.Size(e) - n += 1 + l + runtime.Sov(uint64(l)) - } - } if x.Commission != nil { l = options.Size(x.Commission) n += 1 + l + runtime.Sov(uint64(l)) @@ -1324,35 +1211,12 @@ func (x *fastReflection_MsgCreateReporter) ProtoMethods() *protoiface.Methods { copy(dAtA[i:], encoded) i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) i-- - dAtA[i] = 0x22 - } - if len(x.TokenOrigins) > 0 { - for iNdEx := len(x.TokenOrigins) - 1; iNdEx >= 0; iNdEx-- { - encoded, err := options.Marshal(x.TokenOrigins[iNdEx]) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0x1a - } - } - if len(x.Amount) > 0 { - i -= len(x.Amount) - copy(dAtA[i:], x.Amount) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Amount))) - i-- dAtA[i] = 0x12 } - if len(x.Reporter) > 0 { - i -= len(x.Reporter) - copy(dAtA[i:], x.Reporter) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Reporter))) + if len(x.ReporterAddress) > 0 { + i -= len(x.ReporterAddress) + copy(dAtA[i:], x.ReporterAddress) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ReporterAddress))) i-- dAtA[i] = 0xa } @@ -1407,7 +1271,7 @@ func (x *fastReflection_MsgCreateReporter) ProtoMethods() *protoiface.Methods { switch fieldNum { case 1: if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Reporter", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ReporterAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1435,75 +1299,9 @@ func (x *fastReflection_MsgCreateReporter) ProtoMethods() *protoiface.Methods { if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.Reporter = string(dAtA[iNdEx:postIndex]) + x.ReporterAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Amount", 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.Amount = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field TokenOrigins", wireType) - } - var msglen int - 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++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - 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.TokenOrigins = append(x.TokenOrigins, &TokenOrigin{}) - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.TokenOrigins[len(x.TokenOrigins)-1]); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - case 4: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Commission", wireType) } @@ -1930,83 +1728,28 @@ func (x *fastReflection_MsgCreateReporterResponse) ProtoMethods() *protoiface.Me } } -var _ protoreflect.List = (*_MsgDelegateReporter_4_list)(nil) - -type _MsgDelegateReporter_4_list struct { - list *[]*TokenOrigin -} - -func (x *_MsgDelegateReporter_4_list) Len() int { - if x.list == nil { - return 0 - } - return len(*x.list) -} - -func (x *_MsgDelegateReporter_4_list) Get(i int) protoreflect.Value { - return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) -} - -func (x *_MsgDelegateReporter_4_list) Set(i int, value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*TokenOrigin) - (*x.list)[i] = concreteValue -} - -func (x *_MsgDelegateReporter_4_list) Append(value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*TokenOrigin) - *x.list = append(*x.list, concreteValue) -} - -func (x *_MsgDelegateReporter_4_list) AppendMutable() protoreflect.Value { - v := new(TokenOrigin) - *x.list = append(*x.list, v) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_MsgDelegateReporter_4_list) Truncate(n int) { - for i := n; i < len(*x.list); i++ { - (*x.list)[i] = nil - } - *x.list = (*x.list)[:n] -} - -func (x *_MsgDelegateReporter_4_list) NewElement() protoreflect.Value { - v := new(TokenOrigin) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_MsgDelegateReporter_4_list) IsValid() bool { - return x.list != nil -} - var ( - md_MsgDelegateReporter protoreflect.MessageDescriptor - fd_MsgDelegateReporter_delegator protoreflect.FieldDescriptor - fd_MsgDelegateReporter_reporter protoreflect.FieldDescriptor - fd_MsgDelegateReporter_amount protoreflect.FieldDescriptor - fd_MsgDelegateReporter_token_origins protoreflect.FieldDescriptor + md_MsgChangeReporter protoreflect.MessageDescriptor + fd_MsgChangeReporter_delegator_address protoreflect.FieldDescriptor + fd_MsgChangeReporter_reporter_address protoreflect.FieldDescriptor ) func init() { file_layer_reporter_tx_proto_init() - md_MsgDelegateReporter = File_layer_reporter_tx_proto.Messages().ByName("MsgDelegateReporter") - fd_MsgDelegateReporter_delegator = md_MsgDelegateReporter.Fields().ByName("delegator") - fd_MsgDelegateReporter_reporter = md_MsgDelegateReporter.Fields().ByName("reporter") - fd_MsgDelegateReporter_amount = md_MsgDelegateReporter.Fields().ByName("amount") - fd_MsgDelegateReporter_token_origins = md_MsgDelegateReporter.Fields().ByName("token_origins") + md_MsgChangeReporter = File_layer_reporter_tx_proto.Messages().ByName("MsgChangeReporter") + fd_MsgChangeReporter_delegator_address = md_MsgChangeReporter.Fields().ByName("delegator_address") + fd_MsgChangeReporter_reporter_address = md_MsgChangeReporter.Fields().ByName("reporter_address") } -var _ protoreflect.Message = (*fastReflection_MsgDelegateReporter)(nil) +var _ protoreflect.Message = (*fastReflection_MsgChangeReporter)(nil) -type fastReflection_MsgDelegateReporter MsgDelegateReporter +type fastReflection_MsgChangeReporter MsgChangeReporter -func (x *MsgDelegateReporter) ProtoReflect() protoreflect.Message { - return (*fastReflection_MsgDelegateReporter)(x) +func (x *MsgChangeReporter) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgChangeReporter)(x) } -func (x *MsgDelegateReporter) slowProtoReflect() protoreflect.Message { +func (x *MsgChangeReporter) slowProtoReflect() protoreflect.Message { mi := &file_layer_reporter_tx_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -2018,43 +1761,43 @@ func (x *MsgDelegateReporter) slowProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -var _fastReflection_MsgDelegateReporter_messageType fastReflection_MsgDelegateReporter_messageType -var _ protoreflect.MessageType = fastReflection_MsgDelegateReporter_messageType{} +var _fastReflection_MsgChangeReporter_messageType fastReflection_MsgChangeReporter_messageType +var _ protoreflect.MessageType = fastReflection_MsgChangeReporter_messageType{} -type fastReflection_MsgDelegateReporter_messageType struct{} +type fastReflection_MsgChangeReporter_messageType struct{} -func (x fastReflection_MsgDelegateReporter_messageType) Zero() protoreflect.Message { - return (*fastReflection_MsgDelegateReporter)(nil) +func (x fastReflection_MsgChangeReporter_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgChangeReporter)(nil) } -func (x fastReflection_MsgDelegateReporter_messageType) New() protoreflect.Message { - return new(fastReflection_MsgDelegateReporter) +func (x fastReflection_MsgChangeReporter_messageType) New() protoreflect.Message { + return new(fastReflection_MsgChangeReporter) } -func (x fastReflection_MsgDelegateReporter_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MsgDelegateReporter +func (x fastReflection_MsgChangeReporter_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgChangeReporter } // Descriptor returns message descriptor, which contains only the protobuf // type information for the message. -func (x *fastReflection_MsgDelegateReporter) Descriptor() protoreflect.MessageDescriptor { - return md_MsgDelegateReporter +func (x *fastReflection_MsgChangeReporter) Descriptor() protoreflect.MessageDescriptor { + return md_MsgChangeReporter } // Type returns the message type, which encapsulates both Go and protobuf // type information. If the Go type information is not needed, // it is recommended that the message descriptor be used instead. -func (x *fastReflection_MsgDelegateReporter) Type() protoreflect.MessageType { - return _fastReflection_MsgDelegateReporter_messageType +func (x *fastReflection_MsgChangeReporter) Type() protoreflect.MessageType { + return _fastReflection_MsgChangeReporter_messageType } // New returns a newly allocated and mutable empty message. -func (x *fastReflection_MsgDelegateReporter) New() protoreflect.Message { - return new(fastReflection_MsgDelegateReporter) +func (x *fastReflection_MsgChangeReporter) New() protoreflect.Message { + return new(fastReflection_MsgChangeReporter) } // Interface unwraps the message reflection interface and // returns the underlying ProtoMessage interface. -func (x *fastReflection_MsgDelegateReporter) Interface() protoreflect.ProtoMessage { - return (*MsgDelegateReporter)(x) +func (x *fastReflection_MsgChangeReporter) Interface() protoreflect.ProtoMessage { + return (*MsgChangeReporter)(x) } // Range iterates over every populated field in an undefined order, @@ -2062,28 +1805,16 @@ func (x *fastReflection_MsgDelegateReporter) Interface() protoreflect.ProtoMessa // Range returns immediately if f returns false. // While iterating, mutating operations may only be performed // on the current field descriptor. -func (x *fastReflection_MsgDelegateReporter) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Delegator != "" { - value := protoreflect.ValueOfString(x.Delegator) - if !f(fd_MsgDelegateReporter_delegator, value) { - return - } - } - if x.Reporter != "" { - value := protoreflect.ValueOfString(x.Reporter) - if !f(fd_MsgDelegateReporter_reporter, value) { - return - } - } - if x.Amount != "" { - value := protoreflect.ValueOfString(x.Amount) - if !f(fd_MsgDelegateReporter_amount, value) { +func (x *fastReflection_MsgChangeReporter) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.DelegatorAddress != "" { + value := protoreflect.ValueOfString(x.DelegatorAddress) + if !f(fd_MsgChangeReporter_delegator_address, value) { return } } - if len(x.TokenOrigins) != 0 { - value := protoreflect.ValueOfList(&_MsgDelegateReporter_4_list{list: &x.TokenOrigins}) - if !f(fd_MsgDelegateReporter_token_origins, value) { + if x.ReporterAddress != "" { + value := protoreflect.ValueOfString(x.ReporterAddress) + if !f(fd_MsgChangeReporter_reporter_address, value) { return } } @@ -2100,21 +1831,17 @@ func (x *fastReflection_MsgDelegateReporter) Range(f func(protoreflect.FieldDesc // In other cases (aside from the nullable cases above), // a proto3 scalar field is populated if it contains a non-zero value, and // a repeated field is populated if it is non-empty. -func (x *fastReflection_MsgDelegateReporter) Has(fd protoreflect.FieldDescriptor) bool { +func (x *fastReflection_MsgChangeReporter) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "layer.reporter.MsgDelegateReporter.delegator": - return x.Delegator != "" - case "layer.reporter.MsgDelegateReporter.reporter": - return x.Reporter != "" - case "layer.reporter.MsgDelegateReporter.amount": - return x.Amount != "" - case "layer.reporter.MsgDelegateReporter.token_origins": - return len(x.TokenOrigins) != 0 + case "layer.reporter.MsgChangeReporter.delegator_address": + return x.DelegatorAddress != "" + case "layer.reporter.MsgChangeReporter.reporter_address": + return x.ReporterAddress != "" default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgDelegateReporter")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgChangeReporter")) } - panic(fmt.Errorf("message layer.reporter.MsgDelegateReporter does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.MsgChangeReporter does not contain field %s", fd.FullName())) } } @@ -2124,21 +1851,17 @@ func (x *fastReflection_MsgDelegateReporter) Has(fd protoreflect.FieldDescriptor // associated with the given field number. // // Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgDelegateReporter) Clear(fd protoreflect.FieldDescriptor) { +func (x *fastReflection_MsgChangeReporter) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "layer.reporter.MsgDelegateReporter.delegator": - x.Delegator = "" - case "layer.reporter.MsgDelegateReporter.reporter": - x.Reporter = "" - case "layer.reporter.MsgDelegateReporter.amount": - x.Amount = "" - case "layer.reporter.MsgDelegateReporter.token_origins": - x.TokenOrigins = nil + case "layer.reporter.MsgChangeReporter.delegator_address": + x.DelegatorAddress = "" + case "layer.reporter.MsgChangeReporter.reporter_address": + x.ReporterAddress = "" default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgDelegateReporter")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgChangeReporter")) } - panic(fmt.Errorf("message layer.reporter.MsgDelegateReporter does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.MsgChangeReporter does not contain field %s", fd.FullName())) } } @@ -2148,28 +1871,19 @@ func (x *fastReflection_MsgDelegateReporter) Clear(fd protoreflect.FieldDescript // the default value of a bytes scalar is guaranteed to be a copy. // For unpopulated composite types, it returns an empty, read-only view // of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_MsgDelegateReporter) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MsgChangeReporter) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "layer.reporter.MsgDelegateReporter.delegator": - value := x.Delegator - return protoreflect.ValueOfString(value) - case "layer.reporter.MsgDelegateReporter.reporter": - value := x.Reporter + case "layer.reporter.MsgChangeReporter.delegator_address": + value := x.DelegatorAddress return protoreflect.ValueOfString(value) - case "layer.reporter.MsgDelegateReporter.amount": - value := x.Amount + case "layer.reporter.MsgChangeReporter.reporter_address": + value := x.ReporterAddress return protoreflect.ValueOfString(value) - case "layer.reporter.MsgDelegateReporter.token_origins": - if len(x.TokenOrigins) == 0 { - return protoreflect.ValueOfList(&_MsgDelegateReporter_4_list{}) - } - listValue := &_MsgDelegateReporter_4_list{list: &x.TokenOrigins} - return protoreflect.ValueOfList(listValue) default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgDelegateReporter")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgChangeReporter")) } - panic(fmt.Errorf("message layer.reporter.MsgDelegateReporter does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message layer.reporter.MsgChangeReporter does not contain field %s", descriptor.FullName())) } } @@ -2183,23 +1897,17 @@ func (x *fastReflection_MsgDelegateReporter) Get(descriptor protoreflect.FieldDe // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgDelegateReporter) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_MsgChangeReporter) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "layer.reporter.MsgDelegateReporter.delegator": - x.Delegator = value.Interface().(string) - case "layer.reporter.MsgDelegateReporter.reporter": - x.Reporter = value.Interface().(string) - case "layer.reporter.MsgDelegateReporter.amount": - x.Amount = value.Interface().(string) - case "layer.reporter.MsgDelegateReporter.token_origins": - lv := value.List() - clv := lv.(*_MsgDelegateReporter_4_list) - x.TokenOrigins = *clv.list + case "layer.reporter.MsgChangeReporter.delegator_address": + x.DelegatorAddress = value.Interface().(string) + case "layer.reporter.MsgChangeReporter.reporter_address": + x.ReporterAddress = value.Interface().(string) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgDelegateReporter")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgChangeReporter")) } - panic(fmt.Errorf("message layer.reporter.MsgDelegateReporter does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.MsgChangeReporter does not contain field %s", fd.FullName())) } } @@ -2213,57 +1921,44 @@ func (x *fastReflection_MsgDelegateReporter) Set(fd protoreflect.FieldDescriptor // It panics if the field does not contain a composite type. // // Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgDelegateReporter) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MsgChangeReporter) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "layer.reporter.MsgDelegateReporter.token_origins": - if x.TokenOrigins == nil { - x.TokenOrigins = []*TokenOrigin{} - } - value := &_MsgDelegateReporter_4_list{list: &x.TokenOrigins} - return protoreflect.ValueOfList(value) - case "layer.reporter.MsgDelegateReporter.delegator": - panic(fmt.Errorf("field delegator of message layer.reporter.MsgDelegateReporter is not mutable")) - case "layer.reporter.MsgDelegateReporter.reporter": - panic(fmt.Errorf("field reporter of message layer.reporter.MsgDelegateReporter is not mutable")) - case "layer.reporter.MsgDelegateReporter.amount": - panic(fmt.Errorf("field amount of message layer.reporter.MsgDelegateReporter is not mutable")) + case "layer.reporter.MsgChangeReporter.delegator_address": + panic(fmt.Errorf("field delegator_address of message layer.reporter.MsgChangeReporter is not mutable")) + case "layer.reporter.MsgChangeReporter.reporter_address": + panic(fmt.Errorf("field reporter_address of message layer.reporter.MsgChangeReporter is not mutable")) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgDelegateReporter")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgChangeReporter")) } - panic(fmt.Errorf("message layer.reporter.MsgDelegateReporter does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.MsgChangeReporter does not contain field %s", fd.FullName())) } } // NewField returns a new value that is assignable to the field // for the given descriptor. For scalars, this returns the default value. // For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_MsgDelegateReporter) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MsgChangeReporter) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "layer.reporter.MsgDelegateReporter.delegator": - return protoreflect.ValueOfString("") - case "layer.reporter.MsgDelegateReporter.reporter": + case "layer.reporter.MsgChangeReporter.delegator_address": return protoreflect.ValueOfString("") - case "layer.reporter.MsgDelegateReporter.amount": + case "layer.reporter.MsgChangeReporter.reporter_address": return protoreflect.ValueOfString("") - case "layer.reporter.MsgDelegateReporter.token_origins": - list := []*TokenOrigin{} - return protoreflect.ValueOfList(&_MsgDelegateReporter_4_list{list: &list}) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgDelegateReporter")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgChangeReporter")) } - panic(fmt.Errorf("message layer.reporter.MsgDelegateReporter does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.MsgChangeReporter does not contain field %s", fd.FullName())) } } // WhichOneof reports which field within the oneof is populated, // returning nil if none are populated. // It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_MsgDelegateReporter) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { +func (x *fastReflection_MsgChangeReporter) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in layer.reporter.MsgDelegateReporter", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in layer.reporter.MsgChangeReporter", d.FullName())) } panic("unreachable") } @@ -2271,7 +1966,7 @@ func (x *fastReflection_MsgDelegateReporter) WhichOneof(d protoreflect.OneofDesc // GetUnknown retrieves the entire list of unknown fields. // The caller may only mutate the contents of the RawFields // if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_MsgDelegateReporter) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_MsgChangeReporter) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -2282,7 +1977,7 @@ func (x *fastReflection_MsgDelegateReporter) GetUnknown() protoreflect.RawFields // An empty RawFields may be passed to clear the fields. // // SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgDelegateReporter) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_MsgChangeReporter) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -2294,7 +1989,7 @@ func (x *fastReflection_MsgDelegateReporter) SetUnknown(fields protoreflect.RawF // message type, but the details are implementation dependent. // Validity is not part of the protobuf data model, and may not // be preserved in marshaling or other operations. -func (x *fastReflection_MsgDelegateReporter) IsValid() bool { +func (x *fastReflection_MsgChangeReporter) IsValid() bool { return x != nil } @@ -2304,9 +1999,9 @@ func (x *fastReflection_MsgDelegateReporter) IsValid() bool { // The returned methods type is identical to // "google.golang.org/protobuf/runtime/protoiface".Methods. // Consult the protoiface package documentation for details. -func (x *fastReflection_MsgDelegateReporter) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_MsgChangeReporter) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MsgDelegateReporter) + x := input.Message.Interface().(*MsgChangeReporter) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2318,24 +2013,14 @@ func (x *fastReflection_MsgDelegateReporter) ProtoMethods() *protoiface.Methods var n int var l int _ = l - l = len(x.Delegator) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - l = len(x.Reporter) + l = len(x.DelegatorAddress) if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } - l = len(x.Amount) + l = len(x.ReporterAddress) if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } - if len(x.TokenOrigins) > 0 { - for _, e := range x.TokenOrigins { - l = options.Size(e) - n += 1 + l + runtime.Sov(uint64(l)) - } - } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -2346,7 +2031,7 @@ func (x *fastReflection_MsgDelegateReporter) ProtoMethods() *protoiface.Methods } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*MsgDelegateReporter) + x := input.Message.Interface().(*MsgChangeReporter) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2365,40 +2050,17 @@ func (x *fastReflection_MsgDelegateReporter) ProtoMethods() *protoiface.Methods i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if len(x.TokenOrigins) > 0 { - for iNdEx := len(x.TokenOrigins) - 1; iNdEx >= 0; iNdEx-- { - encoded, err := options.Marshal(x.TokenOrigins[iNdEx]) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0x22 - } - } - if len(x.Amount) > 0 { - i -= len(x.Amount) - copy(dAtA[i:], x.Amount) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Amount))) - i-- - dAtA[i] = 0x1a - } - if len(x.Reporter) > 0 { - i -= len(x.Reporter) - copy(dAtA[i:], x.Reporter) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Reporter))) + if len(x.ReporterAddress) > 0 { + i -= len(x.ReporterAddress) + copy(dAtA[i:], x.ReporterAddress) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ReporterAddress))) i-- dAtA[i] = 0x12 } - if len(x.Delegator) > 0 { - i -= len(x.Delegator) - copy(dAtA[i:], x.Delegator) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Delegator))) + if len(x.DelegatorAddress) > 0 { + i -= len(x.DelegatorAddress) + copy(dAtA[i:], x.DelegatorAddress) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.DelegatorAddress))) i-- dAtA[i] = 0xa } @@ -2413,7 +2075,7 @@ func (x *fastReflection_MsgDelegateReporter) ProtoMethods() *protoiface.Methods }, nil } unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*MsgDelegateReporter) + x := input.Message.Interface().(*MsgChangeReporter) if x == nil { return protoiface.UnmarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2445,15 +2107,15 @@ func (x *fastReflection_MsgDelegateReporter) ProtoMethods() *protoiface.Methods fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgDelegateReporter: wiretype end group for non-group") + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgChangeReporter: wiretype end group for non-group") } if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgDelegateReporter: illegal tag %d (wire type %d)", fieldNum, wire) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgChangeReporter: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Delegator", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2481,43 +2143,11 @@ func (x *fastReflection_MsgDelegateReporter) ProtoMethods() *protoiface.Methods if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.Delegator = string(dAtA[iNdEx:postIndex]) + x.DelegatorAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Reporter", 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.Reporter = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ReporterAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2545,41 +2175,7 @@ func (x *fastReflection_MsgDelegateReporter) ProtoMethods() *protoiface.Methods if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.Amount = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field TokenOrigins", wireType) - } - var msglen int - 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++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - 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.TokenOrigins = append(x.TokenOrigins, &TokenOrigin{}) - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.TokenOrigins[len(x.TokenOrigins)-1]); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } + x.ReporterAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -2617,23 +2213,23 @@ func (x *fastReflection_MsgDelegateReporter) ProtoMethods() *protoiface.Methods } var ( - md_MsgDelegateReporterResponse protoreflect.MessageDescriptor + md_MsgChangeReporterResponse protoreflect.MessageDescriptor ) func init() { file_layer_reporter_tx_proto_init() - md_MsgDelegateReporterResponse = File_layer_reporter_tx_proto.Messages().ByName("MsgDelegateReporterResponse") + md_MsgChangeReporterResponse = File_layer_reporter_tx_proto.Messages().ByName("MsgChangeReporterResponse") } -var _ protoreflect.Message = (*fastReflection_MsgDelegateReporterResponse)(nil) +var _ protoreflect.Message = (*fastReflection_MsgChangeReporterResponse)(nil) -type fastReflection_MsgDelegateReporterResponse MsgDelegateReporterResponse +type fastReflection_MsgChangeReporterResponse MsgChangeReporterResponse -func (x *MsgDelegateReporterResponse) ProtoReflect() protoreflect.Message { - return (*fastReflection_MsgDelegateReporterResponse)(x) +func (x *MsgChangeReporterResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgChangeReporterResponse)(x) } -func (x *MsgDelegateReporterResponse) slowProtoReflect() protoreflect.Message { +func (x *MsgChangeReporterResponse) slowProtoReflect() protoreflect.Message { mi := &file_layer_reporter_tx_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -2645,43 +2241,43 @@ func (x *MsgDelegateReporterResponse) slowProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -var _fastReflection_MsgDelegateReporterResponse_messageType fastReflection_MsgDelegateReporterResponse_messageType -var _ protoreflect.MessageType = fastReflection_MsgDelegateReporterResponse_messageType{} +var _fastReflection_MsgChangeReporterResponse_messageType fastReflection_MsgChangeReporterResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgChangeReporterResponse_messageType{} -type fastReflection_MsgDelegateReporterResponse_messageType struct{} +type fastReflection_MsgChangeReporterResponse_messageType struct{} -func (x fastReflection_MsgDelegateReporterResponse_messageType) Zero() protoreflect.Message { - return (*fastReflection_MsgDelegateReporterResponse)(nil) +func (x fastReflection_MsgChangeReporterResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgChangeReporterResponse)(nil) } -func (x fastReflection_MsgDelegateReporterResponse_messageType) New() protoreflect.Message { - return new(fastReflection_MsgDelegateReporterResponse) +func (x fastReflection_MsgChangeReporterResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgChangeReporterResponse) } -func (x fastReflection_MsgDelegateReporterResponse_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MsgDelegateReporterResponse +func (x fastReflection_MsgChangeReporterResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgChangeReporterResponse } // Descriptor returns message descriptor, which contains only the protobuf // type information for the message. -func (x *fastReflection_MsgDelegateReporterResponse) Descriptor() protoreflect.MessageDescriptor { - return md_MsgDelegateReporterResponse +func (x *fastReflection_MsgChangeReporterResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgChangeReporterResponse } // Type returns the message type, which encapsulates both Go and protobuf // type information. If the Go type information is not needed, // it is recommended that the message descriptor be used instead. -func (x *fastReflection_MsgDelegateReporterResponse) Type() protoreflect.MessageType { - return _fastReflection_MsgDelegateReporterResponse_messageType +func (x *fastReflection_MsgChangeReporterResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgChangeReporterResponse_messageType } // New returns a newly allocated and mutable empty message. -func (x *fastReflection_MsgDelegateReporterResponse) New() protoreflect.Message { - return new(fastReflection_MsgDelegateReporterResponse) +func (x *fastReflection_MsgChangeReporterResponse) New() protoreflect.Message { + return new(fastReflection_MsgChangeReporterResponse) } // Interface unwraps the message reflection interface and // returns the underlying ProtoMessage interface. -func (x *fastReflection_MsgDelegateReporterResponse) Interface() protoreflect.ProtoMessage { - return (*MsgDelegateReporterResponse)(x) +func (x *fastReflection_MsgChangeReporterResponse) Interface() protoreflect.ProtoMessage { + return (*MsgChangeReporterResponse)(x) } // Range iterates over every populated field in an undefined order, @@ -2689,7 +2285,7 @@ func (x *fastReflection_MsgDelegateReporterResponse) Interface() protoreflect.Pr // Range returns immediately if f returns false. // While iterating, mutating operations may only be performed // on the current field descriptor. -func (x *fastReflection_MsgDelegateReporterResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +func (x *fastReflection_MsgChangeReporterResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { } // Has reports whether a field is populated. @@ -2703,13 +2299,13 @@ func (x *fastReflection_MsgDelegateReporterResponse) Range(f func(protoreflect.F // In other cases (aside from the nullable cases above), // a proto3 scalar field is populated if it contains a non-zero value, and // a repeated field is populated if it is non-empty. -func (x *fastReflection_MsgDelegateReporterResponse) Has(fd protoreflect.FieldDescriptor) bool { +func (x *fastReflection_MsgChangeReporterResponse) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgDelegateReporterResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgChangeReporterResponse")) } - panic(fmt.Errorf("message layer.reporter.MsgDelegateReporterResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.MsgChangeReporterResponse does not contain field %s", fd.FullName())) } } @@ -2719,13 +2315,13 @@ func (x *fastReflection_MsgDelegateReporterResponse) Has(fd protoreflect.FieldDe // associated with the given field number. // // Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgDelegateReporterResponse) Clear(fd protoreflect.FieldDescriptor) { +func (x *fastReflection_MsgChangeReporterResponse) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgDelegateReporterResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgChangeReporterResponse")) } - panic(fmt.Errorf("message layer.reporter.MsgDelegateReporterResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.MsgChangeReporterResponse does not contain field %s", fd.FullName())) } } @@ -2735,13 +2331,13 @@ func (x *fastReflection_MsgDelegateReporterResponse) Clear(fd protoreflect.Field // the default value of a bytes scalar is guaranteed to be a copy. // For unpopulated composite types, it returns an empty, read-only view // of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_MsgDelegateReporterResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MsgChangeReporterResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgDelegateReporterResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgChangeReporterResponse")) } - panic(fmt.Errorf("message layer.reporter.MsgDelegateReporterResponse does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message layer.reporter.MsgChangeReporterResponse does not contain field %s", descriptor.FullName())) } } @@ -2755,13 +2351,13 @@ func (x *fastReflection_MsgDelegateReporterResponse) Get(descriptor protoreflect // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgDelegateReporterResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_MsgChangeReporterResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgDelegateReporterResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgChangeReporterResponse")) } - panic(fmt.Errorf("message layer.reporter.MsgDelegateReporterResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.MsgChangeReporterResponse does not contain field %s", fd.FullName())) } } @@ -2775,36 +2371,36 @@ func (x *fastReflection_MsgDelegateReporterResponse) Set(fd protoreflect.FieldDe // It panics if the field does not contain a composite type. // // Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgDelegateReporterResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MsgChangeReporterResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgDelegateReporterResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgChangeReporterResponse")) } - panic(fmt.Errorf("message layer.reporter.MsgDelegateReporterResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.MsgChangeReporterResponse does not contain field %s", fd.FullName())) } } // NewField returns a new value that is assignable to the field // for the given descriptor. For scalars, this returns the default value. // For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_MsgDelegateReporterResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MsgChangeReporterResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgDelegateReporterResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgChangeReporterResponse")) } - panic(fmt.Errorf("message layer.reporter.MsgDelegateReporterResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.MsgChangeReporterResponse does not contain field %s", fd.FullName())) } } // WhichOneof reports which field within the oneof is populated, // returning nil if none are populated. // It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_MsgDelegateReporterResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { +func (x *fastReflection_MsgChangeReporterResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in layer.reporter.MsgDelegateReporterResponse", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in layer.reporter.MsgChangeReporterResponse", d.FullName())) } panic("unreachable") } @@ -2812,7 +2408,7 @@ func (x *fastReflection_MsgDelegateReporterResponse) WhichOneof(d protoreflect.O // GetUnknown retrieves the entire list of unknown fields. // The caller may only mutate the contents of the RawFields // if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_MsgDelegateReporterResponse) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_MsgChangeReporterResponse) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -2823,7 +2419,7 @@ func (x *fastReflection_MsgDelegateReporterResponse) GetUnknown() protoreflect.R // An empty RawFields may be passed to clear the fields. // // SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgDelegateReporterResponse) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_MsgChangeReporterResponse) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -2835,7 +2431,7 @@ func (x *fastReflection_MsgDelegateReporterResponse) SetUnknown(fields protorefl // message type, but the details are implementation dependent. // Validity is not part of the protobuf data model, and may not // be preserved in marshaling or other operations. -func (x *fastReflection_MsgDelegateReporterResponse) IsValid() bool { +func (x *fastReflection_MsgChangeReporterResponse) IsValid() bool { return x != nil } @@ -2845,9 +2441,9 @@ func (x *fastReflection_MsgDelegateReporterResponse) IsValid() bool { // The returned methods type is identical to // "google.golang.org/protobuf/runtime/protoiface".Methods. // Consult the protoiface package documentation for details. -func (x *fastReflection_MsgDelegateReporterResponse) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_MsgChangeReporterResponse) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MsgDelegateReporterResponse) + x := input.Message.Interface().(*MsgChangeReporterResponse) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2869,7 +2465,7 @@ func (x *fastReflection_MsgDelegateReporterResponse) ProtoMethods() *protoiface. } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*MsgDelegateReporterResponse) + x := input.Message.Interface().(*MsgChangeReporterResponse) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2899,7 +2495,7 @@ func (x *fastReflection_MsgDelegateReporterResponse) ProtoMethods() *protoiface. }, nil } unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*MsgDelegateReporterResponse) + x := input.Message.Interface().(*MsgChangeReporterResponse) if x == nil { return protoiface.UnmarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2931,10 +2527,10 @@ func (x *fastReflection_MsgDelegateReporterResponse) ProtoMethods() *protoiface. fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgDelegateReporterResponse: wiretype end group for non-group") + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgChangeReporterResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgDelegateReporterResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgChangeReporterResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -2972,79 +2568,26 @@ func (x *fastReflection_MsgDelegateReporterResponse) ProtoMethods() *protoiface. } } -var _ protoreflect.List = (*_MsgUndelegateReporter_2_list)(nil) +var ( + md_MsgUnjailReporter protoreflect.MessageDescriptor + fd_MsgUnjailReporter_reporter_address protoreflect.FieldDescriptor +) -type _MsgUndelegateReporter_2_list struct { - list *[]*TokenOrigin +func init() { + file_layer_reporter_tx_proto_init() + md_MsgUnjailReporter = File_layer_reporter_tx_proto.Messages().ByName("MsgUnjailReporter") + fd_MsgUnjailReporter_reporter_address = md_MsgUnjailReporter.Fields().ByName("reporter_address") } -func (x *_MsgUndelegateReporter_2_list) Len() int { - if x.list == nil { - return 0 - } - return len(*x.list) -} +var _ protoreflect.Message = (*fastReflection_MsgUnjailReporter)(nil) -func (x *_MsgUndelegateReporter_2_list) Get(i int) protoreflect.Value { - return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) -} +type fastReflection_MsgUnjailReporter MsgUnjailReporter -func (x *_MsgUndelegateReporter_2_list) Set(i int, value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*TokenOrigin) - (*x.list)[i] = concreteValue +func (x *MsgUnjailReporter) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUnjailReporter)(x) } -func (x *_MsgUndelegateReporter_2_list) Append(value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*TokenOrigin) - *x.list = append(*x.list, concreteValue) -} - -func (x *_MsgUndelegateReporter_2_list) AppendMutable() protoreflect.Value { - v := new(TokenOrigin) - *x.list = append(*x.list, v) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_MsgUndelegateReporter_2_list) Truncate(n int) { - for i := n; i < len(*x.list); i++ { - (*x.list)[i] = nil - } - *x.list = (*x.list)[:n] -} - -func (x *_MsgUndelegateReporter_2_list) NewElement() protoreflect.Value { - v := new(TokenOrigin) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_MsgUndelegateReporter_2_list) IsValid() bool { - return x.list != nil -} - -var ( - md_MsgUndelegateReporter protoreflect.MessageDescriptor - fd_MsgUndelegateReporter_delegator_address protoreflect.FieldDescriptor - fd_MsgUndelegateReporter_token_origins protoreflect.FieldDescriptor -) - -func init() { - file_layer_reporter_tx_proto_init() - md_MsgUndelegateReporter = File_layer_reporter_tx_proto.Messages().ByName("MsgUndelegateReporter") - fd_MsgUndelegateReporter_delegator_address = md_MsgUndelegateReporter.Fields().ByName("delegator_address") - fd_MsgUndelegateReporter_token_origins = md_MsgUndelegateReporter.Fields().ByName("token_origins") -} - -var _ protoreflect.Message = (*fastReflection_MsgUndelegateReporter)(nil) - -type fastReflection_MsgUndelegateReporter MsgUndelegateReporter - -func (x *MsgUndelegateReporter) ProtoReflect() protoreflect.Message { - return (*fastReflection_MsgUndelegateReporter)(x) -} - -func (x *MsgUndelegateReporter) slowProtoReflect() protoreflect.Message { +func (x *MsgUnjailReporter) slowProtoReflect() protoreflect.Message { mi := &file_layer_reporter_tx_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -3056,43 +2599,43 @@ func (x *MsgUndelegateReporter) slowProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -var _fastReflection_MsgUndelegateReporter_messageType fastReflection_MsgUndelegateReporter_messageType -var _ protoreflect.MessageType = fastReflection_MsgUndelegateReporter_messageType{} +var _fastReflection_MsgUnjailReporter_messageType fastReflection_MsgUnjailReporter_messageType +var _ protoreflect.MessageType = fastReflection_MsgUnjailReporter_messageType{} -type fastReflection_MsgUndelegateReporter_messageType struct{} +type fastReflection_MsgUnjailReporter_messageType struct{} -func (x fastReflection_MsgUndelegateReporter_messageType) Zero() protoreflect.Message { - return (*fastReflection_MsgUndelegateReporter)(nil) +func (x fastReflection_MsgUnjailReporter_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUnjailReporter)(nil) } -func (x fastReflection_MsgUndelegateReporter_messageType) New() protoreflect.Message { - return new(fastReflection_MsgUndelegateReporter) +func (x fastReflection_MsgUnjailReporter_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUnjailReporter) } -func (x fastReflection_MsgUndelegateReporter_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MsgUndelegateReporter +func (x fastReflection_MsgUnjailReporter_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUnjailReporter } // Descriptor returns message descriptor, which contains only the protobuf // type information for the message. -func (x *fastReflection_MsgUndelegateReporter) Descriptor() protoreflect.MessageDescriptor { - return md_MsgUndelegateReporter +func (x *fastReflection_MsgUnjailReporter) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUnjailReporter } // Type returns the message type, which encapsulates both Go and protobuf // type information. If the Go type information is not needed, // it is recommended that the message descriptor be used instead. -func (x *fastReflection_MsgUndelegateReporter) Type() protoreflect.MessageType { - return _fastReflection_MsgUndelegateReporter_messageType +func (x *fastReflection_MsgUnjailReporter) Type() protoreflect.MessageType { + return _fastReflection_MsgUnjailReporter_messageType } // New returns a newly allocated and mutable empty message. -func (x *fastReflection_MsgUndelegateReporter) New() protoreflect.Message { - return new(fastReflection_MsgUndelegateReporter) +func (x *fastReflection_MsgUnjailReporter) New() protoreflect.Message { + return new(fastReflection_MsgUnjailReporter) } // Interface unwraps the message reflection interface and // returns the underlying ProtoMessage interface. -func (x *fastReflection_MsgUndelegateReporter) Interface() protoreflect.ProtoMessage { - return (*MsgUndelegateReporter)(x) +func (x *fastReflection_MsgUnjailReporter) Interface() protoreflect.ProtoMessage { + return (*MsgUnjailReporter)(x) } // Range iterates over every populated field in an undefined order, @@ -3100,16 +2643,10 @@ func (x *fastReflection_MsgUndelegateReporter) Interface() protoreflect.ProtoMes // Range returns immediately if f returns false. // While iterating, mutating operations may only be performed // on the current field descriptor. -func (x *fastReflection_MsgUndelegateReporter) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.DelegatorAddress != "" { - value := protoreflect.ValueOfString(x.DelegatorAddress) - if !f(fd_MsgUndelegateReporter_delegator_address, value) { - return - } - } - if len(x.TokenOrigins) != 0 { - value := protoreflect.ValueOfList(&_MsgUndelegateReporter_2_list{list: &x.TokenOrigins}) - if !f(fd_MsgUndelegateReporter_token_origins, value) { +func (x *fastReflection_MsgUnjailReporter) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.ReporterAddress != "" { + value := protoreflect.ValueOfString(x.ReporterAddress) + if !f(fd_MsgUnjailReporter_reporter_address, value) { return } } @@ -3126,17 +2663,15 @@ func (x *fastReflection_MsgUndelegateReporter) Range(f func(protoreflect.FieldDe // In other cases (aside from the nullable cases above), // a proto3 scalar field is populated if it contains a non-zero value, and // a repeated field is populated if it is non-empty. -func (x *fastReflection_MsgUndelegateReporter) Has(fd protoreflect.FieldDescriptor) bool { +func (x *fastReflection_MsgUnjailReporter) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "layer.reporter.MsgUndelegateReporter.delegator_address": - return x.DelegatorAddress != "" - case "layer.reporter.MsgUndelegateReporter.token_origins": - return len(x.TokenOrigins) != 0 + case "layer.reporter.MsgUnjailReporter.reporter_address": + return x.ReporterAddress != "" default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgUndelegateReporter")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgUnjailReporter")) } - panic(fmt.Errorf("message layer.reporter.MsgUndelegateReporter does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.MsgUnjailReporter does not contain field %s", fd.FullName())) } } @@ -3146,17 +2681,15 @@ func (x *fastReflection_MsgUndelegateReporter) Has(fd protoreflect.FieldDescript // associated with the given field number. // // Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgUndelegateReporter) Clear(fd protoreflect.FieldDescriptor) { +func (x *fastReflection_MsgUnjailReporter) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "layer.reporter.MsgUndelegateReporter.delegator_address": - x.DelegatorAddress = "" - case "layer.reporter.MsgUndelegateReporter.token_origins": - x.TokenOrigins = nil + case "layer.reporter.MsgUnjailReporter.reporter_address": + x.ReporterAddress = "" default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgUndelegateReporter")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgUnjailReporter")) } - panic(fmt.Errorf("message layer.reporter.MsgUndelegateReporter does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.MsgUnjailReporter does not contain field %s", fd.FullName())) } } @@ -3166,22 +2699,16 @@ func (x *fastReflection_MsgUndelegateReporter) Clear(fd protoreflect.FieldDescri // the default value of a bytes scalar is guaranteed to be a copy. // For unpopulated composite types, it returns an empty, read-only view // of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_MsgUndelegateReporter) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MsgUnjailReporter) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "layer.reporter.MsgUndelegateReporter.delegator_address": - value := x.DelegatorAddress + case "layer.reporter.MsgUnjailReporter.reporter_address": + value := x.ReporterAddress return protoreflect.ValueOfString(value) - case "layer.reporter.MsgUndelegateReporter.token_origins": - if len(x.TokenOrigins) == 0 { - return protoreflect.ValueOfList(&_MsgUndelegateReporter_2_list{}) - } - listValue := &_MsgUndelegateReporter_2_list{list: &x.TokenOrigins} - return protoreflect.ValueOfList(listValue) default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgUndelegateReporter")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgUnjailReporter")) } - panic(fmt.Errorf("message layer.reporter.MsgUndelegateReporter does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message layer.reporter.MsgUnjailReporter does not contain field %s", descriptor.FullName())) } } @@ -3195,19 +2722,15 @@ func (x *fastReflection_MsgUndelegateReporter) Get(descriptor protoreflect.Field // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgUndelegateReporter) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_MsgUnjailReporter) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "layer.reporter.MsgUndelegateReporter.delegator_address": - x.DelegatorAddress = value.Interface().(string) - case "layer.reporter.MsgUndelegateReporter.token_origins": - lv := value.List() - clv := lv.(*_MsgUndelegateReporter_2_list) - x.TokenOrigins = *clv.list + case "layer.reporter.MsgUnjailReporter.reporter_address": + x.ReporterAddress = value.Interface().(string) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgUndelegateReporter")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgUnjailReporter")) } - panic(fmt.Errorf("message layer.reporter.MsgUndelegateReporter does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.MsgUnjailReporter does not contain field %s", fd.FullName())) } } @@ -3221,49 +2744,40 @@ func (x *fastReflection_MsgUndelegateReporter) Set(fd protoreflect.FieldDescript // It panics if the field does not contain a composite type. // // Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgUndelegateReporter) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MsgUnjailReporter) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "layer.reporter.MsgUndelegateReporter.token_origins": - if x.TokenOrigins == nil { - x.TokenOrigins = []*TokenOrigin{} - } - value := &_MsgUndelegateReporter_2_list{list: &x.TokenOrigins} - return protoreflect.ValueOfList(value) - case "layer.reporter.MsgUndelegateReporter.delegator_address": - panic(fmt.Errorf("field delegator_address of message layer.reporter.MsgUndelegateReporter is not mutable")) + case "layer.reporter.MsgUnjailReporter.reporter_address": + panic(fmt.Errorf("field reporter_address of message layer.reporter.MsgUnjailReporter is not mutable")) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgUndelegateReporter")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgUnjailReporter")) } - panic(fmt.Errorf("message layer.reporter.MsgUndelegateReporter does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.MsgUnjailReporter does not contain field %s", fd.FullName())) } } // NewField returns a new value that is assignable to the field // for the given descriptor. For scalars, this returns the default value. // For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_MsgUndelegateReporter) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MsgUnjailReporter) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "layer.reporter.MsgUndelegateReporter.delegator_address": + case "layer.reporter.MsgUnjailReporter.reporter_address": return protoreflect.ValueOfString("") - case "layer.reporter.MsgUndelegateReporter.token_origins": - list := []*TokenOrigin{} - return protoreflect.ValueOfList(&_MsgUndelegateReporter_2_list{list: &list}) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgUndelegateReporter")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgUnjailReporter")) } - panic(fmt.Errorf("message layer.reporter.MsgUndelegateReporter does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.MsgUnjailReporter does not contain field %s", fd.FullName())) } } // WhichOneof reports which field within the oneof is populated, // returning nil if none are populated. // It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_MsgUndelegateReporter) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { +func (x *fastReflection_MsgUnjailReporter) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in layer.reporter.MsgUndelegateReporter", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in layer.reporter.MsgUnjailReporter", d.FullName())) } panic("unreachable") } @@ -3271,7 +2785,7 @@ func (x *fastReflection_MsgUndelegateReporter) WhichOneof(d protoreflect.OneofDe // GetUnknown retrieves the entire list of unknown fields. // The caller may only mutate the contents of the RawFields // if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_MsgUndelegateReporter) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_MsgUnjailReporter) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -3282,7 +2796,7 @@ func (x *fastReflection_MsgUndelegateReporter) GetUnknown() protoreflect.RawFiel // An empty RawFields may be passed to clear the fields. // // SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgUndelegateReporter) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_MsgUnjailReporter) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -3294,7 +2808,7 @@ func (x *fastReflection_MsgUndelegateReporter) SetUnknown(fields protoreflect.Ra // message type, but the details are implementation dependent. // Validity is not part of the protobuf data model, and may not // be preserved in marshaling or other operations. -func (x *fastReflection_MsgUndelegateReporter) IsValid() bool { +func (x *fastReflection_MsgUnjailReporter) IsValid() bool { return x != nil } @@ -3304,9 +2818,9 @@ func (x *fastReflection_MsgUndelegateReporter) IsValid() bool { // The returned methods type is identical to // "google.golang.org/protobuf/runtime/protoiface".Methods. // Consult the protoiface package documentation for details. -func (x *fastReflection_MsgUndelegateReporter) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_MsgUnjailReporter) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MsgUndelegateReporter) + x := input.Message.Interface().(*MsgUnjailReporter) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -3318,16 +2832,10 @@ func (x *fastReflection_MsgUndelegateReporter) ProtoMethods() *protoiface.Method var n int var l int _ = l - l = len(x.DelegatorAddress) + l = len(x.ReporterAddress) if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } - if len(x.TokenOrigins) > 0 { - for _, e := range x.TokenOrigins { - l = options.Size(e) - n += 1 + l + runtime.Sov(uint64(l)) - } - } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -3338,7 +2846,7 @@ func (x *fastReflection_MsgUndelegateReporter) ProtoMethods() *protoiface.Method } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*MsgUndelegateReporter) + x := input.Message.Interface().(*MsgUnjailReporter) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -3357,26 +2865,10 @@ func (x *fastReflection_MsgUndelegateReporter) ProtoMethods() *protoiface.Method i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if len(x.TokenOrigins) > 0 { - for iNdEx := len(x.TokenOrigins) - 1; iNdEx >= 0; iNdEx-- { - encoded, err := options.Marshal(x.TokenOrigins[iNdEx]) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0x12 - } - } - if len(x.DelegatorAddress) > 0 { - i -= len(x.DelegatorAddress) - copy(dAtA[i:], x.DelegatorAddress) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.DelegatorAddress))) + if len(x.ReporterAddress) > 0 { + i -= len(x.ReporterAddress) + copy(dAtA[i:], x.ReporterAddress) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ReporterAddress))) i-- dAtA[i] = 0xa } @@ -3391,7 +2883,7 @@ func (x *fastReflection_MsgUndelegateReporter) ProtoMethods() *protoiface.Method }, nil } unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*MsgUndelegateReporter) + x := input.Message.Interface().(*MsgUnjailReporter) if x == nil { return protoiface.UnmarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -3423,15 +2915,15 @@ func (x *fastReflection_MsgUndelegateReporter) ProtoMethods() *protoiface.Method fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUndelegateReporter: wiretype end group for non-group") + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUnjailReporter: wiretype end group for non-group") } if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUndelegateReporter: illegal tag %d (wire type %d)", fieldNum, wire) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUnjailReporter: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ReporterAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3459,41 +2951,7 @@ func (x *fastReflection_MsgUndelegateReporter) ProtoMethods() *protoiface.Method if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.DelegatorAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field TokenOrigins", wireType) - } - var msglen int - 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++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - 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.TokenOrigins = append(x.TokenOrigins, &TokenOrigin{}) - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.TokenOrigins[len(x.TokenOrigins)-1]); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } + x.ReporterAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -3531,23 +2989,23 @@ func (x *fastReflection_MsgUndelegateReporter) ProtoMethods() *protoiface.Method } var ( - md_MsgUndelegateReporterResponse protoreflect.MessageDescriptor + md_MsgUnjailReporterResponse protoreflect.MessageDescriptor ) func init() { file_layer_reporter_tx_proto_init() - md_MsgUndelegateReporterResponse = File_layer_reporter_tx_proto.Messages().ByName("MsgUndelegateReporterResponse") + md_MsgUnjailReporterResponse = File_layer_reporter_tx_proto.Messages().ByName("MsgUnjailReporterResponse") } -var _ protoreflect.Message = (*fastReflection_MsgUndelegateReporterResponse)(nil) +var _ protoreflect.Message = (*fastReflection_MsgUnjailReporterResponse)(nil) -type fastReflection_MsgUndelegateReporterResponse MsgUndelegateReporterResponse +type fastReflection_MsgUnjailReporterResponse MsgUnjailReporterResponse -func (x *MsgUndelegateReporterResponse) ProtoReflect() protoreflect.Message { - return (*fastReflection_MsgUndelegateReporterResponse)(x) +func (x *MsgUnjailReporterResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUnjailReporterResponse)(x) } -func (x *MsgUndelegateReporterResponse) slowProtoReflect() protoreflect.Message { +func (x *MsgUnjailReporterResponse) slowProtoReflect() protoreflect.Message { mi := &file_layer_reporter_tx_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -3559,43 +3017,43 @@ func (x *MsgUndelegateReporterResponse) slowProtoReflect() protoreflect.Message return mi.MessageOf(x) } -var _fastReflection_MsgUndelegateReporterResponse_messageType fastReflection_MsgUndelegateReporterResponse_messageType -var _ protoreflect.MessageType = fastReflection_MsgUndelegateReporterResponse_messageType{} +var _fastReflection_MsgUnjailReporterResponse_messageType fastReflection_MsgUnjailReporterResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgUnjailReporterResponse_messageType{} -type fastReflection_MsgUndelegateReporterResponse_messageType struct{} +type fastReflection_MsgUnjailReporterResponse_messageType struct{} -func (x fastReflection_MsgUndelegateReporterResponse_messageType) Zero() protoreflect.Message { - return (*fastReflection_MsgUndelegateReporterResponse)(nil) +func (x fastReflection_MsgUnjailReporterResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUnjailReporterResponse)(nil) } -func (x fastReflection_MsgUndelegateReporterResponse_messageType) New() protoreflect.Message { - return new(fastReflection_MsgUndelegateReporterResponse) +func (x fastReflection_MsgUnjailReporterResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUnjailReporterResponse) } -func (x fastReflection_MsgUndelegateReporterResponse_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MsgUndelegateReporterResponse +func (x fastReflection_MsgUnjailReporterResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUnjailReporterResponse } // Descriptor returns message descriptor, which contains only the protobuf // type information for the message. -func (x *fastReflection_MsgUndelegateReporterResponse) Descriptor() protoreflect.MessageDescriptor { - return md_MsgUndelegateReporterResponse +func (x *fastReflection_MsgUnjailReporterResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUnjailReporterResponse } // Type returns the message type, which encapsulates both Go and protobuf // type information. If the Go type information is not needed, // it is recommended that the message descriptor be used instead. -func (x *fastReflection_MsgUndelegateReporterResponse) Type() protoreflect.MessageType { - return _fastReflection_MsgUndelegateReporterResponse_messageType +func (x *fastReflection_MsgUnjailReporterResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgUnjailReporterResponse_messageType } // New returns a newly allocated and mutable empty message. -func (x *fastReflection_MsgUndelegateReporterResponse) New() protoreflect.Message { - return new(fastReflection_MsgUndelegateReporterResponse) +func (x *fastReflection_MsgUnjailReporterResponse) New() protoreflect.Message { + return new(fastReflection_MsgUnjailReporterResponse) } // Interface unwraps the message reflection interface and // returns the underlying ProtoMessage interface. -func (x *fastReflection_MsgUndelegateReporterResponse) Interface() protoreflect.ProtoMessage { - return (*MsgUndelegateReporterResponse)(x) +func (x *fastReflection_MsgUnjailReporterResponse) Interface() protoreflect.ProtoMessage { + return (*MsgUnjailReporterResponse)(x) } // Range iterates over every populated field in an undefined order, @@ -3603,7 +3061,7 @@ func (x *fastReflection_MsgUndelegateReporterResponse) Interface() protoreflect. // Range returns immediately if f returns false. // While iterating, mutating operations may only be performed // on the current field descriptor. -func (x *fastReflection_MsgUndelegateReporterResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +func (x *fastReflection_MsgUnjailReporterResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { } // Has reports whether a field is populated. @@ -3617,13 +3075,13 @@ func (x *fastReflection_MsgUndelegateReporterResponse) Range(f func(protoreflect // In other cases (aside from the nullable cases above), // a proto3 scalar field is populated if it contains a non-zero value, and // a repeated field is populated if it is non-empty. -func (x *fastReflection_MsgUndelegateReporterResponse) Has(fd protoreflect.FieldDescriptor) bool { +func (x *fastReflection_MsgUnjailReporterResponse) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgUndelegateReporterResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgUnjailReporterResponse")) } - panic(fmt.Errorf("message layer.reporter.MsgUndelegateReporterResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.MsgUnjailReporterResponse does not contain field %s", fd.FullName())) } } @@ -3633,13 +3091,13 @@ func (x *fastReflection_MsgUndelegateReporterResponse) Has(fd protoreflect.Field // associated with the given field number. // // Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgUndelegateReporterResponse) Clear(fd protoreflect.FieldDescriptor) { +func (x *fastReflection_MsgUnjailReporterResponse) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgUndelegateReporterResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgUnjailReporterResponse")) } - panic(fmt.Errorf("message layer.reporter.MsgUndelegateReporterResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.MsgUnjailReporterResponse does not contain field %s", fd.FullName())) } } @@ -3649,13 +3107,13 @@ func (x *fastReflection_MsgUndelegateReporterResponse) Clear(fd protoreflect.Fie // the default value of a bytes scalar is guaranteed to be a copy. // For unpopulated composite types, it returns an empty, read-only view // of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_MsgUndelegateReporterResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MsgUnjailReporterResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgUndelegateReporterResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgUnjailReporterResponse")) } - panic(fmt.Errorf("message layer.reporter.MsgUndelegateReporterResponse does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message layer.reporter.MsgUnjailReporterResponse does not contain field %s", descriptor.FullName())) } } @@ -3669,13 +3127,13 @@ func (x *fastReflection_MsgUndelegateReporterResponse) Get(descriptor protorefle // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgUndelegateReporterResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_MsgUnjailReporterResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgUndelegateReporterResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgUnjailReporterResponse")) } - panic(fmt.Errorf("message layer.reporter.MsgUndelegateReporterResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.MsgUnjailReporterResponse does not contain field %s", fd.FullName())) } } @@ -3689,36 +3147,36 @@ func (x *fastReflection_MsgUndelegateReporterResponse) Set(fd protoreflect.Field // It panics if the field does not contain a composite type. // // Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgUndelegateReporterResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MsgUnjailReporterResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgUndelegateReporterResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgUnjailReporterResponse")) } - panic(fmt.Errorf("message layer.reporter.MsgUndelegateReporterResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.MsgUnjailReporterResponse does not contain field %s", fd.FullName())) } } // NewField returns a new value that is assignable to the field // for the given descriptor. For scalars, this returns the default value. // For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_MsgUndelegateReporterResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MsgUnjailReporterResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgUndelegateReporterResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgUnjailReporterResponse")) } - panic(fmt.Errorf("message layer.reporter.MsgUndelegateReporterResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.MsgUnjailReporterResponse does not contain field %s", fd.FullName())) } } // WhichOneof reports which field within the oneof is populated, // returning nil if none are populated. // It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_MsgUndelegateReporterResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { +func (x *fastReflection_MsgUnjailReporterResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in layer.reporter.MsgUndelegateReporterResponse", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in layer.reporter.MsgUnjailReporterResponse", d.FullName())) } panic("unreachable") } @@ -3726,7 +3184,7 @@ func (x *fastReflection_MsgUndelegateReporterResponse) WhichOneof(d protoreflect // GetUnknown retrieves the entire list of unknown fields. // The caller may only mutate the contents of the RawFields // if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_MsgUndelegateReporterResponse) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_MsgUnjailReporterResponse) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -3737,7 +3195,7 @@ func (x *fastReflection_MsgUndelegateReporterResponse) GetUnknown() protoreflect // An empty RawFields may be passed to clear the fields. // // SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgUndelegateReporterResponse) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_MsgUnjailReporterResponse) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -3749,7 +3207,7 @@ func (x *fastReflection_MsgUndelegateReporterResponse) SetUnknown(fields protore // message type, but the details are implementation dependent. // Validity is not part of the protobuf data model, and may not // be preserved in marshaling or other operations. -func (x *fastReflection_MsgUndelegateReporterResponse) IsValid() bool { +func (x *fastReflection_MsgUnjailReporterResponse) IsValid() bool { return x != nil } @@ -3759,9 +3217,9 @@ func (x *fastReflection_MsgUndelegateReporterResponse) IsValid() bool { // The returned methods type is identical to // "google.golang.org/protobuf/runtime/protoiface".Methods. // Consult the protoiface package documentation for details. -func (x *fastReflection_MsgUndelegateReporterResponse) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_MsgUnjailReporterResponse) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MsgUndelegateReporterResponse) + x := input.Message.Interface().(*MsgUnjailReporterResponse) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -3783,7 +3241,7 @@ func (x *fastReflection_MsgUndelegateReporterResponse) ProtoMethods() *protoifac } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*MsgUndelegateReporterResponse) + x := input.Message.Interface().(*MsgUnjailReporterResponse) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -3813,7 +3271,7 @@ func (x *fastReflection_MsgUndelegateReporterResponse) ProtoMethods() *protoifac }, nil } unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*MsgUndelegateReporterResponse) + x := input.Message.Interface().(*MsgUnjailReporterResponse) if x == nil { return protoiface.UnmarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -3845,10 +3303,10 @@ func (x *fastReflection_MsgUndelegateReporterResponse) ProtoMethods() *protoifac fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUndelegateReporterResponse: wiretype end group for non-group") + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUnjailReporterResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUndelegateReporterResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUnjailReporterResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -3887,25 +3345,27 @@ func (x *fastReflection_MsgUndelegateReporterResponse) ProtoMethods() *protoifac } var ( - md_MsgWithdrawReporterCommission protoreflect.MessageDescriptor - fd_MsgWithdrawReporterCommission_reporter_address protoreflect.FieldDescriptor + md_MsgWithdrawTip protoreflect.MessageDescriptor + fd_MsgWithdrawTip_delegator_address protoreflect.FieldDescriptor + fd_MsgWithdrawTip_validator_address protoreflect.FieldDescriptor ) func init() { file_layer_reporter_tx_proto_init() - md_MsgWithdrawReporterCommission = File_layer_reporter_tx_proto.Messages().ByName("MsgWithdrawReporterCommission") - fd_MsgWithdrawReporterCommission_reporter_address = md_MsgWithdrawReporterCommission.Fields().ByName("reporter_address") + md_MsgWithdrawTip = File_layer_reporter_tx_proto.Messages().ByName("MsgWithdrawTip") + fd_MsgWithdrawTip_delegator_address = md_MsgWithdrawTip.Fields().ByName("delegator_address") + fd_MsgWithdrawTip_validator_address = md_MsgWithdrawTip.Fields().ByName("validator_address") } -var _ protoreflect.Message = (*fastReflection_MsgWithdrawReporterCommission)(nil) +var _ protoreflect.Message = (*fastReflection_MsgWithdrawTip)(nil) -type fastReflection_MsgWithdrawReporterCommission MsgWithdrawReporterCommission +type fastReflection_MsgWithdrawTip MsgWithdrawTip -func (x *MsgWithdrawReporterCommission) ProtoReflect() protoreflect.Message { - return (*fastReflection_MsgWithdrawReporterCommission)(x) +func (x *MsgWithdrawTip) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgWithdrawTip)(x) } -func (x *MsgWithdrawReporterCommission) slowProtoReflect() protoreflect.Message { +func (x *MsgWithdrawTip) slowProtoReflect() protoreflect.Message { mi := &file_layer_reporter_tx_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -3917,43 +3377,43 @@ func (x *MsgWithdrawReporterCommission) slowProtoReflect() protoreflect.Message return mi.MessageOf(x) } -var _fastReflection_MsgWithdrawReporterCommission_messageType fastReflection_MsgWithdrawReporterCommission_messageType -var _ protoreflect.MessageType = fastReflection_MsgWithdrawReporterCommission_messageType{} +var _fastReflection_MsgWithdrawTip_messageType fastReflection_MsgWithdrawTip_messageType +var _ protoreflect.MessageType = fastReflection_MsgWithdrawTip_messageType{} -type fastReflection_MsgWithdrawReporterCommission_messageType struct{} +type fastReflection_MsgWithdrawTip_messageType struct{} -func (x fastReflection_MsgWithdrawReporterCommission_messageType) Zero() protoreflect.Message { - return (*fastReflection_MsgWithdrawReporterCommission)(nil) +func (x fastReflection_MsgWithdrawTip_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgWithdrawTip)(nil) } -func (x fastReflection_MsgWithdrawReporterCommission_messageType) New() protoreflect.Message { - return new(fastReflection_MsgWithdrawReporterCommission) +func (x fastReflection_MsgWithdrawTip_messageType) New() protoreflect.Message { + return new(fastReflection_MsgWithdrawTip) } -func (x fastReflection_MsgWithdrawReporterCommission_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MsgWithdrawReporterCommission +func (x fastReflection_MsgWithdrawTip_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgWithdrawTip } // Descriptor returns message descriptor, which contains only the protobuf // type information for the message. -func (x *fastReflection_MsgWithdrawReporterCommission) Descriptor() protoreflect.MessageDescriptor { - return md_MsgWithdrawReporterCommission +func (x *fastReflection_MsgWithdrawTip) Descriptor() protoreflect.MessageDescriptor { + return md_MsgWithdrawTip } // Type returns the message type, which encapsulates both Go and protobuf // type information. If the Go type information is not needed, // it is recommended that the message descriptor be used instead. -func (x *fastReflection_MsgWithdrawReporterCommission) Type() protoreflect.MessageType { - return _fastReflection_MsgWithdrawReporterCommission_messageType +func (x *fastReflection_MsgWithdrawTip) Type() protoreflect.MessageType { + return _fastReflection_MsgWithdrawTip_messageType } // New returns a newly allocated and mutable empty message. -func (x *fastReflection_MsgWithdrawReporterCommission) New() protoreflect.Message { - return new(fastReflection_MsgWithdrawReporterCommission) +func (x *fastReflection_MsgWithdrawTip) New() protoreflect.Message { + return new(fastReflection_MsgWithdrawTip) } // Interface unwraps the message reflection interface and // returns the underlying ProtoMessage interface. -func (x *fastReflection_MsgWithdrawReporterCommission) Interface() protoreflect.ProtoMessage { - return (*MsgWithdrawReporterCommission)(x) +func (x *fastReflection_MsgWithdrawTip) Interface() protoreflect.ProtoMessage { + return (*MsgWithdrawTip)(x) } // Range iterates over every populated field in an undefined order, @@ -3961,10 +3421,16 @@ func (x *fastReflection_MsgWithdrawReporterCommission) Interface() protoreflect. // Range returns immediately if f returns false. // While iterating, mutating operations may only be performed // on the current field descriptor. -func (x *fastReflection_MsgWithdrawReporterCommission) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.ReporterAddress != "" { - value := protoreflect.ValueOfString(x.ReporterAddress) - if !f(fd_MsgWithdrawReporterCommission_reporter_address, value) { +func (x *fastReflection_MsgWithdrawTip) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.DelegatorAddress != "" { + value := protoreflect.ValueOfString(x.DelegatorAddress) + if !f(fd_MsgWithdrawTip_delegator_address, value) { + return + } + } + if x.ValidatorAddress != "" { + value := protoreflect.ValueOfString(x.ValidatorAddress) + if !f(fd_MsgWithdrawTip_validator_address, value) { return } } @@ -3981,15 +3447,17 @@ func (x *fastReflection_MsgWithdrawReporterCommission) Range(f func(protoreflect // In other cases (aside from the nullable cases above), // a proto3 scalar field is populated if it contains a non-zero value, and // a repeated field is populated if it is non-empty. -func (x *fastReflection_MsgWithdrawReporterCommission) Has(fd protoreflect.FieldDescriptor) bool { +func (x *fastReflection_MsgWithdrawTip) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "layer.reporter.MsgWithdrawReporterCommission.reporter_address": - return x.ReporterAddress != "" + case "layer.reporter.MsgWithdrawTip.delegator_address": + return x.DelegatorAddress != "" + case "layer.reporter.MsgWithdrawTip.validator_address": + return x.ValidatorAddress != "" default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawReporterCommission")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawTip")) } - panic(fmt.Errorf("message layer.reporter.MsgWithdrawReporterCommission does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.MsgWithdrawTip does not contain field %s", fd.FullName())) } } @@ -3999,15 +3467,17 @@ func (x *fastReflection_MsgWithdrawReporterCommission) Has(fd protoreflect.Field // associated with the given field number. // // Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgWithdrawReporterCommission) Clear(fd protoreflect.FieldDescriptor) { +func (x *fastReflection_MsgWithdrawTip) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "layer.reporter.MsgWithdrawReporterCommission.reporter_address": - x.ReporterAddress = "" + case "layer.reporter.MsgWithdrawTip.delegator_address": + x.DelegatorAddress = "" + case "layer.reporter.MsgWithdrawTip.validator_address": + x.ValidatorAddress = "" default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawReporterCommission")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawTip")) } - panic(fmt.Errorf("message layer.reporter.MsgWithdrawReporterCommission does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.MsgWithdrawTip does not contain field %s", fd.FullName())) } } @@ -4017,16 +3487,19 @@ func (x *fastReflection_MsgWithdrawReporterCommission) Clear(fd protoreflect.Fie // the default value of a bytes scalar is guaranteed to be a copy. // For unpopulated composite types, it returns an empty, read-only view // of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_MsgWithdrawReporterCommission) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MsgWithdrawTip) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "layer.reporter.MsgWithdrawReporterCommission.reporter_address": - value := x.ReporterAddress + case "layer.reporter.MsgWithdrawTip.delegator_address": + value := x.DelegatorAddress + return protoreflect.ValueOfString(value) + case "layer.reporter.MsgWithdrawTip.validator_address": + value := x.ValidatorAddress return protoreflect.ValueOfString(value) default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawReporterCommission")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawTip")) } - panic(fmt.Errorf("message layer.reporter.MsgWithdrawReporterCommission does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message layer.reporter.MsgWithdrawTip does not contain field %s", descriptor.FullName())) } } @@ -4040,15 +3513,17 @@ func (x *fastReflection_MsgWithdrawReporterCommission) Get(descriptor protorefle // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgWithdrawReporterCommission) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_MsgWithdrawTip) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "layer.reporter.MsgWithdrawReporterCommission.reporter_address": - x.ReporterAddress = value.Interface().(string) + case "layer.reporter.MsgWithdrawTip.delegator_address": + x.DelegatorAddress = value.Interface().(string) + case "layer.reporter.MsgWithdrawTip.validator_address": + x.ValidatorAddress = value.Interface().(string) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawReporterCommission")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawTip")) } - panic(fmt.Errorf("message layer.reporter.MsgWithdrawReporterCommission does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.MsgWithdrawTip does not contain field %s", fd.FullName())) } } @@ -4062,40 +3537,44 @@ func (x *fastReflection_MsgWithdrawReporterCommission) Set(fd protoreflect.Field // It panics if the field does not contain a composite type. // // Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgWithdrawReporterCommission) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MsgWithdrawTip) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "layer.reporter.MsgWithdrawReporterCommission.reporter_address": - panic(fmt.Errorf("field reporter_address of message layer.reporter.MsgWithdrawReporterCommission is not mutable")) + case "layer.reporter.MsgWithdrawTip.delegator_address": + panic(fmt.Errorf("field delegator_address of message layer.reporter.MsgWithdrawTip is not mutable")) + case "layer.reporter.MsgWithdrawTip.validator_address": + panic(fmt.Errorf("field validator_address of message layer.reporter.MsgWithdrawTip is not mutable")) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawReporterCommission")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawTip")) } - panic(fmt.Errorf("message layer.reporter.MsgWithdrawReporterCommission does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.MsgWithdrawTip does not contain field %s", fd.FullName())) } } // NewField returns a new value that is assignable to the field // for the given descriptor. For scalars, this returns the default value. // For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_MsgWithdrawReporterCommission) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MsgWithdrawTip) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "layer.reporter.MsgWithdrawReporterCommission.reporter_address": + case "layer.reporter.MsgWithdrawTip.delegator_address": + return protoreflect.ValueOfString("") + case "layer.reporter.MsgWithdrawTip.validator_address": return protoreflect.ValueOfString("") default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawReporterCommission")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawTip")) } - panic(fmt.Errorf("message layer.reporter.MsgWithdrawReporterCommission does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.MsgWithdrawTip does not contain field %s", fd.FullName())) } } // WhichOneof reports which field within the oneof is populated, // returning nil if none are populated. // It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_MsgWithdrawReporterCommission) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { +func (x *fastReflection_MsgWithdrawTip) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in layer.reporter.MsgWithdrawReporterCommission", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in layer.reporter.MsgWithdrawTip", d.FullName())) } panic("unreachable") } @@ -4103,7 +3582,7 @@ func (x *fastReflection_MsgWithdrawReporterCommission) WhichOneof(d protoreflect // GetUnknown retrieves the entire list of unknown fields. // The caller may only mutate the contents of the RawFields // if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_MsgWithdrawReporterCommission) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_MsgWithdrawTip) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -4114,7 +3593,7 @@ func (x *fastReflection_MsgWithdrawReporterCommission) GetUnknown() protoreflect // An empty RawFields may be passed to clear the fields. // // SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgWithdrawReporterCommission) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_MsgWithdrawTip) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -4126,7 +3605,7 @@ func (x *fastReflection_MsgWithdrawReporterCommission) SetUnknown(fields protore // message type, but the details are implementation dependent. // Validity is not part of the protobuf data model, and may not // be preserved in marshaling or other operations. -func (x *fastReflection_MsgWithdrawReporterCommission) IsValid() bool { +func (x *fastReflection_MsgWithdrawTip) IsValid() bool { return x != nil } @@ -4136,9 +3615,9 @@ func (x *fastReflection_MsgWithdrawReporterCommission) IsValid() bool { // The returned methods type is identical to // "google.golang.org/protobuf/runtime/protoiface".Methods. // Consult the protoiface package documentation for details. -func (x *fastReflection_MsgWithdrawReporterCommission) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_MsgWithdrawTip) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MsgWithdrawReporterCommission) + x := input.Message.Interface().(*MsgWithdrawTip) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -4150,7 +3629,11 @@ func (x *fastReflection_MsgWithdrawReporterCommission) ProtoMethods() *protoifac var n int var l int _ = l - l = len(x.ReporterAddress) + l = len(x.DelegatorAddress) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.ValidatorAddress) if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } @@ -4164,7 +3647,7 @@ func (x *fastReflection_MsgWithdrawReporterCommission) ProtoMethods() *protoifac } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*MsgWithdrawReporterCommission) + x := input.Message.Interface().(*MsgWithdrawTip) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -4183,10 +3666,17 @@ func (x *fastReflection_MsgWithdrawReporterCommission) ProtoMethods() *protoifac i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if len(x.ReporterAddress) > 0 { - i -= len(x.ReporterAddress) - copy(dAtA[i:], x.ReporterAddress) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ReporterAddress))) + if len(x.ValidatorAddress) > 0 { + i -= len(x.ValidatorAddress) + copy(dAtA[i:], x.ValidatorAddress) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ValidatorAddress))) + i-- + dAtA[i] = 0x12 + } + if len(x.DelegatorAddress) > 0 { + i -= len(x.DelegatorAddress) + copy(dAtA[i:], x.DelegatorAddress) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.DelegatorAddress))) i-- dAtA[i] = 0xa } @@ -4201,7 +3691,7 @@ func (x *fastReflection_MsgWithdrawReporterCommission) ProtoMethods() *protoifac }, nil } unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*MsgWithdrawReporterCommission) + x := input.Message.Interface().(*MsgWithdrawTip) if x == nil { return protoiface.UnmarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -4233,15 +3723,15 @@ func (x *fastReflection_MsgWithdrawReporterCommission) ProtoMethods() *protoifac fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgWithdrawReporterCommission: wiretype end group for non-group") + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgWithdrawTip: wiretype end group for non-group") } if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgWithdrawReporterCommission: illegal tag %d (wire type %d)", fieldNum, wire) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgWithdrawTip: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ReporterAddress", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -4269,7 +3759,39 @@ func (x *fastReflection_MsgWithdrawReporterCommission) ProtoMethods() *protoifac if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.ReporterAddress = string(dAtA[iNdEx:postIndex]) + x.DelegatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", 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.ValidatorAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -4306,77 +3828,24 @@ func (x *fastReflection_MsgWithdrawReporterCommission) ProtoMethods() *protoifac } } -var _ protoreflect.List = (*_MsgWithdrawReporterCommissionResponse_1_list)(nil) - -type _MsgWithdrawReporterCommissionResponse_1_list struct { - list *[]*v1beta11.Coin -} - -func (x *_MsgWithdrawReporterCommissionResponse_1_list) Len() int { - if x.list == nil { - return 0 - } - return len(*x.list) -} - -func (x *_MsgWithdrawReporterCommissionResponse_1_list) Get(i int) protoreflect.Value { - return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) -} - -func (x *_MsgWithdrawReporterCommissionResponse_1_list) Set(i int, value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*v1beta11.Coin) - (*x.list)[i] = concreteValue -} - -func (x *_MsgWithdrawReporterCommissionResponse_1_list) Append(value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*v1beta11.Coin) - *x.list = append(*x.list, concreteValue) -} - -func (x *_MsgWithdrawReporterCommissionResponse_1_list) AppendMutable() protoreflect.Value { - v := new(v1beta11.Coin) - *x.list = append(*x.list, v) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_MsgWithdrawReporterCommissionResponse_1_list) Truncate(n int) { - for i := n; i < len(*x.list); i++ { - (*x.list)[i] = nil - } - *x.list = (*x.list)[:n] -} - -func (x *_MsgWithdrawReporterCommissionResponse_1_list) NewElement() protoreflect.Value { - v := new(v1beta11.Coin) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_MsgWithdrawReporterCommissionResponse_1_list) IsValid() bool { - return x.list != nil -} - var ( - md_MsgWithdrawReporterCommissionResponse protoreflect.MessageDescriptor - fd_MsgWithdrawReporterCommissionResponse_amount protoreflect.FieldDescriptor + md_MsgWithdrawTipResponse protoreflect.MessageDescriptor ) func init() { file_layer_reporter_tx_proto_init() - md_MsgWithdrawReporterCommissionResponse = File_layer_reporter_tx_proto.Messages().ByName("MsgWithdrawReporterCommissionResponse") - fd_MsgWithdrawReporterCommissionResponse_amount = md_MsgWithdrawReporterCommissionResponse.Fields().ByName("amount") + md_MsgWithdrawTipResponse = File_layer_reporter_tx_proto.Messages().ByName("MsgWithdrawTipResponse") } -var _ protoreflect.Message = (*fastReflection_MsgWithdrawReporterCommissionResponse)(nil) +var _ protoreflect.Message = (*fastReflection_MsgWithdrawTipResponse)(nil) -type fastReflection_MsgWithdrawReporterCommissionResponse MsgWithdrawReporterCommissionResponse +type fastReflection_MsgWithdrawTipResponse MsgWithdrawTipResponse -func (x *MsgWithdrawReporterCommissionResponse) ProtoReflect() protoreflect.Message { - return (*fastReflection_MsgWithdrawReporterCommissionResponse)(x) +func (x *MsgWithdrawTipResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgWithdrawTipResponse)(x) } -func (x *MsgWithdrawReporterCommissionResponse) slowProtoReflect() protoreflect.Message { +func (x *MsgWithdrawTipResponse) slowProtoReflect() protoreflect.Message { mi := &file_layer_reporter_tx_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -4388,43 +3857,43 @@ func (x *MsgWithdrawReporterCommissionResponse) slowProtoReflect() protoreflect. return mi.MessageOf(x) } -var _fastReflection_MsgWithdrawReporterCommissionResponse_messageType fastReflection_MsgWithdrawReporterCommissionResponse_messageType -var _ protoreflect.MessageType = fastReflection_MsgWithdrawReporterCommissionResponse_messageType{} +var _fastReflection_MsgWithdrawTipResponse_messageType fastReflection_MsgWithdrawTipResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgWithdrawTipResponse_messageType{} -type fastReflection_MsgWithdrawReporterCommissionResponse_messageType struct{} +type fastReflection_MsgWithdrawTipResponse_messageType struct{} -func (x fastReflection_MsgWithdrawReporterCommissionResponse_messageType) Zero() protoreflect.Message { - return (*fastReflection_MsgWithdrawReporterCommissionResponse)(nil) +func (x fastReflection_MsgWithdrawTipResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgWithdrawTipResponse)(nil) } -func (x fastReflection_MsgWithdrawReporterCommissionResponse_messageType) New() protoreflect.Message { - return new(fastReflection_MsgWithdrawReporterCommissionResponse) +func (x fastReflection_MsgWithdrawTipResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgWithdrawTipResponse) } -func (x fastReflection_MsgWithdrawReporterCommissionResponse_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MsgWithdrawReporterCommissionResponse +func (x fastReflection_MsgWithdrawTipResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgWithdrawTipResponse } // Descriptor returns message descriptor, which contains only the protobuf // type information for the message. -func (x *fastReflection_MsgWithdrawReporterCommissionResponse) Descriptor() protoreflect.MessageDescriptor { - return md_MsgWithdrawReporterCommissionResponse +func (x *fastReflection_MsgWithdrawTipResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgWithdrawTipResponse } // Type returns the message type, which encapsulates both Go and protobuf // type information. If the Go type information is not needed, // it is recommended that the message descriptor be used instead. -func (x *fastReflection_MsgWithdrawReporterCommissionResponse) Type() protoreflect.MessageType { - return _fastReflection_MsgWithdrawReporterCommissionResponse_messageType +func (x *fastReflection_MsgWithdrawTipResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgWithdrawTipResponse_messageType } // New returns a newly allocated and mutable empty message. -func (x *fastReflection_MsgWithdrawReporterCommissionResponse) New() protoreflect.Message { - return new(fastReflection_MsgWithdrawReporterCommissionResponse) +func (x *fastReflection_MsgWithdrawTipResponse) New() protoreflect.Message { + return new(fastReflection_MsgWithdrawTipResponse) } // Interface unwraps the message reflection interface and // returns the underlying ProtoMessage interface. -func (x *fastReflection_MsgWithdrawReporterCommissionResponse) Interface() protoreflect.ProtoMessage { - return (*MsgWithdrawReporterCommissionResponse)(x) +func (x *fastReflection_MsgWithdrawTipResponse) Interface() protoreflect.ProtoMessage { + return (*MsgWithdrawTipResponse)(x) } // Range iterates over every populated field in an undefined order, @@ -4432,13 +3901,7 @@ func (x *fastReflection_MsgWithdrawReporterCommissionResponse) Interface() proto // Range returns immediately if f returns false. // While iterating, mutating operations may only be performed // on the current field descriptor. -func (x *fastReflection_MsgWithdrawReporterCommissionResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if len(x.Amount) != 0 { - value := protoreflect.ValueOfList(&_MsgWithdrawReporterCommissionResponse_1_list{list: &x.Amount}) - if !f(fd_MsgWithdrawReporterCommissionResponse_amount, value) { - return - } - } +func (x *fastReflection_MsgWithdrawTipResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { } // Has reports whether a field is populated. @@ -4452,15 +3915,13 @@ func (x *fastReflection_MsgWithdrawReporterCommissionResponse) Range(f func(prot // In other cases (aside from the nullable cases above), // a proto3 scalar field is populated if it contains a non-zero value, and // a repeated field is populated if it is non-empty. -func (x *fastReflection_MsgWithdrawReporterCommissionResponse) Has(fd protoreflect.FieldDescriptor) bool { +func (x *fastReflection_MsgWithdrawTipResponse) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "layer.reporter.MsgWithdrawReporterCommissionResponse.amount": - return len(x.Amount) != 0 default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawReporterCommissionResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawTipResponse")) } - panic(fmt.Errorf("message layer.reporter.MsgWithdrawReporterCommissionResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.MsgWithdrawTipResponse does not contain field %s", fd.FullName())) } } @@ -4470,15 +3931,13 @@ func (x *fastReflection_MsgWithdrawReporterCommissionResponse) Has(fd protorefle // associated with the given field number. // // Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgWithdrawReporterCommissionResponse) Clear(fd protoreflect.FieldDescriptor) { +func (x *fastReflection_MsgWithdrawTipResponse) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "layer.reporter.MsgWithdrawReporterCommissionResponse.amount": - x.Amount = nil default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawReporterCommissionResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawTipResponse")) } - panic(fmt.Errorf("message layer.reporter.MsgWithdrawReporterCommissionResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.MsgWithdrawTipResponse does not contain field %s", fd.FullName())) } } @@ -4488,19 +3947,13 @@ func (x *fastReflection_MsgWithdrawReporterCommissionResponse) Clear(fd protoref // the default value of a bytes scalar is guaranteed to be a copy. // For unpopulated composite types, it returns an empty, read-only view // of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_MsgWithdrawReporterCommissionResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MsgWithdrawTipResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "layer.reporter.MsgWithdrawReporterCommissionResponse.amount": - if len(x.Amount) == 0 { - return protoreflect.ValueOfList(&_MsgWithdrawReporterCommissionResponse_1_list{}) - } - listValue := &_MsgWithdrawReporterCommissionResponse_1_list{list: &x.Amount} - return protoreflect.ValueOfList(listValue) default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawReporterCommissionResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawTipResponse")) } - panic(fmt.Errorf("message layer.reporter.MsgWithdrawReporterCommissionResponse does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message layer.reporter.MsgWithdrawTipResponse does not contain field %s", descriptor.FullName())) } } @@ -4514,17 +3967,13 @@ func (x *fastReflection_MsgWithdrawReporterCommissionResponse) Get(descriptor pr // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgWithdrawReporterCommissionResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_MsgWithdrawTipResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "layer.reporter.MsgWithdrawReporterCommissionResponse.amount": - lv := value.List() - clv := lv.(*_MsgWithdrawReporterCommissionResponse_1_list) - x.Amount = *clv.list default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawReporterCommissionResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawTipResponse")) } - panic(fmt.Errorf("message layer.reporter.MsgWithdrawReporterCommissionResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.MsgWithdrawTipResponse does not contain field %s", fd.FullName())) } } @@ -4538,45 +3987,36 @@ func (x *fastReflection_MsgWithdrawReporterCommissionResponse) Set(fd protorefle // It panics if the field does not contain a composite type. // // Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgWithdrawReporterCommissionResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MsgWithdrawTipResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "layer.reporter.MsgWithdrawReporterCommissionResponse.amount": - if x.Amount == nil { - x.Amount = []*v1beta11.Coin{} - } - value := &_MsgWithdrawReporterCommissionResponse_1_list{list: &x.Amount} - return protoreflect.ValueOfList(value) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawReporterCommissionResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawTipResponse")) } - panic(fmt.Errorf("message layer.reporter.MsgWithdrawReporterCommissionResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.MsgWithdrawTipResponse does not contain field %s", fd.FullName())) } } // NewField returns a new value that is assignable to the field // for the given descriptor. For scalars, this returns the default value. // For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_MsgWithdrawReporterCommissionResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MsgWithdrawTipResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "layer.reporter.MsgWithdrawReporterCommissionResponse.amount": - list := []*v1beta11.Coin{} - return protoreflect.ValueOfList(&_MsgWithdrawReporterCommissionResponse_1_list{list: &list}) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawReporterCommissionResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawTipResponse")) } - panic(fmt.Errorf("message layer.reporter.MsgWithdrawReporterCommissionResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message layer.reporter.MsgWithdrawTipResponse does not contain field %s", fd.FullName())) } } // WhichOneof reports which field within the oneof is populated, // returning nil if none are populated. // It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_MsgWithdrawReporterCommissionResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { +func (x *fastReflection_MsgWithdrawTipResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in layer.reporter.MsgWithdrawReporterCommissionResponse", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in layer.reporter.MsgWithdrawTipResponse", d.FullName())) } panic("unreachable") } @@ -4584,7 +4024,7 @@ func (x *fastReflection_MsgWithdrawReporterCommissionResponse) WhichOneof(d prot // GetUnknown retrieves the entire list of unknown fields. // The caller may only mutate the contents of the RawFields // if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_MsgWithdrawReporterCommissionResponse) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_MsgWithdrawTipResponse) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -4595,7 +4035,7 @@ func (x *fastReflection_MsgWithdrawReporterCommissionResponse) GetUnknown() prot // An empty RawFields may be passed to clear the fields. // // SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgWithdrawReporterCommissionResponse) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_MsgWithdrawTipResponse) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -4607,7 +4047,7 @@ func (x *fastReflection_MsgWithdrawReporterCommissionResponse) SetUnknown(fields // message type, but the details are implementation dependent. // Validity is not part of the protobuf data model, and may not // be preserved in marshaling or other operations. -func (x *fastReflection_MsgWithdrawReporterCommissionResponse) IsValid() bool { +func (x *fastReflection_MsgWithdrawTipResponse) IsValid() bool { return x != nil } @@ -4617,9 +4057,9 @@ func (x *fastReflection_MsgWithdrawReporterCommissionResponse) IsValid() bool { // The returned methods type is identical to // "google.golang.org/protobuf/runtime/protoiface".Methods. // Consult the protoiface package documentation for details. -func (x *fastReflection_MsgWithdrawReporterCommissionResponse) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_MsgWithdrawTipResponse) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MsgWithdrawReporterCommissionResponse) + x := input.Message.Interface().(*MsgWithdrawTipResponse) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -4631,12 +4071,6 @@ func (x *fastReflection_MsgWithdrawReporterCommissionResponse) ProtoMethods() *p var n int var l int _ = l - if len(x.Amount) > 0 { - for _, e := range x.Amount { - l = options.Size(e) - n += 1 + l + runtime.Sov(uint64(l)) - } - } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -4647,7 +4081,7 @@ func (x *fastReflection_MsgWithdrawReporterCommissionResponse) ProtoMethods() *p } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*MsgWithdrawReporterCommissionResponse) + x := input.Message.Interface().(*MsgWithdrawTipResponse) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -4666,22 +4100,6 @@ func (x *fastReflection_MsgWithdrawReporterCommissionResponse) ProtoMethods() *p i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if len(x.Amount) > 0 { - for iNdEx := len(x.Amount) - 1; iNdEx >= 0; iNdEx-- { - encoded, err := options.Marshal(x.Amount[iNdEx]) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0xa - } - } if input.Buf != nil { input.Buf = append(input.Buf, dAtA...) } else { @@ -4693,7 +4111,7 @@ func (x *fastReflection_MsgWithdrawReporterCommissionResponse) ProtoMethods() *p }, nil } unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*MsgWithdrawReporterCommissionResponse) + x := input.Message.Interface().(*MsgWithdrawTipResponse) if x == nil { return protoiface.UnmarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -4725,46 +4143,12 @@ func (x *fastReflection_MsgWithdrawReporterCommissionResponse) ProtoMethods() *p fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgWithdrawReporterCommissionResponse: wiretype end group for non-group") + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgWithdrawTipResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgWithdrawReporterCommissionResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgWithdrawTipResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var msglen int - 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++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - 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.Amount = append(x.Amount, &v1beta11.Coin{}) - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Amount[len(x.Amount)-1]); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -4800,3007 +4184,163 @@ func (x *fastReflection_MsgWithdrawReporterCommissionResponse) ProtoMethods() *p } } -var ( - md_MsgWithdrawDelegatorReward protoreflect.MessageDescriptor - fd_MsgWithdrawDelegatorReward_delegator_address protoreflect.FieldDescriptor - fd_MsgWithdrawDelegatorReward_reporter_address protoreflect.FieldDescriptor -) - -func init() { - file_layer_reporter_tx_proto_init() - md_MsgWithdrawDelegatorReward = File_layer_reporter_tx_proto.Messages().ByName("MsgWithdrawDelegatorReward") - fd_MsgWithdrawDelegatorReward_delegator_address = md_MsgWithdrawDelegatorReward.Fields().ByName("delegator_address") - fd_MsgWithdrawDelegatorReward_reporter_address = md_MsgWithdrawDelegatorReward.Fields().ByName("reporter_address") -} +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: layer/reporter/tx.proto -var _ protoreflect.Message = (*fastReflection_MsgWithdrawDelegatorReward)(nil) +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) -type fastReflection_MsgWithdrawDelegatorReward MsgWithdrawDelegatorReward +// MsgUpdateParams is the Msg/UpdateParams request type. +type MsgUpdateParams struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (x *MsgWithdrawDelegatorReward) ProtoReflect() protoreflect.Message { - return (*fastReflection_MsgWithdrawDelegatorReward)(x) + // authority is the address that controls the module (defaults to x/gov unless overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // NOTE: All parameters must be supplied. + Params *Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty"` } -func (x *MsgWithdrawDelegatorReward) slowProtoReflect() protoreflect.Message { - mi := &file_layer_reporter_tx_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { +func (x *MsgUpdateParams) Reset() { + *x = MsgUpdateParams{} + if protoimpl.UnsafeEnabled { + mi := &file_layer_reporter_tx_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms + ms.StoreMessageInfo(mi) } - return mi.MessageOf(x) } -var _fastReflection_MsgWithdrawDelegatorReward_messageType fastReflection_MsgWithdrawDelegatorReward_messageType -var _ protoreflect.MessageType = fastReflection_MsgWithdrawDelegatorReward_messageType{} - -type fastReflection_MsgWithdrawDelegatorReward_messageType struct{} - -func (x fastReflection_MsgWithdrawDelegatorReward_messageType) Zero() protoreflect.Message { - return (*fastReflection_MsgWithdrawDelegatorReward)(nil) -} -func (x fastReflection_MsgWithdrawDelegatorReward_messageType) New() protoreflect.Message { - return new(fastReflection_MsgWithdrawDelegatorReward) -} -func (x fastReflection_MsgWithdrawDelegatorReward_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MsgWithdrawDelegatorReward +func (x *MsgUpdateParams) String() string { + return protoimpl.X.MessageStringOf(x) } -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_MsgWithdrawDelegatorReward) Descriptor() protoreflect.MessageDescriptor { - return md_MsgWithdrawDelegatorReward -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_MsgWithdrawDelegatorReward) Type() protoreflect.MessageType { - return _fastReflection_MsgWithdrawDelegatorReward_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_MsgWithdrawDelegatorReward) New() protoreflect.Message { - return new(fastReflection_MsgWithdrawDelegatorReward) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_MsgWithdrawDelegatorReward) Interface() protoreflect.ProtoMessage { - return (*MsgWithdrawDelegatorReward)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_MsgWithdrawDelegatorReward) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.DelegatorAddress != "" { - value := protoreflect.ValueOfString(x.DelegatorAddress) - if !f(fd_MsgWithdrawDelegatorReward_delegator_address, value) { - return - } - } - if x.ReporterAddress != "" { - value := protoreflect.ValueOfString(x.ReporterAddress) - if !f(fd_MsgWithdrawDelegatorReward_reporter_address, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_MsgWithdrawDelegatorReward) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "layer.reporter.MsgWithdrawDelegatorReward.delegator_address": - return x.DelegatorAddress != "" - case "layer.reporter.MsgWithdrawDelegatorReward.reporter_address": - return x.ReporterAddress != "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawDelegatorReward")) - } - panic(fmt.Errorf("message layer.reporter.MsgWithdrawDelegatorReward does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgWithdrawDelegatorReward) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "layer.reporter.MsgWithdrawDelegatorReward.delegator_address": - x.DelegatorAddress = "" - case "layer.reporter.MsgWithdrawDelegatorReward.reporter_address": - x.ReporterAddress = "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawDelegatorReward")) - } - panic(fmt.Errorf("message layer.reporter.MsgWithdrawDelegatorReward does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_MsgWithdrawDelegatorReward) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "layer.reporter.MsgWithdrawDelegatorReward.delegator_address": - value := x.DelegatorAddress - return protoreflect.ValueOfString(value) - case "layer.reporter.MsgWithdrawDelegatorReward.reporter_address": - value := x.ReporterAddress - return protoreflect.ValueOfString(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawDelegatorReward")) - } - panic(fmt.Errorf("message layer.reporter.MsgWithdrawDelegatorReward does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgWithdrawDelegatorReward) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "layer.reporter.MsgWithdrawDelegatorReward.delegator_address": - x.DelegatorAddress = value.Interface().(string) - case "layer.reporter.MsgWithdrawDelegatorReward.reporter_address": - x.ReporterAddress = value.Interface().(string) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawDelegatorReward")) - } - panic(fmt.Errorf("message layer.reporter.MsgWithdrawDelegatorReward does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgWithdrawDelegatorReward) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "layer.reporter.MsgWithdrawDelegatorReward.delegator_address": - panic(fmt.Errorf("field delegator_address of message layer.reporter.MsgWithdrawDelegatorReward is not mutable")) - case "layer.reporter.MsgWithdrawDelegatorReward.reporter_address": - panic(fmt.Errorf("field reporter_address of message layer.reporter.MsgWithdrawDelegatorReward is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawDelegatorReward")) - } - panic(fmt.Errorf("message layer.reporter.MsgWithdrawDelegatorReward does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_MsgWithdrawDelegatorReward) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "layer.reporter.MsgWithdrawDelegatorReward.delegator_address": - return protoreflect.ValueOfString("") - case "layer.reporter.MsgWithdrawDelegatorReward.reporter_address": - return protoreflect.ValueOfString("") - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawDelegatorReward")) - } - panic(fmt.Errorf("message layer.reporter.MsgWithdrawDelegatorReward does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_MsgWithdrawDelegatorReward) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in layer.reporter.MsgWithdrawDelegatorReward", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_MsgWithdrawDelegatorReward) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgWithdrawDelegatorReward) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_MsgWithdrawDelegatorReward) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_MsgWithdrawDelegatorReward) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MsgWithdrawDelegatorReward) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - l = len(x.DelegatorAddress) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - l = len(x.ReporterAddress) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*MsgWithdrawDelegatorReward) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if len(x.ReporterAddress) > 0 { - i -= len(x.ReporterAddress) - copy(dAtA[i:], x.ReporterAddress) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ReporterAddress))) - i-- - dAtA[i] = 0x12 - } - if len(x.DelegatorAddress) > 0 { - i -= len(x.DelegatorAddress) - copy(dAtA[i:], x.DelegatorAddress) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.DelegatorAddress))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*MsgWithdrawDelegatorReward) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire 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++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgWithdrawDelegatorReward: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgWithdrawDelegatorReward: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", 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.DelegatorAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ReporterAddress", 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.ReporterAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var _ protoreflect.List = (*_MsgWithdrawDelegatorRewardResponse_1_list)(nil) - -type _MsgWithdrawDelegatorRewardResponse_1_list struct { - list *[]*v1beta11.Coin -} - -func (x *_MsgWithdrawDelegatorRewardResponse_1_list) Len() int { - if x.list == nil { - return 0 - } - return len(*x.list) -} - -func (x *_MsgWithdrawDelegatorRewardResponse_1_list) Get(i int) protoreflect.Value { - return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) -} - -func (x *_MsgWithdrawDelegatorRewardResponse_1_list) Set(i int, value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*v1beta11.Coin) - (*x.list)[i] = concreteValue -} - -func (x *_MsgWithdrawDelegatorRewardResponse_1_list) Append(value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*v1beta11.Coin) - *x.list = append(*x.list, concreteValue) -} - -func (x *_MsgWithdrawDelegatorRewardResponse_1_list) AppendMutable() protoreflect.Value { - v := new(v1beta11.Coin) - *x.list = append(*x.list, v) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_MsgWithdrawDelegatorRewardResponse_1_list) Truncate(n int) { - for i := n; i < len(*x.list); i++ { - (*x.list)[i] = nil - } - *x.list = (*x.list)[:n] -} - -func (x *_MsgWithdrawDelegatorRewardResponse_1_list) NewElement() protoreflect.Value { - v := new(v1beta11.Coin) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_MsgWithdrawDelegatorRewardResponse_1_list) IsValid() bool { - return x.list != nil -} - -var ( - md_MsgWithdrawDelegatorRewardResponse protoreflect.MessageDescriptor - fd_MsgWithdrawDelegatorRewardResponse_amount protoreflect.FieldDescriptor -) - -func init() { - file_layer_reporter_tx_proto_init() - md_MsgWithdrawDelegatorRewardResponse = File_layer_reporter_tx_proto.Messages().ByName("MsgWithdrawDelegatorRewardResponse") - fd_MsgWithdrawDelegatorRewardResponse_amount = md_MsgWithdrawDelegatorRewardResponse.Fields().ByName("amount") -} - -var _ protoreflect.Message = (*fastReflection_MsgWithdrawDelegatorRewardResponse)(nil) - -type fastReflection_MsgWithdrawDelegatorRewardResponse MsgWithdrawDelegatorRewardResponse - -func (x *MsgWithdrawDelegatorRewardResponse) ProtoReflect() protoreflect.Message { - return (*fastReflection_MsgWithdrawDelegatorRewardResponse)(x) -} - -func (x *MsgWithdrawDelegatorRewardResponse) slowProtoReflect() protoreflect.Message { - mi := &file_layer_reporter_tx_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_MsgWithdrawDelegatorRewardResponse_messageType fastReflection_MsgWithdrawDelegatorRewardResponse_messageType -var _ protoreflect.MessageType = fastReflection_MsgWithdrawDelegatorRewardResponse_messageType{} - -type fastReflection_MsgWithdrawDelegatorRewardResponse_messageType struct{} - -func (x fastReflection_MsgWithdrawDelegatorRewardResponse_messageType) Zero() protoreflect.Message { - return (*fastReflection_MsgWithdrawDelegatorRewardResponse)(nil) -} -func (x fastReflection_MsgWithdrawDelegatorRewardResponse_messageType) New() protoreflect.Message { - return new(fastReflection_MsgWithdrawDelegatorRewardResponse) -} -func (x fastReflection_MsgWithdrawDelegatorRewardResponse_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MsgWithdrawDelegatorRewardResponse -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_MsgWithdrawDelegatorRewardResponse) Descriptor() protoreflect.MessageDescriptor { - return md_MsgWithdrawDelegatorRewardResponse -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_MsgWithdrawDelegatorRewardResponse) Type() protoreflect.MessageType { - return _fastReflection_MsgWithdrawDelegatorRewardResponse_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_MsgWithdrawDelegatorRewardResponse) New() protoreflect.Message { - return new(fastReflection_MsgWithdrawDelegatorRewardResponse) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_MsgWithdrawDelegatorRewardResponse) Interface() protoreflect.ProtoMessage { - return (*MsgWithdrawDelegatorRewardResponse)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_MsgWithdrawDelegatorRewardResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if len(x.Amount) != 0 { - value := protoreflect.ValueOfList(&_MsgWithdrawDelegatorRewardResponse_1_list{list: &x.Amount}) - if !f(fd_MsgWithdrawDelegatorRewardResponse_amount, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_MsgWithdrawDelegatorRewardResponse) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "layer.reporter.MsgWithdrawDelegatorRewardResponse.amount": - return len(x.Amount) != 0 - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawDelegatorRewardResponse")) - } - panic(fmt.Errorf("message layer.reporter.MsgWithdrawDelegatorRewardResponse does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgWithdrawDelegatorRewardResponse) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "layer.reporter.MsgWithdrawDelegatorRewardResponse.amount": - x.Amount = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawDelegatorRewardResponse")) - } - panic(fmt.Errorf("message layer.reporter.MsgWithdrawDelegatorRewardResponse does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_MsgWithdrawDelegatorRewardResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "layer.reporter.MsgWithdrawDelegatorRewardResponse.amount": - if len(x.Amount) == 0 { - return protoreflect.ValueOfList(&_MsgWithdrawDelegatorRewardResponse_1_list{}) - } - listValue := &_MsgWithdrawDelegatorRewardResponse_1_list{list: &x.Amount} - return protoreflect.ValueOfList(listValue) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawDelegatorRewardResponse")) - } - panic(fmt.Errorf("message layer.reporter.MsgWithdrawDelegatorRewardResponse does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgWithdrawDelegatorRewardResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "layer.reporter.MsgWithdrawDelegatorRewardResponse.amount": - lv := value.List() - clv := lv.(*_MsgWithdrawDelegatorRewardResponse_1_list) - x.Amount = *clv.list - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawDelegatorRewardResponse")) - } - panic(fmt.Errorf("message layer.reporter.MsgWithdrawDelegatorRewardResponse does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgWithdrawDelegatorRewardResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "layer.reporter.MsgWithdrawDelegatorRewardResponse.amount": - if x.Amount == nil { - x.Amount = []*v1beta11.Coin{} - } - value := &_MsgWithdrawDelegatorRewardResponse_1_list{list: &x.Amount} - return protoreflect.ValueOfList(value) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawDelegatorRewardResponse")) - } - panic(fmt.Errorf("message layer.reporter.MsgWithdrawDelegatorRewardResponse does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_MsgWithdrawDelegatorRewardResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "layer.reporter.MsgWithdrawDelegatorRewardResponse.amount": - list := []*v1beta11.Coin{} - return protoreflect.ValueOfList(&_MsgWithdrawDelegatorRewardResponse_1_list{list: &list}) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawDelegatorRewardResponse")) - } - panic(fmt.Errorf("message layer.reporter.MsgWithdrawDelegatorRewardResponse does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_MsgWithdrawDelegatorRewardResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in layer.reporter.MsgWithdrawDelegatorRewardResponse", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_MsgWithdrawDelegatorRewardResponse) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgWithdrawDelegatorRewardResponse) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_MsgWithdrawDelegatorRewardResponse) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_MsgWithdrawDelegatorRewardResponse) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MsgWithdrawDelegatorRewardResponse) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if len(x.Amount) > 0 { - for _, e := range x.Amount { - l = options.Size(e) - n += 1 + l + runtime.Sov(uint64(l)) - } - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*MsgWithdrawDelegatorRewardResponse) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if len(x.Amount) > 0 { - for iNdEx := len(x.Amount) - 1; iNdEx >= 0; iNdEx-- { - encoded, err := options.Marshal(x.Amount[iNdEx]) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0xa - } - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*MsgWithdrawDelegatorRewardResponse) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire 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++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgWithdrawDelegatorRewardResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgWithdrawDelegatorRewardResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var msglen int - 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++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - 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.Amount = append(x.Amount, &v1beta11.Coin{}) - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Amount[len(x.Amount)-1]); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var ( - md_MsgUnjailReporter protoreflect.MessageDescriptor - fd_MsgUnjailReporter_reporter_address protoreflect.FieldDescriptor -) - -func init() { - file_layer_reporter_tx_proto_init() - md_MsgUnjailReporter = File_layer_reporter_tx_proto.Messages().ByName("MsgUnjailReporter") - fd_MsgUnjailReporter_reporter_address = md_MsgUnjailReporter.Fields().ByName("reporter_address") -} - -var _ protoreflect.Message = (*fastReflection_MsgUnjailReporter)(nil) - -type fastReflection_MsgUnjailReporter MsgUnjailReporter - -func (x *MsgUnjailReporter) ProtoReflect() protoreflect.Message { - return (*fastReflection_MsgUnjailReporter)(x) -} - -func (x *MsgUnjailReporter) slowProtoReflect() protoreflect.Message { - mi := &file_layer_reporter_tx_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_MsgUnjailReporter_messageType fastReflection_MsgUnjailReporter_messageType -var _ protoreflect.MessageType = fastReflection_MsgUnjailReporter_messageType{} - -type fastReflection_MsgUnjailReporter_messageType struct{} - -func (x fastReflection_MsgUnjailReporter_messageType) Zero() protoreflect.Message { - return (*fastReflection_MsgUnjailReporter)(nil) -} -func (x fastReflection_MsgUnjailReporter_messageType) New() protoreflect.Message { - return new(fastReflection_MsgUnjailReporter) -} -func (x fastReflection_MsgUnjailReporter_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MsgUnjailReporter -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_MsgUnjailReporter) Descriptor() protoreflect.MessageDescriptor { - return md_MsgUnjailReporter -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_MsgUnjailReporter) Type() protoreflect.MessageType { - return _fastReflection_MsgUnjailReporter_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_MsgUnjailReporter) New() protoreflect.Message { - return new(fastReflection_MsgUnjailReporter) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_MsgUnjailReporter) Interface() protoreflect.ProtoMessage { - return (*MsgUnjailReporter)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_MsgUnjailReporter) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.ReporterAddress != "" { - value := protoreflect.ValueOfString(x.ReporterAddress) - if !f(fd_MsgUnjailReporter_reporter_address, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_MsgUnjailReporter) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "layer.reporter.MsgUnjailReporter.reporter_address": - return x.ReporterAddress != "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgUnjailReporter")) - } - panic(fmt.Errorf("message layer.reporter.MsgUnjailReporter does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgUnjailReporter) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "layer.reporter.MsgUnjailReporter.reporter_address": - x.ReporterAddress = "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgUnjailReporter")) - } - panic(fmt.Errorf("message layer.reporter.MsgUnjailReporter does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_MsgUnjailReporter) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "layer.reporter.MsgUnjailReporter.reporter_address": - value := x.ReporterAddress - return protoreflect.ValueOfString(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgUnjailReporter")) - } - panic(fmt.Errorf("message layer.reporter.MsgUnjailReporter does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgUnjailReporter) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "layer.reporter.MsgUnjailReporter.reporter_address": - x.ReporterAddress = value.Interface().(string) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgUnjailReporter")) - } - panic(fmt.Errorf("message layer.reporter.MsgUnjailReporter does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgUnjailReporter) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "layer.reporter.MsgUnjailReporter.reporter_address": - panic(fmt.Errorf("field reporter_address of message layer.reporter.MsgUnjailReporter is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgUnjailReporter")) - } - panic(fmt.Errorf("message layer.reporter.MsgUnjailReporter does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_MsgUnjailReporter) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "layer.reporter.MsgUnjailReporter.reporter_address": - return protoreflect.ValueOfString("") - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgUnjailReporter")) - } - panic(fmt.Errorf("message layer.reporter.MsgUnjailReporter does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_MsgUnjailReporter) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in layer.reporter.MsgUnjailReporter", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_MsgUnjailReporter) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgUnjailReporter) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_MsgUnjailReporter) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_MsgUnjailReporter) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MsgUnjailReporter) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - l = len(x.ReporterAddress) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*MsgUnjailReporter) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if len(x.ReporterAddress) > 0 { - i -= len(x.ReporterAddress) - copy(dAtA[i:], x.ReporterAddress) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ReporterAddress))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*MsgUnjailReporter) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire 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++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUnjailReporter: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUnjailReporter: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ReporterAddress", 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.ReporterAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var ( - md_MsgUnjailReporterResponse protoreflect.MessageDescriptor -) - -func init() { - file_layer_reporter_tx_proto_init() - md_MsgUnjailReporterResponse = File_layer_reporter_tx_proto.Messages().ByName("MsgUnjailReporterResponse") -} - -var _ protoreflect.Message = (*fastReflection_MsgUnjailReporterResponse)(nil) - -type fastReflection_MsgUnjailReporterResponse MsgUnjailReporterResponse - -func (x *MsgUnjailReporterResponse) ProtoReflect() protoreflect.Message { - return (*fastReflection_MsgUnjailReporterResponse)(x) -} - -func (x *MsgUnjailReporterResponse) slowProtoReflect() protoreflect.Message { - mi := &file_layer_reporter_tx_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_MsgUnjailReporterResponse_messageType fastReflection_MsgUnjailReporterResponse_messageType -var _ protoreflect.MessageType = fastReflection_MsgUnjailReporterResponse_messageType{} - -type fastReflection_MsgUnjailReporterResponse_messageType struct{} - -func (x fastReflection_MsgUnjailReporterResponse_messageType) Zero() protoreflect.Message { - return (*fastReflection_MsgUnjailReporterResponse)(nil) -} -func (x fastReflection_MsgUnjailReporterResponse_messageType) New() protoreflect.Message { - return new(fastReflection_MsgUnjailReporterResponse) -} -func (x fastReflection_MsgUnjailReporterResponse_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MsgUnjailReporterResponse -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_MsgUnjailReporterResponse) Descriptor() protoreflect.MessageDescriptor { - return md_MsgUnjailReporterResponse -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_MsgUnjailReporterResponse) Type() protoreflect.MessageType { - return _fastReflection_MsgUnjailReporterResponse_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_MsgUnjailReporterResponse) New() protoreflect.Message { - return new(fastReflection_MsgUnjailReporterResponse) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_MsgUnjailReporterResponse) Interface() protoreflect.ProtoMessage { - return (*MsgUnjailReporterResponse)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_MsgUnjailReporterResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_MsgUnjailReporterResponse) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgUnjailReporterResponse")) - } - panic(fmt.Errorf("message layer.reporter.MsgUnjailReporterResponse does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgUnjailReporterResponse) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgUnjailReporterResponse")) - } - panic(fmt.Errorf("message layer.reporter.MsgUnjailReporterResponse does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_MsgUnjailReporterResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgUnjailReporterResponse")) - } - panic(fmt.Errorf("message layer.reporter.MsgUnjailReporterResponse does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgUnjailReporterResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgUnjailReporterResponse")) - } - panic(fmt.Errorf("message layer.reporter.MsgUnjailReporterResponse does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgUnjailReporterResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgUnjailReporterResponse")) - } - panic(fmt.Errorf("message layer.reporter.MsgUnjailReporterResponse does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_MsgUnjailReporterResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgUnjailReporterResponse")) - } - panic(fmt.Errorf("message layer.reporter.MsgUnjailReporterResponse does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_MsgUnjailReporterResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in layer.reporter.MsgUnjailReporterResponse", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_MsgUnjailReporterResponse) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgUnjailReporterResponse) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_MsgUnjailReporterResponse) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_MsgUnjailReporterResponse) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MsgUnjailReporterResponse) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*MsgUnjailReporterResponse) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*MsgUnjailReporterResponse) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire 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++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUnjailReporterResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUnjailReporterResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var ( - md_MsgWithdrawTip protoreflect.MessageDescriptor - fd_MsgWithdrawTip_delegator_address protoreflect.FieldDescriptor - fd_MsgWithdrawTip_validator_address protoreflect.FieldDescriptor -) - -func init() { - file_layer_reporter_tx_proto_init() - md_MsgWithdrawTip = File_layer_reporter_tx_proto.Messages().ByName("MsgWithdrawTip") - fd_MsgWithdrawTip_delegator_address = md_MsgWithdrawTip.Fields().ByName("delegator_address") - fd_MsgWithdrawTip_validator_address = md_MsgWithdrawTip.Fields().ByName("validator_address") -} - -var _ protoreflect.Message = (*fastReflection_MsgWithdrawTip)(nil) - -type fastReflection_MsgWithdrawTip MsgWithdrawTip - -func (x *MsgWithdrawTip) ProtoReflect() protoreflect.Message { - return (*fastReflection_MsgWithdrawTip)(x) -} - -func (x *MsgWithdrawTip) slowProtoReflect() protoreflect.Message { - mi := &file_layer_reporter_tx_proto_msgTypes[14] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_MsgWithdrawTip_messageType fastReflection_MsgWithdrawTip_messageType -var _ protoreflect.MessageType = fastReflection_MsgWithdrawTip_messageType{} - -type fastReflection_MsgWithdrawTip_messageType struct{} - -func (x fastReflection_MsgWithdrawTip_messageType) Zero() protoreflect.Message { - return (*fastReflection_MsgWithdrawTip)(nil) -} -func (x fastReflection_MsgWithdrawTip_messageType) New() protoreflect.Message { - return new(fastReflection_MsgWithdrawTip) -} -func (x fastReflection_MsgWithdrawTip_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MsgWithdrawTip -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_MsgWithdrawTip) Descriptor() protoreflect.MessageDescriptor { - return md_MsgWithdrawTip -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_MsgWithdrawTip) Type() protoreflect.MessageType { - return _fastReflection_MsgWithdrawTip_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_MsgWithdrawTip) New() protoreflect.Message { - return new(fastReflection_MsgWithdrawTip) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_MsgWithdrawTip) Interface() protoreflect.ProtoMessage { - return (*MsgWithdrawTip)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_MsgWithdrawTip) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.DelegatorAddress != "" { - value := protoreflect.ValueOfString(x.DelegatorAddress) - if !f(fd_MsgWithdrawTip_delegator_address, value) { - return - } - } - if x.ValidatorAddress != "" { - value := protoreflect.ValueOfString(x.ValidatorAddress) - if !f(fd_MsgWithdrawTip_validator_address, value) { - return - } - } -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_MsgWithdrawTip) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "layer.reporter.MsgWithdrawTip.delegator_address": - return x.DelegatorAddress != "" - case "layer.reporter.MsgWithdrawTip.validator_address": - return x.ValidatorAddress != "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawTip")) - } - panic(fmt.Errorf("message layer.reporter.MsgWithdrawTip does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgWithdrawTip) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "layer.reporter.MsgWithdrawTip.delegator_address": - x.DelegatorAddress = "" - case "layer.reporter.MsgWithdrawTip.validator_address": - x.ValidatorAddress = "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawTip")) - } - panic(fmt.Errorf("message layer.reporter.MsgWithdrawTip does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_MsgWithdrawTip) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "layer.reporter.MsgWithdrawTip.delegator_address": - value := x.DelegatorAddress - return protoreflect.ValueOfString(value) - case "layer.reporter.MsgWithdrawTip.validator_address": - value := x.ValidatorAddress - return protoreflect.ValueOfString(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawTip")) - } - panic(fmt.Errorf("message layer.reporter.MsgWithdrawTip does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgWithdrawTip) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "layer.reporter.MsgWithdrawTip.delegator_address": - x.DelegatorAddress = value.Interface().(string) - case "layer.reporter.MsgWithdrawTip.validator_address": - x.ValidatorAddress = value.Interface().(string) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawTip")) - } - panic(fmt.Errorf("message layer.reporter.MsgWithdrawTip does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgWithdrawTip) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "layer.reporter.MsgWithdrawTip.delegator_address": - panic(fmt.Errorf("field delegator_address of message layer.reporter.MsgWithdrawTip is not mutable")) - case "layer.reporter.MsgWithdrawTip.validator_address": - panic(fmt.Errorf("field validator_address of message layer.reporter.MsgWithdrawTip is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawTip")) - } - panic(fmt.Errorf("message layer.reporter.MsgWithdrawTip does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_MsgWithdrawTip) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "layer.reporter.MsgWithdrawTip.delegator_address": - return protoreflect.ValueOfString("") - case "layer.reporter.MsgWithdrawTip.validator_address": - return protoreflect.ValueOfString("") - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawTip")) - } - panic(fmt.Errorf("message layer.reporter.MsgWithdrawTip does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_MsgWithdrawTip) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in layer.reporter.MsgWithdrawTip", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_MsgWithdrawTip) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgWithdrawTip) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_MsgWithdrawTip) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_MsgWithdrawTip) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MsgWithdrawTip) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - l = len(x.DelegatorAddress) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - l = len(x.ValidatorAddress) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*MsgWithdrawTip) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if len(x.ValidatorAddress) > 0 { - i -= len(x.ValidatorAddress) - copy(dAtA[i:], x.ValidatorAddress) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ValidatorAddress))) - i-- - dAtA[i] = 0x12 - } - if len(x.DelegatorAddress) > 0 { - i -= len(x.DelegatorAddress) - copy(dAtA[i:], x.DelegatorAddress) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.DelegatorAddress))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*MsgWithdrawTip) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire 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++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgWithdrawTip: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgWithdrawTip: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", 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.DelegatorAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", 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.ValidatorAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var ( - md_MsgWithdrawTipResponse protoreflect.MessageDescriptor -) - -func init() { - file_layer_reporter_tx_proto_init() - md_MsgWithdrawTipResponse = File_layer_reporter_tx_proto.Messages().ByName("MsgWithdrawTipResponse") -} - -var _ protoreflect.Message = (*fastReflection_MsgWithdrawTipResponse)(nil) - -type fastReflection_MsgWithdrawTipResponse MsgWithdrawTipResponse - -func (x *MsgWithdrawTipResponse) ProtoReflect() protoreflect.Message { - return (*fastReflection_MsgWithdrawTipResponse)(x) -} - -func (x *MsgWithdrawTipResponse) slowProtoReflect() protoreflect.Message { - mi := &file_layer_reporter_tx_proto_msgTypes[15] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_MsgWithdrawTipResponse_messageType fastReflection_MsgWithdrawTipResponse_messageType -var _ protoreflect.MessageType = fastReflection_MsgWithdrawTipResponse_messageType{} - -type fastReflection_MsgWithdrawTipResponse_messageType struct{} - -func (x fastReflection_MsgWithdrawTipResponse_messageType) Zero() protoreflect.Message { - return (*fastReflection_MsgWithdrawTipResponse)(nil) -} -func (x fastReflection_MsgWithdrawTipResponse_messageType) New() protoreflect.Message { - return new(fastReflection_MsgWithdrawTipResponse) -} -func (x fastReflection_MsgWithdrawTipResponse_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MsgWithdrawTipResponse -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_MsgWithdrawTipResponse) Descriptor() protoreflect.MessageDescriptor { - return md_MsgWithdrawTipResponse -} - -// Type returns the message type, which encapsulates both Go and protobuf -// type information. If the Go type information is not needed, -// it is recommended that the message descriptor be used instead. -func (x *fastReflection_MsgWithdrawTipResponse) Type() protoreflect.MessageType { - return _fastReflection_MsgWithdrawTipResponse_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_MsgWithdrawTipResponse) New() protoreflect.Message { - return new(fastReflection_MsgWithdrawTipResponse) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_MsgWithdrawTipResponse) Interface() protoreflect.ProtoMessage { - return (*MsgWithdrawTipResponse)(x) -} - -// Range iterates over every populated field in an undefined order, -// calling f for each field descriptor and value encountered. -// Range returns immediately if f returns false. -// While iterating, mutating operations may only be performed -// on the current field descriptor. -func (x *fastReflection_MsgWithdrawTipResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { -} - -// Has reports whether a field is populated. -// -// Some fields have the property of nullability where it is possible to -// distinguish between the default value of a field and whether the field -// was explicitly populated with the default value. Singular message fields, -// member fields of a oneof, and proto2 scalar fields are nullable. Such -// fields are populated only if explicitly set. -// -// In other cases (aside from the nullable cases above), -// a proto3 scalar field is populated if it contains a non-zero value, and -// a repeated field is populated if it is non-empty. -func (x *fastReflection_MsgWithdrawTipResponse) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawTipResponse")) - } - panic(fmt.Errorf("message layer.reporter.MsgWithdrawTipResponse does not contain field %s", fd.FullName())) - } -} - -// Clear clears the field such that a subsequent Has call reports false. -// -// Clearing an extension field clears both the extension type and value -// associated with the given field number. -// -// Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgWithdrawTipResponse) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawTipResponse")) - } - panic(fmt.Errorf("message layer.reporter.MsgWithdrawTipResponse does not contain field %s", fd.FullName())) - } -} - -// Get retrieves the value for a field. -// -// For unpopulated scalars, it returns the default value, where -// the default value of a bytes scalar is guaranteed to be a copy. -// For unpopulated composite types, it returns an empty, read-only view -// of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_MsgWithdrawTipResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawTipResponse")) - } - panic(fmt.Errorf("message layer.reporter.MsgWithdrawTipResponse does not contain field %s", descriptor.FullName())) - } -} - -// Set stores the value for a field. -// -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType. -// When setting a composite type, it is unspecified whether the stored value -// aliases the source's memory in any way. If the composite value is an -// empty, read-only value, then it panics. -// -// Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgWithdrawTipResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawTipResponse")) - } - panic(fmt.Errorf("message layer.reporter.MsgWithdrawTipResponse does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgWithdrawTipResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawTipResponse")) - } - panic(fmt.Errorf("message layer.reporter.MsgWithdrawTipResponse does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_MsgWithdrawTipResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: layer.reporter.MsgWithdrawTipResponse")) - } - panic(fmt.Errorf("message layer.reporter.MsgWithdrawTipResponse does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_MsgWithdrawTipResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in layer.reporter.MsgWithdrawTipResponse", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_MsgWithdrawTipResponse) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgWithdrawTipResponse) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_MsgWithdrawTipResponse) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_MsgWithdrawTipResponse) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MsgWithdrawTipResponse) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*MsgWithdrawTipResponse) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*MsgWithdrawTipResponse) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire 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++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgWithdrawTipResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgWithdrawTipResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.27.0 -// protoc (unknown) -// source: layer/reporter/tx.proto - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// MsgUpdateParams is the Msg/UpdateParams request type. -type MsgUpdateParams struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // authority is the address that controls the module (defaults to x/gov unless overwritten). - Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` - // NOTE: All parameters must be supplied. - Params *Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty"` -} - -func (x *MsgUpdateParams) Reset() { - *x = MsgUpdateParams{} - if protoimpl.UnsafeEnabled { - mi := &file_layer_reporter_tx_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MsgUpdateParams) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MsgUpdateParams) ProtoMessage() {} - -// Deprecated: Use MsgUpdateParams.ProtoReflect.Descriptor instead. -func (*MsgUpdateParams) Descriptor() ([]byte, []int) { - return file_layer_reporter_tx_proto_rawDescGZIP(), []int{0} -} - -func (x *MsgUpdateParams) GetAuthority() string { - if x != nil { - return x.Authority - } - return "" -} - -func (x *MsgUpdateParams) GetParams() *Params { - if x != nil { - return x.Params - } - return nil -} - -// MsgUpdateParamsResponse defines the response structure for executing a -// MsgUpdateParams message. -type MsgUpdateParamsResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *MsgUpdateParamsResponse) Reset() { - *x = MsgUpdateParamsResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_layer_reporter_tx_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MsgUpdateParamsResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MsgUpdateParamsResponse) ProtoMessage() {} - -// Deprecated: Use MsgUpdateParamsResponse.ProtoReflect.Descriptor instead. -func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { - return file_layer_reporter_tx_proto_rawDescGZIP(), []int{1} -} - -type MsgCreateReporter struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Reporter string `protobuf:"bytes,1,opt,name=reporter,proto3" json:"reporter,omitempty"` - Amount string `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount,omitempty"` - TokenOrigins []*TokenOrigin `protobuf:"bytes,3,rep,name=token_origins,json=tokenOrigins,proto3" json:"token_origins,omitempty"` - Commission *v1beta1.Commission `protobuf:"bytes,4,opt,name=commission,proto3" json:"commission,omitempty"` -} - -func (x *MsgCreateReporter) Reset() { - *x = MsgCreateReporter{} - if protoimpl.UnsafeEnabled { - mi := &file_layer_reporter_tx_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MsgCreateReporter) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MsgCreateReporter) ProtoMessage() {} - -// Deprecated: Use MsgCreateReporter.ProtoReflect.Descriptor instead. -func (*MsgCreateReporter) Descriptor() ([]byte, []int) { - return file_layer_reporter_tx_proto_rawDescGZIP(), []int{2} -} - -func (x *MsgCreateReporter) GetReporter() string { - if x != nil { - return x.Reporter - } - return "" -} - -func (x *MsgCreateReporter) GetAmount() string { - if x != nil { - return x.Amount - } - return "" -} - -func (x *MsgCreateReporter) GetTokenOrigins() []*TokenOrigin { - if x != nil { - return x.TokenOrigins - } - return nil -} - -func (x *MsgCreateReporter) GetCommission() *v1beta1.Commission { - if x != nil { - return x.Commission - } - return nil -} - -type MsgCreateReporterResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *MsgCreateReporterResponse) Reset() { - *x = MsgCreateReporterResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_layer_reporter_tx_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MsgCreateReporterResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MsgCreateReporterResponse) ProtoMessage() {} - -// Deprecated: Use MsgCreateReporterResponse.ProtoReflect.Descriptor instead. -func (*MsgCreateReporterResponse) Descriptor() ([]byte, []int) { - return file_layer_reporter_tx_proto_rawDescGZIP(), []int{3} -} - -type MsgDelegateReporter struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Delegator string `protobuf:"bytes,1,opt,name=delegator,proto3" json:"delegator,omitempty"` - Reporter string `protobuf:"bytes,2,opt,name=reporter,proto3" json:"reporter,omitempty"` - Amount string `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount,omitempty"` - TokenOrigins []*TokenOrigin `protobuf:"bytes,4,rep,name=token_origins,json=tokenOrigins,proto3" json:"token_origins,omitempty"` -} - -func (x *MsgDelegateReporter) Reset() { - *x = MsgDelegateReporter{} - if protoimpl.UnsafeEnabled { - mi := &file_layer_reporter_tx_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MsgDelegateReporter) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MsgDelegateReporter) ProtoMessage() {} - -// Deprecated: Use MsgDelegateReporter.ProtoReflect.Descriptor instead. -func (*MsgDelegateReporter) Descriptor() ([]byte, []int) { - return file_layer_reporter_tx_proto_rawDescGZIP(), []int{4} -} - -func (x *MsgDelegateReporter) GetDelegator() string { - if x != nil { - return x.Delegator - } - return "" -} +func (*MsgUpdateParams) ProtoMessage() {} -func (x *MsgDelegateReporter) GetReporter() string { - if x != nil { - return x.Reporter - } - return "" +// Deprecated: Use MsgUpdateParams.ProtoReflect.Descriptor instead. +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return file_layer_reporter_tx_proto_rawDescGZIP(), []int{0} } -func (x *MsgDelegateReporter) GetAmount() string { +func (x *MsgUpdateParams) GetAuthority() string { if x != nil { - return x.Amount + return x.Authority } return "" } -func (x *MsgDelegateReporter) GetTokenOrigins() []*TokenOrigin { +func (x *MsgUpdateParams) GetParams() *Params { if x != nil { - return x.TokenOrigins + return x.Params } return nil } -// MsgDelegateReporterResponse defines the response structure for executing a MsgDelegateReporter message. -type MsgDelegateReporterResponse struct { +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +type MsgUpdateParamsResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields } -func (x *MsgDelegateReporterResponse) Reset() { - *x = MsgDelegateReporterResponse{} +func (x *MsgUpdateParamsResponse) Reset() { + *x = MsgUpdateParamsResponse{} if protoimpl.UnsafeEnabled { - mi := &file_layer_reporter_tx_proto_msgTypes[5] + mi := &file_layer_reporter_tx_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *MsgDelegateReporterResponse) String() string { +func (x *MsgUpdateParamsResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*MsgDelegateReporterResponse) ProtoMessage() {} +func (*MsgUpdateParamsResponse) ProtoMessage() {} -// Deprecated: Use MsgDelegateReporterResponse.ProtoReflect.Descriptor instead. -func (*MsgDelegateReporterResponse) Descriptor() ([]byte, []int) { - return file_layer_reporter_tx_proto_rawDescGZIP(), []int{5} +// Deprecated: Use MsgUpdateParamsResponse.ProtoReflect.Descriptor instead. +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return file_layer_reporter_tx_proto_rawDescGZIP(), []int{1} } -// MsgUndelegateReporter defines the Msg/UndelegateReporter request type. -type MsgUndelegateReporter struct { +type MsgCreateReporter struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` - // token_origin is the token origin to undelegate from. If empty, all token origins are undelegated, - // else the amount field will be the amount to undelegate from the specified token origin. - TokenOrigins []*TokenOrigin `protobuf:"bytes,2,rep,name=token_origins,json=tokenOrigins,proto3" json:"token_origins,omitempty"` + ReporterAddress string `protobuf:"bytes,1,opt,name=reporter_address,json=reporterAddress,proto3" json:"reporter_address,omitempty"` + Commission *v1beta1.Commission `protobuf:"bytes,2,opt,name=commission,proto3" json:"commission,omitempty"` } -func (x *MsgUndelegateReporter) Reset() { - *x = MsgUndelegateReporter{} +func (x *MsgCreateReporter) Reset() { + *x = MsgCreateReporter{} if protoimpl.UnsafeEnabled { - mi := &file_layer_reporter_tx_proto_msgTypes[6] + mi := &file_layer_reporter_tx_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *MsgUndelegateReporter) String() string { +func (x *MsgCreateReporter) String() string { return protoimpl.X.MessageStringOf(x) } -func (*MsgUndelegateReporter) ProtoMessage() {} +func (*MsgCreateReporter) ProtoMessage() {} -// Deprecated: Use MsgUndelegateReporter.ProtoReflect.Descriptor instead. -func (*MsgUndelegateReporter) Descriptor() ([]byte, []int) { - return file_layer_reporter_tx_proto_rawDescGZIP(), []int{6} +// Deprecated: Use MsgCreateReporter.ProtoReflect.Descriptor instead. +func (*MsgCreateReporter) Descriptor() ([]byte, []int) { + return file_layer_reporter_tx_proto_rawDescGZIP(), []int{2} } -func (x *MsgUndelegateReporter) GetDelegatorAddress() string { +func (x *MsgCreateReporter) GetReporterAddress() string { if x != nil { - return x.DelegatorAddress + return x.ReporterAddress } return "" } -func (x *MsgUndelegateReporter) GetTokenOrigins() []*TokenOrigin { +func (x *MsgCreateReporter) GetCommission() *v1beta1.Commission { if x != nil { - return x.TokenOrigins + return x.Commission } return nil } -type MsgUndelegateReporterResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *MsgUndelegateReporterResponse) Reset() { - *x = MsgUndelegateReporterResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_layer_reporter_tx_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MsgUndelegateReporterResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MsgUndelegateReporterResponse) ProtoMessage() {} - -// Deprecated: Use MsgUndelegateReporterResponse.ProtoReflect.Descriptor instead. -func (*MsgUndelegateReporterResponse) Descriptor() ([]byte, []int) { - return file_layer_reporter_tx_proto_rawDescGZIP(), []int{7} -} - -// MsgWithdrawReporterCommission withdraws the full commission to the reporter -// address. -type MsgWithdrawReporterCommission struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ReporterAddress string `protobuf:"bytes,1,opt,name=reporter_address,json=reporterAddress,proto3" json:"reporter_address,omitempty"` -} - -func (x *MsgWithdrawReporterCommission) Reset() { - *x = MsgWithdrawReporterCommission{} - if protoimpl.UnsafeEnabled { - mi := &file_layer_reporter_tx_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MsgWithdrawReporterCommission) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MsgWithdrawReporterCommission) ProtoMessage() {} - -// Deprecated: Use MsgWithdrawReporterCommission.ProtoReflect.Descriptor instead. -func (*MsgWithdrawReporterCommission) Descriptor() ([]byte, []int) { - return file_layer_reporter_tx_proto_rawDescGZIP(), []int{8} -} - -func (x *MsgWithdrawReporterCommission) GetReporterAddress() string { - if x != nil { - return x.ReporterAddress - } - return "" -} - -// MsgWithdrawReporterCommissionResponse defines the -// Msg/WithdrawReporterCommission response type. -type MsgWithdrawReporterCommissionResponse struct { +type MsgCreateReporterResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - - Amount []*v1beta11.Coin `protobuf:"bytes,1,rep,name=amount,proto3" json:"amount,omitempty"` } -func (x *MsgWithdrawReporterCommissionResponse) Reset() { - *x = MsgWithdrawReporterCommissionResponse{} +func (x *MsgCreateReporterResponse) Reset() { + *x = MsgCreateReporterResponse{} if protoimpl.UnsafeEnabled { - mi := &file_layer_reporter_tx_proto_msgTypes[9] + mi := &file_layer_reporter_tx_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *MsgWithdrawReporterCommissionResponse) String() string { +func (x *MsgCreateReporterResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*MsgWithdrawReporterCommissionResponse) ProtoMessage() {} - -// Deprecated: Use MsgWithdrawReporterCommissionResponse.ProtoReflect.Descriptor instead. -func (*MsgWithdrawReporterCommissionResponse) Descriptor() ([]byte, []int) { - return file_layer_reporter_tx_proto_rawDescGZIP(), []int{9} -} +func (*MsgCreateReporterResponse) ProtoMessage() {} -func (x *MsgWithdrawReporterCommissionResponse) GetAmount() []*v1beta11.Coin { - if x != nil { - return x.Amount - } - return nil +// Deprecated: Use MsgCreateReporterResponse.ProtoReflect.Descriptor instead. +func (*MsgCreateReporterResponse) Descriptor() ([]byte, []int) { + return file_layer_reporter_tx_proto_rawDescGZIP(), []int{3} } -// MsgWithdrawDelegatorReward represents delegation withdrawal to a delegator -// from a reporter. -type MsgWithdrawDelegatorReward struct { +type MsgChangeReporter struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -7809,75 +4349,64 @@ type MsgWithdrawDelegatorReward struct { ReporterAddress string `protobuf:"bytes,2,opt,name=reporter_address,json=reporterAddress,proto3" json:"reporter_address,omitempty"` } -func (x *MsgWithdrawDelegatorReward) Reset() { - *x = MsgWithdrawDelegatorReward{} +func (x *MsgChangeReporter) Reset() { + *x = MsgChangeReporter{} if protoimpl.UnsafeEnabled { - mi := &file_layer_reporter_tx_proto_msgTypes[10] + mi := &file_layer_reporter_tx_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *MsgWithdrawDelegatorReward) String() string { +func (x *MsgChangeReporter) String() string { return protoimpl.X.MessageStringOf(x) } -func (*MsgWithdrawDelegatorReward) ProtoMessage() {} +func (*MsgChangeReporter) ProtoMessage() {} -// Deprecated: Use MsgWithdrawDelegatorReward.ProtoReflect.Descriptor instead. -func (*MsgWithdrawDelegatorReward) Descriptor() ([]byte, []int) { - return file_layer_reporter_tx_proto_rawDescGZIP(), []int{10} +// Deprecated: Use MsgChangeReporter.ProtoReflect.Descriptor instead. +func (*MsgChangeReporter) Descriptor() ([]byte, []int) { + return file_layer_reporter_tx_proto_rawDescGZIP(), []int{4} } -func (x *MsgWithdrawDelegatorReward) GetDelegatorAddress() string { +func (x *MsgChangeReporter) GetDelegatorAddress() string { if x != nil { return x.DelegatorAddress } return "" } -func (x *MsgWithdrawDelegatorReward) GetReporterAddress() string { +func (x *MsgChangeReporter) GetReporterAddress() string { if x != nil { return x.ReporterAddress } return "" } -// MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward -// response type. -type MsgWithdrawDelegatorRewardResponse struct { +type MsgChangeReporterResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - - Amount []*v1beta11.Coin `protobuf:"bytes,1,rep,name=amount,proto3" json:"amount,omitempty"` } -func (x *MsgWithdrawDelegatorRewardResponse) Reset() { - *x = MsgWithdrawDelegatorRewardResponse{} +func (x *MsgChangeReporterResponse) Reset() { + *x = MsgChangeReporterResponse{} if protoimpl.UnsafeEnabled { - mi := &file_layer_reporter_tx_proto_msgTypes[11] + mi := &file_layer_reporter_tx_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *MsgWithdrawDelegatorRewardResponse) String() string { +func (x *MsgChangeReporterResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*MsgWithdrawDelegatorRewardResponse) ProtoMessage() {} - -// Deprecated: Use MsgWithdrawDelegatorRewardResponse.ProtoReflect.Descriptor instead. -func (*MsgWithdrawDelegatorRewardResponse) Descriptor() ([]byte, []int) { - return file_layer_reporter_tx_proto_rawDescGZIP(), []int{11} -} +func (*MsgChangeReporterResponse) ProtoMessage() {} -func (x *MsgWithdrawDelegatorRewardResponse) GetAmount() []*v1beta11.Coin { - if x != nil { - return x.Amount - } - return nil +// Deprecated: Use MsgChangeReporterResponse.ProtoReflect.Descriptor instead. +func (*MsgChangeReporterResponse) Descriptor() ([]byte, []int) { + return file_layer_reporter_tx_proto_rawDescGZIP(), []int{5} } // MsgUnjailReporter defines the Msg/UnjailReporter request type. @@ -7892,7 +4421,7 @@ type MsgUnjailReporter struct { func (x *MsgUnjailReporter) Reset() { *x = MsgUnjailReporter{} if protoimpl.UnsafeEnabled { - mi := &file_layer_reporter_tx_proto_msgTypes[12] + mi := &file_layer_reporter_tx_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -7906,7 +4435,7 @@ func (*MsgUnjailReporter) ProtoMessage() {} // Deprecated: Use MsgUnjailReporter.ProtoReflect.Descriptor instead. func (*MsgUnjailReporter) Descriptor() ([]byte, []int) { - return file_layer_reporter_tx_proto_rawDescGZIP(), []int{12} + return file_layer_reporter_tx_proto_rawDescGZIP(), []int{6} } func (x *MsgUnjailReporter) GetReporterAddress() string { @@ -7926,7 +4455,7 @@ type MsgUnjailReporterResponse struct { func (x *MsgUnjailReporterResponse) Reset() { *x = MsgUnjailReporterResponse{} if protoimpl.UnsafeEnabled { - mi := &file_layer_reporter_tx_proto_msgTypes[13] + mi := &file_layer_reporter_tx_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -7940,7 +4469,7 @@ func (*MsgUnjailReporterResponse) ProtoMessage() {} // Deprecated: Use MsgUnjailReporterResponse.ProtoReflect.Descriptor instead. func (*MsgUnjailReporterResponse) Descriptor() ([]byte, []int) { - return file_layer_reporter_tx_proto_rawDescGZIP(), []int{13} + return file_layer_reporter_tx_proto_rawDescGZIP(), []int{7} } // MsgWithdrawTip defines the Msg/WithdrawTip request type. @@ -7956,7 +4485,7 @@ type MsgWithdrawTip struct { func (x *MsgWithdrawTip) Reset() { *x = MsgWithdrawTip{} if protoimpl.UnsafeEnabled { - mi := &file_layer_reporter_tx_proto_msgTypes[14] + mi := &file_layer_reporter_tx_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -7970,7 +4499,7 @@ func (*MsgWithdrawTip) ProtoMessage() {} // Deprecated: Use MsgWithdrawTip.ProtoReflect.Descriptor instead. func (*MsgWithdrawTip) Descriptor() ([]byte, []int) { - return file_layer_reporter_tx_proto_rawDescGZIP(), []int{14} + return file_layer_reporter_tx_proto_rawDescGZIP(), []int{8} } func (x *MsgWithdrawTip) GetDelegatorAddress() string { @@ -7997,7 +4526,7 @@ type MsgWithdrawTipResponse struct { func (x *MsgWithdrawTipResponse) Reset() { *x = MsgWithdrawTipResponse{} if protoimpl.UnsafeEnabled { - mi := &file_layer_reporter_tx_proto_msgTypes[15] + mi := &file_layer_reporter_tx_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -8011,7 +4540,7 @@ func (*MsgWithdrawTipResponse) ProtoMessage() {} // Deprecated: Use MsgWithdrawTipResponse.ProtoReflect.Descriptor instead. func (*MsgWithdrawTipResponse) Descriptor() ([]byte, []int) { - return file_layer_reporter_tx_proto_rawDescGZIP(), []int{15} + return file_layer_reporter_tx_proto_rawDescGZIP(), []int{9} } var File_layer_reporter_tx_proto protoreflect.FileDescriptor @@ -8047,180 +4576,96 @@ var file_layer_reporter_tx_proto_rawDesc = []byte{ 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x19, 0x0a, 0x17, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x89, 0x02, 0x0a, 0x11, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, - 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x70, - 0x6f, 0x72, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x70, - 0x6f, 0x72, 0x74, 0x65, 0x72, 0x12, 0x43, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, - 0x2e, 0x49, 0x6e, 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, - 0x6e, 0x74, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x40, 0x0a, 0x0d, 0x74, 0x6f, - 0x6b, 0x65, 0x6e, 0x5f, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x1b, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, - 0x65, 0x72, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x52, 0x0c, - 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x73, 0x12, 0x42, 0x0a, 0x0a, - 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x22, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, - 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x73, - 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, - 0x3a, 0x0d, 0x82, 0xe7, 0xb0, 0x2a, 0x08, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x22, + 0x6e, 0x73, 0x65, 0x22, 0x99, 0x01, 0x0a, 0x11, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x12, 0x29, 0x0a, 0x10, 0x72, 0x65, 0x70, + 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x41, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x12, 0x42, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x73, 0x74, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x63, 0x6f, + 0x6d, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x3a, 0x15, 0x82, 0xe7, 0xb0, 0x2a, 0x10, 0x72, + 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x1b, 0x0a, 0x19, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, - 0x72, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xe6, 0x01, 0x0a, - 0x13, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, - 0x72, 0x74, 0x65, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, - 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, - 0x6f, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x12, 0x43, - 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2b, - 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, - 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xd2, 0xb4, 0x2d, - 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x06, 0x61, 0x6d, 0x6f, - 0x75, 0x6e, 0x74, 0x12, 0x40, 0x0a, 0x0d, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x6f, 0x72, 0x69, - 0x67, 0x69, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6c, 0x61, 0x79, - 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x54, 0x6f, 0x6b, 0x65, - 0x6e, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x52, 0x0c, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x4f, 0x72, - 0x69, 0x67, 0x69, 0x6e, 0x73, 0x3a, 0x0e, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x64, 0x65, 0x6c, 0x65, - 0x67, 0x61, 0x74, 0x6f, 0x72, 0x22, 0x1d, 0x0a, 0x1b, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x6c, 0x65, - 0x67, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x9e, 0x01, 0x0a, 0x15, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x64, 0x65, - 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x12, 0x2b, - 0x0a, 0x11, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x64, 0x65, 0x6c, 0x65, 0x67, - 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x40, 0x0a, 0x0d, 0x74, - 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, - 0x74, 0x65, 0x72, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x52, - 0x0c, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x73, 0x3a, 0x16, 0x82, - 0xe7, 0xb0, 0x2a, 0x11, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x1f, 0x0a, 0x1d, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x64, 0x65, - 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x83, 0x01, 0x0a, 0x1d, 0x4d, 0x73, 0x67, 0x57, 0x69, - 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x43, 0x6f, - 0x6d, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x43, 0x0a, 0x10, 0x72, 0x65, 0x70, 0x6f, + 0x72, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xb7, 0x01, 0x0a, + 0x11, 0x4d, 0x73, 0x67, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, + 0x65, 0x72, 0x12, 0x45, 0x0a, 0x11, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x5f, + 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, + 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x10, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, + 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x43, 0x0a, 0x10, 0x72, 0x65, 0x70, + 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x0f, 0x72, + 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x3a, 0x16, + 0x82, 0xe7, 0xb0, 0x2a, 0x11, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x1b, 0x0a, 0x19, 0x4d, 0x73, 0x67, 0x43, 0x68, 0x61, + 0x6e, 0x67, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x77, 0x0a, 0x11, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x6a, 0x61, 0x69, 0x6c, + 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x12, 0x43, 0x0a, 0x10, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x0f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x3a, 0x1d, 0x88, 0xa0, 0x1f, 0x00, 0xe8, 0xa0, 0x1f, 0x00, 0x82, 0xe7, 0xb0, 0x2a, 0x10, 0x72, 0x65, 0x70, 0x6f, - 0x72, 0x74, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x91, 0x01, 0x0a, - 0x25, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x52, 0x65, 0x70, 0x6f, - 0x72, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x68, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, - 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, - 0x6e, 0x42, 0x35, 0xc8, 0xde, 0x1f, 0x00, 0xaa, 0xdf, 0x1f, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, - 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x43, 0x6f, - 0x69, 0x6e, 0x73, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, - 0x22, 0xc8, 0x01, 0x0a, 0x1a, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, - 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x12, - 0x45, 0x0a, 0x11, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, - 0x72, 0x69, 0x6e, 0x67, 0x52, 0x10, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x41, - 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x43, 0x0a, 0x10, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, - 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x0f, 0x72, 0x65, 0x70, 0x6f, - 0x72, 0x74, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x3a, 0x1e, 0x88, 0xa0, 0x1f, - 0x00, 0xe8, 0xa0, 0x1f, 0x00, 0x82, 0xe7, 0xb0, 0x2a, 0x11, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, - 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x8e, 0x01, 0x0a, 0x22, - 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x44, 0x65, 0x6c, 0x65, 0x67, - 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x68, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, - 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x35, 0xc8, - 0xde, 0x1f, 0x00, 0xaa, 0xdf, 0x1f, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, - 0x73, 0x64, 0x6b, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0xa8, - 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x77, 0x0a, 0x11, + 0x72, 0x74, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x1b, 0x0a, 0x19, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x6a, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, - 0x72, 0x12, 0x43, 0x0a, 0x10, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5f, 0x61, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, - 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, - 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x0f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x41, - 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x3a, 0x1d, 0x88, 0xa0, 0x1f, 0x00, 0xe8, 0xa0, 0x1f, 0x00, - 0x82, 0xe7, 0xb0, 0x2a, 0x10, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5f, 0x61, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x1b, 0x0a, 0x19, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x6a, 0x61, - 0x69, 0x6c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0xbf, 0x01, 0x0a, 0x0e, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, - 0x61, 0x77, 0x54, 0x69, 0x70, 0x12, 0x45, 0x0a, 0x11, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, - 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x10, 0x64, 0x65, 0x6c, 0x65, - 0x67, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x4e, 0x0a, 0x11, - 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x21, 0xd2, 0xb4, 0x2d, 0x1d, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x10, 0x76, 0x61, 0x6c, 0x69, - 0x64, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x3a, 0x16, 0x82, 0xe7, - 0xb0, 0x2a, 0x11, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x22, 0x18, 0x0a, 0x16, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, - 0x72, 0x61, 0x77, 0x54, 0x69, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xcf, - 0x06, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x58, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x1f, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, - 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x27, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, - 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x5e, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, - 0x65, 0x72, 0x12, 0x21, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, - 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, - 0x6f, 0x72, 0x74, 0x65, 0x72, 0x1a, 0x29, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, - 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, - 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x64, 0x0a, 0x10, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, - 0x72, 0x74, 0x65, 0x72, 0x12, 0x23, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, - 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, - 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x1a, 0x2b, 0x2e, 0x6c, 0x61, 0x79, 0x65, - 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x65, - 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6a, 0x0a, 0x12, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, - 0x67, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x12, 0x25, 0x2e, 0x6c, - 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, - 0x67, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, - 0x74, 0x65, 0x72, 0x1a, 0x2d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, - 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, - 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x82, 0x01, 0x0a, 0x1a, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x52, - 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, - 0x6e, 0x12, 0x2d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, - 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x52, 0x65, - 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, - 0x1a, 0x35, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, - 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x52, 0x65, 0x70, - 0x6f, 0x72, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x79, 0x0a, 0x17, 0x57, 0x69, 0x74, 0x68, 0x64, - 0x72, 0x61, 0x77, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x77, 0x61, - 0x72, 0x64, 0x12, 0x2a, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, - 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x44, - 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x1a, 0x32, + 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xbf, 0x01, 0x0a, 0x0e, 0x4d, 0x73, + 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x54, 0x69, 0x70, 0x12, 0x45, 0x0a, 0x11, + 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, + 0x67, 0x52, 0x10, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x12, 0x4e, 0x0a, 0x11, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, + 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x21, + 0xd2, 0xb4, 0x2d, 0x1d, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, + 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, + 0x67, 0x52, 0x10, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x3a, 0x16, 0x82, 0xe7, 0xb0, 0x2a, 0x11, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, + 0x74, 0x6f, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x18, 0x0a, 0x16, 0x4d, + 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x54, 0x69, 0x70, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xdd, 0x03, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x58, 0x0a, + 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x1f, 0x2e, + 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, + 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x27, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, - 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x44, 0x65, 0x6c, 0x65, 0x67, - 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x5e, 0x0a, 0x0e, 0x55, 0x6e, 0x6a, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x70, 0x6f, - 0x72, 0x74, 0x65, 0x72, 0x12, 0x21, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, - 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x6a, 0x61, 0x69, 0x6c, 0x52, - 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x1a, 0x29, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, - 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x6a, 0x61, - 0x69, 0x6c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x55, 0x0a, 0x0b, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x54, 0x69, - 0x70, 0x12, 0x1e, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, - 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x54, 0x69, - 0x70, 0x1a, 0x26, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, - 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x54, 0x69, - 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, - 0x42, 0xa5, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, - 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, - 0x50, 0x01, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, - 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x61, - 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, - 0x72, 0xa2, 0x02, 0x03, 0x4c, 0x52, 0x58, 0xaa, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x2e, - 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xca, 0x02, 0x0e, 0x4c, 0x61, 0x79, 0x65, 0x72, - 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xe2, 0x02, 0x1a, 0x4c, 0x61, 0x79, 0x65, - 0x72, 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x3a, 0x3a, - 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5e, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x12, 0x21, 0x2e, 0x6c, 0x61, 0x79, 0x65, + 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x1a, 0x29, 0x2e, 0x6c, + 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, + 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5e, 0x0a, 0x0e, 0x43, 0x68, 0x61, 0x6e, 0x67, + 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x12, 0x21, 0x2e, 0x6c, 0x61, 0x79, 0x65, + 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x68, + 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x1a, 0x29, 0x2e, 0x6c, + 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, + 0x67, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5e, 0x0a, 0x0e, 0x55, 0x6e, 0x6a, 0x61, 0x69, + 0x6c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x12, 0x21, 0x2e, 0x6c, 0x61, 0x79, 0x65, + 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, + 0x6a, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x1a, 0x29, 0x2e, 0x6c, + 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, + 0x67, 0x55, 0x6e, 0x6a, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x55, 0x0a, 0x0b, 0x57, 0x69, 0x74, 0x68, 0x64, + 0x72, 0x61, 0x77, 0x54, 0x69, 0x70, 0x12, 0x1e, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, + 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, + 0x72, 0x61, 0x77, 0x54, 0x69, 0x70, 0x1a, 0x26, 0x2e, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2e, 0x72, + 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x57, 0x69, 0x74, 0x68, 0x64, + 0x72, 0x61, 0x77, 0x54, 0x69, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, + 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xa5, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x6c, 0x61, + 0x79, 0x65, 0x72, 0x2e, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x42, 0x07, 0x54, 0x78, + 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x65, 0x6c, 0x6c, 0x6f, 0x72, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, + 0x79, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x2f, 0x72, 0x65, + 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xa2, 0x02, 0x03, 0x4c, 0x52, 0x58, 0xaa, 0x02, 0x0e, 0x4c, + 0x61, 0x79, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xca, 0x02, 0x0e, + 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0xe2, 0x02, + 0x1a, 0x4c, 0x61, 0x79, 0x65, 0x72, 0x5c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x5c, + 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x4c, 0x61, + 0x79, 0x65, 0x72, 0x3a, 0x3a, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x72, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -8235,58 +4680,39 @@ func file_layer_reporter_tx_proto_rawDescGZIP() []byte { return file_layer_reporter_tx_proto_rawDescData } -var file_layer_reporter_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 16) +var file_layer_reporter_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 10) var file_layer_reporter_tx_proto_goTypes = []interface{}{ - (*MsgUpdateParams)(nil), // 0: layer.reporter.MsgUpdateParams - (*MsgUpdateParamsResponse)(nil), // 1: layer.reporter.MsgUpdateParamsResponse - (*MsgCreateReporter)(nil), // 2: layer.reporter.MsgCreateReporter - (*MsgCreateReporterResponse)(nil), // 3: layer.reporter.MsgCreateReporterResponse - (*MsgDelegateReporter)(nil), // 4: layer.reporter.MsgDelegateReporter - (*MsgDelegateReporterResponse)(nil), // 5: layer.reporter.MsgDelegateReporterResponse - (*MsgUndelegateReporter)(nil), // 6: layer.reporter.MsgUndelegateReporter - (*MsgUndelegateReporterResponse)(nil), // 7: layer.reporter.MsgUndelegateReporterResponse - (*MsgWithdrawReporterCommission)(nil), // 8: layer.reporter.MsgWithdrawReporterCommission - (*MsgWithdrawReporterCommissionResponse)(nil), // 9: layer.reporter.MsgWithdrawReporterCommissionResponse - (*MsgWithdrawDelegatorReward)(nil), // 10: layer.reporter.MsgWithdrawDelegatorReward - (*MsgWithdrawDelegatorRewardResponse)(nil), // 11: layer.reporter.MsgWithdrawDelegatorRewardResponse - (*MsgUnjailReporter)(nil), // 12: layer.reporter.MsgUnjailReporter - (*MsgUnjailReporterResponse)(nil), // 13: layer.reporter.MsgUnjailReporterResponse - (*MsgWithdrawTip)(nil), // 14: layer.reporter.MsgWithdrawTip - (*MsgWithdrawTipResponse)(nil), // 15: layer.reporter.MsgWithdrawTipResponse - (*Params)(nil), // 16: layer.reporter.Params - (*TokenOrigin)(nil), // 17: layer.reporter.TokenOrigin - (*v1beta1.Commission)(nil), // 18: cosmos.staking.v1beta1.Commission - (*v1beta11.Coin)(nil), // 19: cosmos.base.v1beta1.Coin + (*MsgUpdateParams)(nil), // 0: layer.reporter.MsgUpdateParams + (*MsgUpdateParamsResponse)(nil), // 1: layer.reporter.MsgUpdateParamsResponse + (*MsgCreateReporter)(nil), // 2: layer.reporter.MsgCreateReporter + (*MsgCreateReporterResponse)(nil), // 3: layer.reporter.MsgCreateReporterResponse + (*MsgChangeReporter)(nil), // 4: layer.reporter.MsgChangeReporter + (*MsgChangeReporterResponse)(nil), // 5: layer.reporter.MsgChangeReporterResponse + (*MsgUnjailReporter)(nil), // 6: layer.reporter.MsgUnjailReporter + (*MsgUnjailReporterResponse)(nil), // 7: layer.reporter.MsgUnjailReporterResponse + (*MsgWithdrawTip)(nil), // 8: layer.reporter.MsgWithdrawTip + (*MsgWithdrawTipResponse)(nil), // 9: layer.reporter.MsgWithdrawTipResponse + (*Params)(nil), // 10: layer.reporter.Params + (*v1beta1.Commission)(nil), // 11: cosmos.staking.v1beta1.Commission } var file_layer_reporter_tx_proto_depIdxs = []int32{ - 16, // 0: layer.reporter.MsgUpdateParams.params:type_name -> layer.reporter.Params - 17, // 1: layer.reporter.MsgCreateReporter.token_origins:type_name -> layer.reporter.TokenOrigin - 18, // 2: layer.reporter.MsgCreateReporter.commission:type_name -> cosmos.staking.v1beta1.Commission - 17, // 3: layer.reporter.MsgDelegateReporter.token_origins:type_name -> layer.reporter.TokenOrigin - 17, // 4: layer.reporter.MsgUndelegateReporter.token_origins:type_name -> layer.reporter.TokenOrigin - 19, // 5: layer.reporter.MsgWithdrawReporterCommissionResponse.amount:type_name -> cosmos.base.v1beta1.Coin - 19, // 6: layer.reporter.MsgWithdrawDelegatorRewardResponse.amount:type_name -> cosmos.base.v1beta1.Coin - 0, // 7: layer.reporter.Msg.UpdateParams:input_type -> layer.reporter.MsgUpdateParams - 2, // 8: layer.reporter.Msg.CreateReporter:input_type -> layer.reporter.MsgCreateReporter - 4, // 9: layer.reporter.Msg.DelegateReporter:input_type -> layer.reporter.MsgDelegateReporter - 6, // 10: layer.reporter.Msg.UndelegateReporter:input_type -> layer.reporter.MsgUndelegateReporter - 8, // 11: layer.reporter.Msg.WithdrawReporterCommission:input_type -> layer.reporter.MsgWithdrawReporterCommission - 10, // 12: layer.reporter.Msg.WithdrawDelegatorReward:input_type -> layer.reporter.MsgWithdrawDelegatorReward - 12, // 13: layer.reporter.Msg.UnjailReporter:input_type -> layer.reporter.MsgUnjailReporter - 14, // 14: layer.reporter.Msg.WithdrawTip:input_type -> layer.reporter.MsgWithdrawTip - 1, // 15: layer.reporter.Msg.UpdateParams:output_type -> layer.reporter.MsgUpdateParamsResponse - 3, // 16: layer.reporter.Msg.CreateReporter:output_type -> layer.reporter.MsgCreateReporterResponse - 5, // 17: layer.reporter.Msg.DelegateReporter:output_type -> layer.reporter.MsgDelegateReporterResponse - 7, // 18: layer.reporter.Msg.UndelegateReporter:output_type -> layer.reporter.MsgUndelegateReporterResponse - 9, // 19: layer.reporter.Msg.WithdrawReporterCommission:output_type -> layer.reporter.MsgWithdrawReporterCommissionResponse - 11, // 20: layer.reporter.Msg.WithdrawDelegatorReward:output_type -> layer.reporter.MsgWithdrawDelegatorRewardResponse - 13, // 21: layer.reporter.Msg.UnjailReporter:output_type -> layer.reporter.MsgUnjailReporterResponse - 15, // 22: layer.reporter.Msg.WithdrawTip:output_type -> layer.reporter.MsgWithdrawTipResponse - 15, // [15:23] is the sub-list for method output_type - 7, // [7:15] is the sub-list for method input_type - 7, // [7:7] is the sub-list for extension type_name - 7, // [7:7] is the sub-list for extension extendee - 0, // [0:7] is the sub-list for field type_name + 10, // 0: layer.reporter.MsgUpdateParams.params:type_name -> layer.reporter.Params + 11, // 1: layer.reporter.MsgCreateReporter.commission:type_name -> cosmos.staking.v1beta1.Commission + 0, // 2: layer.reporter.Msg.UpdateParams:input_type -> layer.reporter.MsgUpdateParams + 2, // 3: layer.reporter.Msg.CreateReporter:input_type -> layer.reporter.MsgCreateReporter + 4, // 4: layer.reporter.Msg.ChangeReporter:input_type -> layer.reporter.MsgChangeReporter + 6, // 5: layer.reporter.Msg.UnjailReporter:input_type -> layer.reporter.MsgUnjailReporter + 8, // 6: layer.reporter.Msg.WithdrawTip:input_type -> layer.reporter.MsgWithdrawTip + 1, // 7: layer.reporter.Msg.UpdateParams:output_type -> layer.reporter.MsgUpdateParamsResponse + 3, // 8: layer.reporter.Msg.CreateReporter:output_type -> layer.reporter.MsgCreateReporterResponse + 5, // 9: layer.reporter.Msg.ChangeReporter:output_type -> layer.reporter.MsgChangeReporterResponse + 7, // 10: layer.reporter.Msg.UnjailReporter:output_type -> layer.reporter.MsgUnjailReporterResponse + 9, // 11: layer.reporter.Msg.WithdrawTip:output_type -> layer.reporter.MsgWithdrawTipResponse + 7, // [7:12] is the sub-list for method output_type + 2, // [2:7] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name } func init() { file_layer_reporter_tx_proto_init() } @@ -8346,7 +4772,7 @@ func file_layer_reporter_tx_proto_init() { } } file_layer_reporter_tx_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MsgDelegateReporter); i { + switch v := v.(*MsgChangeReporter); i { case 0: return &v.state case 1: @@ -8358,7 +4784,7 @@ func file_layer_reporter_tx_proto_init() { } } file_layer_reporter_tx_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MsgDelegateReporterResponse); i { + switch v := v.(*MsgChangeReporterResponse); i { case 0: return &v.state case 1: @@ -8370,78 +4796,6 @@ func file_layer_reporter_tx_proto_init() { } } file_layer_reporter_tx_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MsgUndelegateReporter); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_layer_reporter_tx_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MsgUndelegateReporterResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_layer_reporter_tx_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MsgWithdrawReporterCommission); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_layer_reporter_tx_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MsgWithdrawReporterCommissionResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_layer_reporter_tx_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MsgWithdrawDelegatorReward); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_layer_reporter_tx_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MsgWithdrawDelegatorRewardResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_layer_reporter_tx_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*MsgUnjailReporter); i { case 0: return &v.state @@ -8453,7 +4807,7 @@ func file_layer_reporter_tx_proto_init() { return nil } } - file_layer_reporter_tx_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + file_layer_reporter_tx_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*MsgUnjailReporterResponse); i { case 0: return &v.state @@ -8465,7 +4819,7 @@ func file_layer_reporter_tx_proto_init() { return nil } } - file_layer_reporter_tx_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + file_layer_reporter_tx_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*MsgWithdrawTip); i { case 0: return &v.state @@ -8477,7 +4831,7 @@ func file_layer_reporter_tx_proto_init() { return nil } } - file_layer_reporter_tx_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + file_layer_reporter_tx_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*MsgWithdrawTipResponse); i { case 0: return &v.state @@ -8496,7 +4850,7 @@ func file_layer_reporter_tx_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_layer_reporter_tx_proto_rawDesc, NumEnums: 0, - NumMessages: 16, + NumMessages: 10, NumExtensions: 0, NumServices: 1, }, diff --git a/api/layer/reporter/tx_grpc.pb.go b/api/layer/reporter/tx_grpc.pb.go index e146d205a..f07292d38 100644 --- a/api/layer/reporter/tx_grpc.pb.go +++ b/api/layer/reporter/tx_grpc.pb.go @@ -23,16 +23,7 @@ type MsgClient interface { UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) // CreateReporter defines a (reporter) operation for creating a new reporter. CreateReporter(ctx context.Context, in *MsgCreateReporter, opts ...grpc.CallOption) (*MsgCreateReporterResponse, error) - // DelegateReporter defines a (reporter) operation for delegating to a reporter. - DelegateReporter(ctx context.Context, in *MsgDelegateReporter, opts ...grpc.CallOption) (*MsgDelegateReporterResponse, error) - // UndelegateReporter defines a (reporter) operation for undelegating from a reporter. - UndelegateReporter(ctx context.Context, in *MsgUndelegateReporter, opts ...grpc.CallOption) (*MsgUndelegateReporterResponse, error) - // WithdrawReporterCommission defines a method to withdraw the - // full commission to the reporter address. - WithdrawReporterCommission(ctx context.Context, in *MsgWithdrawReporterCommission, opts ...grpc.CallOption) (*MsgWithdrawReporterCommissionResponse, error) - // WithdrawDelegatorReward defines a method to withdraw rewards of delegator - // from a reporter. - WithdrawDelegatorReward(ctx context.Context, in *MsgWithdrawDelegatorReward, opts ...grpc.CallOption) (*MsgWithdrawDelegatorRewardResponse, error) + ChangeReporter(ctx context.Context, in *MsgChangeReporter, opts ...grpc.CallOption) (*MsgChangeReporterResponse, error) // UnjailReporter defines a method to unjail a jailed reporter. UnjailReporter(ctx context.Context, in *MsgUnjailReporter, opts ...grpc.CallOption) (*MsgUnjailReporterResponse, error) // WithdrawTip defines a method to withdraw tip from a reporter module. @@ -65,36 +56,9 @@ func (c *msgClient) CreateReporter(ctx context.Context, in *MsgCreateReporter, o return out, nil } -func (c *msgClient) DelegateReporter(ctx context.Context, in *MsgDelegateReporter, opts ...grpc.CallOption) (*MsgDelegateReporterResponse, error) { - out := new(MsgDelegateReporterResponse) - err := c.cc.Invoke(ctx, "/layer.reporter.Msg/DelegateReporter", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) UndelegateReporter(ctx context.Context, in *MsgUndelegateReporter, opts ...grpc.CallOption) (*MsgUndelegateReporterResponse, error) { - out := new(MsgUndelegateReporterResponse) - err := c.cc.Invoke(ctx, "/layer.reporter.Msg/UndelegateReporter", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) WithdrawReporterCommission(ctx context.Context, in *MsgWithdrawReporterCommission, opts ...grpc.CallOption) (*MsgWithdrawReporterCommissionResponse, error) { - out := new(MsgWithdrawReporterCommissionResponse) - err := c.cc.Invoke(ctx, "/layer.reporter.Msg/WithdrawReporterCommission", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) WithdrawDelegatorReward(ctx context.Context, in *MsgWithdrawDelegatorReward, opts ...grpc.CallOption) (*MsgWithdrawDelegatorRewardResponse, error) { - out := new(MsgWithdrawDelegatorRewardResponse) - err := c.cc.Invoke(ctx, "/layer.reporter.Msg/WithdrawDelegatorReward", in, out, opts...) +func (c *msgClient) ChangeReporter(ctx context.Context, in *MsgChangeReporter, opts ...grpc.CallOption) (*MsgChangeReporterResponse, error) { + out := new(MsgChangeReporterResponse) + err := c.cc.Invoke(ctx, "/layer.reporter.Msg/ChangeReporter", in, out, opts...) if err != nil { return nil, err } @@ -128,16 +92,7 @@ type MsgServer interface { UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) // CreateReporter defines a (reporter) operation for creating a new reporter. CreateReporter(context.Context, *MsgCreateReporter) (*MsgCreateReporterResponse, error) - // DelegateReporter defines a (reporter) operation for delegating to a reporter. - DelegateReporter(context.Context, *MsgDelegateReporter) (*MsgDelegateReporterResponse, error) - // UndelegateReporter defines a (reporter) operation for undelegating from a reporter. - UndelegateReporter(context.Context, *MsgUndelegateReporter) (*MsgUndelegateReporterResponse, error) - // WithdrawReporterCommission defines a method to withdraw the - // full commission to the reporter address. - WithdrawReporterCommission(context.Context, *MsgWithdrawReporterCommission) (*MsgWithdrawReporterCommissionResponse, error) - // WithdrawDelegatorReward defines a method to withdraw rewards of delegator - // from a reporter. - WithdrawDelegatorReward(context.Context, *MsgWithdrawDelegatorReward) (*MsgWithdrawDelegatorRewardResponse, error) + ChangeReporter(context.Context, *MsgChangeReporter) (*MsgChangeReporterResponse, error) // UnjailReporter defines a method to unjail a jailed reporter. UnjailReporter(context.Context, *MsgUnjailReporter) (*MsgUnjailReporterResponse, error) // WithdrawTip defines a method to withdraw tip from a reporter module. @@ -155,17 +110,8 @@ func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (* func (UnimplementedMsgServer) CreateReporter(context.Context, *MsgCreateReporter) (*MsgCreateReporterResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CreateReporter not implemented") } -func (UnimplementedMsgServer) DelegateReporter(context.Context, *MsgDelegateReporter) (*MsgDelegateReporterResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DelegateReporter not implemented") -} -func (UnimplementedMsgServer) UndelegateReporter(context.Context, *MsgUndelegateReporter) (*MsgUndelegateReporterResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UndelegateReporter not implemented") -} -func (UnimplementedMsgServer) WithdrawReporterCommission(context.Context, *MsgWithdrawReporterCommission) (*MsgWithdrawReporterCommissionResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method WithdrawReporterCommission not implemented") -} -func (UnimplementedMsgServer) WithdrawDelegatorReward(context.Context, *MsgWithdrawDelegatorReward) (*MsgWithdrawDelegatorRewardResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method WithdrawDelegatorReward not implemented") +func (UnimplementedMsgServer) ChangeReporter(context.Context, *MsgChangeReporter) (*MsgChangeReporterResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ChangeReporter not implemented") } func (UnimplementedMsgServer) UnjailReporter(context.Context, *MsgUnjailReporter) (*MsgUnjailReporterResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UnjailReporter not implemented") @@ -222,74 +168,20 @@ func _Msg_CreateReporter_Handler(srv interface{}, ctx context.Context, dec func( return interceptor(ctx, in, info, handler) } -func _Msg_DelegateReporter_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgDelegateReporter) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).DelegateReporter(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/layer.reporter.Msg/DelegateReporter", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).DelegateReporter(ctx, req.(*MsgDelegateReporter)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_UndelegateReporter_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgUndelegateReporter) +func _Msg_ChangeReporter_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgChangeReporter) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).UndelegateReporter(ctx, in) + return srv.(MsgServer).ChangeReporter(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/layer.reporter.Msg/UndelegateReporter", + FullMethod: "/layer.reporter.Msg/ChangeReporter", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).UndelegateReporter(ctx, req.(*MsgUndelegateReporter)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_WithdrawReporterCommission_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgWithdrawReporterCommission) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).WithdrawReporterCommission(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/layer.reporter.Msg/WithdrawReporterCommission", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).WithdrawReporterCommission(ctx, req.(*MsgWithdrawReporterCommission)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_WithdrawDelegatorReward_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgWithdrawDelegatorReward) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).WithdrawDelegatorReward(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/layer.reporter.Msg/WithdrawDelegatorReward", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).WithdrawDelegatorReward(ctx, req.(*MsgWithdrawDelegatorReward)) + return srv.(MsgServer).ChangeReporter(ctx, req.(*MsgChangeReporter)) } return interceptor(ctx, in, info, handler) } @@ -346,20 +238,8 @@ var Msg_ServiceDesc = grpc.ServiceDesc{ Handler: _Msg_CreateReporter_Handler, }, { - MethodName: "DelegateReporter", - Handler: _Msg_DelegateReporter_Handler, - }, - { - MethodName: "UndelegateReporter", - Handler: _Msg_UndelegateReporter_Handler, - }, - { - MethodName: "WithdrawReporterCommission", - Handler: _Msg_WithdrawReporterCommission_Handler, - }, - { - MethodName: "WithdrawDelegatorReward", - Handler: _Msg_WithdrawDelegatorReward_Handler, + MethodName: "ChangeReporter", + Handler: _Msg_ChangeReporter_Handler, }, { MethodName: "UnjailReporter", diff --git a/daemons/reporter/client/client.go b/daemons/reporter/client/client.go index 70b5cc30a..6412f7bad 100644 --- a/daemons/reporter/client/client.go +++ b/daemons/reporter/client/client.go @@ -18,7 +18,6 @@ import ( reportertypes "github.com/tellor-io/layer/x/reporter/types" "cosmossdk.io/log" - "cosmossdk.io/math" "github.com/cosmos/cosmos-sdk/client" sdk "github.com/cosmos/cosmos-sdk/types" @@ -141,11 +140,6 @@ func StartReporterDaemonTaskLoop( stop <-chan bool, ctxGetter func(int64, bool) (sdk.Context, error), ) { - if err := client.CreateReporter(ctx, ctxGetter); err != nil { - client.logger.Error("Error creating reporter: %w", "err", err) - panic(err) - } - for { select { case <-ticker.C: @@ -164,76 +158,6 @@ func StartReporterDaemonTaskLoop( } } -// MsgCreateReporter creates a staked reporter -func (c *Client) CreateReporter(ctx context.Context, ctxGetter func(int64, bool) (sdk.Context, error)) error { - for { - latestHeight, err := c.LatestBlockHeight(ctx) - if err != nil { - c.logger.Error("Error getting latest block height: %v", err) - panic(err) - } - - if latestHeight < 2 { - time.Sleep(time.Second) - continue - } - - appCtx, err := ctxGetter(0, false) - if err != nil { - c.logger.Error("Error getting context: %v", err) - time.Sleep(time.Second * 5) - appCtx, err = ctxGetter(0, false) - if err != nil { - c.logger.Error("Error getting context: %v", err) - panic(err) - } - } - - validators, err := c.StakingKeeper.GetDelegatorValidators(appCtx, c.accAddr, 1) - if err != nil { - return err - } - if len(validators.Validators) == 0 { - c.logger.Info("No validators found, waiting for validators to be available") - time.Sleep(time.Second) - } else { - break - } - } - - // get reporter - appCtx, err := ctxGetter(0, false) - if err != nil { - return err - } - - validators, err := c.StakingKeeper.GetDelegatorValidators(appCtx, c.accAddr, 1) - if err != nil { - return err - } - - val := validators.Validators[0] - valAcc, err := sdk.ValAddressFromBech32(val.OperatorAddress) - if err != nil { - return err - } - - // stake reporter transaction, reporter is determined by LAYERD_NODE_HOME environment variable - // should make this configurable by user :time.Sleep(time.Second)todo - // staking 1 TRB - amtToStake := math.NewInt(1_000_000) // one TRB - commission := reportertypes.NewCommissionWithTime(math.LegacyNewDecWithPrec(1, 1), math.LegacyNewDecWithPrec(3, 1), - math.LegacyNewDecWithPrec(1, 1), time.Now()) - source := reportertypes.TokenOrigin{ValidatorAddress: valAcc, Amount: amtToStake} - msgCreateReporter := &reportertypes.MsgCreateReporter{ - Reporter: c.accAddr.String(), - Amount: amtToStake, - TokenOrigins: []*reportertypes.TokenOrigin{&source}, - Commission: &commission, - } - return c.sendTx(ctx, msgCreateReporter, nil) -} - func (c *Client) SubmitReport(ctx context.Context) error { querydata, value, err := c.deposits() if err != nil { diff --git a/daemons/server/median/median.go b/daemons/server/median/median.go index 65845fada..ab76832f4 100644 --- a/daemons/server/median/median.go +++ b/daemons/server/median/median.go @@ -46,8 +46,6 @@ func (s *medianServer) GetAllMedianValues(ctx context.Context, req *types.GetAll medianValues = append(medianValues, &types.MedianValues{ MarketId: i, Price: value, - // TODO: add exponent as well here - // Exponent: , }) } return &types.GetAllMedianValuesResponse{MedianValues: medianValues}, nil diff --git a/proto/layer/oracle/aggregate_reporter.proto b/proto/layer/oracle/aggregate_reporter.proto index bbaca3e77..ec077f6f5 100644 --- a/proto/layer/oracle/aggregate_reporter.proto +++ b/proto/layer/oracle/aggregate_reporter.proto @@ -4,7 +4,7 @@ package layer.oracle; option go_package = "github.com/tellor-io/layer/x/oracle/types"; message AggregateReporter { - - string reporter = 1; - int64 power = 2; -} \ No newline at end of file + string reporter = 1; + int64 power = 2; + int64 block_number = 3; +} diff --git a/proto/layer/reporter/delegation.proto b/proto/layer/reporter/delegation.proto index d186b69c7..257960198 100644 --- a/proto/layer/reporter/delegation.proto +++ b/proto/layer/reporter/delegation.proto @@ -17,4 +17,5 @@ message Delegation { (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; + uint64 delegation_count = 3; } diff --git a/proto/layer/reporter/oracle_reporter.proto b/proto/layer/reporter/oracle_reporter.proto index d1f32bbbe..fa7809bf9 100644 --- a/proto/layer/reporter/oracle_reporter.proto +++ b/proto/layer/reporter/oracle_reporter.proto @@ -11,20 +11,18 @@ option go_package = "github.com/tellor-io/layer/x/reporter/types"; // OracleReporter is the struct that holds the data for a reporter message OracleReporter { - // reporter is the address of the reporter - bytes reporter = 1; // tokens is the amount of tokens the reporter has - string total_tokens = 2 [ + string total_tokens = 1 [ (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false ]; // commission for the reporter - cosmos.staking.v1beta1.Commission commission = 3; + cosmos.staking.v1beta1.Commission commission = 2; // jailed is a bool whether the reporter is jailed or not - bool jailed = 4; + bool jailed = 3; // jailed_until is the time the reporter is jailed until - google.protobuf.Timestamp jailed_until = 5 [ + google.protobuf.Timestamp jailed_until = 4 [ (gogoproto.stdtime) = true, (gogoproto.nullable) = false, (amino.dont_omitempty) = true diff --git a/proto/layer/reporter/query.proto b/proto/layer/reporter/query.proto index cd7c79cee..1551f346a 100644 --- a/proto/layer/reporter/query.proto +++ b/proto/layer/reporter/query.proto @@ -19,10 +19,6 @@ service Query { rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { option (google.api.http).get = "/tellor-io/layer/reporter/params"; } - // Reporter queries the reporter of a reporter address. - rpc Reporter(QueryReporterRequest) returns (QueryReporterResponse) { - option (google.api.http).get = "/tellor-io/layer/reporter/{reporter_address}"; - } // Reporters queries all the staked reporters. rpc Reporters(QueryReportersRequest) returns (QueryReportersResponse) { option (google.api.http).get = "/tellor-io/layer/reporter/reporters"; @@ -31,22 +27,7 @@ service Query { rpc DelegatorReporter(QueryDelegatorReporterRequest) returns (QueryDelegatorReporterResponse) { option (google.api.http).get = "/tellor-io/layer/reporter/delegator-reporter/{delegator_address}"; } - // ReporterStake queries the total tokens of a reporter. - rpc ReporterStake(QueryReporterStakeRequest) returns (QueryReporterStakeResponse) { - option (google.api.http).get = "/tellor-io/layer/reporter/reporter-stake/{reporter_address}"; - } - // DelegationRewards queries the total rewards accrued by a delegation. - rpc DelegationRewards(QueryDelegationRewardsRequest) returns (QueryDelegationRewardsResponse) { - option (google.api.http).get = "/tellor-io/layer/reporter/delegation-rewards/{delegator_address}/{reporter_address}"; - } - // ReporterOutstandingRewards queries rewards of a reporter address. - rpc ReporterOutstandingRewards(QueryReporterOutstandingRewardsRequest) returns (QueryReporterOutstandingRewardsResponse) { - option (google.api.http).get = "/tellor-io/layer/reporter/outstanding-rewards/{reporter_address}"; - } - // ReporterCommission queries accumulated commission for a reporter. - rpc ReporterCommission(QueryReporterCommissionRequest) returns (QueryReporterCommissionResponse) { - option (google.api.http).get = "/tellor-io/layer/reporter/commission/{reporter_address}"; - } + } // QueryParamsRequest is request type for the Query/Params RPC method. @@ -61,17 +42,6 @@ message QueryParamsResponse { ]; } -// QueryReporterRequest is the request type for the Query/Reporter RPC method. -message QueryReporterRequest { - // reporter_address defines the reporter address to query for. - string reporter_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; -} - -// QueryReporterResponse is the response type for the Query/Reporter RPC method. -message QueryReporterResponse { - OracleReporter reporter = 1; -} - // QueryReportersRequest is the request type for the Query/Reporters RPC method. message QueryReportersRequest {} @@ -97,80 +67,3 @@ message QueryDelegatorReporterResponse { // reporter defines the reporter of a delegator. string reporter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } - -// QueryReporterStakeRequest is the request type for the -// Query/ReporterStake RPC method. -message QueryReporterStakeRequest { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - // reporter_address defines the reporter address to query for. - string reporter_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; -} - -// QueryReporterStakeResponse is the response type for the -// Query/ReporterStake RPC method. -message QueryReporterStakeResponse { - // stake defines the total tokens of a reporter. - string stake = 1 [ - (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "cosmossdk.io/math.Int", - (gogoproto.nullable) = false - ]; -} - -// QueryDelegationRewardsRequest is the request type for the -// Query/DelegationRewards RPC method. -message QueryDelegationRewardsRequest { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - // delegator_address defines the delegator address to query for. - string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - // reporter_address defines the reporter address to query for. - string reporter_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; -} - -// QueryDelegationRewardsResponse is the response type for the -// Query/DelegationRewards RPC method. -message QueryDelegationRewardsResponse { - // rewards defines the rewards accrued by a delegation. - repeated cosmos.base.v1beta1.DecCoin rewards = 1 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins" - ]; -} - -// QueryReporterOutstandingRewardsRequest is the request type for the -// Query/ReporterOutstandingRewards RPC method. -message QueryReporterOutstandingRewardsRequest { - // reporter_address defines the reporter address to query for. - string reporter_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; -} - -// QueryReporterOutstandingRewardsResponse is the response type for the -// Query/ReporterOutstandingRewards RPC method. -message QueryReporterOutstandingRewardsResponse { - ReporterOutstandingRewards rewards = 1 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; -} - -// QueryReporterCommissionRequest is the request type for the -// Query/ReporterCommission RPC method -message QueryReporterCommissionRequest { - // reporter_address defines the reporter address to query for. - string reporter_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; -} - -// QueryReporterCommissionResponse is the response type for the -// Query/ReporterCommission RPC method -message QueryReporterCommissionResponse { - // commission defines the commission the reporter received. - ReporterAccumulatedCommission commission = 1 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; -} diff --git a/proto/layer/reporter/token_origin.proto b/proto/layer/reporter/token_origin.proto index f219741a4..ba9252c1d 100644 --- a/proto/layer/reporter/token_origin.proto +++ b/proto/layer/reporter/token_origin.proto @@ -7,21 +7,13 @@ import "gogoproto/gogo.proto"; option go_package = "github.com/tellor-io/layer/x/reporter/types"; -// TokenOrigin is a message to store the origin of a token -message TokenOrigin { - // validator_address is the address of the validator that tokens in staking are delegated to - bytes validator_address = 1; - // amount is the amount of tokens to be delegated to a reporter from a delegation in staking - string amount = 2 [ - (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "cosmossdk.io/math.Int", - (gogoproto.nullable) = false - ]; -} - +// TokenOriginInfo is the struct that holds the data of where tokens are staked message TokenOriginInfo { + // delegator_address is the address of the delegator bytes delegator_address = 1; + // validator_address is the address of the validator bytes validator_address = 2; + // amount is the amount of tokens staked string amount = 3 [ (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "cosmossdk.io/math.Int", @@ -29,8 +21,14 @@ message TokenOriginInfo { ]; } -// reporter's snapshot of delegators' sources pre unbonding -message DelegationsPreUpdate { - // token_origin is the origin of the tokens that are about to be updated +// DelegationsAmounts is the struct that holds the data of delegations and amounts and the total +message DelegationsAmounts { + // token_origins is the list of token origins for and where the amounts are staked repeated TokenOriginInfo token_origins = 1; + // total amount of tokens in the list + string total = 2 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false + ]; } diff --git a/proto/layer/reporter/tx.proto b/proto/layer/reporter/tx.proto index 793dd6a75..ba66def22 100644 --- a/proto/layer/reporter/tx.proto +++ b/proto/layer/reporter/tx.proto @@ -24,19 +24,8 @@ service Msg { // CreateReporter defines a (reporter) operation for creating a new reporter. rpc CreateReporter(MsgCreateReporter) returns (MsgCreateReporterResponse); - // DelegateReporter defines a (reporter) operation for delegating to a reporter. - rpc DelegateReporter(MsgDelegateReporter) returns (MsgDelegateReporterResponse); - - // UndelegateReporter defines a (reporter) operation for undelegating from a reporter. - rpc UndelegateReporter(MsgUndelegateReporter) returns (MsgUndelegateReporterResponse); - - // WithdrawReporterCommission defines a method to withdraw the - // full commission to the reporter address. - rpc WithdrawReporterCommission(MsgWithdrawReporterCommission) returns (MsgWithdrawReporterCommissionResponse); - - // WithdrawDelegatorReward defines a method to withdraw rewards of delegator - // from a reporter. - rpc WithdrawDelegatorReward(MsgWithdrawDelegatorReward) returns (MsgWithdrawDelegatorRewardResponse); + // ChangeReporter defines a (delegator) operation for changing a reporter. + rpc ChangeReporter(MsgChangeReporter) returns (MsgChangeReporterResponse); // UnjailReporter defines a method to unjail a jailed reporter. rpc UnjailReporter(MsgUnjailReporter) returns (MsgUnjailReporterResponse); @@ -67,83 +56,20 @@ message MsgUpdateParams { message MsgUpdateParamsResponse {} message MsgCreateReporter { - option (cosmos.msg.v1.signer) = "reporter"; - string reporter = 1; - string amount = 2 [ - (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "cosmossdk.io/math.Int", - (gogoproto.nullable) = false - ]; - repeated TokenOrigin token_origins = 3; - cosmos.staking.v1beta1.Commission commission = 4; -} - -message MsgCreateReporterResponse {} - -message MsgDelegateReporter { - option (cosmos.msg.v1.signer) = "delegator"; - string delegator = 1; - string reporter = 2; - string amount = 3 [ - (cosmos_proto.scalar) = "cosmos.Int", - (gogoproto.customtype) = "cosmossdk.io/math.Int", - (gogoproto.nullable) = false - ]; - repeated TokenOrigin token_origins = 4; -} - -// MsgDelegateReporterResponse defines the response structure for executing a MsgDelegateReporter message. -message MsgDelegateReporterResponse {} - -// MsgUndelegateReporter defines the Msg/UndelegateReporter request type. -message MsgUndelegateReporter { - option (cosmos.msg.v1.signer) = "delegator_address"; - string delegator_address = 1; - // token_origin is the token origin to undelegate from. If empty, all token origins are undelegated, - // else the amount field will be the amount to undelegate from the specified token origin. - repeated TokenOrigin token_origins = 2; -} - -message MsgUndelegateReporterResponse {} - -// MsgWithdrawReporterCommission withdraws the full commission to the reporter -// address. -message MsgWithdrawReporterCommission { option (cosmos.msg.v1.signer) = "reporter_address"; - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - string reporter_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string reporter_address = 1; + cosmos.staking.v1beta1.Commission commission = 2; } -// MsgWithdrawReporterCommissionResponse defines the -// Msg/WithdrawReporterCommission response type. -message MsgWithdrawReporterCommissionResponse { - repeated cosmos.base.v1beta1.Coin amount = 1 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" - ]; -} +message MsgCreateReporterResponse {} -// MsgWithdrawDelegatorReward represents delegation withdrawal to a delegator -// from a reporter. -message MsgWithdrawDelegatorReward { +message MsgChangeReporter { option (cosmos.msg.v1.signer) = "delegator_address"; - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; string delegator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; string reporter_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } -// MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward -// response type. -message MsgWithdrawDelegatorRewardResponse { - repeated cosmos.base.v1beta1.Coin amount = 1 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" - ]; -} +message MsgChangeReporterResponse {} // MsgUnjailReporter defines the Msg/UnjailReporter request type. message MsgUnjailReporter { diff --git a/tests/e2e/basic_dispute_test.go b/tests/e2e/basic_dispute_test.go index 196e81a01..cba67e1c7 100644 --- a/tests/e2e/basic_dispute_test.go +++ b/tests/e2e/basic_dispute_test.go @@ -2,8 +2,10 @@ package e2e_test import ( "encoding/hex" + "fmt" "time" + "github.com/tellor-io/layer/testutil" utils "github.com/tellor-io/layer/utils" disputekeeper "github.com/tellor-io/layer/x/dispute/keeper" disputetypes "github.com/tellor-io/layer/x/dispute/types" @@ -18,57 +20,54 @@ import ( simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) func (s *E2ETestSuite) TestDisputes() { require := s.Require() - msgServerOracle := oraclekeeper.NewMsgServerImpl(s.oraclekeeper) + msgServerOracle := oraclekeeper.NewMsgServerImpl(s.Setup.Oraclekeeper) require.NotNil(msgServerOracle) - msgServerReporter := reporterkeeper.NewMsgServerImpl(s.reporterkeeper) + msgServerReporter := reporterkeeper.NewMsgServerImpl(s.Setup.Reporterkeeper) require.NotNil(msgServerReporter) - msgServerDispute := disputekeeper.NewMsgServerImpl(s.disputekeeper) + msgServerDispute := disputekeeper.NewMsgServerImpl(s.Setup.Disputekeeper) require.NotNil(msgServerDispute) + msgServerStaking := stakingkeeper.NewMsgServerImpl(s.Setup.Stakingkeeper) + require.NotNil(msgServerStaking) //--------------------------------------------------------------------------- // Height 0 - create validator and 2 reporters //--------------------------------------------------------------------------- - _, err := s.app.BeginBlocker(s.ctx) + _, err := s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) // create a validator valAccount := simtestutil.CreateIncrementalAccounts(1) // mint 5000*1e8 tokens for validator - initCoins := sdk.NewCoin(s.denom, math.NewInt(5000*1e8)) - require.NoError(s.bankKeeper.MintCoins(s.ctx, authtypes.Minter, sdk.NewCoins(initCoins))) - require.NoError(s.bankKeeper.SendCoinsFromModuleToAccount(s.ctx, authtypes.Minter, valAccount[0], sdk.NewCoins(initCoins))) + initCoins := sdk.NewCoin(s.Setup.Denom, math.NewInt(5000*1e8)) + require.NoError(s.Setup.Bankkeeper.MintCoins(s.Setup.Ctx, authtypes.Minter, sdk.NewCoins(initCoins))) + require.NoError(s.Setup.Bankkeeper.SendCoinsFromModuleToAccount(s.Setup.Ctx, authtypes.Minter, valAccount[0], sdk.NewCoins(initCoins))) // get val address valAccountValAddrs := simtestutil.ConvertAddrsToValAddrs(valAccount) // create pub key for validator pubKey := simtestutil.CreateTestPubKeys(1) // tell keepers about the new validator - s.accountKeeper.NewAccountWithAddress(s.ctx, valAccount[0]) - validator, err := stakingtypes.NewValidator(valAccountValAddrs[0].String(), pubKey[0], stakingtypes.Description{Moniker: "created validator"}) - require.NoError(err) - require.NoError(s.stakingKeeper.SetValidator(s.ctx, validator)) - require.NoError(s.stakingKeeper.SetValidatorByConsAddr(s.ctx, validator)) - require.NoError(s.stakingKeeper.SetNewValidatorByPowerIndex(s.ctx, validator)) - // self delegate from validator account to itself - _, err = s.stakingKeeper.Delegate(s.ctx, valAccount[0], math.NewInt(int64(4000)*1e8), stakingtypes.Unbonded, validator, true) - require.NoError(err) - // call hooks for distribution init - valBz, err := s.stakingKeeper.ValidatorAddressCodec().StringToBytes(validator.GetOperator()) - if err != nil { - panic(err) - } - err = s.distrKeeper.Hooks().AfterValidatorCreated(s.ctx, valBz) + s.Setup.Accountkeeper.NewAccountWithAddress(s.Setup.Ctx, valAccount[0]) + msgCreateValidaotr, err := stakingtypes.NewMsgCreateValidator( + valAccountValAddrs[0].String(), + pubKey[0], + sdk.NewCoin(s.Setup.Denom, math.NewInt(4000*1e8)), + stakingtypes.Description{Moniker: "created validator"}, + stakingtypes.NewCommissionRates(math.LegacyNewDecWithPrec(0, 0), math.LegacyNewDecWithPrec(3, 1), math.LegacyNewDecWithPrec(1, 1)), + math.OneInt(), + ) require.NoError(err) - err = s.distrKeeper.Hooks().BeforeDelegationCreated(s.ctx, valAccount[0], valBz) + _, err = msgServerStaking.CreateValidator(s.Setup.Ctx, msgCreateValidaotr) require.NoError(err) - err = s.distrKeeper.Hooks().AfterDelegationModified(s.ctx, valAccount[0], valBz) + _, err = s.Setup.App.EndBlocker(s.Setup.Ctx) + require.NoError(err) + validator, err := s.Setup.Stakingkeeper.GetValidator(s.Setup.Ctx, valAccountValAddrs[0]) require.NoError(err) - _, err = s.stakingKeeper.EndBlocker(s.ctx) - s.NoError(err) type Delegator struct { delegatorAddress sdk.AccAddress @@ -78,49 +77,32 @@ func (s *E2ETestSuite) TestDisputes() { pk := secp256k1.GenPrivKey() reporterAccount := sdk.AccAddress(pk.PubKey().Address()) // mint 5000*1e6 tokens for reporter - s.NoError(s.bankKeeper.MintCoins(s.ctx, authtypes.Minter, sdk.NewCoins(initCoins))) - s.NoError(s.bankKeeper.SendCoinsFromModuleToAccount(s.ctx, authtypes.Minter, reporterAccount, sdk.NewCoins(initCoins))) + s.NoError(s.Setup.Bankkeeper.MintCoins(s.Setup.Ctx, authtypes.Minter, sdk.NewCoins(initCoins))) + s.NoError(s.Setup.Bankkeeper.SendCoinsFromModuleToAccount(s.Setup.Ctx, authtypes.Minter, reporterAccount, sdk.NewCoins(initCoins))) // delegate 5k trb to validator so reporter can delegate to themselves - reporterDelToVal := Delegator{delegatorAddress: reporterAccount, validator: validator, tokenAmount: math.NewInt(5000 * 1e6)} - _, err = s.stakingKeeper.Delegate(s.ctx, reporterDelToVal.delegatorAddress, reporterDelToVal.tokenAmount, stakingtypes.Unbonded, reporterDelToVal.validator, true) - require.NoError(err) - // call dist module hooks - err = s.distrKeeper.Hooks().AfterValidatorCreated(s.ctx, valBz) - require.NoError(err) - err = s.distrKeeper.Hooks().BeforeDelegationCreated(s.ctx, reporterAccount, valAccountValAddrs[0]) + reporterDelToVal := Delegator{delegatorAddress: reporterAccount, validator: validator, tokenAmount: math.NewInt(4000 * 1e6)} + msgDelegate := stakingtypes.NewMsgDelegate( + reporterDelToVal.delegatorAddress.String(), + reporterDelToVal.validator.GetOperator(), sdk.NewCoin(s.Setup.Denom, reporterDelToVal.tokenAmount), + ) + _, err = msgServerStaking.Delegate(s.Setup.Ctx, msgDelegate) require.NoError(err) - err = s.distrKeeper.Hooks().AfterDelegationModified(s.ctx, reporterAccount, valAccountValAddrs[0]) + // // check that reporter was created in Reporters collections + _, err = msgServerReporter.CreateReporter(s.Setup.Ctx, &reportertypes.MsgCreateReporter{ReporterAddress: reporterAccount.String(), Commission: reporterkeeper.DefaultCommission()}) require.NoError(err) - - // self delegate in reporter module with 4k trb - var createReporterMsg reportertypes.MsgCreateReporter - reporterAddress := reporterDelToVal.delegatorAddress.String() - amount := math.NewInt(4000 * 1e6) - source := reportertypes.TokenOrigin{ValidatorAddress: valAccountValAddrs[0], Amount: math.NewInt(4000 * 1e6)} - // 0% commission for reporter staking to validator - commission := stakingtypes.NewCommissionWithTime(math.LegacyNewDecWithPrec(0, 0), math.LegacyNewDecWithPrec(3, 1), - math.LegacyNewDecWithPrec(1, 1), s.ctx.BlockTime()) - // fill in createReporterMsg - createReporterMsg.Reporter = reporterAddress - createReporterMsg.Amount = amount - createReporterMsg.TokenOrigins = []*reportertypes.TokenOrigin{&source} - createReporterMsg.Commission = &commission - // send createreporter msg - _, err = msgServerReporter.CreateReporter(s.ctx, &createReporterMsg) - require.NoError(err) - // check that reporter was created in Reporters collections - reporter, err := s.reporterkeeper.Reporters.Get(s.ctx, reporterAccount) + reporter, err := s.Setup.Reporterkeeper.Reporters.Get(s.Setup.Ctx, reporterAccount) + fmt.Println(reporterAccount.String()) require.NoError(err) - require.Equal(reporter.Reporter, reporterAccount.Bytes()) + fmt.Println(reporter.TotalTokens) require.Equal(reporter.TotalTokens, math.NewInt(4000*1e6)) require.Equal(reporter.Jailed, false) - // check on reporter in Delegators collections - rkDelegation, err := s.reporterkeeper.Delegators.Get(s.ctx, reporterAccount) + // // check on reporter in Delegators collections + rkDelegation, err := s.Setup.Reporterkeeper.Delegators.Get(s.Setup.Ctx, reporterAccount) require.NoError(err) require.Equal(rkDelegation.Reporter, reporterAccount.Bytes()) require.Equal(rkDelegation.Amount, math.NewInt(4000*1e6)) // check on reporter/validator delegation - skDelegation, err := s.stakingKeeper.Delegation(s.ctx, reporterAccount, valBz) + skDelegation, err := s.Setup.Stakingkeeper.Delegation(s.Setup.Ctx, reporterAccount, valAccountValAddrs[0]) require.NoError(err) require.Equal(skDelegation.GetDelegatorAddr(), reporterAccount.String()) require.Equal(skDelegation.GetValidatorAddr(), validator.GetOperator()) @@ -128,28 +110,29 @@ func (s *E2ETestSuite) TestDisputes() { //--------------------------------------------------------------------------- // Height 1 - direct reveal for cycle list //--------------------------------------------------------------------------- - s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Second)) - _, err = s.app.BeginBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(s.Setup.Ctx.BlockHeight() + 1) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(time.Second)) + _, err = s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) // get new cycle list query data - cycleListQuery, err := s.oraclekeeper.GetCurrentQueryInCycleList(s.ctx) + cycleListQuery, err := s.Setup.Oraclekeeper.GetCurrentQueryInCycleList(s.Setup.Ctx) require.NoError(err) // create reveal message - value := encodeValue(100_000) + value := testutil.EncodeValue(100_000) require.NoError(err) reveal := oracletypes.MsgSubmitValue{ - Creator: sdk.AccAddress(reporter.Reporter).String(), + Creator: reporterAccount.String(), QueryData: cycleListQuery, Value: value, } // send reveal message - revealResponse, err := msgServerOracle.SubmitValue(s.ctx, &reveal) + revealResponse, err := msgServerOracle.SubmitValue(s.Setup.Ctx, &reveal) + revealBlock := s.Setup.Ctx.BlockHeight() require.NoError(err) require.NotNil(revealResponse) // advance time and block height to expire the query and aggregate report - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(7 * time.Second)) - _, err = s.app.EndBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(7 * time.Second)) + _, err = s.Setup.App.EndBlocker(s.Setup.Ctx) require.NoError(err) // get queryId for GetAggregatedReportRequest queryId := utils.QueryIDFromData(cycleListQuery) @@ -159,12 +142,12 @@ func (s *E2ETestSuite) TestDisputes() { QueryId: hex.EncodeToString(queryId), } // aggregated report is stored correctly - queryServer := oraclekeeper.NewQuerier(s.oraclekeeper) - result, err := queryServer.GetAggregatedReport(s.ctx, &getAggReportRequest) + queryServer := oraclekeeper.NewQuerier(s.Setup.Oraclekeeper) + result, err := queryServer.GetAggregatedReport(s.Setup.Ctx, &getAggReportRequest) require.NoError(err) require.Equal(int64(0), result.Report.AggregateReportIndex) - require.Equal(encodeValue(100_000), result.Report.AggregateValue) - require.Equal(sdk.AccAddress(reporter.Reporter).String(), result.Report.AggregateReporter) + require.Equal(testutil.EncodeValue(100_000), result.Report.AggregateValue) + require.Equal(reporterAccount.String(), result.Report.AggregateReporter) require.Equal(queryId, result.Report.QueryId) require.Equal(int64(4000), result.Report.ReporterPower) require.Equal(int64(1), result.Report.Height) @@ -172,33 +155,34 @@ func (s *E2ETestSuite) TestDisputes() { //--------------------------------------------------------------------------- // Height 2 - create a dispute //--------------------------------------------------------------------------- - s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Second)) - _, err = s.app.BeginBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(s.Setup.Ctx.BlockHeight() + 1) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(time.Second)) + _, err = s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) - reporter, err = s.reporterkeeper.Reporters.Get(s.ctx, reporterAccount) + reporter, err = s.Setup.Reporterkeeper.Reporters.Get(s.Setup.Ctx, reporterAccount) require.NoError(err) require.Equal(reporter.Jailed, false) - freeFloatingBalanceBefore := s.bankKeeper.GetBalance(s.ctx, reporterAccount, s.denom) + freeFloatingBalanceBefore := s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, reporterAccount, s.Setup.Denom) balBeforeDispute := reporter.TotalTokens onePercent := balBeforeDispute.Mul(math.NewInt(1)).Quo(math.NewInt(100)) - disputeFee := sdk.NewCoin(s.denom, onePercent) // warning should be 1% of bonded tokens + disputeFee := sdk.NewCoin(s.Setup.Denom, onePercent) // warning should be 1% of bonded tokens // todo: is there a getter for this ? // get microreport for dispute report := oracletypes.MicroReport{ - Reporter: sdk.AccAddress(reporter.Reporter).String(), - Power: reporter.TotalTokens.Quo(sdk.DefaultPowerReduction).Int64(), - QueryId: queryId, - Value: value, - Timestamp: s.ctx.BlockTime(), + Reporter: reporterAccount.String(), + Power: reporter.TotalTokens.Quo(sdk.DefaultPowerReduction).Int64(), + QueryId: queryId, + Value: value, + Timestamp: s.Setup.Ctx.BlockTime(), + BlockNumber: revealBlock, } // create msg for propose dispute tx msgProposeDispute := disputetypes.MsgProposeDispute{ - Creator: sdk.AccAddress(reporter.Reporter).String(), + Creator: reporterAccount.String(), Report: &report, DisputeCategory: disputetypes.Warning, Fee: disputeFee, @@ -206,89 +190,89 @@ func (s *E2ETestSuite) TestDisputes() { } // send propose dispute tx - _, err = msgServerDispute.ProposeDispute(s.ctx, &msgProposeDispute) + _, err = msgServerDispute.ProposeDispute(s.Setup.Ctx, &msgProposeDispute) require.NoError(err) burnAmount := disputeFee.Amount.MulRaw(1).QuoRaw(20) - disputes, err := s.disputekeeper.GetOpenDisputes(s.ctx) + disputes, err := s.Setup.Disputekeeper.GetOpenDisputes(s.Setup.Ctx) require.NoError(err) require.NotNil(disputes) // dispute is created correctly - dispute, err := s.disputekeeper.Disputes.Get(s.ctx, 1) + dispute, err := s.Setup.Disputekeeper.Disputes.Get(s.Setup.Ctx, 1) require.NoError(err) require.Equal(dispute.DisputeId, uint64(1)) require.Equal(dispute.DisputeStatus, disputetypes.Voting) require.Equal(dispute.DisputeCategory, disputetypes.Warning) require.Equal(dispute.DisputeFee, disputeFee.Amount.Sub(burnAmount)) - require.Equal(dispute.FeePayers, []disputetypes.PayerInfo{{PayerAddress: reporter.Reporter, Amount: disputeFee.Amount, FromBond: false, BlockNumber: 2}}) - - _, err = s.app.EndBlocker(s.ctx) + require.Equal(dispute.FeePayers, []disputetypes.PayerInfo{{PayerAddress: reporterAccount.Bytes(), Amount: disputeFee.Amount, FromBond: false, BlockNumber: 2}}) + slashAmount := dispute.SlashAmount + _, err = s.Setup.App.EndBlocker(s.Setup.Ctx) require.NoError(err) //--------------------------------------------------------------------------- // Height 3 - unjail reporter //--------------------------------------------------------------------------- - s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Second)) - err = s.disputekeeper.Tallyvote(s.ctx, dispute.DisputeId) + s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(s.Setup.Ctx.BlockHeight() + 1) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(time.Second)) + err = s.Setup.Disputekeeper.Tallyvote(s.Setup.Ctx, dispute.DisputeId) require.Error(err, "vote period not ended and quorum not reached") - _, err = s.app.BeginBlocker(s.ctx) + _, err = s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) // reporter is in jail - reporter, err = s.reporterkeeper.Reporters.Get(s.ctx, reporterAccount) + reporter, err = s.Setup.Reporterkeeper.Reporters.Get(s.Setup.Ctx, reporterAccount) require.NoError(err) require.Equal(reporter.Jailed, true) // reporter lost 1% of their free floating tokens - freeFloatingBalanceAfter := s.bankKeeper.GetBalance(s.ctx, reporterAccount, s.denom) + freeFloatingBalanceAfter := s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, reporterAccount, s.Setup.Denom) require.Equal(freeFloatingBalanceAfter, freeFloatingBalanceBefore.Sub(disputeFee)) // create msgUnJailReporter msgUnjailReporter := reportertypes.MsgUnjailReporter{ - ReporterAddress: sdk.AccAddress(reporter.Reporter).String(), + ReporterAddress: reporterAccount.String(), } // send unjailreporter tx - _, err = msgServerReporter.UnjailReporter(s.ctx, &msgUnjailReporter) + _, err = msgServerReporter.UnjailReporter(s.Setup.Ctx, &msgUnjailReporter) require.NoError(err) // reporter is now unjailed - reporter, err = s.reporterkeeper.Reporters.Get(s.ctx, reporterAccount) + reporter, err = s.Setup.Reporterkeeper.Reporters.Get(s.Setup.Ctx, reporterAccount) require.NoError(err) require.Equal(reporter.Jailed, false) - freeFloatingBalanceAfter = s.bankKeeper.GetBalance(s.ctx, reporterAccount, s.denom) + freeFloatingBalanceAfter = s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, reporterAccount, s.Setup.Denom) require.Equal(freeFloatingBalanceAfter, freeFloatingBalanceBefore.Sub(disputeFee)) - _, err = s.app.EndBlocker(s.ctx) + _, err = s.Setup.App.EndBlocker(s.Setup.Ctx) require.NoError(err) // todo: more balance checks at each step //--------------------------------------------------------------------------- // Height 4 - direct reveal for cycle list again //--------------------------------------------------------------------------- - s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Second)) - err = s.disputekeeper.Tallyvote(s.ctx, 1) + s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(s.Setup.Ctx.BlockHeight() + 1) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(time.Second)) + err = s.Setup.Disputekeeper.Tallyvote(s.Setup.Ctx, 1) require.Error(err, "vote period not ended and quorum not reached") - _, err = s.app.BeginBlocker(s.ctx) + _, err = s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) // get new cycle list query data - cycleListQuery, err = s.oraclekeeper.GetCurrentQueryInCycleList(s.ctx) + cycleListQuery, err = s.Setup.Oraclekeeper.GetCurrentQueryInCycleList(s.Setup.Ctx) require.NoError(err) // create reveal message - value = encodeValue(100_000) + value = testutil.EncodeValue(100_000) require.NoError(err) reveal = oracletypes.MsgSubmitValue{ - Creator: sdk.AccAddress(reporter.Reporter).String(), + Creator: reporterAccount.String(), QueryData: cycleListQuery, Value: value, } // send reveal message - revealResponse, err = msgServerOracle.SubmitValue(s.ctx, &reveal) + revealResponse, err = msgServerOracle.SubmitValue(s.Setup.Ctx, &reveal) require.NoError(err) require.NotNil(revealResponse) // advance time and block height to expire the query and aggregate report - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(7 * time.Second)) - _, err = s.app.EndBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(7 * time.Second)) + _, err = s.Setup.App.EndBlocker(s.Setup.Ctx) require.NoError(err) // get queryId for GetAggregatedReportRequest queryId = utils.QueryIDFromData(cycleListQuery) @@ -298,41 +282,42 @@ func (s *E2ETestSuite) TestDisputes() { QueryId: hex.EncodeToString(queryId), } // aggregated report is stored correctly - result, err = queryServer.GetAggregatedReport(s.ctx, &getAggReportRequest) + result, err = queryServer.GetAggregatedReport(s.Setup.Ctx, &getAggReportRequest) require.NoError(err) require.Equal(int64(0), result.Report.AggregateReportIndex) - require.Equal(encodeValue(100_000), result.Report.AggregateValue) - require.Equal(sdk.AccAddress(reporter.Reporter).String(), result.Report.AggregateReporter) + require.Equal(testutil.EncodeValue(100_000), result.Report.AggregateValue) + require.Equal(reporterAccount.String(), result.Report.AggregateReporter) require.Equal(queryId, result.Report.QueryId) - require.Equal(int64(4000), result.Report.ReporterPower) + require.Equal(int64(4000)-slashAmount.Quo(sdk.DefaultPowerReduction).Int64(), result.Report.ReporterPower) require.Equal(int64(4), result.Report.Height) - _, err = s.app.EndBlocker(s.ctx) + _, err = s.Setup.App.EndBlocker(s.Setup.Ctx) require.NoError(err) //--------------------------------------------------------------------------- // Height 5 - open minor dispute //--------------------------------------------------------------------------- - s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Second)) - _, err = s.app.BeginBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(s.Setup.Ctx.BlockHeight() + 1) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(time.Second)) + _, err = s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) balBeforeDispute = reporter.TotalTokens fivePercent := balBeforeDispute.Mul(math.NewInt(5)).Quo(math.NewInt(100)) - disputeFee = sdk.NewCoin(s.denom, fivePercent) + disputeFee = sdk.NewCoin(s.Setup.Denom, fivePercent) report = oracletypes.MicroReport{ - Reporter: sdk.AccAddress(reporter.Reporter).String(), - Power: reporter.TotalTokens.Quo(sdk.DefaultPowerReduction).Int64(), - QueryId: queryId, - Value: value, - Timestamp: s.ctx.BlockTime(), + Reporter: reporterAccount.String(), + Power: reporter.TotalTokens.Quo(sdk.DefaultPowerReduction).Int64(), + QueryId: queryId, + Value: value, + Timestamp: s.Setup.Ctx.BlockTime(), + BlockNumber: revealBlock, } // create msg for propose dispute tx msgProposeDispute = disputetypes.MsgProposeDispute{ - Creator: sdk.AccAddress(reporter.Reporter).String(), + Creator: reporterAccount.String(), Report: &report, DisputeCategory: disputetypes.Minor, Fee: disputeFee, @@ -340,51 +325,51 @@ func (s *E2ETestSuite) TestDisputes() { } // send propose dispute tx - _, err = msgServerDispute.ProposeDispute(s.ctx, &msgProposeDispute) + _, err = msgServerDispute.ProposeDispute(s.Setup.Ctx, &msgProposeDispute) require.NoError(err) - disputeStartTime := s.ctx.BlockTime() + disputeStartTime := s.Setup.Ctx.BlockTime() - _, err = s.app.EndBlocker(s.ctx) + _, err = s.Setup.App.EndBlocker(s.Setup.Ctx) require.NoError(err) //--------------------------------------------------------------------------- // Height 6 - vote on minor dispute - //--------------------------------------------------------------------------- - s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Second)) - err = s.disputekeeper.Tallyvote(s.ctx, 1) + // --------------------------------------------------------------------------- + s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(s.Setup.Ctx.BlockHeight() + 1) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(time.Second)) + err = s.Setup.Disputekeeper.Tallyvote(s.Setup.Ctx, 1) require.Error(err, "vote period not ended and quorum not reached") - err = s.disputekeeper.Tallyvote(s.ctx, 2) + err = s.Setup.Disputekeeper.Tallyvote(s.Setup.Ctx, 2) require.Error(err, "vote period not ended and quorum not reached") - _, err = s.app.BeginBlocker(s.ctx) + _, err = s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) // reporter is in jail - reporter, err = s.reporterkeeper.Reporters.Get(s.ctx, reporterAccount) + reporter, err = s.Setup.Reporterkeeper.Reporters.Get(s.Setup.Ctx, reporterAccount) require.NoError(err) require.Equal(reporter.Jailed, true) // dispute is created correctly burnAmount = disputeFee.Amount.MulRaw(1).QuoRaw(20) - dispute, err = s.disputekeeper.GetDisputeByReporter(s.ctx, report, disputetypes.Minor) + dispute, err = s.Setup.Disputekeeper.GetDisputeByReporter(s.Setup.Ctx, report, disputetypes.Minor) require.NoError(err) require.Equal(dispute.DisputeCategory, disputetypes.Minor) require.Equal(dispute.DisputeStatus, disputetypes.Voting) require.Equal(dispute.DisputeFee, disputeFee.Amount.Sub(burnAmount)) - require.Equal(dispute.FeePayers, []disputetypes.PayerInfo{{PayerAddress: reporter.Reporter, Amount: disputeFee.Amount, FromBond: false, BlockNumber: 5}}) + require.Equal(dispute.FeePayers, []disputetypes.PayerInfo{{PayerAddress: reporterAccount.Bytes(), Amount: disputeFee.Amount, FromBond: false, BlockNumber: 5}}) // create vote tx msg msgVote := disputetypes.MsgVote{ - Voter: sdk.AccAddress(reporter.Reporter).String(), + Voter: reporterAccount.String(), Id: dispute.DisputeId, Vote: disputetypes.VoteEnum_VOTE_SUPPORT, } // send vote tx - voteResponse, err := msgServerDispute.Vote(s.ctx, &msgVote) + voteResponse, err := msgServerDispute.Vote(s.Setup.Ctx, &msgVote) require.NoError(err) require.NotNil(voteResponse) // vote is properly stored - vote, err := s.disputekeeper.Votes.Get(s.ctx, dispute.DisputeId) + vote, err := s.Setup.Disputekeeper.Votes.Get(s.Setup.Ctx, dispute.DisputeId) require.NoError(err) require.NotNil(vote) require.Equal(vote.Executed, false) @@ -393,67 +378,68 @@ func (s *E2ETestSuite) TestDisputes() { require.Equal(vote.VoteEnd, disputeStartTime.Add(disputekeeper.TWO_DAYS)) // advance 2 days to expire vote - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(disputekeeper.THREE_DAYS)) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(disputekeeper.THREE_DAYS)) // call unjail function msgUnjailReporter = reportertypes.MsgUnjailReporter{ - ReporterAddress: sdk.AccAddress(reporter.Reporter).String(), + ReporterAddress: reporterAccount.String(), } - _, err = msgServerReporter.UnjailReporter(s.ctx, &msgUnjailReporter) + _, err = msgServerReporter.UnjailReporter(s.Setup.Ctx, &msgUnjailReporter) require.NoError(err) // reporter no longer in jail - reporter, err = s.reporterkeeper.Reporters.Get(s.ctx, reporterAccount) + reporter, err = s.Setup.Reporterkeeper.Reporters.Get(s.Setup.Ctx, reporterAccount) require.NoError(err) require.Equal(reporter.Jailed, false) - _, err = s.app.EndBlocker(s.ctx) + _, err = s.Setup.App.EndBlocker(s.Setup.Ctx) require.NoError(err) //--------------------------------------------------------------------------- // Height 7 - minor dispute ends and another direct reveal for cycle list //--------------------------------------------------------------------------- - s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Second)) + s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(s.Setup.Ctx.BlockHeight() + 1) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(time.Second)) - require.NoError(s.disputekeeper.Tallyvote(s.ctx, 1)) - require.NoError(s.disputekeeper.Tallyvote(s.ctx, 2)) - require.NoError(s.disputekeeper.ExecuteVote(s.ctx, 1)) - require.NoError(s.disputekeeper.ExecuteVote(s.ctx, 2)) + require.NoError(s.Setup.Disputekeeper.Tallyvote(s.Setup.Ctx, 1)) + require.NoError(s.Setup.Disputekeeper.Tallyvote(s.Setup.Ctx, 2)) + require.NoError(s.Setup.Disputekeeper.ExecuteVote(s.Setup.Ctx, 1)) + require.NoError(s.Setup.Disputekeeper.ExecuteVote(s.Setup.Ctx, 2)) // vote is executed - vote, err = s.disputekeeper.Votes.Get(s.ctx, dispute.DisputeId) + vote, err = s.Setup.Disputekeeper.Votes.Get(s.Setup.Ctx, dispute.DisputeId) require.NoError(err) require.NotNil(vote) require.Equal(vote.Executed, true) require.Equal(vote.Id, dispute.DisputeId) // reporter no longer in jail - reporter, err = s.reporterkeeper.Reporters.Get(s.ctx, reporterAccount) + reporter, err = s.Setup.Reporterkeeper.Reporters.Get(s.Setup.Ctx, reporterAccount) require.NoError(err) require.Equal(reporter.Jailed, false) // get open disputes - disputes, err = s.disputekeeper.GetOpenDisputes(s.ctx) + disputes, err = s.Setup.Disputekeeper.GetOpenDisputes(s.Setup.Ctx) require.NoError(err) require.NotNil(disputes) // get new cycle list query data - cycleListQuery, err = s.oraclekeeper.GetCurrentQueryInCycleList(s.ctx) + cycleListQuery, err = s.Setup.Oraclekeeper.GetCurrentQueryInCycleList(s.Setup.Ctx) require.NoError(err) // create reveal message - value = encodeValue(100_000) + value = testutil.EncodeValue(100_000) require.NoError(err) reveal = oracletypes.MsgSubmitValue{ - Creator: sdk.AccAddress(reporter.Reporter).String(), + Creator: reporterAccount.String(), QueryData: cycleListQuery, Value: value, } // send reveal message - revealResponse, err = msgServerOracle.SubmitValue(s.ctx, &reveal) + revealResponse, err = msgServerOracle.SubmitValue(s.Setup.Ctx, &reveal) + revealBlock = s.Setup.Ctx.BlockHeight() require.NoError(err) require.NotNil(revealResponse) // advance time and block height to expire the query and aggregate report - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(7 * time.Second)) - _, err = s.app.EndBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(7 * time.Second)) + _, err = s.Setup.App.EndBlocker(s.Setup.Ctx) require.NoError(err) // get queryId for GetAggregatedReportRequest queryId = utils.QueryIDFromData(cycleListQuery) @@ -463,44 +449,44 @@ func (s *E2ETestSuite) TestDisputes() { QueryId: hex.EncodeToString(queryId), } // check that aggregated report is stored correctly - result, err = queryServer.GetAggregatedReport(s.ctx, &getAggReportRequest) + result, err = queryServer.GetAggregatedReport(s.Setup.Ctx, &getAggReportRequest) require.NoError(err) require.Equal(int64(0), result.Report.AggregateReportIndex) - require.Equal(encodeValue(100_000), result.Report.AggregateValue) - require.Equal(sdk.AccAddress(reporter.Reporter).String(), result.Report.AggregateReporter) + require.Equal(testutil.EncodeValue(100_000), result.Report.AggregateValue) + require.Equal(reporterAccount.String(), result.Report.AggregateReporter) require.Equal(queryId, result.Report.QueryId) require.Equal(int64(7), result.Report.Height) - _, err = s.app.EndBlocker(s.ctx) + _, err = s.Setup.App.EndBlocker(s.Setup.Ctx) require.NoError(err) //--------------------------------------------------------------------------- // Height 8 - open major dispute for report //--------------------------------------------------------------------------- - s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Second)) - _, err = s.app.BeginBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(s.Setup.Ctx.BlockHeight() + 1) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(time.Second)) + _, err = s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) - reporter, err = s.reporterkeeper.Reporters.Get(s.ctx, reporterAccount) + reporter, err = s.Setup.Reporterkeeper.Reporters.Get(s.Setup.Ctx, reporterAccount) require.NoError(err) require.Equal(reporter.Jailed, false) oneHundredPercent := reporter.TotalTokens - disputeFee = sdk.NewCoin(s.denom, oneHundredPercent) + disputeFee = sdk.NewCoin(s.Setup.Denom, oneHundredPercent) report = oracletypes.MicroReport{ - Reporter: sdk.AccAddress(reporter.Reporter).String(), + Reporter: reporterAccount.String(), Power: reporter.TotalTokens.Quo(sdk.DefaultPowerReduction).Int64(), QueryId: queryId, Value: value, - Timestamp: s.ctx.BlockTime(), - BlockNumber: s.ctx.BlockHeight(), + Timestamp: s.Setup.Ctx.BlockTime(), + BlockNumber: revealBlock, } // create msg for propose dispute tx msgProposeDispute = disputetypes.MsgProposeDispute{ - Creator: sdk.AccAddress(reporter.Reporter).String(), + Creator: reporterAccount.String(), Report: &report, DisputeCategory: disputetypes.Major, Fee: disputeFee, @@ -508,31 +494,31 @@ func (s *E2ETestSuite) TestDisputes() { } // send propose dispute tx - _, err = msgServerDispute.ProposeDispute(s.ctx, &msgProposeDispute) + _, err = msgServerDispute.ProposeDispute(s.Setup.Ctx, &msgProposeDispute) require.NoError(err) - disputeStartTime = s.ctx.BlockTime() - disputeStartHeight := s.ctx.BlockHeight() + disputeStartTime = s.Setup.Ctx.BlockTime() + disputeStartHeight := s.Setup.Ctx.BlockHeight() - _, err = s.app.EndBlocker(s.ctx) + _, err = s.Setup.App.EndBlocker(s.Setup.Ctx) require.NoError(err) //--------------------------------------------------------------------------- // Height 9 - vote on major dispute //--------------------------------------------------------------------------- - s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Second)) + s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(s.Setup.Ctx.BlockHeight() + 1) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(time.Second)) - err = s.disputekeeper.Tallyvote(s.ctx, 3) + err = s.Setup.Disputekeeper.Tallyvote(s.Setup.Ctx, 3) require.Error(err, "vote period not ended and quorum not reached") - _, err = s.app.BeginBlocker(s.ctx) + _, err = s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) - fee, err := s.disputekeeper.GetDisputeFee(s.ctx, sdk.AccAddress(reporter.Reporter).String(), disputetypes.Major) + fee, err := s.Setup.Disputekeeper.GetDisputeFee(s.Setup.Ctx, report, disputetypes.Major) require.NoError(err) require.GreaterOrEqual(msgProposeDispute.Fee.Amount.Uint64(), fee.Uint64()) // dispute is created and open for voting - dispute, err = s.disputekeeper.GetDisputeByReporter(s.ctx, report, disputetypes.Major) + dispute, err = s.Setup.Disputekeeper.GetDisputeByReporter(s.Setup.Ctx, report, disputetypes.Major) require.NoError(err) burnAmount = disputeFee.Amount.MulRaw(1).QuoRaw(20) require.Equal(dispute.DisputeStatus, disputetypes.Voting) @@ -541,22 +527,22 @@ func (s *E2ETestSuite) TestDisputes() { require.Equal(dispute.DisputeFee, disputeFee.Amount.Sub(burnAmount)) require.Equal(dispute.DisputeStartBlock, disputeStartHeight) // todo: handle reporter removal - reporter, err = s.reporterkeeper.Reporters.Get(s.ctx, reporterAccount) - require.NoError(err) + reporter, err = s.Setup.Reporterkeeper.Reporters.Get(s.Setup.Ctx, reporterAccount) + require.ErrorContains(err, "not found") // create vote tx msg msgVote = disputetypes.MsgVote{ - Voter: sdk.AccAddress(reporter.Reporter).String(), + Voter: reporterAccount.String(), Id: dispute.DisputeId, Vote: disputetypes.VoteEnum_VOTE_SUPPORT, } // send vote tx - voteResponse, err = msgServerDispute.Vote(s.ctx, &msgVote) + voteResponse, err = msgServerDispute.Vote(s.Setup.Ctx, &msgVote) require.NoError(err) require.NotNil(voteResponse) // vote is properly stored - vote, err = s.disputekeeper.Votes.Get(s.ctx, dispute.DisputeId) + vote, err = s.Setup.Disputekeeper.Votes.Get(s.Setup.Ctx, dispute.DisputeId) require.NoError(err) require.NotNil(vote) require.Equal(vote.Executed, false) @@ -565,23 +551,23 @@ func (s *E2ETestSuite) TestDisputes() { require.Equal(vote.VoteEnd, disputeStartTime.Add(disputekeeper.TWO_DAYS)) // advance 3 days to expire vote - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(disputekeeper.THREE_DAYS)) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(disputekeeper.THREE_DAYS)) - _, err = s.app.EndBlocker(s.ctx) + _, err = s.Setup.App.EndBlocker(s.Setup.Ctx) require.NoError(err) // --------------------------------------------------------------------------- // Height 10 - dispute is resolved, reporter no longer a reporter // --------------------------------------------------------------------------- - // s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) - // s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Second)) - // _, err = s.app.BeginBlocker(s.ctx) + // s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(s.Setup.Ctx.BlockHeight() + 1) + // s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(time.Second)) + // _, err = s.Setup.App.BeginBlocker(s.Setup.Ctx) // require.NoError(err) - err = s.disputekeeper.Tallyvote(s.ctx, 3) + err = s.Setup.Disputekeeper.Tallyvote(s.Setup.Ctx, 3) require.NoError(err) - _, err = s.app.BeginBlocker(s.ctx) + _, err = s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) - // reporter, err = s.reporterkeeper.Reporters.Get(s.ctx, reporterAccount) + // reporter, err = s.Setup.Reporterkeeper.Reporters.Get(s.Setup.Ctx, reporterAccount) // require.NoError(err) } diff --git a/tests/e2e/basic_reporting_test.go b/tests/e2e/basic_reporting_test.go index 8b90164d5..5ff48764d 100644 --- a/tests/e2e/basic_reporting_test.go +++ b/tests/e2e/basic_reporting_test.go @@ -4,6 +4,7 @@ import ( "encoding/hex" "time" + "github.com/tellor-io/layer/testutil" utils "github.com/tellor-io/layer/utils" minttypes "github.com/tellor-io/layer/x/mint/types" oraclekeeper "github.com/tellor-io/layer/x/oracle/keeper" @@ -14,54 +15,53 @@ import ( "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" + "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) func (s *E2ETestSuite) TestBasicReporting() { require := s.Require() + msgServerStaking := stakingkeeper.NewMsgServerImpl(s.Setup.Stakingkeeper) //--------------------------------------------------------------------------- // Height 0 //--------------------------------------------------------------------------- - _, err := s.app.BeginBlocker(s.ctx) + _, err := s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) // create a validator valAccount := simtestutil.CreateIncrementalAccounts(1) // mint 5000*1e8 tokens for validator - initCoins := sdk.NewCoin(s.denom, math.NewInt(5000*1e8)) - require.NoError(s.bankKeeper.MintCoins(s.ctx, authtypes.Minter, sdk.NewCoins(initCoins))) - require.NoError(s.bankKeeper.SendCoinsFromModuleToAccount(s.ctx, authtypes.Minter, valAccount[0], sdk.NewCoins(initCoins))) + initCoins := sdk.NewCoin(s.Setup.Denom, math.NewInt(5000*1e8)) + require.NoError(s.Setup.Bankkeeper.MintCoins(s.Setup.Ctx, authtypes.Minter, sdk.NewCoins(initCoins))) + require.NoError(s.Setup.Bankkeeper.SendCoinsFromModuleToAccount(s.Setup.Ctx, authtypes.Minter, valAccount[0], sdk.NewCoins(initCoins))) // get val address valAccountValAddrs := simtestutil.ConvertAddrsToValAddrs(valAccount) // create pub key for validator pubKey := simtestutil.CreateTestPubKeys(1) // tell keepers about the new validator - s.accountKeeper.NewAccountWithAddress(s.ctx, valAccount[0]) - validator, err := stakingtypes.NewValidator(valAccountValAddrs[0].String(), pubKey[0], stakingtypes.Description{Moniker: "created validator"}) - require.NoError(err) - s.NoError(s.stakingKeeper.SetValidator(s.ctx, validator)) - s.NoError(s.stakingKeeper.SetValidatorByConsAddr(s.ctx, validator)) - s.NoError(s.stakingKeeper.SetNewValidatorByPowerIndex(s.ctx, validator)) - // self delegate from validator account to itself - _, err = s.stakingKeeper.Delegate(s.ctx, valAccount[0], math.NewInt(int64(4000)*1e8), stakingtypes.Unbonded, validator, true) - require.NoError(err) - // call hooks for distribution init - valBz, err := s.stakingKeeper.ValidatorAddressCodec().StringToBytes(validator.GetOperator()) - if err != nil { - panic(err) - } - err = s.distrKeeper.Hooks().AfterValidatorCreated(s.ctx, valBz) + s.Setup.Accountkeeper.NewAccountWithAddress(s.Setup.Ctx, valAccount[0]) + msgCreateValidaotr, err := stakingtypes.NewMsgCreateValidator( + valAccountValAddrs[0].String(), + pubKey[0], + sdk.NewCoin(s.Setup.Denom, math.NewInt(4000*1e8)), + stakingtypes.Description{Moniker: "created validator"}, + stakingtypes.NewCommissionRates(math.LegacyNewDecWithPrec(0, 0), math.LegacyNewDecWithPrec(3, 1), math.LegacyNewDecWithPrec(1, 1)), + math.OneInt(), + ) + require.NoError(err) + _, err = msgServerStaking.CreateValidator(s.Setup.Ctx, msgCreateValidaotr) require.NoError(err) - err = s.distrKeeper.Hooks().BeforeDelegationCreated(s.ctx, valAccount[0], valBz) + _, err = s.Setup.App.EndBlocker(s.Setup.Ctx) require.NoError(err) - err = s.distrKeeper.Hooks().AfterDelegationModified(s.ctx, valAccount[0], valBz) + validator, err := s.Setup.Stakingkeeper.GetValidator(s.Setup.Ctx, valAccountValAddrs[0]) require.NoError(err) - _, err = s.stakingKeeper.EndBlocker(s.ctx) + + _, err = s.Setup.Stakingkeeper.EndBlocker(s.Setup.Ctx) s.NoError(err) type Delegator struct { @@ -69,133 +69,121 @@ func (s *E2ETestSuite) TestBasicReporting() { validator stakingtypes.Validator tokenAmount math.Int } - pk := secp256k1.GenPrivKey() + pk := ed25519.GenPrivKey() reporterAccount := sdk.AccAddress(pk.PubKey().Address()) // mint 5000*1e6 tokens for reporter - s.NoError(s.bankKeeper.MintCoins(s.ctx, authtypes.Minter, sdk.NewCoins(initCoins))) - s.NoError(s.bankKeeper.SendCoinsFromModuleToAccount(s.ctx, authtypes.Minter, reporterAccount, sdk.NewCoins(initCoins))) + s.NoError(s.Setup.Bankkeeper.MintCoins(s.Setup.Ctx, authtypes.Minter, sdk.NewCoins(initCoins))) + s.NoError(s.Setup.Bankkeeper.SendCoinsFromModuleToAccount(s.Setup.Ctx, authtypes.Minter, reporterAccount, sdk.NewCoins(initCoins))) // delegate to validator so reporter can delegate to themselves - reporterDelToVal := Delegator{delegatorAddress: reporterAccount, validator: validator, tokenAmount: math.NewInt(5000 * 1e6)} - _, err = s.stakingKeeper.Delegate(s.ctx, reporterDelToVal.delegatorAddress, reporterDelToVal.tokenAmount, stakingtypes.Unbonded, reporterDelToVal.validator, true) - require.NoError(err) - // call dist module hooks - err = s.distrKeeper.Hooks().AfterValidatorCreated(s.ctx, valBz) - require.NoError(err) - err = s.distrKeeper.Hooks().BeforeDelegationCreated(s.ctx, reporterAccount, valAccountValAddrs[0]) - require.NoError(err) - err = s.distrKeeper.Hooks().AfterDelegationModified(s.ctx, reporterAccount, valAccountValAddrs[0]) + reporterDelToVal := Delegator{delegatorAddress: reporterAccount, validator: validator, tokenAmount: math.NewInt(4000 * 1e6)} + msgDelegate := stakingtypes.NewMsgDelegate(reporterAccount.String(), validator.OperatorAddress, sdk.NewCoin(s.Setup.Denom, math.NewInt(4000*1e6))) + _, err = msgServerStaking.Delegate(s.Setup.Ctx, msgDelegate) require.NoError(err) // set up reporter module msgServer - msgServerReporter := reporterkeeper.NewMsgServerImpl(s.reporterkeeper) + msgServerReporter := reporterkeeper.NewMsgServerImpl(s.Setup.Reporterkeeper) require.NotNil(msgServerReporter) // define createReporterMsg params - var createReporterMsg reportertypes.MsgCreateReporter reporterAddress := reporterDelToVal.delegatorAddress.String() - amount := math.NewInt(4000 * 1e6) - source := reportertypes.TokenOrigin{ValidatorAddress: valBz, Amount: math.NewInt(4000 * 1e6)} // 0% commission for reporter staking to validator commission := stakingtypes.NewCommissionWithTime(math.LegacyNewDecWithPrec(0, 0), math.LegacyNewDecWithPrec(3, 1), - math.LegacyNewDecWithPrec(1, 1), s.ctx.BlockTime()) - // fill in createReporterMsg - createReporterMsg.Reporter = reporterAddress - createReporterMsg.Amount = amount - createReporterMsg.TokenOrigins = []*reportertypes.TokenOrigin{&source} - createReporterMsg.Commission = &commission + math.LegacyNewDecWithPrec(1, 1), s.Setup.Ctx.BlockTime()) + createReporterMsg := reportertypes.MsgCreateReporter{ReporterAddress: reporterAddress, Commission: &commission} // send createreporter msg - _, err = msgServerReporter.CreateReporter(s.ctx, &createReporterMsg) + _, err = msgServerReporter.CreateReporter(s.Setup.Ctx, &createReporterMsg) require.NoError(err) // check that reporter was created in Reporters collections - reporter, err := s.reporterkeeper.Reporters.Get(s.ctx, reporterAccount) + reporter, err := s.Setup.Reporterkeeper.Reporters.Get(s.Setup.Ctx, reporterAccount) require.NoError(err) - require.Equal(reporter.Reporter, reporterAccount.Bytes()) require.Equal(reporter.TotalTokens, math.NewInt(4000*1e6)) require.Equal(reporter.Jailed, false) // check on reporter in Delegators collections - rkDelegation, err := s.reporterkeeper.Delegators.Get(s.ctx, reporterAccount) + rkDelegation, err := s.Setup.Reporterkeeper.Delegators.Get(s.Setup.Ctx, reporterAccount) require.NoError(err) require.Equal(rkDelegation.Reporter, reporterAccount.Bytes()) require.Equal(rkDelegation.Amount, math.NewInt(4000*1e6)) // check on reporter/validator delegation - skDelegation, err := s.stakingKeeper.Delegation(s.ctx, reporterAccount, valBz) + valBz, err := s.Setup.Stakingkeeper.ValidatorAddressCodec().StringToBytes(validator.GetOperator()) + require.NoError(err) + skDelegation, err := s.Setup.Stakingkeeper.Delegation(s.Setup.Ctx, reporterAccount, valBz) require.NoError(err) require.Equal(skDelegation.GetDelegatorAddr(), reporterAccount.String()) require.Equal(skDelegation.GetValidatorAddr(), validator.GetOperator()) // setup oracle msgServer - msgServerOracle := oraclekeeper.NewMsgServerImpl(s.oraclekeeper) + msgServerOracle := oraclekeeper.NewMsgServerImpl(s.Setup.Oraclekeeper) require.NotNil(msgServerOracle) // case 1: commit/reveal for cycle list //--------------------------------------------------------------------------- // Height 1 //--------------------------------------------------------------------------- - s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) - _, err = s.app.BeginBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(s.Setup.Ctx.BlockHeight() + 1) + _, err = s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) // check that no time based rewards have been minted yet - tbrModuleAccount := s.accountKeeper.GetModuleAddress(minttypes.TimeBasedRewards) - tbrModuleAccountBalance := s.bankKeeper.GetBalance(s.ctx, tbrModuleAccount, sdk.DefaultBondDenom) + tbrModuleAccount := s.Setup.Accountkeeper.GetModuleAddress(minttypes.TimeBasedRewards) + tbrModuleAccountBalance := s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, tbrModuleAccount, s.Setup.Denom) require.Equal(int64(0), tbrModuleAccountBalance.Amount.Int64()) // begin report - cycleListEth, err := s.oraclekeeper.GetCurrentQueryInCycleList(s.ctx) + cycleListEth, err := s.Setup.Oraclekeeper.GetCurrentQueryInCycleList(s.Setup.Ctx) require.NoError(err) // create hash for commit salt1, err := oracleutils.Salt(32) require.NoError(err) - value1 := encodeValue(4500) + value1 := testutil.EncodeValue(4500) hash1 := oracleutils.CalculateCommitment(value1, salt1) // create commit1 msg commit1 := oracletypes.MsgCommitReport{ - Creator: sdk.AccAddress(reporter.Reporter).String(), + Creator: reporterAccount.String(), QueryData: cycleListEth, Hash: hash1, } // send commit tx - commitResponse1, err := msgServerOracle.CommitReport(s.ctx, &commit1) + commitResponse1, err := msgServerOracle.CommitReport(s.Setup.Ctx, &commit1) require.NoError(err) require.NotNil(commitResponse1) - commitHeight := s.ctx.BlockHeight() + commitHeight := s.Setup.Ctx.BlockHeight() require.Equal(int64(1), commitHeight) - _, err = s.app.EndBlocker(s.ctx) + _, err = s.Setup.App.EndBlocker(s.Setup.Ctx) require.NoError(err) //--------------------------------------------------------------------------- // Height 2 //--------------------------------------------------------------------------- - s.ctx = s.ctx.WithBlockHeight(commitHeight + 1) - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Second)) - _, err = s.app.BeginBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(commitHeight + 1) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(time.Second)) + _, err = s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) // check that 1 second worth of tbr has been minted // expected tbr = (daily mint rate * time elapsed) / (# of ms in a day) expectedBlockProvision := int64(146940000 * (1 * time.Second) / (24 * 60 * 60 * 1000)) - expectedTbr := sdk.NewCoin(s.denom, math.NewInt((expectedBlockProvision)).MulRaw(75).QuoRaw(100).Quo(sdk.DefaultPowerReduction)) - tbrModuleAccountBalance = s.bankKeeper.GetBalance(s.ctx, tbrModuleAccount, sdk.DefaultBondDenom) + expectedTbr := sdk.NewCoin(s.Setup.Denom, math.NewInt((expectedBlockProvision)).MulRaw(75).QuoRaw(100).Quo(sdk.DefaultPowerReduction)) + tbrModuleAccountBalance = s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, tbrModuleAccount, s.Setup.Denom) require.Equal(expectedTbr, tbrModuleAccountBalance) // check that the cycle list has rotated - cycleListBtc, err := s.oraclekeeper.GetCurrentQueryInCycleList(s.ctx) + cycleListBtc, err := s.Setup.Oraclekeeper.GetCurrentQueryInCycleList(s.Setup.Ctx) require.NotEqual(cycleListEth, cycleListBtc) require.NoError(err) // create reveal msg require.NoError(err) reveal1 := oracletypes.MsgSubmitValue{ - Creator: sdk.AccAddress(reporter.Reporter).String(), + Creator: reporterAccount.String(), QueryData: cycleListEth, Value: value1, Salt: salt1, } // send reveal tx - revealResponse1, err := msgServerOracle.SubmitValue(s.ctx, &reveal1) + revealResponse1, err := msgServerOracle.SubmitValue(s.Setup.Ctx, &reveal1) require.NoError(err) require.NotNil(revealResponse1) // advance time and block height to expire the query and aggregate report - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(7 * time.Second)) - _, err = s.app.EndBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(7 * time.Second)) + _, err = s.Setup.App.EndBlocker(s.Setup.Ctx) require.NoError(err) // get queryId for GetAggregatedReportRequest queryIdEth := utils.QueryIDFromData(cycleListEth) @@ -204,36 +192,34 @@ func (s *E2ETestSuite) TestBasicReporting() { getAggReportRequest1 := oracletypes.QueryGetCurrentAggregatedReportRequest{ QueryId: hex.EncodeToString(queryIdEth), } - queryServer := oraclekeeper.NewQuerier(s.oraclekeeper) - result1, err := queryServer.GetAggregatedReport(s.ctx, &getAggReportRequest1) + queryServer := oraclekeeper.NewQuerier(s.Setup.Oraclekeeper) + result1, err := queryServer.GetAggregatedReport(s.Setup.Ctx, &getAggReportRequest1) require.NoError(err) require.Equal(result1.Report.Height, int64(2)) require.Equal(result1.Report.AggregateReportIndex, int64(0)) - require.Equal(result1.Report.AggregateValue, encodeValue(4500)) - require.Equal(result1.Report.AggregateReporter, sdk.AccAddress(reporter.Reporter).String()) + require.Equal(result1.Report.AggregateValue, testutil.EncodeValue(4500)) + require.Equal(result1.Report.AggregateReporter, reporterAccount.String()) require.Equal(result1.Report.QueryId, queryIdEth) require.Equal(int64(4000), result1.Report.ReporterPower) // check that tbr is no longer in timeBasedRewards module acct - tbrModuleAccountBalance = s.bankKeeper.GetBalance(s.ctx, tbrModuleAccount, sdk.DefaultBondDenom) + tbrModuleAccountBalance = s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, tbrModuleAccount, s.Setup.Denom) require.Equal(int64(0), tbrModuleAccountBalance.Amount.Int64()) // check that tbr was sent to reporter module account - reporterModuleAccount := s.accountKeeper.GetModuleAddress(reportertypes.ModuleName) - reporterModuleAccountBalance := s.bankKeeper.GetBalance(s.ctx, reporterModuleAccount, sdk.DefaultBondDenom) + reporterModuleAccount := s.Setup.Accountkeeper.GetModuleAddress(reportertypes.TipsEscrowPool) + reporterModuleAccountBalance := s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, reporterModuleAccount, s.Setup.Denom) require.Equal(expectedTbr, reporterModuleAccountBalance) // check reporters outstaning rewards - outstandingRewards, err := s.reporterkeeper.GetReporterOutstandingRewardsCoins(s.ctx, sdk.ValAddress(reporterAccount)) + outstandingRewards, err := s.Setup.Reporterkeeper.DelegatorTips.Get(s.Setup.Ctx, reporterAccount.Bytes()) require.NoError(err) - require.Equal(outstandingRewards.AmountOf(s.denom).TruncateInt(), expectedTbr.Amount) + require.Equal(outstandingRewards, expectedTbr.Amount) // withdraw tbr - rewards, err := s.reporterkeeper.WithdrawDelegationRewards(s.ctx, sdk.ValAddress(reporterAccount), reporterAccount) + rewards, err := msgServerReporter.WithdrawTip(s.Setup.Ctx, &reportertypes.MsgWithdrawTip{DelegatorAddress: reporterAddress, ValidatorAddress: validator.OperatorAddress}) require.NoError(err) + tbrEarned := outstandingRewards // check that there is only one reward to claim - require.Equal(len(rewards), 1) - // check that the reward is the correct amount and denom - require.Equal(rewards[0].Denom, s.denom) - require.Equal(rewards.AmountOf(s.denom), expectedTbr.Amount) + require.NotNil(rewards) // check that reporter module account balance is now empty - reporterModuleAccountBalance = s.bankKeeper.GetBalance(s.ctx, reporterModuleAccount, sdk.DefaultBondDenom) + reporterModuleAccountBalance = s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, reporterModuleAccount, s.Setup.Denom) require.Equal(int64(0), reporterModuleAccountBalance.Amount.Int64()) // check that reporter now has more bonded tokens @@ -241,37 +227,38 @@ func (s *E2ETestSuite) TestBasicReporting() { //--------------------------------------------------------------------------- // Height 3 //--------------------------------------------------------------------------- - s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Second)) - _, err = s.app.BeginBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(s.Setup.Ctx.BlockHeight() + 1) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(time.Second)) + _, err = s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) // check that 8 sec of tbr has been minted - tbrModuleAccountBalance = s.bankKeeper.GetBalance(s.ctx, tbrModuleAccount, sdk.DefaultBondDenom) + tbrModuleAccountBalance = s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, tbrModuleAccount, s.Setup.Denom) expectedBlockProvision = int64(146940000 * (8 * time.Second) / (24 * 60 * 60 * 1000)) - expectedTbr = sdk.NewCoin(s.denom, math.NewInt((expectedBlockProvision)).MulRaw(75).QuoRaw(100).Quo(sdk.DefaultPowerReduction)) + expectedTbr = sdk.NewCoin(s.Setup.Denom, math.NewInt((expectedBlockProvision)).MulRaw(75).QuoRaw(100).Quo(sdk.DefaultPowerReduction)) + require.Equal(expectedTbr, tbrModuleAccountBalance) // get new cycle list query data - cycleListTrb, err := s.oraclekeeper.GetCurrentQueryInCycleList(s.ctx) + cycleListTrb, err := s.Setup.Oraclekeeper.GetCurrentQueryInCycleList(s.Setup.Ctx) require.NoError(err) require.NotEqual(cycleListEth, cycleListTrb) require.NotEqual(cycleListBtc, cycleListTrb) // create reveal message - value2 := encodeValue(100_000) + value2 := testutil.EncodeValue(100_000) require.NoError(err) reveal2 := oracletypes.MsgSubmitValue{ - Creator: sdk.AccAddress(reporter.Reporter).String(), + Creator: reporterAccount.String(), QueryData: cycleListTrb, Value: value2, } // send reveal message - revealResponse2, err := msgServerOracle.SubmitValue(s.ctx, &reveal2) + revealResponse2, err := msgServerOracle.SubmitValue(s.Setup.Ctx, &reveal2) require.NoError(err) require.NotNil(revealResponse2) // advance time and block height to expire the query and aggregate report - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(7 * time.Second)) - _, err = s.app.EndBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(7 * time.Second)) + _, err = s.Setup.App.EndBlocker(s.Setup.Ctx) require.NoError(err) // get queryId for GetAggregatedReportRequest queryIdTrb := utils.QueryIDFromData(cycleListTrb) @@ -281,213 +268,219 @@ func (s *E2ETestSuite) TestBasicReporting() { QueryId: hex.EncodeToString(queryIdTrb), } // check that aggregated report is stored correctly - result2, err := queryServer.GetAggregatedReport(s.ctx, &getAggReportRequest2) + result2, err := queryServer.GetAggregatedReport(s.Setup.Ctx, &getAggReportRequest2) require.NoError(err) require.Equal(int64(0), result2.Report.AggregateReportIndex) - require.Equal(encodeValue(100_000), result2.Report.AggregateValue) - require.Equal(sdk.AccAddress(reporter.Reporter).String(), result2.Report.AggregateReporter) + require.Equal(testutil.EncodeValue(100_000), result2.Report.AggregateValue) + require.Equal(reporterAccount.String(), result2.Report.AggregateReporter) require.Equal(queryIdTrb, result2.Report.QueryId) require.Equal(int64(4000), result2.Report.ReporterPower) require.Equal(int64(3), result2.Report.Height) // check that tbr is no longer in timeBasedRewards module acct - tbrModuleAccountBalance = s.bankKeeper.GetBalance(s.ctx, tbrModuleAccount, sdk.DefaultBondDenom) + tbrModuleAccountBalance = s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, tbrModuleAccount, s.Setup.Denom) require.Equal(int64(0), tbrModuleAccountBalance.Amount.Int64()) // check that tbr was sent to reporter module account - reporterModuleAccount = s.accountKeeper.GetModuleAddress(reportertypes.ModuleName) - reporterModuleAccountBalance = s.bankKeeper.GetBalance(s.ctx, reporterModuleAccount, sdk.DefaultBondDenom) + reporterModuleAccount = s.Setup.Accountkeeper.GetModuleAddress(reportertypes.TipsEscrowPool) + reporterModuleAccountBalance = s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, reporterModuleAccount, s.Setup.Denom) require.Equal(expectedTbr, reporterModuleAccountBalance) + // check reporters outstaning rewards - outstandingRewards, err = s.reporterkeeper.GetReporterOutstandingRewardsCoins(s.ctx, sdk.ValAddress(reporterAccount)) + outstandingRewards, err = s.Setup.Reporterkeeper.DelegatorTips.Get(s.Setup.Ctx, reporterAccount.Bytes()) require.NoError(err) - require.Equal(outstandingRewards.AmountOf(s.denom).TruncateInt(), expectedTbr.Amount) + require.Equal(outstandingRewards, expectedTbr.Amount) // withdraw tbr - rewards, err = s.reporterkeeper.WithdrawDelegationRewards(s.ctx, sdk.ValAddress(reporterAccount), reporterAccount) + tbrEarned = tbrEarned.Add(outstandingRewards) + rewards, err = msgServerReporter.WithdrawTip(s.Setup.Ctx, &reportertypes.MsgWithdrawTip{DelegatorAddress: reporterAddress, ValidatorAddress: validator.OperatorAddress}) require.NoError(err) - // check that there is only one reward to claim - require.Equal(len(rewards), 1) - // check that the reward is the correct amount and denom - require.Equal(rewards[0].Denom, s.denom) - require.Equal(rewards.AmountOf(s.denom), expectedTbr.Amount) + require.NotNil(rewards) // check that reporter module account balance is now empty - reporterModuleAccountBalance = s.bankKeeper.GetBalance(s.ctx, reporterModuleAccount, sdk.DefaultBondDenom) + reporterModuleAccountBalance = s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, reporterModuleAccount, s.Setup.Denom) require.Equal(int64(0), reporterModuleAccountBalance.Amount.Int64()) - // check that reporter now has more bonded tokens // case 3: commit/reveal for tipped query //--------------------------------------------------------------------------- // Height 4 //--------------------------------------------------------------------------- - s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) - _, err = s.app.BeginBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(s.Setup.Ctx.BlockHeight() + 1) + _, err = s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) // get reporters shares - deleBeforeReport, err := s.stakingKeeper.Delegation(s.ctx, reporterAccount.Bytes(), valBz) + deleBeforeReport, err := s.Setup.Stakingkeeper.Delegation(s.Setup.Ctx, reporterAccount.Bytes(), valBz) require.NoError(err) - require.Equal(deleBeforeReport.GetShares(), math.LegacyNewDecFromInt(math.NewInt(5000*1e6))) + require.Equal(deleBeforeReport.GetShares(), math.LegacyNewDecFromInt(math.NewInt(4000*1e6).Add(tbrEarned))) // create tip msg - tipAmount := sdk.NewCoin(sdk.DefaultBondDenom, math.NewInt(100)) + balanceBeforetip := s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, tbrModuleAccount, s.Setup.Denom) + tipAmount := sdk.NewCoin(s.Setup.Denom, math.NewInt(100)) msgTip := oracletypes.MsgTip{ - Tipper: sdk.AccAddress(reporter.Reporter).String(), + Tipper: reporterAccount.String(), QueryData: cycleListEth, Amount: tipAmount, } // send tip tx - tipRes, err := msgServerOracle.Tip(s.ctx, &msgTip) + tipRes, err := msgServerOracle.Tip(s.Setup.Ctx, &msgTip) require.NoError(err) require.NotNil(tipRes) + // check that tip is in oracle module account - twoPercent := sdk.NewCoin(s.denom, tipAmount.Amount.Mul(math.NewInt(2)).Quo(math.NewInt(100))) - tipModuleAcct := s.accountKeeper.GetModuleAddress(oracletypes.ModuleName) - tipAcctBalance := s.bankKeeper.GetBalance(s.ctx, tipModuleAcct, sdk.DefaultBondDenom) + twoPercent := sdk.NewCoin(s.Setup.Denom, tipAmount.Amount.Mul(math.NewInt(2)).Quo(math.NewInt(100))) + tipModuleAcct := s.Setup.Accountkeeper.GetModuleAddress(oracletypes.ModuleName) + tipAcctBalance := s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, tipModuleAcct, s.Setup.Denom) require.Equal(tipAcctBalance, tipAmount.Sub(twoPercent)) // create commit for tipped eth query salt1, err = oracleutils.Salt(32) require.NoError(err) - value1 = encodeValue(5000) + value1 = testutil.EncodeValue(5000) hash1 = oracleutils.CalculateCommitment(value1, salt1) + + queryId := utils.QueryIDFromData(cycleListEth) + quertip, err := s.Setup.Oraclekeeper.GetQueryTip(s.Setup.Ctx, queryId) + require.NoError(err) + require.Equal(quertip, tipAmount.Amount.Sub(twoPercent.Amount)) + commit1 = oracletypes.MsgCommitReport{ - Creator: sdk.AccAddress(reporter.Reporter).String(), + Creator: reporterAccount.String(), QueryData: cycleListEth, Hash: hash1, } // send commit tx - commitResponse1, err = msgServerOracle.CommitReport(s.ctx, &commit1) + commitResponse1, err = msgServerOracle.CommitReport(s.Setup.Ctx, &commit1) require.NoError(err) require.NotNil(commitResponse1) - commitHeight = s.ctx.BlockHeight() + commitHeight = s.Setup.Ctx.BlockHeight() require.Equal(int64(4), commitHeight) - _, err = s.app.EndBlocker(s.ctx) + _, err = s.Setup.App.EndBlocker(s.Setup.Ctx) require.NoError(err) //--------------------------------------------------------------------------- - // Height 5 - //--------------------------------------------------------------------------- - s.ctx = s.ctx.WithBlockHeight(commitHeight + 1) - _, err = s.app.BeginBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(commitHeight + 1) + _, err = s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) // create reveal msg - value1 = encodeValue(5000) + value1 = testutil.EncodeValue(5000) reveal1 = oracletypes.MsgSubmitValue{ - Creator: sdk.AccAddress(reporter.Reporter).String(), + Creator: reporterAccount.String(), QueryData: cycleListEth, Value: value1, Salt: salt1, } // send reveal tx - revealResponse1, err = msgServerOracle.SubmitValue(s.ctx, &reveal1) + revealResponse1, err = msgServerOracle.SubmitValue(s.Setup.Ctx, &reveal1) require.NoError(err) require.NotNil(revealResponse1) + // advance time and block height to expire the query and aggregate report - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(7 * time.Second)) - _, err = s.app.EndBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(7 * time.Second)) + _, err = s.Setup.App.EndBlocker(s.Setup.Ctx) require.NoError(err) + // create get aggreagted report query getAggReportRequest1 = oracletypes.QueryGetCurrentAggregatedReportRequest{ QueryId: hex.EncodeToString(queryIdEth), } // check that the aggregated report is stored correctly - result1, err = queryServer.GetAggregatedReport(s.ctx, &getAggReportRequest1) + result1, err = queryServer.GetAggregatedReport(s.Setup.Ctx, &getAggReportRequest1) require.NoError(err) require.Equal(result1.Report.AggregateReportIndex, int64(0)) - require.Equal(result1.Report.AggregateValue, encodeValue(5000)) - require.Equal(result1.Report.AggregateReporter, sdk.AccAddress(reporter.Reporter).String()) + require.Equal(result1.Report.AggregateValue, testutil.EncodeValue(5000)) + require.Equal(result1.Report.AggregateReporter, reporterAccount.String()) require.Equal(queryIdEth, result1.Report.QueryId) require.Equal(int64(4000), result1.Report.ReporterPower) require.Equal(int64(5), result1.Report.Height) // check that the tip is in tip escrow - tipEscrowAcct := s.accountKeeper.GetModuleAddress(reportertypes.TipsEscrowPool) - tipEscrowBalance := s.bankKeeper.GetBalance(s.ctx, tipEscrowAcct, sdk.DefaultBondDenom) // 98 loya - require.Equal(tipAmount.Amount.Sub(twoPercent.Amount), tipEscrowBalance.Amount) + tipEscrowAcct := s.Setup.Accountkeeper.GetModuleAddress(reportertypes.TipsEscrowPool) + tipEscrowBalance := s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, tipEscrowAcct, s.Setup.Denom) // 98 loya + require.Equal(tipAmount.Amount.Sub(twoPercent.Amount), tipEscrowBalance.Amount.Sub(balanceBeforetip.Amount)) // withdraw tip msgWithdrawTip := reportertypes.MsgWithdrawTip{ DelegatorAddress: reporterAddress, ValidatorAddress: validator.OperatorAddress, } - _, err = msgServerReporter.WithdrawTip(s.ctx, &msgWithdrawTip) + _, err = msgServerReporter.WithdrawTip(s.Setup.Ctx, &msgWithdrawTip) require.NoError(err) + // check that tip is no longer in escrow pool - tipEscrowBalance = s.bankKeeper.GetBalance(s.ctx, tipEscrowAcct, sdk.DefaultBondDenom) + tipEscrowBalance = s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, tipEscrowAcct, s.Setup.Denom) require.Equal(int64(0), tipEscrowBalance.Amount.Int64()) // check that reporter now has more bonded tokens - deleAfter, err := s.stakingKeeper.Delegation(s.ctx, reporterAccount.Bytes(), valBz) + deleAfter, err := s.Setup.Stakingkeeper.Delegation(s.Setup.Ctx, reporterAccount.Bytes(), valBz) require.NoError(err) - require.Equal(deleBeforeReport.GetShares().Add(math.LegacyNewDec(98)), deleAfter.GetShares()) + require.Equal(deleBeforeReport.GetShares().Add(math.LegacyNewDec(98+8928)), deleAfter.GetShares()) - _, err = s.app.EndBlocker(s.ctx) + _, err = s.Setup.App.EndBlocker(s.Setup.Ctx) require.NoError(err) // case 4: submit without committing for tipped query //--------------------------------------------------------------------------- // Height 6 //--------------------------------------------------------------------------- - s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) - _, err = s.app.BeginBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(s.Setup.Ctx.BlockHeight() + 1) + _, err = s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) // check reporter starting shares - deleBeforeReport2, err := s.stakingKeeper.Delegation(s.ctx, reporterAccount.Bytes(), valBz) + deleBeforeReport2, err := s.Setup.Stakingkeeper.Delegation(s.Setup.Ctx, reporterAccount.Bytes(), valBz) require.NoError(err) - expectedShares := math.LegacyNewDecFromInt(math.NewInt(5000 * 1e6).Add(math.NewInt(98))) + expectedShares := math.LegacyNewDecFromInt(deleBeforeReport.GetShares().TruncateInt().Add(math.NewInt(98 + 8928))) // 8928 is the tbr that was earned require.Equal(deleBeforeReport2.GetShares(), expectedShares) // create tip msg msgTip = oracletypes.MsgTip{ - Tipper: sdk.AccAddress(reporter.Reporter).String(), + Tipper: reporterAccount.String(), QueryData: cycleListTrb, Amount: tipAmount, } // send tip tx - tipRes, err = msgServerOracle.Tip(s.ctx, &msgTip) + tipRes, err = msgServerOracle.Tip(s.Setup.Ctx, &msgTip) require.NoError(err) require.NotNil(tipRes) // check that tip is in oracle module account - tipModuleAcct = s.accountKeeper.GetModuleAddress(oracletypes.ModuleName) - tipAcctBalance = s.bankKeeper.GetBalance(s.ctx, tipModuleAcct, sdk.DefaultBondDenom) + tipModuleAcct = s.Setup.Accountkeeper.GetModuleAddress(oracletypes.ModuleName) + tipAcctBalance = s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, tipModuleAcct, s.Setup.Denom) require.Equal(tipAcctBalance, tipAmount.Sub(twoPercent)) // create submit msg revealMsgTrb := oracletypes.MsgSubmitValue{ - Creator: sdk.AccAddress(reporter.Reporter).String(), + Creator: reporterAccount.String(), QueryData: cycleListTrb, - Value: encodeValue(1_000_000), + Value: testutil.EncodeValue(1_000_000), } // send submit msg - revealTrb, err := msgServerOracle.SubmitValue(s.ctx, &revealMsgTrb) + revealTrb, err := msgServerOracle.SubmitValue(s.Setup.Ctx, &revealMsgTrb) require.NoError(err) require.NotNil(revealTrb) // advance time and block height to expire the query and aggregate report - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(7 * time.Second)) - _, err = s.app.EndBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(7 * time.Second)) + _, err = s.Setup.App.EndBlocker(s.Setup.Ctx) require.NoError(err) // create get aggregated report query getAggReportRequestTrb := oracletypes.QueryGetCurrentAggregatedReportRequest{ QueryId: hex.EncodeToString(queryIdTrb), } // query aggregated report - resultTrb, err := queryServer.GetAggregatedReport(s.ctx, &getAggReportRequestTrb) + resultTrb, err := queryServer.GetAggregatedReport(s.Setup.Ctx, &getAggReportRequestTrb) require.NoError(err) require.Equal(resultTrb.Report.AggregateReportIndex, int64(0)) - require.Equal(resultTrb.Report.AggregateValue, encodeValue(1_000_000)) - require.Equal(resultTrb.Report.AggregateReporter, sdk.AccAddress(reporter.Reporter).String()) + require.Equal(resultTrb.Report.AggregateValue, testutil.EncodeValue(1_000_000)) + require.Equal(resultTrb.Report.AggregateReporter, reporterAccount.String()) require.Equal(queryIdTrb, resultTrb.Report.QueryId) require.Equal(int64(4000), resultTrb.Report.ReporterPower) require.Equal(int64(6), resultTrb.Report.Height) // check that the tip is in tip escrow - tipEscrowBalance = s.bankKeeper.GetBalance(s.ctx, tipEscrowAcct, sdk.DefaultBondDenom) // 98 loya + tipEscrowBalance = s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, tipEscrowAcct, s.Setup.Denom) // 98 loya require.Equal(tipAmount.Amount.Sub(twoPercent.Amount), tipEscrowBalance.Amount) // withdraw tip - _, err = msgServerReporter.WithdrawTip(s.ctx, &msgWithdrawTip) + _, err = msgServerReporter.WithdrawTip(s.Setup.Ctx, &msgWithdrawTip) require.NoError(err) // check that tip is no longer in escrow pool - tipEscrowBalance = s.bankKeeper.GetBalance(s.ctx, tipEscrowAcct, sdk.DefaultBondDenom) + tipEscrowBalance = s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, tipEscrowAcct, s.Setup.Denom) require.Equal(int64(0), tipEscrowBalance.Amount.Int64()) // check that reporter now has more bonded tokens - deleAfter, err = s.stakingKeeper.Delegation(s.ctx, reporterAccount.Bytes(), valBz) + deleAfter, err = s.Setup.Stakingkeeper.Delegation(s.Setup.Ctx, reporterAccount.Bytes(), valBz) require.NoError(err) require.Equal(deleBeforeReport2.GetShares().Add(math.LegacyNewDec(98)), deleAfter.GetShares()) - _, err = s.app.EndBlocker(s.ctx) + _, err = s.Setup.App.EndBlocker(s.Setup.Ctx) require.NoError(err) } diff --git a/tests/e2e/e2e_test.go b/tests/e2e/e2e_test.go index abe061924..add02de53 100644 --- a/tests/e2e/e2e_test.go +++ b/tests/e2e/e2e_test.go @@ -7,6 +7,7 @@ import ( "strconv" "time" + "github.com/tellor-io/layer/testutil" "github.com/tellor-io/layer/utils" disputekeeper "github.com/tellor-io/layer/x/dispute/keeper" disputetypes "github.com/tellor-io/layer/x/dispute/types" @@ -20,29 +21,31 @@ import ( collections "cosmossdk.io/collections" "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) func (s *E2ETestSuite) TestNoInitialMint() { require := s.Require() - mintToTeamAcc := s.accountKeeper.GetModuleAddress(minttypes.MintToTeam) + mintToTeamAcc := s.Setup.Accountkeeper.GetModuleAddress(minttypes.MintToTeam) require.NotNil(mintToTeamAcc) - balance := s.bankKeeper.GetBalance(s.ctx, mintToTeamAcc, s.denom) - require.Equal(balance.Amount, sdk.NewCoin(s.denom, math.NewInt(0)).Amount) + balance := s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, mintToTeamAcc, s.Setup.Denom) + require.Equal(balance.Amount, sdk.NewCoin(s.Setup.Denom, math.NewInt(0)).Amount) } // func (s *E2ETestSuite) TestTransferAfterMint() { -// require := s.Require() +// require := s.Setup.Require() -// mintToTeamAcc := s.accountKeeper.GetModuleAddress(minttypes.MintToTeam) +// mintToTeamAcc := s.Setup.Accountkeeper.GetModuleAddress(minttypes.MintToTeam) // require.NotNil(mintToTeamAcc) -// balance := s.bankKeeper.GetBalance(s.ctx, mintToTeamAcc, s.denom) +// balance := s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, mintToTeamAcc, s.Setup.Denom) // require.Equal(balance.Amount, math.NewInt(300*1e6)) // // create 5 accounts @@ -59,9 +62,9 @@ func (s *E2ETestSuite) TestNoInitialMint() { // PubKey: codectypes.UnsafePackAny(privKey.PubKey()), // AccountNumber: uint64(i + 1), // } -// existingAccount := s.accountKeeper.GetAccount(s.ctx, accountAddress) +// existingAccount := s.Setup.Accountkeeper.GetAccount(s.Setup.Ctx, accountAddress) // if existingAccount == nil { -// s.accountKeeper.SetAccount(s.ctx, &account) +// s.Setup.Accountkeeper.SetAccount(s.Setup.Ctx, &account) // accounts = append(accounts, Accounts{ // PrivateKey: *privKey, // Account: accountAddress, @@ -71,29 +74,29 @@ func (s *E2ETestSuite) TestNoInitialMint() { // // transfer 1000 tokens from team to all 5 accounts // for _, acc := range accounts { -// startBalance := s.bankKeeper.GetBalance(s.ctx, acc.Account, s.denom).Amount -// err := s.bankKeeper.SendCoinsFromModuleToAccount(s.ctx, minttypes.MintToTeam, acc.Account, sdk.NewCoins(sdk.NewCoin(s.denom, math.NewInt(1000)))) +// startBalance := s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, acc.Account, s.Setup.Denom).Amount +// err := s.Setup.Bankkeeper.SendCoinsFromModuleToAccount(s.Setup.Ctx, minttypes.MintToTeam, acc.Account, sdk.NewCoins(sdk.NewCoin(s.Setup.Denom, math.NewInt(1000)))) // require.NoError(err) -// require.Equal(startBalance.Add(math.NewInt(1000)), s.bankKeeper.GetBalance(s.ctx, acc.Account, s.denom).Amount) +// require.Equal(startBalance.Add(math.NewInt(1000)), s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, acc.Account, s.Setup.Denom).Amount) // } // expectedTeamBalance := math.NewInt(300*1e6 - 1000*5) -// require.Equal(expectedTeamBalance, s.bankKeeper.GetBalance(s.ctx, mintToTeamAcc, s.denom).Amount) +// require.Equal(expectedTeamBalance, s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, mintToTeamAcc, s.Setup.Denom).Amount) // // transfer from account 0 to account 1 -// s.bankKeeper.SendCoins(s.ctx, accounts[0].Account, accounts[1].Account, sdk.NewCoins(sdk.NewCoin(s.denom, math.NewInt(1000)))) -// require.Equal(math.NewInt(0), s.bankKeeper.GetBalance(s.ctx, accounts[0].Account, s.denom).Amount) -// require.Equal(math.NewInt(2000), s.bankKeeper.GetBalance(s.ctx, accounts[1].Account, s.denom).Amount) +// s.Setup.Bankkeeper.SendCoins(s.Setup.Ctx, accounts[0].Account, accounts[1].Account, sdk.NewCoins(sdk.NewCoin(s.Setup.Denom, math.NewInt(1000)))) +// require.Equal(math.NewInt(0), s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, accounts[0].Account, s.Setup.Denom).Amount) +// require.Equal(math.NewInt(2000), s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, accounts[1].Account, s.Setup.Denom).Amount) // // transfer from account 2 to team -// s.bankKeeper.SendCoinsFromAccountToModule(s.ctx, accounts[2].Account, minttypes.MintToTeam, sdk.NewCoins(sdk.NewCoin(s.denom, math.NewInt(1000)))) -// require.Equal(math.NewInt(0), s.bankKeeper.GetBalance(s.ctx, accounts[2].Account, s.denom).Amount) -// require.Equal(expectedTeamBalance.Add(math.NewInt(1000)), s.bankKeeper.GetBalance(s.ctx, mintToTeamAcc, s.denom).Amount) +// s.Setup.Bankkeeper.SendCoinsFromAccountToModule(s.Setup.Ctx, accounts[2].Account, minttypes.MintToTeam, sdk.NewCoins(sdk.NewCoin(s.Setup.Denom, math.NewInt(1000)))) +// require.Equal(math.NewInt(0), s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, accounts[2].Account, s.Setup.Denom).Amount) +// require.Equal(expectedTeamBalance.Add(math.NewInt(1000)), s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, mintToTeamAcc, s.Setup.Denom).Amount) // // try to transfer more than balance from account 3 to 4 -// err := s.bankKeeper.SendCoins(s.ctx, accounts[3].Account, accounts[4].Account, sdk.NewCoins(sdk.NewCoin(s.denom, math.NewInt(1001)))) +// err := s.Setup.Bankkeeper.SendCoins(s.Setup.Ctx, accounts[3].Account, accounts[4].Account, sdk.NewCoins(sdk.NewCoin(s.Setup.Denom, math.NewInt(1001)))) // require.Error(err) -// require.Equal(s.bankKeeper.GetBalance(s.ctx, accounts[3].Account, s.denom).Amount, math.NewInt(1000)) -// require.Equal(s.bankKeeper.GetBalance(s.ctx, accounts[4].Account, s.denom).Amount, math.NewInt(1000)) +// require.Equal(s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, accounts[3].Account, s.Setup.Denom).Amount, math.NewInt(1000)) +// require.Equal(s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, accounts[4].Account, s.Setup.Denom).Amount, math.NewInt(1000)) // } func (s *E2ETestSuite) TestSetUpValidatorAndReporter() { @@ -107,47 +110,48 @@ func (s *E2ETestSuite) TestSetUpValidatorAndReporter() { // make addresses testAddresses := simtestutil.CreateIncrementalAccounts(numValidators) // mint 50k tokens to minter account and send to each address - initCoins := sdk.NewCoin(s.denom, math.NewInt(5000*1e6)) + initCoins := sdk.NewCoin(s.Setup.Denom, math.NewInt(10000*1e6)) for _, addr := range testAddresses { - s.NoError(s.bankKeeper.MintCoins(s.ctx, authtypes.Minter, sdk.NewCoins(initCoins))) - s.NoError(s.bankKeeper.SendCoinsFromModuleToAccount(s.ctx, authtypes.Minter, addr, sdk.NewCoins(initCoins))) + s.NoError(s.Setup.Bankkeeper.MintCoins(s.Setup.Ctx, authtypes.Minter, sdk.NewCoins(initCoins))) + s.NoError(s.Setup.Bankkeeper.SendCoinsFromModuleToAccount(s.Setup.Ctx, authtypes.Minter, addr, sdk.NewCoins(initCoins))) } // get val address for each test address valAddresses := simtestutil.ConvertAddrsToValAddrs(testAddresses) // create pub keys for each address pubKeys := simtestutil.CreateTestPubKeys(numValidators) - + stakingserver := stakingkeeper.NewMsgServerImpl(s.Setup.Stakingkeeper) // set each account with proper keepers for i, pubKey := range pubKeys { - s.accountKeeper.NewAccountWithAddress(s.ctx, testAddresses[i]) - validator, err := stakingtypes.NewValidator(valAddresses[i].String(), pubKey, stakingtypes.Description{Moniker: strconv.Itoa(i)}) - require.NoError(err) - s.NoError(s.stakingKeeper.SetValidator(s.ctx, validator)) - s.NoError(s.stakingKeeper.SetValidatorByConsAddr(s.ctx, validator)) - s.NoError(s.stakingKeeper.SetNewValidatorByPowerIndex(s.ctx, validator)) + s.Setup.Accountkeeper.NewAccountWithAddress(s.Setup.Ctx, testAddresses[i]) + valMsg, err := stakingtypes.NewMsgCreateValidator( + valAddresses[i].String(), + pubKey, + sdk.NewInt64Coin(s.Setup.Denom, 5000*1e6), + stakingtypes.Description{Moniker: strconv.Itoa(i)}, + stakingtypes.CommissionRates{ + Rate: math.LegacyNewDecWithPrec(5, 1), + MaxRate: math.LegacyNewDecWithPrec(5, 1), + MaxChangeRate: math.LegacyNewDec(0), + }, + math.OneInt()) + s.NoError(err) + _, err = stakingserver.CreateValidator(s.Setup.Ctx, valMsg) + s.NoError(err) + val, err := s.Setup.Stakingkeeper.GetValidator(s.Setup.Ctx, valAddresses[i]) + s.NoError(err) randomStakeAmount := rand.Intn(5000-1000+1) + 1000 require.True(randomStakeAmount >= 1000 && randomStakeAmount <= 5000, "randomStakeAmount is not within the expected range") - _, err = s.stakingKeeper.Delegate(s.ctx, testAddresses[i], math.NewInt(int64(randomStakeAmount)*1e6), stakingtypes.Unbonded, validator, true) - require.NoError(err) - // call hooks for distribution init - valBz, err := s.stakingKeeper.ValidatorAddressCodec().StringToBytes(validator.GetOperator()) - if err != nil { - panic(err) - } - err = s.distrKeeper.Hooks().AfterValidatorCreated(s.ctx, valBz) - require.NoError(err) - err = s.distrKeeper.Hooks().BeforeDelegationCreated(s.ctx, testAddresses[i], valBz) - require.NoError(err) - err = s.distrKeeper.Hooks().AfterDelegationModified(s.ctx, testAddresses[i], valBz) - require.NoError(err) + msg := stakingtypes.MsgDelegate{DelegatorAddress: testAddresses[i].String(), ValidatorAddress: val.OperatorAddress, Amount: sdk.NewCoin(s.Setup.Denom, math.NewInt(5000*1e6))} + _, err = stakingserver.Delegate(s.Setup.Ctx, &msg) + s.NoError(err) } - _, err := s.stakingKeeper.EndBlocker(s.ctx) + _, err := s.Setup.Stakingkeeper.EndBlocker(s.Setup.Ctx) s.NoError(err) // check that everyone is a bonded validator - validatorSet, err := s.stakingKeeper.GetAllValidators(s.ctx) + validatorSet, err := s.Setup.Stakingkeeper.GetAllValidators(s.Setup.Ctx) require.NoError(err) for _, val := range validatorSet { status := val.GetStatus() @@ -180,8 +184,8 @@ func (s *E2ETestSuite) TestSetUpValidatorAndReporter() { for i, pk := range delegatorPrivateKeys { delegatorAccounts[i] = sdk.AccAddress(pk.PubKey().Address()) // give each account tokens - s.NoError(s.bankKeeper.MintCoins(s.ctx, authtypes.Minter, sdk.NewCoins(initCoins))) - s.NoError(s.bankKeeper.SendCoinsFromModuleToAccount(s.ctx, authtypes.Minter, delegatorAccounts[i], sdk.NewCoins(initCoins))) + s.NoError(s.Setup.Bankkeeper.MintCoins(s.Setup.Ctx, authtypes.Minter, sdk.NewCoins(initCoins))) + s.NoError(s.Setup.Bankkeeper.SendCoinsFromModuleToAccount(s.Setup.Ctx, authtypes.Minter, delegatorAccounts[i], sdk.NewCoins(initCoins))) } // define each delegator delegators := map[string]Delegator{ @@ -192,62 +196,38 @@ func (s *E2ETestSuite) TestSetUpValidatorAndReporter() { } // delegate to validators for _, del := range delegators { - _, err := s.stakingKeeper.Delegate(s.ctx, del.delegatorAddress, del.tokenAmount, stakingtypes.Unbonded, del.validator, true) + _, err := stakingserver.Delegate(s.Setup.Ctx, &stakingtypes.MsgDelegate{DelegatorAddress: del.delegatorAddress.String(), ValidatorAddress: del.validator.GetOperator(), Amount: sdk.NewCoin(s.Setup.Denom, del.tokenAmount)}) require.NoError(err) } - + _, err = s.Setup.Stakingkeeper.EndBlocker(s.Setup.Ctx) + require.NoError(err) // set up reporter module msgServer - msgServerReporter := reporterkeeper.NewMsgServerImpl(s.reporterkeeper) + msgServerReporter := reporterkeeper.NewMsgServerImpl(s.Setup.Reporterkeeper) require.NotNil(msgServerReporter) - // define reporter params - var createReporterMsg reportertypes.MsgCreateReporter - reporterAddress := delegators[reporter].delegatorAddress.String() - amount := math.NewInt(100 * 1e6) - valAcc, err := sdk.ValAddressFromBech32(validatorSet[1].GetOperator()) - require.NoError(err) - source := reportertypes.TokenOrigin{ValidatorAddress: valAcc, Amount: math.NewInt(100 * 1e6)} - commission := stakingtypes.NewCommissionWithTime(math.LegacyNewDecWithPrec(1, 1), math.LegacyNewDecWithPrec(3, 1), - math.LegacyNewDecWithPrec(1, 1), s.ctx.BlockTime()) - // fill in createReporterMsg - createReporterMsg.Reporter = reporterAddress - createReporterMsg.Amount = amount - createReporterMsg.TokenOrigins = []*reportertypes.TokenOrigin{&source} - createReporterMsg.Commission = &commission - // create reporter through msg server - _, err = msgServerReporter.CreateReporter(s.ctx, &createReporterMsg) - require.NoError(err) + // check that reporter was created correctly - oracleReporter, err := s.reporterkeeper.Reporters.Get(s.ctx, delegators[reporter].delegatorAddress) + valAddr, err := sdk.ValAddressFromBech32(delegators[reporter].validator.GetOperator()) require.NoError(err) - require.Equal(oracleReporter.Reporter, delegators[reporter].delegatorAddress.Bytes()) - require.Equal(oracleReporter.TotalTokens, math.NewInt(100*1e6)) - require.Equal(oracleReporter.Jailed, false) - - // define delegation source - source = reportertypes.TokenOrigin{ValidatorAddress: valAcc, Amount: math.NewInt(25 * 1e6)} - delegationMsg := reportertypes.NewMsgDelegateReporter( - delegators[delegatorI].delegatorAddress.String(), - delegators[reporter].delegatorAddress.String(), - math.NewInt(25*1e6), - []*reportertypes.TokenOrigin{&source}, - ) - // self delegate as reporter - _, err = msgServerReporter.DelegateReporter(s.ctx, delegationMsg) + oracleReporter, err := s.Setup.Reporterkeeper.Reporters.Get(s.Setup.Ctx, valAddr) + require.NoError(err) + val, err := s.Setup.Stakingkeeper.GetValidator(s.Setup.Ctx, valAddr) require.NoError(err) - delegationReporter, err := s.reporterkeeper.Delegators.Get(s.ctx, delegators[delegatorI].delegatorAddress) + + require.Equal(oracleReporter.TotalTokens, val.Tokens) + require.Equal(oracleReporter.Jailed, false) + delegationReporter, err := s.Setup.Reporterkeeper.Delegators.Get(s.Setup.Ctx, delegators[delegatorI].delegatorAddress) require.NoError(err) - require.Equal(delegationReporter.Reporter, delegators[reporter].delegatorAddress.Bytes()) + require.Equal(delegationReporter.Reporter, valAddr.Bytes()) } func (s *E2ETestSuite) TestUnstaking() { require := s.Require() - // create 5 validators with 5_000 TRB - accaddr, valaddr, _ := s.CreateValidators(5) - _, err := s.stakingKeeper.EndBlocker(s.ctx) + accaddr, valaddr, _ := s.Setup.CreateValidators(5) + _, err := s.Setup.Stakingkeeper.EndBlocker(s.Setup.Ctx) require.NoError(err) // all validators are bonded - validators, err := s.stakingKeeper.GetAllValidators(s.ctx) + validators, err := s.Setup.Stakingkeeper.GetAllValidators(s.Setup.Ctx) require.NoError(err) require.NotNil(validators) for _, val := range validators { @@ -255,66 +235,69 @@ func (s *E2ETestSuite) TestUnstaking() { } // begin unbonding validator 0 - del, err := s.stakingKeeper.GetDelegation(s.ctx, accaddr[1], valaddr[1]) + del, err := s.Setup.Stakingkeeper.GetDelegation(s.Setup.Ctx, accaddr[1], valaddr[1]) require.NoError(err) // undelegate all shares except for 1 to avoid getting the validator deleted - timeToUnbond, _, err := s.stakingKeeper.Undelegate(s.ctx, accaddr[1], valaddr[1], del.Shares.Sub(math.LegacyNewDec(1))) + timeToUnbond, _, err := s.Setup.Stakingkeeper.Undelegate(s.Setup.Ctx, accaddr[1], valaddr[1], del.Shares.Sub(math.LegacyNewDec(1))) require.NoError(err) // unbonding time is 21 days after calling BeginUnbondingValidator - unbondingStartTime := s.ctx.BlockTime() + unbondingStartTime := s.Setup.Ctx.BlockTime() twentyOneDays := time.Hour * 24 * 21 require.Equal(unbondingStartTime.Add(twentyOneDays), timeToUnbond) - _, err = s.app.EndBlocker(s.ctx) + _, err = s.Setup.App.EndBlocker(s.Setup.Ctx) require.NoError(err) - val1, err := s.stakingKeeper.GetValidator(s.ctx, valaddr[1]) + val1, err := s.Setup.Stakingkeeper.GetValidator(s.Setup.Ctx, valaddr[1]) require.Equal(val1.UnbondingTime, unbondingStartTime.Add(twentyOneDays)) require.NoError(err) require.Equal(val1.IsUnbonding(), true) require.Equal(val1.IsBonded(), false) require.Equal(val1.IsUnbonded(), false) // new block - s.ctx = s.ctx.WithBlockHeight(val1.UnbondingHeight + 1) - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(twentyOneDays)) - _, err = s.app.BeginBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(val1.UnbondingHeight + 1) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(twentyOneDays)) + _, err = s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) - _, err = s.app.EndBlocker(s.ctx) + _, err = s.Setup.App.EndBlocker(s.Setup.Ctx) require.NoError(err) // validator 0 is now unbonded - val1, err = s.stakingKeeper.GetValidator(s.ctx, valaddr[1]) + val1, err = s.Setup.Stakingkeeper.GetValidator(s.Setup.Ctx, valaddr[1]) require.NoError(err) require.Equal(val1.IsUnbonded(), true) } func (s *E2ETestSuite) TestDisputes2() { require := s.Require() - msgServerOracle := oraclekeeper.NewMsgServerImpl(s.oraclekeeper) + msgServerOracle := oraclekeeper.NewMsgServerImpl(s.Setup.Oraclekeeper) require.NotNil(msgServerOracle) - msgServerReporter := reporterkeeper.NewMsgServerImpl(s.reporterkeeper) + msgServerReporter := reporterkeeper.NewMsgServerImpl(s.Setup.Reporterkeeper) require.NotNil(msgServerReporter) - msgServerDispute := disputekeeper.NewMsgServerImpl(s.disputekeeper) + msgServerDispute := disputekeeper.NewMsgServerImpl(s.Setup.Disputekeeper) require.NotNil(msgServerDispute) + msgServerStaking := stakingkeeper.NewMsgServerImpl(s.Setup.Stakingkeeper) + require.NotNil(msgServerStaking) //--------------------------------------------------------------------------- // Height 0 - create 3 validators and 3 reporters //--------------------------------------------------------------------------- - _, err := s.app.BeginBlocker(s.ctx) + _, err := s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Second)) - valsAcctAddrs, valsValAddrs, vals := s.CreateValidators(3) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(time.Second)) + valsAcctAddrs, valsValAddrs, _ := s.Setup.CreateValidators(3) require.NotNil(valsAcctAddrs) - repsAccs := s.CreateReporters(3, valsValAddrs, vals) + repsAccs := valsAcctAddrs + badReporter := repsAccs[0] - _, err = s.app.EndBlocker(s.ctx) + _, err = s.Setup.App.EndBlocker(s.Setup.Ctx) require.NoError(err) // mapping to track reporter delegation balance reporterToBalanceMap := make(map[string]math.Int) for _, acc := range repsAccs { - rkDelegation, err := s.reporterkeeper.Delegators.Get(s.ctx, acc) + rkDelegation, err := s.Setup.Reporterkeeper.Delegators.Get(s.Setup.Ctx, acc) require.NoError(err) reporterToBalanceMap[acc.String()] = rkDelegation.Amount } @@ -322,104 +305,96 @@ func (s *E2ETestSuite) TestDisputes2() { //--------------------------------------------------------------------------- // Height 1 - delegate 500 trb to validator 0 and bad reporter //--------------------------------------------------------------------------- - s.ctx = s.ctx.WithBlockHeight(1) - _, err = s.app.BeginBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(1) + _, err = s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Second)) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(time.Second)) - pk := secp256k1.GenPrivKey() - delAcc := s.convertToAccAddress([]secp256k1.PrivKey{*pk}) + pk := ed25519.GenPrivKey() + delAcc := s.Setup.ConvertToAccAddress([]ed25519.PrivKey{*pk}) delAccAddr := delAcc[0] - initCoins := sdk.NewCoin(s.denom, math.NewInt(500*1e6)) - s.NoError(s.bankKeeper.MintCoins(s.ctx, authtypes.Minter, sdk.NewCoins(initCoins))) - s.NoError(s.bankKeeper.SendCoinsFromModuleToAccount(s.ctx, authtypes.Minter, delAccAddr, sdk.NewCoins(initCoins))) + initCoins := sdk.NewCoin(s.Setup.Denom, math.NewInt(500*1e6)) + s.NoError(s.Setup.Bankkeeper.MintCoins(s.Setup.Ctx, authtypes.Minter, sdk.NewCoins(initCoins))) + s.NoError(s.Setup.Bankkeeper.SendCoinsFromModuleToAccount(s.Setup.Ctx, authtypes.Minter, delAccAddr, sdk.NewCoins(initCoins))) // delegate to validator 0 - val, err := s.stakingKeeper.GetValidator(s.ctx, valsValAddrs[0]) - require.NoError(err) - _, err = s.stakingKeeper.Delegate(s.ctx, delAccAddr, math.NewInt(500*1e6), stakingtypes.Unbonded, val, false) - require.NoError(err) - - // delegate to bad reporter - source := reportertypes.TokenOrigin{ValidatorAddress: valsValAddrs[0], Amount: math.NewInt(500 * 1e6)} - msgDelegate := reportertypes.NewMsgDelegateReporter(delAccAddr.String(), badReporter.String(), math.NewInt(500*1e6), []*reportertypes.TokenOrigin{&source}) - _, err = msgServerReporter.DelegateReporter(s.ctx, msgDelegate) + s.Setup.MintTokens(delAccAddr, math.NewInt(500*1e6)) + _, err = msgServerStaking.Delegate(s.Setup.Ctx, &stakingtypes.MsgDelegate{DelegatorAddress: delAccAddr.String(), ValidatorAddress: valsValAddrs[0].String(), Amount: sdk.NewCoin(s.Setup.Denom, math.NewInt(500*1e6))}) require.NoError(err) - _, err = s.app.EndBlocker(s.ctx) + _, err = s.Setup.App.EndBlocker(s.Setup.Ctx) require.NoError(err) - val, err = s.stakingKeeper.GetValidator(s.ctx, valsValAddrs[0]) + val, err := s.Setup.Stakingkeeper.GetValidator(s.Setup.Ctx, valsValAddrs[0]) require.NoError(err) - require.Equal(val.Tokens, math.NewInt(1500*1e6)) - rep, err := s.reporterkeeper.Reporters.Get(s.ctx, badReporter) + rep, err := s.Setup.Reporterkeeper.Reporters.Get(s.Setup.Ctx, badReporter) require.NoError(err) - require.Equal(rep.TotalTokens, math.NewInt(1500*1e6)) + require.Equal(rep.TotalTokens, val.Tokens) //--------------------------------------------------------------------------- // Height 2 - direct reveal for cycle list //--------------------------------------------------------------------------- - s.ctx = s.ctx.WithBlockHeight(2) - _, err = s.app.BeginBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(2) + _, err = s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) - disputedRep, err := s.reporterkeeper.Reporters.Get(s.ctx, repsAccs[0]) + disputedRep, err := s.Setup.Reporterkeeper.Reporters.Get(s.Setup.Ctx, repsAccs[0]) require.NoError(err) // get new cycle list query data - cycleListQuery, err := s.oraclekeeper.GetCurrentQueryInCycleList(s.ctx) + cycleListQuery, err := s.Setup.Oraclekeeper.GetCurrentQueryInCycleList(s.Setup.Ctx) require.NoError(err) queryId := utils.QueryIDFromData(cycleListQuery) // create reveal message - value := encodeValue(10_000) + value := testutil.EncodeValue(10_000) require.NoError(err) reveal := oracletypes.MsgSubmitValue{ - Creator: sdk.AccAddress(disputedRep.Reporter).String(), + Creator: repsAccs[0].String(), QueryData: cycleListQuery, Value: value, } + reportBlock := s.Setup.Ctx.BlockHeight() // send reveal message - revealResponse, err := msgServerOracle.SubmitValue(s.ctx, &reveal) + revealResponse, err := msgServerOracle.SubmitValue(s.Setup.Ctx, &reveal) require.NoError(err) require.NotNil(revealResponse) - revealTime := s.ctx.BlockTime() + revealTime := s.Setup.Ctx.BlockTime() // advance time and block height to expire the query and aggregate report - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(7 * time.Second)) - _, err = s.app.EndBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(7 * time.Second)) + _, err = s.Setup.App.EndBlocker(s.Setup.Ctx) require.NoError(err) - _, err = s.app.EndBlocker(s.ctx) + _, err = s.Setup.App.EndBlocker(s.Setup.Ctx) require.NoError(err) //--------------------------------------------------------------------------- // Height 3 - open warning, pay from bond from reporter 1 //--------------------------------------------------------------------------- - s.ctx = s.ctx.WithBlockHeight(3) - _, err = s.app.BeginBlocker(s.ctx) - require.NoError(err) - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Second)) - - disputer, err := s.reporterkeeper.Reporters.Get(s.ctx, repsAccs[1]) + s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(3) + _, err = s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) - - // disputerBal := disputer.TotalTokens - disputedBal := disputedRep.TotalTokens - onePercent := disputedBal.Mul(math.NewInt(1)).Quo(math.NewInt(100)) - disputeFee := sdk.NewCoin(s.denom, onePercent) // warning should be 1% of bonded tokens + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(time.Second)) // todo: is there a getter for this ? // get microreport for dispute report := oracletypes.MicroReport{ - Reporter: sdk.AccAddress(disputedRep.Reporter).String(), - Power: disputedRep.TotalTokens.Quo(sdk.DefaultPowerReduction).Int64(), - QueryId: queryId, - Value: value, - Timestamp: revealTime, + Reporter: repsAccs[0].String(), + Power: disputedRep.TotalTokens.Quo(sdk.DefaultPowerReduction).Int64(), + QueryId: queryId, + Value: value, + Timestamp: revealTime, + BlockNumber: reportBlock, } + // disputedBal := disputedRep.TotalTokens + // onePercent := disputedBal.Mul(math.NewInt(1)).Quo(math.NewInt(100)) + fee, err := s.Setup.Disputekeeper.GetDisputeFee(s.Setup.Ctx, report, disputetypes.Warning) + require.NoError(err) + disputeFee := sdk.NewCoin(s.Setup.Denom, fee) // warning should be 1% of bonded tokens + // create msg for propose dispute tx msgProposeDispute := disputetypes.MsgProposeDispute{ - Creator: sdk.AccAddress(disputer.Reporter).String(), + Creator: repsAccs[0].String(), Report: &report, DisputeCategory: disputetypes.Warning, Fee: disputeFee, @@ -427,106 +402,109 @@ func (s *E2ETestSuite) TestDisputes2() { } // send propose dispute tx - _, err = msgServerDispute.ProposeDispute(s.ctx, &msgProposeDispute) + _, err = msgServerDispute.ProposeDispute(s.Setup.Ctx, &msgProposeDispute) require.NoError(err) burnAmount := disputeFee.Amount.MulRaw(1).QuoRaw(20) - disputes, err := s.disputekeeper.GetOpenDisputes(s.ctx) + disputes, err := s.Setup.Disputekeeper.GetOpenDisputes(s.Setup.Ctx) require.NoError(err) require.NotNil(disputes) // dispute is created correctly - dispute, err := s.disputekeeper.Disputes.Get(s.ctx, 1) + dispute, err := s.Setup.Disputekeeper.Disputes.Get(s.Setup.Ctx, 1) require.NoError(err) require.Equal(dispute.DisputeId, uint64(1)) require.Equal(dispute.DisputeStatus, disputetypes.Voting) require.Equal(dispute.DisputeCategory, disputetypes.Warning) require.Equal(dispute.DisputeFee, disputeFee.Amount.Sub(burnAmount)) - require.Equal(dispute.FeePayers, []disputetypes.PayerInfo{{PayerAddress: disputer.Reporter, Amount: disputeFee.Amount, FromBond: true, BlockNumber: 3}}) + require.Equal(dispute.FeePayers, []disputetypes.PayerInfo{{PayerAddress: repsAccs[0].Bytes(), Amount: disputeFee.Amount, FromBond: true, BlockNumber: 3}}) - _, err = s.app.EndBlocker(s.ctx) + _, err = s.Setup.App.EndBlocker(s.Setup.Ctx) require.NoError(err) //--------------------------------------------------------------------------- // Height 4 - disputed reporter reports after calling unjail //--------------------------------------------------------------------------- - s.ctx = s.ctx.WithBlockHeight(4) - _, err = s.app.BeginBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(4) + _, err = s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) - disputedRep, err = s.reporterkeeper.Reporters.Get(s.ctx, repsAccs[0]) + disputedRep, err = s.Setup.Reporterkeeper.Reporters.Get(s.Setup.Ctx, repsAccs[0]) require.NoError(err) require.Equal(disputedRep.Jailed, true) // disputed reporter cant report yet - cycleListQuery, err = s.oraclekeeper.GetCurrentQueryInCycleList(s.ctx) + cycleListQuery, err = s.Setup.Oraclekeeper.GetCurrentQueryInCycleList(s.Setup.Ctx) require.NoError(err) - value = encodeValue(10_000) + value = testutil.EncodeValue(10_000) require.NoError(err) reveal = oracletypes.MsgSubmitValue{ - Creator: sdk.AccAddress(disputedRep.Reporter).String(), + Creator: repsAccs[0].String(), QueryData: cycleListQuery, Value: value, } - _, err = msgServerOracle.SubmitValue(s.ctx, &reveal) + _, err = msgServerOracle.SubmitValue(s.Setup.Ctx, &reveal) require.Error(err) // disputed reporter can report after calling unjail function msgUnjail := reportertypes.MsgUnjailReporter{ - ReporterAddress: sdk.AccAddress(disputedRep.Reporter).String(), + ReporterAddress: repsAccs[0].String(), } - _, err = msgServerReporter.UnjailReporter(s.ctx, &msgUnjail) + _, err = msgServerReporter.UnjailReporter(s.Setup.Ctx, &msgUnjail) require.NoError(err) - disputedRep, err = s.reporterkeeper.Reporters.Get(s.ctx, repsAccs[0]) + disputedRep, err = s.Setup.Reporterkeeper.Reporters.Get(s.Setup.Ctx, repsAccs[0]) require.NoError(err) require.Equal(disputedRep.Jailed, false) // send reveal message - revealResponse, err = msgServerOracle.SubmitValue(s.ctx, &reveal) + revealResponse, err = msgServerOracle.SubmitValue(s.Setup.Ctx, &reveal) require.NoError(err) require.NotNil(revealResponse) - revealTime = s.ctx.BlockTime() + revealTime = s.Setup.Ctx.BlockTime() + revealBlock := s.Setup.Ctx.BlockHeight() // give disputer tokens to pay for next disputes not from bond - initCoins = sdk.NewCoin(s.denom, math.NewInt(10_000*1e6)) - require.NoError(s.bankKeeper.MintCoins(s.ctx, authtypes.Minter, sdk.NewCoins(initCoins))) + beforemint := s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, repsAccs[1], s.Setup.Denom) + initCoins = sdk.NewCoin(s.Setup.Denom, math.NewInt(10_000*1e6)) + require.NoError(s.Setup.Bankkeeper.MintCoins(s.Setup.Ctx, authtypes.Minter, sdk.NewCoins(initCoins))) // send from module to account - require.NoError(s.bankKeeper.SendCoinsFromModuleToAccount(s.ctx, authtypes.Minter, disputer.Reporter, sdk.NewCoins(initCoins))) - require.Equal(initCoins, s.bankKeeper.GetBalance(s.ctx, disputer.Reporter, s.denom)) + require.NoError(s.Setup.Bankkeeper.SendCoinsFromModuleToAccount(s.Setup.Ctx, authtypes.Minter, repsAccs[1], sdk.NewCoins(initCoins))) + require.Equal(beforemint.Add(initCoins), s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, repsAccs[1], s.Setup.Denom)) // advance time and block height to expire the query and aggregate report - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(7 * time.Second)) - _, err = s.app.EndBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(7 * time.Second)) + _, err = s.Setup.App.EndBlocker(s.Setup.Ctx) require.NoError(err) - disputer, err = s.reporterkeeper.Reporters.Get(s.ctx, repsAccs[1]) - require.NoError(err) - disputedRep, err = s.reporterkeeper.Reporters.Get(s.ctx, repsAccs[0]) + // disputer, err = s.Setup.Reporterkeeper.Reporters.Get(s.Setup.Ctx, repsAccs[1]) + // require.NoError(err) + disputedRep, err = s.Setup.Reporterkeeper.Reporters.Get(s.Setup.Ctx, repsAccs[0]) require.NoError(err) //--------------------------------------------------------------------------- // Height 5 - open warning, pay from not bond from reporter 1 //--------------------------------------------------------------------------- - s.ctx = s.ctx.WithBlockHeight(5) - _, err = s.app.BeginBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(5) + _, err = s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Second)) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(time.Second)) - // disputerBal := disputer.TotalTokens - disputedBal = disputedRep.TotalTokens - onePercent = disputedBal.Mul(math.NewInt(1)).Quo(math.NewInt(100)) - disputeFee = sdk.NewCoin(s.denom, onePercent) // warning should be 1% of bonded tokens + report.Power = disputedRep.TotalTokens.Quo(sdk.DefaultPowerReduction).Int64() + fee, err = s.Setup.Disputekeeper.GetDisputeFee(s.Setup.Ctx, report, disputetypes.Warning) + require.NoError(err) + disputeFee = sdk.NewCoin(s.Setup.Denom, fee) // warning should be 1% of bonded tokens // get microreport for dispute report = oracletypes.MicroReport{ - Reporter: sdk.AccAddress(disputedRep.Reporter).String(), - Power: disputedRep.TotalTokens.Quo(sdk.DefaultPowerReduction).Int64(), - QueryId: queryId, - Value: value, - Timestamp: revealTime, + Reporter: repsAccs[0].String(), + Power: disputedRep.TotalTokens.Quo(sdk.DefaultPowerReduction).Int64(), + QueryId: queryId, + Value: value, + Timestamp: revealTime, + BlockNumber: revealBlock, } // create msg for propose dispute tx msgProposeDispute = disputetypes.MsgProposeDispute{ - Creator: sdk.AccAddress(disputer.Reporter).String(), + Creator: repsAccs[1].String(), Report: &report, DisputeCategory: disputetypes.Warning, Fee: disputeFee, @@ -534,92 +512,94 @@ func (s *E2ETestSuite) TestDisputes2() { } // send propose dispute tx - _, err = msgServerDispute.ProposeDispute(s.ctx, &msgProposeDispute) + _, err = msgServerDispute.ProposeDispute(s.Setup.Ctx, &msgProposeDispute) require.NoError(err) burnAmount = disputeFee.Amount.MulRaw(1).QuoRaw(20) - disputes, err = s.disputekeeper.GetOpenDisputes(s.ctx) + disputes, err = s.Setup.Disputekeeper.GetOpenDisputes(s.Setup.Ctx) require.NoError(err) require.NotNil(disputes) // dispute is created correctly - dispute, err = s.disputekeeper.Disputes.Get(s.ctx, 2) + dispute, err = s.Setup.Disputekeeper.Disputes.Get(s.Setup.Ctx, 2) require.NoError(err) require.Equal(dispute.DisputeId, uint64(2)) require.Equal(dispute.DisputeStatus, disputetypes.Voting) require.Equal(dispute.DisputeCategory, disputetypes.Warning) require.Equal(dispute.DisputeFee, disputeFee.Amount.Sub(burnAmount)) - require.Equal(dispute.FeePayers, []disputetypes.PayerInfo{{PayerAddress: disputer.Reporter, Amount: disputeFee.Amount, FromBond: false, BlockNumber: 5}}) + require.Equal(dispute.FeePayers, []disputetypes.PayerInfo{{PayerAddress: repsAccs[1].Bytes(), Amount: disputeFee.Amount, FromBond: false, BlockNumber: 5}}) - _, err = s.app.EndBlocker(s.ctx) + _, err = s.Setup.App.EndBlocker(s.Setup.Ctx) require.NoError(err) //--------------------------------------------------------------------------- // Height 6 - dispute is resolved, direct reveal again //--------------------------------------------------------------------------- - s.ctx = s.ctx.WithBlockHeight(6) - _, err = s.app.BeginBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(6) + _, err = s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Second)) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(time.Second)) - disputedRep, err = s.reporterkeeper.Reporters.Get(s.ctx, repsAccs[0]) + disputedRep, err = s.Setup.Reporterkeeper.Reporters.Get(s.Setup.Ctx, repsAccs[0]) require.NoError(err) require.Equal(disputedRep.Jailed, true) // disputed reporter cant report yet - cycleListQuery, err = s.oraclekeeper.GetCurrentQueryInCycleList(s.ctx) + cycleListQuery, err = s.Setup.Oraclekeeper.GetCurrentQueryInCycleList(s.Setup.Ctx) require.NoError(err) - value = encodeValue(10_000) + value = testutil.EncodeValue(10_000) require.NoError(err) queryId = utils.QueryIDFromData(cycleListQuery) reveal = oracletypes.MsgSubmitValue{ - Creator: sdk.AccAddress(disputedRep.Reporter).String(), + Creator: repsAccs[0].String(), QueryData: cycleListQuery, Value: value, } - _, err = msgServerOracle.SubmitValue(s.ctx, &reveal) + _, err = msgServerOracle.SubmitValue(s.Setup.Ctx, &reveal) require.Error(err) // disputed reporter can report after calling unjail function msgUnjail = reportertypes.MsgUnjailReporter{ - ReporterAddress: sdk.AccAddress(disputedRep.Reporter).String(), + ReporterAddress: repsAccs[0].String(), } - _, err = msgServerReporter.UnjailReporter(s.ctx, &msgUnjail) + _, err = msgServerReporter.UnjailReporter(s.Setup.Ctx, &msgUnjail) require.NoError(err) - disputedRep, err = s.reporterkeeper.Reporters.Get(s.ctx, repsAccs[0]) + disputedRep, err = s.Setup.Reporterkeeper.Reporters.Get(s.Setup.Ctx, repsAccs[0]) require.NoError(err) require.Equal(disputedRep.Jailed, false) // send reveal message - revealResponse, err = msgServerOracle.SubmitValue(s.ctx, &reveal) + revealResponse, err = msgServerOracle.SubmitValue(s.Setup.Ctx, &reveal) require.NoError(err) require.NotNil(revealResponse) - revealTime = s.ctx.BlockTime() + revealTime = s.Setup.Ctx.BlockTime() + revealBlock = s.Setup.Ctx.BlockHeight() - _, err = s.app.EndBlocker(s.ctx) + _, err = s.Setup.App.EndBlocker(s.Setup.Ctx) require.NoError(err) //--------------------------------------------------------------------------- // Height 7 - open minor dispute, pay from bond from reporter 1 //--------------------------------------------------------------------------- - s.ctx = s.ctx.WithBlockHeight(7) - _, err = s.app.BeginBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(7) + _, err = s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Second)) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(time.Second)) balBeforeDispute := disputedRep.TotalTokens fivePercent := balBeforeDispute.Mul(math.NewInt(5)).Quo(math.NewInt(100)) - disputeFee = sdk.NewCoin(s.denom, fivePercent) + disputeFee = sdk.NewCoin(s.Setup.Denom, fivePercent) report = oracletypes.MicroReport{ - Reporter: sdk.AccAddress(disputedRep.Reporter).String(), - Power: disputedRep.TotalTokens.Quo(sdk.DefaultPowerReduction).Int64(), - QueryId: queryId, - Value: value, - Timestamp: revealTime, + Reporter: repsAccs[0].String(), + Power: disputedRep.TotalTokens.Quo(sdk.DefaultPowerReduction).Int64(), + QueryId: queryId, + Value: value, + Timestamp: revealTime, + BlockNumber: revealBlock, } // create msg for propose dispute tx msgProposeDispute = disputetypes.MsgProposeDispute{ - Creator: sdk.AccAddress(disputer.Reporter).String(), + Creator: repsAccs[1].String(), Report: &report, DisputeCategory: disputetypes.Minor, Fee: disputeFee, @@ -627,50 +607,50 @@ func (s *E2ETestSuite) TestDisputes2() { } // send propose dispute tx - _, err = msgServerDispute.ProposeDispute(s.ctx, &msgProposeDispute) + _, err = msgServerDispute.ProposeDispute(s.Setup.Ctx, &msgProposeDispute) require.NoError(err) - _ = s.ctx.BlockTime() + _ = s.Setup.Ctx.BlockTime() - _, err = s.app.EndBlocker(s.ctx) + _, err = s.Setup.App.EndBlocker(s.Setup.Ctx) require.NoError(err) //--------------------------------------------------------------------------- // Height 8 - vote on minor dispute -- reaches quorum //--------------------------------------------------------------------------- - s.ctx = s.ctx.WithBlockHeight(8) - _, err = s.app.BeginBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(8) + _, err = s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Second)) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(time.Second)) // vote from disputer msgVote := disputetypes.MsgVote{ - Voter: sdk.AccAddress(disputer.Reporter).String(), + Voter: repsAccs[0].String(), Id: dispute.DisputeId, Vote: disputetypes.VoteEnum_VOTE_SUPPORT, } - voteResponse, err := msgServerDispute.Vote(s.ctx, &msgVote) + voteResponse, err := msgServerDispute.Vote(s.Setup.Ctx, &msgVote) require.NoError(err) require.NotNil(voteResponse) // vote from disputed reporter msgVote = disputetypes.MsgVote{ - Voter: sdk.AccAddress(disputedRep.Reporter).String(), + Voter: repsAccs[1].String(), Id: dispute.DisputeId, Vote: disputetypes.VoteEnum_VOTE_SUPPORT, } - voteResponse, err = msgServerDispute.Vote(s.ctx, &msgVote) + voteResponse, err = msgServerDispute.Vote(s.Setup.Ctx, &msgVote) require.NoError(err) require.NotNil(voteResponse) // vote from third reporter - thirdReporter, err := s.reporterkeeper.Reporters.Get(s.ctx, repsAccs[2]) + // thirdReporter, err := s.Setup.Reporterkeeper.Reporters.Get(s.Setup.Ctx, repsAccs[2]) require.NoError(err) msgVote = disputetypes.MsgVote{ - Voter: sdk.AccAddress(thirdReporter.Reporter).String(), + Voter: repsAccs[2].String(), Id: dispute.DisputeId, Vote: disputetypes.VoteEnum_VOTE_SUPPORT, } - voteResponse, err = msgServerDispute.Vote(s.ctx, &msgVote) + voteResponse, err = msgServerDispute.Vote(s.Setup.Ctx, &msgVote) require.NoError(err) require.NotNil(voteResponse) @@ -681,30 +661,30 @@ func (s *E2ETestSuite) TestDisputes2() { // Id: dispute.DisputeId, // Vote: disputetypes.VoteEnum_VOTE_SUPPORT, // } - // voteResponse, err = msgServerDispute.Vote(s.ctx, &msgVote) + // voteResponse, err = msgServerDispute.Vote(s.Setup.Ctx, &msgVote) // require.NoError(err) // require.NotNil(voteResponse) - totalTips, err := s.disputekeeper.BlockInfo.Get(s.ctx, dispute.HashId) + totalTips, err := s.Setup.Disputekeeper.BlockInfo.Get(s.Setup.Ctx, dispute.HashId) require.NoError(err) fmt.Println("totalTips: ", totalTips) - totalReporterPower, err := s.reporterkeeper.TotalReporterPower(s.ctx) + totalReporterPower, err := s.Setup.Reporterkeeper.TotalReporterPower(s.Setup.Ctx) require.NoError(err) fmt.Println("total reporter power: ", totalReporterPower.Quo(sdk.DefaultPowerReduction)) - reporter1Power, err := s.disputekeeper.ReportersGroup.Get(s.ctx, collections.Join(dispute.DisputeId, disputedRep.Reporter)) + reporter1Power, err := s.Setup.Disputekeeper.ReportersGroup.Get(s.Setup.Ctx, collections.Join(dispute.DisputeId, repsAccs[0].Bytes())) require.NoError(err) fmt.Println("reporter1 Power: ", reporter1Power) - reporter2Power, err := s.disputekeeper.ReportersGroup.Get(s.ctx, collections.Join(dispute.DisputeId, disputer.Reporter)) + reporter2Power, err := s.Setup.Disputekeeper.ReportersGroup.Get(s.Setup.Ctx, collections.Join(dispute.DisputeId, repsAccs[1].Bytes())) require.NoError(err) fmt.Println("reporter2 Power: ", reporter2Power) - reporter3Power, err := s.disputekeeper.ReportersGroup.Get(s.ctx, collections.Join(dispute.DisputeId, thirdReporter.Reporter)) + reporter3Power, err := s.Setup.Disputekeeper.ReportersGroup.Get(s.Setup.Ctx, collections.Join(dispute.DisputeId, repsAccs[2].Bytes())) require.NoError(err) fmt.Println("reporter3 Power: ", reporter3Power) - totalFreeFloatingTokens := s.disputekeeper.GetTotalSupply(s.ctx) + totalFreeFloatingTokens := s.Setup.Disputekeeper.GetTotalSupply(s.Setup.Ctx) fmt.Println("total Free Floating Tokens: ", totalFreeFloatingTokens) - owners, err := s.bankKeeper.DenomOwners(s.ctx, &banktypes.QueryDenomOwnersRequest{Denom: s.denom}) + owners, err := s.Setup.Bankkeeper.DenomOwners(s.Setup.Ctx, &banktypes.QueryDenomOwnersRequest{Denom: s.Setup.Denom}) require.NoError(err) sumFromDenomOwners := math.ZeroInt() for _, owner := range owners.DenomOwners { @@ -723,110 +703,110 @@ func (s *E2ETestSuite) TestDisputes2() { fmt.Println("delegator acc addr: ", delAccAddr.String()) // print tbr module account address - tbrModuleAccount := s.accountKeeper.GetModuleAddress(minttypes.TimeBasedRewards) // yes + tbrModuleAccount := s.Setup.Accountkeeper.GetModuleAddress(minttypes.TimeBasedRewards) // yes fmt.Println("tbr module account: ", tbrModuleAccount.String()) - teamAccount := s.accountKeeper.GetModuleAddress(minttypes.MintToTeam) // yes + teamAccount := s.Setup.Accountkeeper.GetModuleAddress(minttypes.MintToTeam) // yes fmt.Println("team account: ", teamAccount.String()) - disputeModuleAccount := s.accountKeeper.GetModuleAddress(disputetypes.ModuleName) // yes + disputeModuleAccount := s.Setup.Accountkeeper.GetModuleAddress(disputetypes.ModuleName) // yes fmt.Println("dispute module account: ", disputeModuleAccount.String()) - authModuleAccount := s.accountKeeper.GetModuleAddress(authtypes.ModuleName) // + authModuleAccount := s.Setup.Accountkeeper.GetModuleAddress(authtypes.ModuleName) // fmt.Println("auth module account: ", authModuleAccount.String()) - reporterModuleAccount := s.accountKeeper.GetModuleAddress(reportertypes.ModuleName) // yes + reporterModuleAccount := s.Setup.Accountkeeper.GetModuleAddress(reportertypes.ModuleName) // yes fmt.Println("reporter module account: ", reporterModuleAccount.String()) - registryModuleAccount := s.accountKeeper.GetModuleAddress(registrytypes.ModuleName) // no + registryModuleAccount := s.Setup.Accountkeeper.GetModuleAddress(registrytypes.ModuleName) // no fmt.Println("registry module account: ", registryModuleAccount.String()) - reporterTipsEscrowAccount := s.accountKeeper.GetModuleAddress(reportertypes.TipsEscrowPool) // no + reporterTipsEscrowAccount := s.Setup.Accountkeeper.GetModuleAddress(reportertypes.TipsEscrowPool) // no fmt.Println("reporter tips escrow account: ", reporterTipsEscrowAccount.String()) - oracleModuleAccount := s.accountKeeper.GetModuleAddress(oracletypes.ModuleName) // no + oracleModuleAccount := s.Setup.Accountkeeper.GetModuleAddress(oracletypes.ModuleName) // no fmt.Println("oracle module account: ", oracleModuleAccount.String()) - stakingModuleAccount := s.accountKeeper.GetModuleAddress(stakingtypes.ModuleName) // + stakingModuleAccount := s.Setup.Accountkeeper.GetModuleAddress(stakingtypes.ModuleName) // fmt.Println("staking module account: ", stakingModuleAccount.String()) //--------------------------------------------------------------------------- // Height 9 - resolve dispute, direct reveal again //--------------------------------------------------------------------------- - s.ctx = s.ctx.WithBlockHeight(9) - _, err = s.app.BeginBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(9) + _, err = s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Second)) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(time.Second)) //--------------------------------------------------------------------------- // Height 10 - open minor dispute, pay from not bond from reporter 1 //--------------------------------------------------------------------------- - s.ctx = s.ctx.WithBlockHeight(10) - _, err = s.app.BeginBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(10) + _, err = s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Second)) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(time.Second)) //--------------------------------------------------------------------------- // Height 11 - vote on minor dispute //--------------------------------------------------------------------------- - s.ctx = s.ctx.WithBlockHeight(11) - _, err = s.app.BeginBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(11) + _, err = s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Second)) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(time.Second)) //--------------------------------------------------------------------------- // Height 12 - resolve dispute, direct reveal again //--------------------------------------------------------------------------- - s.ctx = s.ctx.WithBlockHeight(12) - _, err = s.app.BeginBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(12) + _, err = s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Second)) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(time.Second)) //--------------------------------------------------------------------------- // Height 13 - open major dispute, pay from bond from reporter 1 //--------------------------------------------------------------------------- - s.ctx = s.ctx.WithBlockHeight(13) - _, err = s.app.BeginBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(13) + _, err = s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Second)) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(time.Second)) //--------------------------------------------------------------------------- // Height 14 - vote on major dispute //--------------------------------------------------------------------------- - s.ctx = s.ctx.WithBlockHeight(14) - _, err = s.app.BeginBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(14) + _, err = s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Second)) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(time.Second)) //--------------------------------------------------------------------------- // Height 15 - resolve dispute, direct reveal again //--------------------------------------------------------------------------- - s.ctx = s.ctx.WithBlockHeight(15) - _, err = s.app.BeginBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(15) + _, err = s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Second)) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(time.Second)) //--------------------------------------------------------------------------- // Height 16 - open major dispute, pay from not bond from reporter 1 //--------------------------------------------------------------------------- - s.ctx = s.ctx.WithBlockHeight(16) - _, err = s.app.BeginBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(16) + _, err = s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Second)) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(time.Second)) //--------------------------------------------------------------------------- // Height 17 - vote on major dispute //--------------------------------------------------------------------------- - s.ctx = s.ctx.WithBlockHeight(17) - _, err = s.app.BeginBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(17) + _, err = s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Second)) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(time.Second)) //--------------------------------------------------------------------------- // Height 18 - resolve dispute, direct reveal again //--------------------------------------------------------------------------- - s.ctx = s.ctx.WithBlockHeight(18) - _, err = s.app.BeginBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(18) + _, err = s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Second)) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(time.Second)) } diff --git a/tests/e2e/edit_spec_test.go b/tests/e2e/edit_spec_test.go index 0181f2a30..d6cfa045e 100644 --- a/tests/e2e/edit_spec_test.go +++ b/tests/e2e/edit_spec_test.go @@ -3,6 +3,7 @@ package e2e_test import ( "time" + "github.com/tellor-io/layer/testutil" oraclekeeper "github.com/tellor-io/layer/x/oracle/keeper" oracletypes "github.com/tellor-io/layer/x/oracle/types" registrykeeper "github.com/tellor-io/layer/x/registry/keeper" @@ -24,35 +25,35 @@ import ( func (s *E2ETestSuite) TestEditSpec() { require := s.Require() - registryMsgServer := registrykeeper.NewMsgServerImpl(s.registrykeeper) + registryMsgServer := registrykeeper.NewMsgServerImpl(s.Setup.Registrykeeper) require.NotNil(registryMsgServer) - oracleMsgServer := oraclekeeper.NewMsgServerImpl(s.oraclekeeper) + oracleMsgServer := oraclekeeper.NewMsgServerImpl(s.Setup.Oraclekeeper) require.NotNil(oracleMsgServer) - reporterMsgServer := reporterkeeper.NewMsgServerImpl(s.reporterkeeper) + reporterMsgServer := reporterkeeper.NewMsgServerImpl(s.Setup.Reporterkeeper) require.NotNil(reporterMsgServer) - govMsgServer := govkeeper.NewMsgServerImpl(s.govKeeper) + govMsgServer := govkeeper.NewMsgServerImpl(s.Setup.Govkeeper) require.NotNil(govMsgServer) //--------------------------------------------------------------------------- // Height 0 - create 1 validator and 1 reporter //--------------------------------------------------------------------------- - _, err := s.app.BeginBlocker(s.ctx) + _, err := s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Second)) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(time.Second)) - valAccAddrs, valValAddrs, vals := s.CreateValidators(1) - repAccAddrs := s.CreateReporters(1, valValAddrs, vals) + valAccAddrs, valValAddrs, _ := s.Setup.CreateValidators(1) + // valAccAddrs := s.CreateReporters(1, valValAddrs, vals) - _, err = s.app.EndBlocker(s.ctx) + _, err = s.Setup.App.EndBlocker(s.Setup.Ctx) require.NoError(err) //--------------------------------------------------------------------------- // Height 1 - register a spec for a TWAP query, registrar is reporter //--------------------------------------------------------------------------- - s.ctx = s.ctx.WithBlockHeight(1) - _, err = s.app.BeginBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(1) + _, err = s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Second)) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(time.Second)) abiComponents := []*registrytypes.ABIComponent{ {Name: "asset", FieldType: "string"}, @@ -61,89 +62,89 @@ func (s *E2ETestSuite) TestEditSpec() { dataspec := registrytypes.DataSpec{ ResponseValueType: "uint256", AggregationMethod: "weighted-median", - Registrar: repAccAddrs[0].String(), + Registrar: valAccAddrs[0].String(), AbiComponents: abiComponents, } - _, err = registryMsgServer.RegisterSpec(s.ctx, ®istrytypes.MsgRegisterSpec{ - Registrar: repAccAddrs[0].String(), + _, err = registryMsgServer.RegisterSpec(s.Setup.Ctx, ®istrytypes.MsgRegisterSpec{ + Registrar: valAccAddrs[0].String(), QueryType: "TWAP", Spec: dataspec, }) require.NoError(err) - spec, err := s.registrykeeper.GetSpec(s.ctx, "TWAP") + spec, err := s.Setup.Registrykeeper.GetSpec(s.Setup.Ctx, "TWAP") require.NoError(err) - require.Equal(spec.Registrar, repAccAddrs[0].String()) + require.Equal(spec.Registrar, valAccAddrs[0].String()) require.Equal(spec.AbiComponents, abiComponents) require.Equal(spec.ResponseValueType, "uint256") require.Equal(spec.AggregationMethod, "weighted-median") - _, err = s.app.EndBlocker(s.ctx) + _, err = s.Setup.App.EndBlocker(s.Setup.Ctx) require.NoError(err) //--------------------------------------------------------------------------- // Height 2 - tip for eth/usd TWAP //--------------------------------------------------------------------------- - s.ctx = s.ctx.WithBlockHeight(2) - _, err = s.app.BeginBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(2) + _, err = s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Second)) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(time.Second)) encodedDataSpec, err := dataspec.EncodeData("TWAP", `["eth","usd"]`) require.NoError(err) // mint coins to val so they can tip - initCoins := sdk.NewCoin(s.denom, math.NewInt(100*1e6)) - s.NoError(s.bankKeeper.MintCoins(s.ctx, authtypes.Minter, sdk.NewCoins(initCoins))) - s.NoError(s.bankKeeper.SendCoinsFromModuleToAccount(s.ctx, authtypes.Minter, valAccAddrs[0], sdk.NewCoins(initCoins))) + initCoins := sdk.NewCoin(s.Setup.Denom, math.NewInt(100*1e6)) + s.NoError(s.Setup.Bankkeeper.MintCoins(s.Setup.Ctx, authtypes.Minter, sdk.NewCoins(initCoins))) + s.NoError(s.Setup.Bankkeeper.SendCoinsFromModuleToAccount(s.Setup.Ctx, authtypes.Minter, valAccAddrs[0], sdk.NewCoins(initCoins))) msgTip := oracletypes.MsgTip{ Tipper: valAccAddrs[0].String(), QueryData: encodedDataSpec, - Amount: sdk.NewCoin(s.denom, math.NewInt(1*1e6)), + Amount: sdk.NewCoin(s.Setup.Denom, math.NewInt(1*1e6)), } - tipResponse, err := oracleMsgServer.Tip(s.ctx, &msgTip) + tipResponse, err := oracleMsgServer.Tip(s.Setup.Ctx, &msgTip) require.NoError(err) require.NotNil(tipResponse) - _, err = s.app.EndBlocker(s.ctx) + _, err = s.Setup.App.EndBlocker(s.Setup.Ctx) require.NoError(err) //--------------------------------------------------------------------------- // Height 3 - direct reveal for eth/usd TWAP //--------------------------------------------------------------------------- - s.ctx = s.ctx.WithBlockHeight(3) - _, err = s.app.BeginBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(3) + _, err = s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Second)) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(time.Second)) msgSubmit := oracletypes.MsgSubmitValue{ - Creator: repAccAddrs[0].String(), + Creator: valAccAddrs[0].String(), QueryData: encodedDataSpec, - Value: encodeValue(5_000), + Value: testutil.EncodeValue(5_000), } - _, err = oracleMsgServer.SubmitValue(s.ctx, &msgSubmit) + _, err = oracleMsgServer.SubmitValue(s.Setup.Ctx, &msgSubmit) require.NoError(err) - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(7 * time.Second)) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(7 * time.Second)) - _, err = s.app.EndBlocker(s.ctx) + _, err = s.Setup.App.EndBlocker(s.Setup.Ctx) require.NoError(err) //--------------------------------------------------------------------------- // Height 4 - submit and vote on proposal for spec owner to be validator instead of reporter //--------------------------------------------------------------------------- - s.ctx = s.ctx.WithBlockHeight(4) - _, err = s.app.BeginBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(4) + _, err = s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Second)) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(time.Second)) msgWithdrawTip := reportertypes.MsgWithdrawTip{ - DelegatorAddress: repAccAddrs[0].String(), + DelegatorAddress: valAccAddrs[0].String(), ValidatorAddress: valValAddrs[0].String(), } - _, err = reporterMsgServer.WithdrawTip(s.ctx, &msgWithdrawTip) + _, err = reporterMsgServer.WithdrawTip(s.Setup.Ctx, &msgWithdrawTip) require.NoError(err) - govParams, err := s.govKeeper.Params.Get(s.ctx) + govParams, err := s.Setup.Govkeeper.Params.Get(s.Setup.Ctx) require.NoError(err) updatedSpec := registrytypes.DataSpec{ ResponseValueType: "uint256", @@ -170,16 +171,16 @@ func (s *E2ETestSuite) TestEditSpec() { Expedited: false, } - proposal, err := govMsgServer.SubmitProposal(s.ctx, &msgSubmitProposal) + proposal, err := govMsgServer.SubmitProposal(s.Setup.Ctx, &msgSubmitProposal) require.NoError(err) - spec, err = s.registrykeeper.GetSpec(s.ctx, "TWAP") + spec, err = s.Setup.Registrykeeper.GetSpec(s.Setup.Ctx, "TWAP") require.NoError(err) - require.Equal(spec.Registrar, repAccAddrs[0].String()) + require.Equal(spec.Registrar, valAccAddrs[0].String()) require.Equal(spec.AbiComponents, abiComponents) require.Equal(spec.ResponseValueType, "uint256") require.Equal(spec.AggregationMethod, "weighted-median") - voteResponse, err := govMsgServer.Vote(s.ctx, &v1.MsgVote{ + voteResponse, err := govMsgServer.Vote(s.Setup.Ctx, &v1.MsgVote{ ProposalId: proposal.ProposalId, Voter: valAccAddrs[0].String(), Option: v1.VoteOption(1), @@ -188,26 +189,26 @@ func (s *E2ETestSuite) TestEditSpec() { require.NoError(err) require.NotNil(voteResponse) - vote, err := s.govKeeper.Votes.Get(s.ctx, collections.Join(proposal.ProposalId, valAccAddrs[0])) + vote, err := s.Setup.Govkeeper.Votes.Get(s.Setup.Ctx, collections.Join(proposal.ProposalId, valAccAddrs[0])) require.NoError(err) require.Equal(vote.ProposalId, proposal.ProposalId) require.Equal(vote.Voter, valAccAddrs[0].String()) require.Equal(vote.Metadata, "vote metadata from validator") - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(48 * time.Hour)) - _, err = s.app.EndBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(48 * time.Hour)) + _, err = s.Setup.App.EndBlocker(s.Setup.Ctx) require.NoError(err) //--------------------------------------------------------------------------- // Height 5 - vote passes, tip and direct reveal for updated spec //--------------------------------------------------------------------------- - s.ctx = s.ctx.WithBlockHeight(5) - _, err = s.app.BeginBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(5) + _, err = s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Second)) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(time.Second)) // proposal passed - proposal1, err := s.govKeeper.Proposals.Get(s.ctx, proposal.ProposalId) + proposal1, err := s.Setup.Govkeeper.Proposals.Get(s.Setup.Ctx, proposal.ProposalId) require.NoError(err) require.Equal(proposal1.Status, v1.StatusPassed) require.Equal(proposal1.Proposer, valAccAddrs[0].String()) @@ -218,41 +219,41 @@ func (s *E2ETestSuite) TestEditSpec() { require.Equal(proposal1.Summary, "test summary") require.Equal(proposal1.Expedited, false) - spec, err = s.registrykeeper.GetSpec(s.ctx, "TWAP") + spec, err = s.Setup.Registrykeeper.GetSpec(s.Setup.Ctx, "TWAP") require.NoError(err) require.Equal(spec.Registrar, valAccAddrs[0].String()) require.Equal(spec.AbiComponents, abiComponents) require.Equal(spec.ResponseValueType, "uint256") require.Equal(spec.AggregationMethod, "weighted-median") - _, err = oracleMsgServer.Tip(s.ctx, &msgTip) + _, err = oracleMsgServer.Tip(s.Setup.Ctx, &msgTip) require.NoError(err) - _, err = oracleMsgServer.SubmitValue(s.ctx, &msgSubmit) + _, err = oracleMsgServer.SubmitValue(s.Setup.Ctx, &msgSubmit) require.NoError(err) - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(7 * time.Second)) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(7 * time.Second)) - _, err = s.app.EndBlocker(s.ctx) + _, err = s.Setup.App.EndBlocker(s.Setup.Ctx) require.NoError(err) //--------------------------------------------------------------------------- // Height 6 - tip, submit proposal to change registar to reporter, then reveal //--------------------------------------------------------------------------- - s.ctx = s.ctx.WithBlockHeight(6) - _, err = s.app.BeginBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(6) + _, err = s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Second)) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(time.Second)) - _, err = reporterMsgServer.WithdrawTip(s.ctx, &msgWithdrawTip) + _, err = reporterMsgServer.WithdrawTip(s.Setup.Ctx, &msgWithdrawTip) require.NoError(err) - _, err = oracleMsgServer.Tip(s.ctx, &msgTip) + _, err = oracleMsgServer.Tip(s.Setup.Ctx, &msgTip) require.NoError(err) updatedSpec = registrytypes.DataSpec{ ResponseValueType: "uint256", AggregationMethod: "weighted-median", - Registrar: repAccAddrs[0].String(), + Registrar: valAccAddrs[0].String(), AbiComponents: []*registrytypes.ABIComponent{ {Name: "asset", FieldType: "string"}, {Name: "currency", FieldType: "string"}, @@ -276,29 +277,29 @@ func (s *E2ETestSuite) TestEditSpec() { Expedited: false, } - proposal, err = govMsgServer.SubmitProposal(s.ctx, &msgSubmitProposal) + proposal, err = govMsgServer.SubmitProposal(s.Setup.Ctx, &msgSubmitProposal) require.NoError(err) require.Equal(proposal.ProposalId, uint64(2)) - _, err = oracleMsgServer.SubmitValue(s.ctx, &msgSubmit) + _, err = oracleMsgServer.SubmitValue(s.Setup.Ctx, &msgSubmit) require.NoError(err) - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(7 * time.Second)) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(7 * time.Second)) - _, err = s.app.EndBlocker(s.ctx) + _, err = s.Setup.App.EndBlocker(s.Setup.Ctx) require.NoError(err) //--------------------------------------------------------------------------- // Height 7 - vote on proposal //--------------------------------------------------------------------------- - s.ctx = s.ctx.WithBlockHeight(7) - _, err = s.app.BeginBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(7) + _, err = s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Second)) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(time.Second)) - _, err = reporterMsgServer.WithdrawTip(s.ctx, &msgWithdrawTip) + _, err = reporterMsgServer.WithdrawTip(s.Setup.Ctx, &msgWithdrawTip) require.NoError(err) - voteResponse, err = govMsgServer.Vote(s.ctx, &v1.MsgVote{ + voteResponse, err = govMsgServer.Vote(s.Setup.Ctx, &v1.MsgVote{ ProposalId: proposal.ProposalId, Voter: valAccAddrs[0].String(), Option: v1.VoteOption(1), @@ -307,26 +308,26 @@ func (s *E2ETestSuite) TestEditSpec() { require.NoError(err) require.NotNil(voteResponse) - vote, err = s.govKeeper.Votes.Get(s.ctx, collections.Join(proposal.ProposalId, valAccAddrs[0])) + vote, err = s.Setup.Govkeeper.Votes.Get(s.Setup.Ctx, collections.Join(proposal.ProposalId, valAccAddrs[0])) require.NoError(err) require.Equal(vote.ProposalId, proposal.ProposalId) require.Equal(vote.Voter, valAccAddrs[0].String()) require.Equal(vote.Metadata, "vote metadata from validator") - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(48 * time.Hour)) - _, err = s.app.EndBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(48 * time.Hour)) + _, err = s.Setup.App.EndBlocker(s.Setup.Ctx) require.NoError(err) //--------------------------------------------------------------------------- // Height 8 - proposal passes //--------------------------------------------------------------------------- - s.ctx = s.ctx.WithBlockHeight(8) - _, err = s.app.BeginBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(8) + _, err = s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Second)) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(time.Second)) // proposal passed - proposal1, err = s.govKeeper.Proposals.Get(s.ctx, proposal.ProposalId) + proposal1, err = s.Setup.Govkeeper.Proposals.Get(s.Setup.Ctx, proposal.ProposalId) require.NoError(err) require.Equal(proposal1.Status, v1.StatusPassed) require.Equal(proposal1.Proposer, valAccAddrs[0].String()) @@ -337,20 +338,20 @@ func (s *E2ETestSuite) TestEditSpec() { require.Equal(proposal1.Summary, "test summary") require.Equal(proposal1.Expedited, false) - spec, err = s.registrykeeper.GetSpec(s.ctx, "TWAP") + spec, err = s.Setup.Registrykeeper.GetSpec(s.Setup.Ctx, "TWAP") require.NoError(err) - require.Equal(spec.Registrar, repAccAddrs[0].String()) + require.Equal(spec.Registrar, valAccAddrs[0].String()) require.Equal(spec.AbiComponents, abiComponents) require.Equal(spec.ResponseValueType, "uint256") require.Equal(spec.AggregationMethod, "weighted-median") - _, err = oracleMsgServer.Tip(s.ctx, &msgTip) + _, err = oracleMsgServer.Tip(s.Setup.Ctx, &msgTip) require.NoError(err) - _, err = oracleMsgServer.SubmitValue(s.ctx, &msgSubmit) + _, err = oracleMsgServer.SubmitValue(s.Setup.Ctx, &msgSubmit) require.NoError(err) - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(7 * time.Second)) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(7 * time.Second)) - _, err = s.app.EndBlocker(s.ctx) + _, err = s.Setup.App.EndBlocker(s.Setup.Ctx) require.NoError(err) } diff --git a/tests/e2e/gov_changes_cyclelist_test.go b/tests/e2e/gov_changes_cyclelist_test.go index eead1b989..d13135743 100644 --- a/tests/e2e/gov_changes_cyclelist_test.go +++ b/tests/e2e/gov_changes_cyclelist_test.go @@ -20,36 +20,36 @@ import ( func (s *E2ETestSuite) TestGovernanceChangesCycleList() { require := s.Require() - govMsgServer := govkeeper.NewMsgServerImpl(s.govKeeper) + govMsgServer := govkeeper.NewMsgServerImpl(s.Setup.Govkeeper) require.NotNil(govMsgServer) //--------------------------------------------------------------------------- // Height 0 - create bonded validators and reporters //--------------------------------------------------------------------------- - _, err := s.app.BeginBlocker(s.ctx) + _, err := s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) - valAccAddrs, valValAddrs, vals := s.CreateValidators(5) - repAccAddrs := s.CreateReporters(5, valValAddrs, vals) - proposer := repAccAddrs[0] - initCoins := sdk.NewCoin(s.denom, math.NewInt(500*1e6)) - for _, rep := range repAccAddrs { - s.NoError(s.bankKeeper.MintCoins(s.ctx, authtypes.Minter, sdk.NewCoins(initCoins))) - s.NoError(s.bankKeeper.SendCoinsFromModuleToAccount(s.ctx, authtypes.Minter, rep, sdk.NewCoins(initCoins))) + valAccAddrs, _, _ := s.Setup.CreateValidators(5) + + proposer := valAccAddrs[0] + initCoins := sdk.NewCoin(s.Setup.Denom, math.NewInt(500*1e6)) + for _, rep := range valAccAddrs { + s.NoError(s.Setup.Bankkeeper.MintCoins(s.Setup.Ctx, authtypes.Minter, sdk.NewCoins(initCoins))) + s.NoError(s.Setup.Bankkeeper.SendCoinsFromModuleToAccount(s.Setup.Ctx, authtypes.Minter, rep, sdk.NewCoins(initCoins))) } - govParams, err := s.govKeeper.Params.Get(s.ctx) + govParams, err := s.Setup.Govkeeper.Params.Get(s.Setup.Ctx) require.NoError(err) - _, err = s.app.EndBlocker(s.ctx) + _, err = s.Setup.App.EndBlocker(s.Setup.Ctx) require.NoError(err) //--------------------------------------------------------------------------- // Height 1 - submit proposal //--------------------------------------------------------------------------- - s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Second)) - _, err = s.app.BeginBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(s.Setup.Ctx.BlockHeight() + 1) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(time.Second)) + _, err = s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) matic, _ := hex.DecodeString("00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706F745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C00000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000056D6174696300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000") @@ -70,11 +70,11 @@ func (s *E2ETestSuite) TestGovernanceChangesCycleList() { Expedited: false, } - proposal, err := govMsgServer.SubmitProposal(s.ctx, &msgSubmitProposal) + proposal, err := govMsgServer.SubmitProposal(s.Setup.Ctx, &msgSubmitProposal) require.NoError(err) require.Equal(proposal.ProposalId, uint64(1)) - proposal1, err := s.govKeeper.Proposals.Get(s.ctx, proposal.ProposalId) + proposal1, err := s.Setup.Govkeeper.Proposals.Get(s.Setup.Ctx, proposal.ProposalId) require.NoError(err) require.Equal(proposal1.Status, v1.StatusVotingPeriod) require.Equal(proposal1.Proposer, proposer.String()) @@ -85,20 +85,20 @@ func (s *E2ETestSuite) TestGovernanceChangesCycleList() { require.Equal(proposal1.Summary, "test summary") require.Equal(proposal1.Expedited, false) - _, err = s.app.EndBlocker(s.ctx) // end blocker should emit active proposal event + _, err = s.Setup.App.EndBlocker(s.Setup.Ctx) // end blocker should emit active proposal event require.NoError(err) //--------------------------------------------------------------------------- // Height 2 - vote on proposal //--------------------------------------------------------------------------- - s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Second)) - _, err = s.app.BeginBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(s.Setup.Ctx.BlockHeight() + 1) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(time.Second)) + _, err = s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) // vote from each validator for _, val := range valAccAddrs { - voteResponse, err := govMsgServer.Vote(s.ctx, &v1.MsgVote{ + voteResponse, err := govMsgServer.Vote(s.Setup.Ctx, &v1.MsgVote{ ProposalId: proposal.ProposalId, Voter: val.String(), Option: v1.VoteOption(1), @@ -109,25 +109,25 @@ func (s *E2ETestSuite) TestGovernanceChangesCycleList() { } // check on vote in collections - vote, err := s.govKeeper.Votes.Get(s.ctx, collections.Join(proposal.ProposalId, valAccAddrs[0])) + vote, err := s.Setup.Govkeeper.Votes.Get(s.Setup.Ctx, collections.Join(proposal.ProposalId, valAccAddrs[0])) require.NoError(err) require.Equal(vote.ProposalId, proposal.ProposalId) require.Equal(vote.Voter, valAccAddrs[0].String()) require.Equal(vote.Metadata, "vote metadata from validator") - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(48 * time.Hour)) - _, err = s.app.EndBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(48 * time.Hour)) + _, err = s.Setup.App.EndBlocker(s.Setup.Ctx) require.NoError(err) //--------------------------------------------------------------------------- // Height 3 - proposal passes //--------------------------------------------------------------------------- - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Second)) - _, err = s.app.BeginBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(time.Second)) + _, err = s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) // proposal passed - proposal1, err = s.govKeeper.Proposals.Get(s.ctx, proposal.ProposalId) + proposal1, err = s.Setup.Govkeeper.Proposals.Get(s.Setup.Ctx, proposal.ProposalId) require.NoError(err) require.Equal(proposal1.Status, v1.StatusPassed) require.Equal(proposal1.Proposer, proposer.String()) @@ -138,18 +138,18 @@ func (s *E2ETestSuite) TestGovernanceChangesCycleList() { require.Equal(proposal1.Summary, "test summary") require.Equal(proposal1.Expedited, false) - _, err = s.app.EndBlocker(s.ctx) + _, err = s.Setup.App.EndBlocker(s.Setup.Ctx) require.NoError(err) //--------------------------------------------------------------------------- // Height 4 - check cycle list //--------------------------------------------------------------------------- - s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Second)) - _, err = s.app.BeginBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(s.Setup.Ctx.BlockHeight() + 1) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(time.Second)) + _, err = s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) - cycleList, err := s.oraclekeeper.GetCyclelist(s.ctx) + cycleList, err := s.Setup.Oraclekeeper.GetCyclelist(s.Setup.Ctx) require.NoError(err) require.Equal(cycleList, [][]byte{matic}) } diff --git a/tests/e2e/keeper_test.go b/tests/e2e/keeper_test.go index 25eed23e0..545c6d5b3 100644 --- a/tests/e2e/keeper_test.go +++ b/tests/e2e/keeper_test.go @@ -1,75 +1,28 @@ package e2e_test import ( - "encoding/hex" "fmt" - "math/big" - "strconv" - "strings" "testing" - "time" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - "github.com/ethereum/go-ethereum/accounts/abi" "github.com/stretchr/testify/suite" - "github.com/tellor-io/layer/app/config" - testutils "github.com/tellor-io/layer/tests" + setup "github.com/tellor-io/layer/tests" _ "github.com/tellor-io/layer/x/dispute" - disputekeeper "github.com/tellor-io/layer/x/dispute/keeper" - disputetypes "github.com/tellor-io/layer/x/dispute/types" _ "github.com/tellor-io/layer/x/mint" - mintkeeper "github.com/tellor-io/layer/x/mint/keeper" - minttypes "github.com/tellor-io/layer/x/mint/types" _ "github.com/tellor-io/layer/x/oracle" - oraclekeeper "github.com/tellor-io/layer/x/oracle/keeper" - oracletypes "github.com/tellor-io/layer/x/oracle/types" - registrykeeper "github.com/tellor-io/layer/x/registry/keeper" _ "github.com/tellor-io/layer/x/registry/module" - registrytypes "github.com/tellor-io/layer/x/registry/types" - reporterkeeper "github.com/tellor-io/layer/x/reporter/keeper" _ "github.com/tellor-io/layer/x/reporter/module" - reportertypes "github.com/tellor-io/layer/x/reporter/types" - authmodulev1 "cosmossdk.io/api/cosmos/auth/module/v1" - "cosmossdk.io/depinject" - "cosmossdk.io/log" - "cosmossdk.io/math" - storetypes "cosmossdk.io/store/types" - - "github.com/cosmos/cosmos-sdk/baseapp" - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" - "github.com/cosmos/cosmos-sdk/runtime" - "github.com/cosmos/cosmos-sdk/testutil/configurator" - simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" - moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" - "github.com/cosmos/cosmos-sdk/x/auth" - authcodec "github.com/cosmos/cosmos-sdk/x/auth/codec" - authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" - // _ "github.com/cosmos/cosmos-sdk/x/auth" + _ "github.com/cosmos/cosmos-sdk/x/auth" _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/cosmos/cosmos-sdk/x/bank" - bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - // _ "github.com/cosmos/cosmos-sdk/x/bank" _ "github.com/cosmos/cosmos-sdk/x/consensus" _ "github.com/cosmos/cosmos-sdk/x/distribution" - distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" - distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" _ "github.com/cosmos/cosmos-sdk/x/genutil" _ "github.com/cosmos/cosmos-sdk/x/gov" - govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" _ "github.com/cosmos/cosmos-sdk/x/mint" _ "github.com/cosmos/cosmos-sdk/x/params" _ "github.com/cosmos/cosmos-sdk/x/slashing" - slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper" - "github.com/cosmos/cosmos-sdk/x/staking" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) const ( @@ -80,356 +33,12 @@ const ( type E2ETestSuite struct { suite.Suite - - oraclekeeper oraclekeeper.Keeper - disputekeeper disputekeeper.Keeper - registrykeeper registrykeeper.Keeper - mintkeeper mintkeeper.Keeper - reporterkeeper reporterkeeper.Keeper - - accountKeeper authkeeper.AccountKeeper - bankKeeper bankkeeper.BaseKeeper - distrKeeper distrkeeper.Keeper - slashingKeeper slashingkeeper.Keeper - stakingKeeper *stakingkeeper.Keeper - govKeeper *govkeeper.Keeper - ctx sdk.Context - appCodec codec.Codec - authConfig *authmodulev1.Module - - queryHelper *baseapp.QueryServiceTestHelper - interfaceRegistry codectypes.InterfaceRegistry - fetchStoreKey func(string) storetypes.StoreKey - - denom string - app *runtime.App -} - -func (suite *E2ETestSuite) initKeepersWithmAccPerms(blockedAddrs map[string]bool) { - maccPerms := map[string][]string{} - for _, permission := range suite.authConfig.ModuleAccountPermissions { - maccPerms[permission.Account] = permission.Permissions - } - - appCodec := moduletestutil.MakeTestEncodingConfig(auth.AppModuleBasic{}, bank.AppModuleBasic{}, staking.AppModuleBasic{}).Codec - cdc := moduletestutil.MakeTestEncodingConfig(auth.AppModuleBasic{}, bank.AppModuleBasic{}, staking.AppModuleBasic{}).Amino - - maccPerms[authtypes.Burner] = []string{authtypes.Burner} - maccPerms[authtypes.Minter] = []string{authtypes.Minter} - - suite.accountKeeper = authkeeper.NewAccountKeeper( - appCodec, - runtime.NewKVStoreService(suite.fetchStoreKey(banktypes.StoreKey).(*storetypes.KVStoreKey)), - authtypes.ProtoBaseAccount, - maccPerms, - authcodec.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix()), - sdk.GetConfig().GetBech32AccountAddrPrefix(), authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - - suite.bankKeeper = bankkeeper.NewBaseKeeper( - appCodec, - runtime.NewKVStoreService(suite.fetchStoreKey(banktypes.StoreKey).(*storetypes.KVStoreKey)), - suite.accountKeeper, - blockedAddrs, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - log.NewNopLogger(), - ) - - suite.stakingKeeper = stakingkeeper.NewKeeper( - appCodec, - runtime.NewKVStoreService(suite.fetchStoreKey(stakingtypes.StoreKey).(*storetypes.KVStoreKey)), - suite.accountKeeper, - suite.bankKeeper, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ValidatorAddrPrefix()), - authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ConsensusAddrPrefix()), - ) - - suite.slashingKeeper = slashingkeeper.NewKeeper( - appCodec, - cdc, - runtime.NewKVStoreService(suite.fetchStoreKey(banktypes.StoreKey).(*storetypes.KVStoreKey)), - suite.stakingKeeper, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - - suite.registrykeeper = registrykeeper.NewKeeper( - appCodec, - runtime.NewKVStoreService(suite.fetchStoreKey(registrytypes.StoreKey).(*storetypes.KVStoreKey)), - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - suite.distrKeeper = distrkeeper.NewKeeper( - appCodec, runtime.NewKVStoreService(suite.fetchStoreKey(distrtypes.StoreKey).(*storetypes.KVStoreKey)), suite.accountKeeper, suite.bankKeeper, suite.stakingKeeper, authtypes.FeeCollectorName, authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - suite.oraclekeeper = oraclekeeper.NewKeeper( - appCodec, runtime.NewKVStoreService(suite.fetchStoreKey(oracletypes.StoreKey).(*storetypes.KVStoreKey)), suite.accountKeeper, suite.bankKeeper, suite.registrykeeper, suite.reporterkeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - suite.disputekeeper = disputekeeper.NewKeeper( - appCodec, runtime.NewKVStoreService(suite.fetchStoreKey(disputetypes.StoreKey).(*storetypes.KVStoreKey)), suite.accountKeeper, suite.bankKeeper, suite.oraclekeeper, suite.reporterkeeper, - ) - suite.mintkeeper = mintkeeper.NewKeeper( - appCodec, suite.fetchStoreKey(minttypes.StoreKey), suite.accountKeeper, suite.bankKeeper, - ) + Setup *setup.SharedSetup } func (s *E2ETestSuite) SetupTest() { - sdk.DefaultBondDenom = "loya" - config.SetupConfig() - - app, err := simtestutil.SetupWithConfiguration( - depinject.Configs( - configurator.NewAppConfig( - testutils.AuthModule(), - configurator.BankModule(), - configurator.StakingModule(), - configurator.SlashingModule(), - configurator.ParamsModule(), - configurator.ConsensusModule(), - configurator.DistributionModule(), - testutils.OracleModule(), - testutils.DisputeModule(), - testutils.RegistryModule(), - testutils.MintModule(), - testutils.ReporterModule(), - configurator.GovModule(), - ), - depinject.Supply(log.NewNopLogger()), - ), - testutils.DefaultStartUpConfig(), - &s.accountKeeper, &s.bankKeeper, &s.stakingKeeper, &s.slashingKeeper, - &s.interfaceRegistry, &s.appCodec, &s.authConfig, &s.oraclekeeper, - &s.disputekeeper, &s.registrykeeper, &s.govKeeper, &s.distrKeeper, &s.mintkeeper, &s.reporterkeeper) - - s.NoError(err) - s.ctx = sdk.UnwrapSDKContext(app.BaseApp.NewContextLegacy(false, tmproto.Header{Time: time.Now()})) - s.fetchStoreKey = app.UnsafeFindStoreKey - - s.queryHelper = baseapp.NewQueryServerTestHelper(s.ctx, s.interfaceRegistry) - s.denom = sdk.DefaultBondDenom - s.initKeepersWithmAccPerms(make(map[string]bool)) - s.app = app -} - -func (s *E2ETestSuite) CreateValidators(numValidators int) ([]sdk.AccAddress, []sdk.ValAddress, []stakingtypes.Validator) { - require := s.Require() - - // create account that will become a validator - accountsAddrs := simtestutil.CreateIncrementalAccounts(numValidators) - // mint numTrb for each validator - initCoins := sdk.NewCoin(s.denom, math.NewInt(5000*1e6)) - for _, acc := range accountsAddrs { - // mint to module - require.NoError(s.bankKeeper.MintCoins(s.ctx, authtypes.Minter, sdk.NewCoins(initCoins))) - // send from module to account - require.NoError(s.bankKeeper.SendCoinsFromModuleToAccount(s.ctx, authtypes.Minter, acc, sdk.NewCoins(initCoins))) - require.Equal(initCoins, s.bankKeeper.GetBalance(s.ctx, acc, s.denom)) - } - - // get val address for each account - validatorsAddrs := simtestutil.ConvertAddrsToValAddrs(accountsAddrs) - // create pub keys for validators - pubKeys := simtestutil.CreateTestPubKeys(numValidators) - validators := make([]stakingtypes.Validator, numValidators) - // set each account with proper keepers - for i, pubKey := range pubKeys { - s.accountKeeper.NewAccountWithAddress(s.ctx, accountsAddrs[i]) - validator, err := stakingtypes.NewValidator(validatorsAddrs[i].String(), pubKey, stakingtypes.Description{Moniker: strconv.Itoa(i)}) - require.NoError(err) - validators[i] = validator - s.NoError(s.stakingKeeper.SetValidator(s.ctx, validator)) - s.NoError(s.stakingKeeper.SetValidatorByConsAddr(s.ctx, validator)) - s.NoError(s.stakingKeeper.SetNewValidatorByPowerIndex(s.ctx, validator)) - - _, err = s.stakingKeeper.Delegate(s.ctx, accountsAddrs[i], math.NewInt(5000*1e6), stakingtypes.Unbonded, validator, true) - require.NoError(err) - // call hooks for distribution init - valBz, err := s.stakingKeeper.ValidatorAddressCodec().StringToBytes(validator.GetOperator()) - if err != nil { - panic(err) - } - err = s.distrKeeper.Hooks().AfterValidatorCreated(s.ctx, valBz) - require.NoError(err) - err = s.distrKeeper.Hooks().BeforeDelegationCreated(s.ctx, accountsAddrs[i], valBz) - require.NoError(err) - err = s.distrKeeper.Hooks().AfterDelegationModified(s.ctx, accountsAddrs[i], valBz) - require.NoError(err) - } - - return accountsAddrs, validatorsAddrs, validators -} - -func (s *E2ETestSuite) CreateReporters(numReporters int, valAddrs []sdk.ValAddress, vals []stakingtypes.Validator) []sdk.AccAddress { - require := s.Require() - type Delegator struct { - delegatorAddress sdk.AccAddress - validator stakingtypes.Validator - tokenAmount math.Int - } - - if numReporters != len(valAddrs) { - panic("numReporters must be equal to the the number of validators (make other reporters manually)") - } - - msgServerReporter := reporterkeeper.NewMsgServerImpl(s.reporterkeeper) - require.NotNil(msgServerReporter) - - // create reporter accounts from random private keys - privKeys := CreateRandomPrivateKeys(numReporters) - accs := s.convertToAccAddress(privKeys) // sdk.AccountAddresses - - // mint 1k trb to each account - initCoins := sdk.NewCoin(s.denom, math.NewInt(1000*1e6)) - for _, acc := range accs { - s.NoError(s.bankKeeper.MintCoins(s.ctx, authtypes.Minter, sdk.NewCoins(initCoins))) - s.NoError(s.bankKeeper.SendCoinsFromModuleToAccount(s.ctx, authtypes.Minter, acc, sdk.NewCoins(initCoins))) - } - // delegate 1k trb to validators - for i, acc := range accs { - valBz, err := s.stakingKeeper.ValidatorAddressCodec().StringToBytes(vals[i].GetOperator()) - require.NoError(err) - reporterDelToVal := Delegator{delegatorAddress: acc, validator: vals[i], tokenAmount: math.NewInt(1000 * 1e6)} - _, err = s.stakingKeeper.Delegate(s.ctx, reporterDelToVal.delegatorAddress, reporterDelToVal.tokenAmount, stakingtypes.Unbonded, reporterDelToVal.validator, true) - require.NoError(err) - // call dist module hooks - err = s.distrKeeper.Hooks().AfterValidatorCreated(s.ctx, valBz) - require.NoError(err) - err = s.distrKeeper.Hooks().BeforeDelegationCreated(s.ctx, acc, valBz) - require.NoError(err) - err = s.distrKeeper.Hooks().AfterDelegationModified(s.ctx, acc, valBz) - require.NoError(err) - } - // self delegate in reporter module with 1k trb - // CreateReporter tx - for i, acc := range accs { - valBz, err := s.stakingKeeper.ValidatorAddressCodec().StringToBytes(vals[i].GetOperator()) - require.NoError(err) - commission := stakingtypes.NewCommissionWithTime(math.LegacyNewDecWithPrec(1, 1), math.LegacyNewDecWithPrec(3, 1), - math.LegacyNewDecWithPrec(1, 1), s.ctx.BlockTime()) // rate = 10%, maxRate = 30%, maxChangeRate = 10% - - var createReporterMsg reportertypes.MsgCreateReporter - createReporterMsg.Reporter = acc.String() - createReporterMsg.Amount = math.NewInt(1000 * 1e6) - createReporterMsg.Commission = &commission - valAddr, err := sdk.ValAddressFromBech32(vals[i].GetOperator()) - require.NoError(err) - createReporterMsg.TokenOrigins = []*reportertypes.TokenOrigin{ - { - ValidatorAddress: valAddr.Bytes(), - Amount: math.NewInt(1000 * 1e6), - }, - } - // send CreateReporter Tx - _, err = msgServerReporter.CreateReporter(s.ctx, &createReporterMsg) - s.NoError(err) - - // verify in collections - rkDelegation, err := s.reporterkeeper.Delegators.Get(s.ctx, acc) - require.NoError(err) - require.Equal(rkDelegation.Reporter, acc.Bytes()) - require.Equal(rkDelegation.Amount, math.NewInt(1000*1e6)) - // check on reporter/validator delegation - skDelegation, err := s.stakingKeeper.Delegation(s.ctx, acc, valBz) - require.NoError(err) - require.Equal(skDelegation.GetDelegatorAddr(), acc.String()) - require.Equal(skDelegation.GetValidatorAddr(), vals[i].GetOperator()) - } - - return accs -} - -func (s *E2ETestSuite) mintTokens(addr sdk.AccAddress, amount sdk.Coin) { - ctx := s.ctx - s.accountKeeper.SetAccount(ctx, authtypes.NewBaseAccountWithAddress(addr)) - s.NoError(s.bankKeeper.MintCoins(ctx, authtypes.Minter, sdk.NewCoins(amount))) - s.NoError(s.bankKeeper.SendCoinsFromModuleToAccount(ctx, authtypes.Minter, addr, sdk.NewCoins(amount))) -} - -// func (s *E2ETestSuite) microReport() (disputetypes.MicroReport, sdk.ValAddress) { -// vals, err := s.stakingKeeper.GetAllValidators(s.ctx) -// s.Require().NoError(err) -// valAddr, err := sdk.ValAddressFromBech32(vals[0].OperatorAddress) -// s.Require().NoError(err) -// return disputetypes.MicroReport{ -// Reporter: sdk.AccAddress(valAddr).String(), -// Power: vals[0].GetConsensusPower(vals[0].GetBondedTokens()), -// QueryId: "83a7f3d48786ac2667503a61e8c415438ed2922eb86a2906e4ee66d9a2ce4992", -// Value: "000000000000000000000000000000000000000000000058528649cf80ee0000", -// Timestamp: 1696516597, -// }, valAddr - -// } - -func (s *E2ETestSuite) CreateAccountsWithTokens(numofAccs int, amountOfTokens int64) []sdk.AccAddress { - privKeys := CreateRandomPrivateKeys(numofAccs) - accs := make([]sdk.AccAddress, numofAccs) - for i, pk := range privKeys { - accs[i] = sdk.AccAddress(pk.PubKey().Address()) - s.mintTokens(accs[i], sdk.NewCoin(s.denom, math.NewInt(amountOfTokens))) - } - return accs -} - -// func (s *E2ETestSuite) createValidators(powers []int64) ([]sdk.AccAddress, []sdk.ValAddress) { -// ctx := s.ctx -// acctNum := len(powers) -// base := new(big.Int).Exp(big.NewInt(10), big.NewInt(6), nil) -// amount := new(big.Int).Mul(big.NewInt(1000), base) -// testAddrs := simtestutil.CreateIncrementalAccounts(acctNum) -// addrs := s.addTestAddrs(acctNum, math.NewIntFromBigInt(amount), testAddrs) -// valAddrs := simtestutil.ConvertAddrsToValAddrs(addrs) -// pks := simtestutil.CreateTestPubKeys(acctNum) - -// for i, pk := range pks { -// // account := authtypes.BaseAccount{ -// // Address: testAddrs[i].String(), -// // PubKey: codectypes.UnsafePackAny(pk), -// // AccountNumber: s.accountKeeper.NextAccountNumber(ctx), -// // } -// // s.accountKeeper.NewAccount(s.ctx, &account) - -// s.accountKeeper.NewAccountWithAddress(ctx, testAddrs[i]) - -// val, err := stakingtypes.NewValidator(valAddrs[i].String(), pk, stakingtypes.Description{}) -// s.NoError(err) -// s.stakingKeeper.SetValidator(ctx, val) -// s.stakingKeeper.SetValidatorByConsAddr(ctx, val) -// s.stakingKeeper.SetNewValidatorByPowerIndex(ctx, val) -// s.stakingKeeper.Delegate(ctx, addrs[i], s.stakingKeeper.TokensFromConsensusPower(ctx, powers[i]), stakingtypes.Unbonded, val, true) -// } - -// _, err := s.stakingKeeper.EndBlocker(ctx) -// s.NoError(err) - -// return addrs, valAddrs -// } - -type ModuleAccs struct { - staking sdk.AccountI - dispute sdk.AccountI -} - -func (s *E2ETestSuite) ModuleAccs() ModuleAccs { - return ModuleAccs{ - staking: s.accountKeeper.GetModuleAccount(s.ctx, "bonded_tokens_pool"), - dispute: s.accountKeeper.GetModuleAccount(s.ctx, "dispute"), - } -} - -func CreateRandomPrivateKeys(accNum int) []secp256k1.PrivKey { - testAddrs := make([]secp256k1.PrivKey, accNum) - for i := 0; i < accNum; i++ { - pk := secp256k1.GenPrivKey() - testAddrs[i] = *pk - } - return testAddrs -} - -func (s *E2ETestSuite) convertToAccAddress(priv []secp256k1.PrivKey) []sdk.AccAddress { - testAddrs := make([]sdk.AccAddress, len(priv)) - for i, pk := range priv { - testAddrs[i] = sdk.AccAddress(pk.PubKey().Address()) - } - return testAddrs + s.Setup = &setup.SharedSetup{} + s.Setup.SetupTest(s.T()) } func JailValidator(ctx sdk.Context, consensusAddress sdk.ConsAddress, validatorAddress sdk.ValAddress, k stakingkeeper.Keeper) error { @@ -450,57 +59,6 @@ func JailValidator(ctx sdk.Context, consensusAddress sdk.ConsAddress, validatorA return nil } -// func CommitReport(ctx context.Context, accountAddr string, []queryData bytes, msgServerOracle oracletypes.MsgServer) error { -// // commit -// value := "000000000000000000000000000000000000000000000058528649cf80ee0000" -// valueDecoded, err := hex.DecodeString(value) // convert hex value to bytes -// if err != nil { -// return err -// } -// salt, err := utils.Salt(32) -// if err != nil { -// return err -// } -// hash := utils.CalculateCommitment(string(valueDecoded), salt) -// if err != nil { -// return err -// } -// // commit report with query data in cycle list -// commitreq := &oracletypes.MsgCommitReport{ -// Creator: accountAddr, -// QueryData: queryData, -// Hash: hash, -// } -// _, err = msgServerOracle.CommitReport(ctx, commitreq) -// if err != nil { -// return err -// } - -// return nil -// } - -// inspired by telliot python code -func encodeValue(number float64) string { - strNumber := fmt.Sprintf("%.18f", number) - - parts := strings.Split(strNumber, ".") - if len(parts[1]) > 18 { - parts[1] = parts[1][:18] - } - truncatedStr := parts[0] + parts[1] - - bigIntNumber := new(big.Int) - bigIntNumber.SetString(truncatedStr, 10) - - uint256ABIType, _ := abi.NewType("uint256", "", nil) - - arguments := abi.Arguments{{Type: uint256ABIType}} - encodedBytes, _ := arguments.Pack(bigIntNumber) - - encodedString := hex.EncodeToString(encodedBytes) - return encodedString -} - func TestKeeperTestSuite(t *testing.T) { suite.Run(t, new(E2ETestSuite)) } diff --git a/tests/e2e/validate_cyclelist_test.go b/tests/e2e/validate_cyclelist_test.go index 6a3462199..e2680ad41 100644 --- a/tests/e2e/validate_cyclelist_test.go +++ b/tests/e2e/validate_cyclelist_test.go @@ -10,60 +10,60 @@ func (s *E2ETestSuite) TestValidateCycleList() { //--------------------------------------------------------------------------- // Height 0 - get initial cycle list query //--------------------------------------------------------------------------- - _, err := s.app.BeginBlocker(s.ctx) + _, err := s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) - firstInCycle, err := s.oraclekeeper.GetCurrentQueryInCycleList(s.ctx) + firstInCycle, err := s.Setup.Oraclekeeper.GetCurrentQueryInCycleList(s.Setup.Ctx) require.NoError(err) queryDataBytes, err := utils.QueryBytesFromString(ethQueryData[2:]) require.NoError(err) require.Equal(queryDataBytes, firstInCycle) - require.Equal(s.ctx.BlockHeight(), int64(0)) - _, err = s.app.EndBlocker(s.ctx) + require.Equal(s.Setup.Ctx.BlockHeight(), int64(0)) + _, err = s.Setup.App.EndBlocker(s.Setup.Ctx) require.NoError(err) //--------------------------------------------------------------------------- // Height 1 - get second cycle list query //--------------------------------------------------------------------------- - s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) - _, err = s.app.BeginBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(s.Setup.Ctx.BlockHeight() + 1) + _, err = s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) - require.Equal(s.ctx.BlockHeight(), int64(1)) - secondInCycle, err := s.oraclekeeper.GetCurrentQueryInCycleList(s.ctx) + require.Equal(s.Setup.Ctx.BlockHeight(), int64(1)) + secondInCycle, err := s.Setup.Oraclekeeper.GetCurrentQueryInCycleList(s.Setup.Ctx) require.NoError(err) queryDataBytes, err = utils.QueryBytesFromString(btcQueryData[2:]) require.NoError(err) require.Equal(queryDataBytes, secondInCycle) - _, err = s.app.EndBlocker(s.ctx) + _, err = s.Setup.App.EndBlocker(s.Setup.Ctx) require.NoError(err) //--------------------------------------------------------------------------- // Height 2 - get third cycle list query //--------------------------------------------------------------------------- - s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) - _, err = s.app.BeginBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(s.Setup.Ctx.BlockHeight() + 1) + _, err = s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) - require.Equal(s.ctx.BlockHeight(), int64(2)) - thirdInCycle, err := s.oraclekeeper.GetCurrentQueryInCycleList(s.ctx) + require.Equal(s.Setup.Ctx.BlockHeight(), int64(2)) + thirdInCycle, err := s.Setup.Oraclekeeper.GetCurrentQueryInCycleList(s.Setup.Ctx) require.NoError(err) queryDataBytes, err = utils.QueryBytesFromString(trbQueryData[2:]) require.NoError(err) require.Equal(queryDataBytes, thirdInCycle) - _, err = s.app.EndBlocker(s.ctx) + _, err = s.Setup.App.EndBlocker(s.Setup.Ctx) require.NoError(err) // loop through 20 more blocks - list, err := s.oraclekeeper.GetCyclelist(s.ctx) + list, err := s.Setup.Oraclekeeper.GetCyclelist(s.Setup.Ctx) require.NoError(err) for i := 0; i < 20; i++ { - s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) - _, err = s.app.BeginBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(s.Setup.Ctx.BlockHeight() + 1) + _, err = s.Setup.App.BeginBlocker(s.Setup.Ctx) require.NoError(err) - query, err := s.oraclekeeper.GetCurrentQueryInCycleList(s.ctx) + query, err := s.Setup.Oraclekeeper.GetCurrentQueryInCycleList(s.Setup.Ctx) require.NoError(err) require.Contains(list, query) - _, err = s.app.EndBlocker(s.ctx) + _, err = s.Setup.App.EndBlocker(s.Setup.Ctx) require.NoError(err) } } diff --git a/tests/integration/dispute_keeper_test.go b/tests/integration/dispute_keeper_test.go index 6183fdc36..86ac05c25 100644 --- a/tests/integration/dispute_keeper_test.go +++ b/tests/integration/dispute_keeper_test.go @@ -3,13 +3,13 @@ package integration_test import ( "bytes" "encoding/hex" + "fmt" "time" - "github.com/tellor-io/layer/testutil/sample" "github.com/tellor-io/layer/x/dispute" "github.com/tellor-io/layer/x/dispute/keeper" "github.com/tellor-io/layer/x/dispute/types" - oracleKeeper "github.com/tellor-io/layer/x/oracle/keeper" + oraclekeeper "github.com/tellor-io/layer/x/oracle/keeper" oracletypes "github.com/tellor-io/layer/x/oracle/types" reporterKeeper "github.com/tellor-io/layer/x/reporter/keeper" reportertypes "github.com/tellor-io/layer/x/reporter/types" @@ -21,24 +21,31 @@ import ( ) func (s *IntegrationTestSuite) TestVotingOnDispute() { - msgServer := keeper.NewMsgServerImpl(s.disputekeeper) - + msgServer := keeper.NewMsgServerImpl(s.Setup.Disputekeeper) _, valAddrs, _ := s.createValidatorAccs([]int64{1000}) - - repAccs := s.CreateAccountsWithTokens(2, 100*1e6) - stakeAmount := math.NewInt(100 * 1e6) - - repAcc := repAccs[0] valAddr := valAddrs[0] - delegators := repAccs - commission := reportertypes.NewCommissionWithTime(math.LegacyZeroDec(), math.LegacyZeroDec(), math.LegacyZeroDec(), s.ctx.BlockTime()) - _, err := createReporterStakedWithValidator(s.ctx, s.reporterkeeper, s.stakingKeeper, valAddr, delegators, commission, stakeAmount) + repAddr := sdk.AccAddress(valAddr) + valBond, err := s.Setup.Stakingkeeper.GetValidator(s.Setup.Ctx, valAddr) + s.NoError(err) + dels, err := s.Setup.Stakingkeeper.GetValidatorDelegations(s.Setup.Ctx, valAddr) s.NoError(err) + srcs := make([]*reportertypes.TokenOriginInfo, len(dels)) + total := math.ZeroInt() + for i, del := range dels { + srcs[i] = &reportertypes.TokenOriginInfo{ + DelegatorAddress: sdk.MustAccAddressFromBech32(del.DelegatorAddress).Bytes(), + ValidatorAddress: valAddr.Bytes(), + Amount: valBond.TokensFromShares(del.Shares).TruncateInt(), + } + total = total.Add(srcs[i].Amount) + } + err = s.Setup.Reporterkeeper.Report.Set(s.Setup.Ctx, collections.Join(repAddr.Bytes(), s.Setup.Ctx.BlockHeight()), reportertypes.DelegationsAmounts{TokenOrigins: srcs, Total: total}) + s.NoError(err) // assemble report with reporter to dispute qId, _ := hex.DecodeString("83a7f3d48786ac2667503a61e8c415438ed2922eb86a2906e4ee66d9a2ce4992") report := oracletypes.MicroReport{ - Reporter: repAcc.String(), + Reporter: repAddr.String(), Power: 100, QueryId: qId, Value: "000000000000000000000000000000000000000000000058528649cf80ee0000", @@ -48,58 +55,59 @@ func (s *IntegrationTestSuite) TestVotingOnDispute() { disputer := s.newKeysWithTokens() // Propose dispute pay half of the fee from account - _, err = msgServer.ProposeDispute(s.ctx, &types.MsgProposeDispute{ + _, err = msgServer.ProposeDispute(s.Setup.Ctx, &types.MsgProposeDispute{ Creator: disputer.String(), Report: &report, - Fee: sdk.NewCoin(s.denom, math.NewInt(500_000)), + Fee: sdk.NewCoin(s.Setup.Denom, math.NewInt(500_000)), DisputeCategory: types.Warning, }) s.NoError(err) // 2 here because dispute count starts from 1 and dispute count gives the next dispute id - s.Equal(uint64(2), s.disputekeeper.NextDisputeId(s.ctx)) - open, err := s.disputekeeper.GetOpenDisputes(s.ctx) + s.Equal(uint64(2), s.Setup.Disputekeeper.NextDisputeId(s.Setup.Ctx)) + open, err := s.Setup.Disputekeeper.GetOpenDisputes(s.Setup.Ctx) s.NoError(err) s.Equal(1, len(open)) // check validator wasn't slashed/jailed - rep, err := s.reporterkeeper.Reporter(s.ctx, repAcc) + rep, err := s.Setup.Reporterkeeper.Reporter(s.Setup.Ctx, repAddr.Bytes()) s.NoError(err) // reporter tokens should be the same as the stake amount since fee wasn't fully paid - s.Equal(rep.TotalTokens, stakeAmount) + s.Equal(rep.TotalTokens, valBond.Tokens) s.False(rep.Jailed) // Add dispute fee to complete the fee and jail/slash validator - _, err = msgServer.AddFeeToDispute(s.ctx, &types.MsgAddFeeToDispute{ + _, err = msgServer.AddFeeToDispute(s.Setup.Ctx, &types.MsgAddFeeToDispute{ Creator: disputer.String(), DisputeId: 1, - Amount: sdk.NewCoin(s.denom, math.NewInt(500_000)), + Amount: sdk.NewCoin(s.Setup.Denom, math.NewInt(500_000)), }) s.NoError(err) // check reporter was slashed/jailed after fee was added - rep, err = s.reporterkeeper.Reporter(s.ctx, repAcc) + rep, err = s.Setup.Reporterkeeper.Reporter(s.Setup.Ctx, repAddr.Bytes()) s.NoError(err) - s.Equal(rep.TotalTokens, stakeAmount.Sub(math.NewInt(1_000_000))) + + s.Equal(rep.TotalTokens, valBond.Tokens.Sub(math.NewInt(1_000_000))) s.True(rep.Jailed) - dispute, err := s.disputekeeper.Disputes.Get(s.ctx, 1) + dispute, err := s.Setup.Disputekeeper.Disputes.Get(s.Setup.Ctx, 1) s.NoError(err) s.Equal(types.Voting, dispute.DisputeStatus) // vote on dispute // mint more tokens to disputer to give voting power - s.mintTokens(disputer, math.NewInt(1_000_000)) - _, err = msgServer.Vote(s.ctx, &types.MsgVote{ + s.Setup.MintTokens(disputer, math.NewInt(1_000_000)) + _, err = msgServer.Vote(s.Setup.Ctx, &types.MsgVote{ Voter: disputer.String(), Id: 1, Vote: types.VoteEnum_VOTE_SUPPORT, }) s.NoError(err) - vtr, err := s.disputekeeper.Voter.Get(s.ctx, collections.Join(uint64(1), disputer.Bytes())) + vtr, err := s.Setup.Disputekeeper.Voter.Get(s.Setup.Ctx, collections.Join(uint64(1), disputer.Bytes())) s.NoError(err) s.Equal(types.VoteEnum_VOTE_SUPPORT, vtr.Vote) - v, err := s.disputekeeper.Votes.Get(s.ctx, 1) + v, err := s.Setup.Disputekeeper.Votes.Get(s.Setup.Ctx, 1) s.NoError(err) s.Equal(v.VoteResult, types.VoteResult_NO_TALLY) - iter, err := s.disputekeeper.Voter.Indexes.VotersById.MatchExact(s.ctx, uint64(1)) + iter, err := s.Setup.Disputekeeper.Voter.Indexes.VotersById.MatchExact(s.Setup.Ctx, uint64(1)) s.NoError(err) voters, err := iter.PrimaryKeys() s.NoError(err) @@ -107,96 +115,118 @@ func (s *IntegrationTestSuite) TestVotingOnDispute() { } func (s *IntegrationTestSuite) TestProposeDisputeFromBond() { - msgServer := keeper.NewMsgServerImpl(s.disputekeeper) + msgServer := keeper.NewMsgServerImpl(s.Setup.Disputekeeper) _, valAddrs, _ := s.createValidatorAccs([]int64{1000}) - repAccs := s.CreateAccountsWithTokens(2, 100*1e6) - stakeAmount := math.NewInt(100 * 1e6) - - repAcc := repAccs[0] valAddr := valAddrs[0] - delegators := repAccs - commission := reportertypes.NewCommissionWithTime(math.LegacyZeroDec(), math.LegacyZeroDec(), math.LegacyZeroDec(), s.ctx.BlockTime()) - _, err := createReporterStakedWithValidator(s.ctx, s.reporterkeeper, s.stakingKeeper, valAddr, delegators, commission, stakeAmount) + repAddr := sdk.AccAddress(valAddr) + + valBond, err := s.Setup.Stakingkeeper.GetValidator(s.Setup.Ctx, valAddr) + s.NoError(err) + dels, err := s.Setup.Stakingkeeper.GetValidatorDelegations(s.Setup.Ctx, valAddr) s.NoError(err) + srcs := make([]*reportertypes.TokenOriginInfo, len(dels)) + total := math.ZeroInt() + for i, del := range dels { + srcs[i] = &reportertypes.TokenOriginInfo{ + DelegatorAddress: sdk.MustAccAddressFromBech32(del.DelegatorAddress).Bytes(), + ValidatorAddress: valAddr.Bytes(), + Amount: valBond.TokensFromShares(del.Shares).TruncateInt(), + } + total = total.Add(srcs[i].Amount) + } + err = s.Setup.Reporterkeeper.Report.Set(s.Setup.Ctx, collections.Join(repAddr.Bytes(), s.Setup.Ctx.BlockHeight()), reportertypes.DelegationsAmounts{TokenOrigins: srcs, Total: total}) + s.NoError(err) qId, _ := hex.DecodeString("83a7f3d48786ac2667503a61e8c415438ed2922eb86a2906e4ee66d9a2ce4992") report := oracletypes.MicroReport{ - Reporter: repAcc.String(), + Reporter: repAddr.String(), Power: 100, QueryId: qId, Value: "000000000000000000000000000000000000000000000058528649cf80ee0000", Timestamp: time.Unix(1696516597, 0), - BlockNumber: s.ctx.BlockHeight(), + BlockNumber: s.Setup.Ctx.BlockHeight(), } - s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) - _, err = msgServer.ProposeDispute(s.ctx, &types.MsgProposeDispute{ - Creator: repAcc.String(), + s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(s.Setup.Ctx.BlockHeight() + 1) + _, err = msgServer.ProposeDispute(s.Setup.Ctx, &types.MsgProposeDispute{ + Creator: repAddr.String(), Report: &report, DisputeCategory: types.Warning, - Fee: sdk.NewCoin(s.denom, math.NewInt(1_000_000)), // one percent dispute fee + Fee: sdk.NewCoin(s.Setup.Denom, math.NewInt(1_000_000)), // one percent dispute fee PayFromBond: true, }) s.NoError(err) // check reporter was slashed/jailed after fee was added - rep, err := s.reporterkeeper.Reporter(s.ctx, repAcc) + rep, err := s.Setup.Reporterkeeper.Reporter(s.Setup.Ctx, repAddr) s.NoError(err) - s.Equal(rep.TotalTokens, stakeAmount.Sub(math.NewInt(2_000_000))) // two because fee was paid from bond (self dispute) and reporter was slashed + s.Equal(rep.TotalTokens, valBond.Tokens.Sub(math.NewInt(2_000_000))) // two because fee was paid from bond (self dispute) and reporter was slashed s.True(rep.Jailed) - reporterServer := reporterKeeper.NewMsgServerImpl(s.reporterkeeper) + reporterServer := reporterKeeper.NewMsgServerImpl(s.Setup.Reporterkeeper) req := &reportertypes.MsgUnjailReporter{ - ReporterAddress: repAcc.String(), + ReporterAddress: repAddr.String(), } - _, err = reporterServer.UnjailReporter(s.ctx, req) + _, err = reporterServer.UnjailReporter(s.Setup.Ctx, req) s.NoError(err) - rep, err = s.reporterkeeper.Reporter(s.ctx, repAcc) + rep, err = s.Setup.Reporterkeeper.Reporter(s.Setup.Ctx, repAddr) s.NoError(err) s.False(rep.Jailed) } func (s *IntegrationTestSuite) TestExecuteVoteInvalid() { - msgServer := keeper.NewMsgServerImpl(s.disputekeeper) + msgServer := keeper.NewMsgServerImpl(s.Setup.Disputekeeper) _, valAddrs, _ := s.createValidatorAccs([]int64{1000}) - repAccs := s.CreateAccountsWithTokens(3, 100*1e6) - stakeAmount := math.NewInt(100 * 1e6) disputer := s.newKeysWithTokens() - - repAcc := repAccs[0] - valAddr := valAddrs[0] delegators := repAccs - commission := reportertypes.NewCommissionWithTime(math.LegacyZeroDec(), math.LegacyZeroDec(), math.LegacyZeroDec(), s.ctx.BlockTime()) - _, err := createReporterStakedWithValidator(s.ctx, s.reporterkeeper, s.stakingKeeper, valAddr, delegators, commission, stakeAmount) + valAddr := valAddrs[0] + repAddr := sdk.AccAddress(valAddr) + + valBond, err := s.Setup.Stakingkeeper.GetValidator(s.Setup.Ctx, valAddr) + s.NoError(err) + dels, err := s.Setup.Stakingkeeper.GetValidatorDelegations(s.Setup.Ctx, valAddr) + s.NoError(err) + + srcs := make([]*reportertypes.TokenOriginInfo, len(dels)) + total := math.ZeroInt() + for i, del := range dels { + srcs[i] = &reportertypes.TokenOriginInfo{ + DelegatorAddress: sdk.MustAccAddressFromBech32(del.DelegatorAddress).Bytes(), + ValidatorAddress: valAddr.Bytes(), + Amount: valBond.TokensFromShares(del.Shares).TruncateInt(), + } + total = total.Add(srcs[i].Amount) + } + err = s.Setup.Reporterkeeper.Report.Set(s.Setup.Ctx, collections.Join(repAddr.Bytes(), s.Setup.Ctx.BlockHeight()), reportertypes.DelegationsAmounts{TokenOrigins: srcs, Total: total}) s.NoError(err) qId, _ := hex.DecodeString("83a7f3d48786ac2667503a61e8c415438ed2922eb86a2906e4ee66d9a2ce4992") report := oracletypes.MicroReport{ - Reporter: repAcc.String(), + Reporter: repAddr.String(), Power: 100, QueryId: qId, Value: "000000000000000000000000000000000000000000000058528649cf80ee0000", Timestamp: time.Unix(1696516597, 0), - BlockNumber: s.ctx.BlockHeight(), + BlockNumber: s.Setup.Ctx.BlockHeight(), } - disputeFee, err := s.disputekeeper.GetDisputeFee(s.ctx, repAcc.String(), types.Warning) + disputeFee, err := s.Setup.Disputekeeper.GetDisputeFee(s.Setup.Ctx, report, types.Warning) s.NoError(err) burnAmount := disputeFee.MulRaw(1).QuoRaw(20) - disputerBalanceBefore := s.bankKeeper.GetBalance(s.ctx, disputer, s.denom) + disputerBalanceBefore := s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, disputer, s.Setup.Denom) // Propose dispute pay half of the fee from account - _, err = msgServer.ProposeDispute(s.ctx, &types.MsgProposeDispute{ + _, err = msgServer.ProposeDispute(s.Setup.Ctx, &types.MsgProposeDispute{ Creator: disputer.String(), Report: &report, - Fee: sdk.NewCoin(s.denom, disputeFee), + Fee: sdk.NewCoin(s.Setup.Denom, disputeFee), DisputeCategory: types.Warning, }) s.NoError(err) - s.True(s.bankKeeper.GetBalance(s.ctx, disputer, s.denom).IsLT(disputerBalanceBefore)) + s.True(s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, disputer, s.Setup.Denom).IsLT(disputerBalanceBefore)) - s.NoError(dispute.CheckPrevoteDisputesForExpiration(s.ctx, s.disputekeeper)) + s.NoError(dispute.CheckPrevoteDisputesForExpiration(s.Setup.Ctx, s.Setup.Disputekeeper)) votes := []types.MsgVote{ { @@ -221,31 +251,31 @@ func (s *IntegrationTestSuite) TestExecuteVoteInvalid() { }, } for i := range votes { - _, err = msgServer.Vote(s.ctx, &votes[i]) + _, err = msgServer.Vote(s.Setup.Ctx, &votes[i]) if err != nil { s.Error(err, "voter power is zero") } } // only 25 percent of the total power voted so vote should not be tallied unless it's expired - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(keeper.THREE_DAYS + 1)) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(keeper.THREE_DAYS + 1)) // // tally vote - err = s.disputekeeper.Tallyvote(s.ctx, 1) + err = s.Setup.Disputekeeper.Tallyvote(s.Setup.Ctx, 1) s.NoError(err) - reporter, err := s.reporterkeeper.Reporter(s.ctx, repAcc) + reporter, err := s.Setup.Reporterkeeper.Reporter(s.Setup.Ctx, repAddr) s.NoError(err) repTknBeforeExecuteVote := reporter.TotalTokens - disputerBalanceBeforeExecuteVote := s.bankKeeper.GetBalance(s.ctx, disputer, s.denom) + disputerBalanceBeforeExecuteVote := s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, disputer, s.Setup.Denom) // execute vote - err = s.disputekeeper.ExecuteVote(s.ctx, 1) + err = s.Setup.Disputekeeper.ExecuteVote(s.Setup.Ctx, 1) s.NoError(err) - reporter, err = s.reporterkeeper.Reporter(s.ctx, repAcc) + reporter, err = s.Setup.Reporterkeeper.Reporter(s.Setup.Ctx, repAddr) s.NoError(err) s.True(reporter.TotalTokens.GT(repTknBeforeExecuteVote)) // // dispute fee returned so balance should be the same as before paying fee - disputerBalanceAfterExecuteVote := s.bankKeeper.GetBalance(s.ctx, disputer, s.denom) - iter, err := s.disputekeeper.Voter.Indexes.VotersById.MatchExact(s.ctx, uint64(1)) + disputerBalanceAfterExecuteVote := s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, disputer, s.Setup.Denom) + iter, err := s.Setup.Disputekeeper.Voter.Indexes.VotersById.MatchExact(s.Setup.Ctx, uint64(1)) s.NoError(err) keys, err := iter.PrimaryKeys() s.NoError(err) @@ -253,12 +283,12 @@ func (s *IntegrationTestSuite) TestExecuteVoteInvalid() { disputerInfo := keeper.VoterInfo{Share: math.ZeroInt()} totalVoterPower := math.ZeroInt() for i := range keys { - v, err := s.disputekeeper.Voter.Get(s.ctx, keys[i]) + v, err := s.Setup.Disputekeeper.Voter.Get(s.Setup.Ctx, keys[i]) s.NoError(err) voters[i] = keeper.VoterInfo{Voter: keys[i].K2(), Power: v.VoterPower} totalVoterPower = totalVoterPower.Add(v.VoterPower) } - rewards, _ := s.disputekeeper.CalculateVoterShare(s.ctx, voters, burnAmount.QuoRaw(2), totalVoterPower) + rewards, _ := s.Setup.Disputekeeper.CalculateVoterShare(s.Setup.Ctx, voters, burnAmount.QuoRaw(2), totalVoterPower) for i := range rewards { if rewards[i].Voter.String() == disputer.String() { disputerInfo = rewards[i] @@ -270,129 +300,126 @@ func (s *IntegrationTestSuite) TestExecuteVoteInvalid() { } func (s *IntegrationTestSuite) TestExecuteVoteNoQuorumInvalid() { - msgServer := keeper.NewMsgServerImpl(s.disputekeeper) + msgServer := keeper.NewMsgServerImpl(s.Setup.Disputekeeper) _, valAddrs, _ := s.createValidatorAccs([]int64{1000}) - repAccs := s.CreateAccountsWithTokens(3, 100*1e6) - stakeAmount := math.NewInt(100 * 1e6) disputer := s.newKeysWithTokens() + s.Setup.MintTokens(disputer, math.NewInt(20_000_000)) - repAcc := repAccs[0] valAddr := valAddrs[0] - delegators := repAccs - commission := reportertypes.NewCommissionWithTime(math.LegacyZeroDec(), math.LegacyZeroDec(), math.LegacyZeroDec(), s.ctx.BlockTime()) - reporter, err := createReporterStakedWithValidator(s.ctx, s.reporterkeeper, s.stakingKeeper, valAddr, delegators, commission, stakeAmount) - s.NoError(err) + repAddr := sdk.AccAddress(valAddr) + stake, err := s.Setup.Reporterkeeper.ReporterStake(s.Setup.Ctx, repAddr) + s.NoError(err) qId, _ := hex.DecodeString("83a7f3d48786ac2667503a61e8c415438ed2922eb86a2906e4ee66d9a2ce4992") report := oracletypes.MicroReport{ - Reporter: repAcc.String(), - Power: 100, + Reporter: repAddr.String(), + Power: stake.Quo(sdk.DefaultPowerReduction).Int64(), QueryId: qId, Value: "000000000000000000000000000000000000000000000058528649cf80ee0000", Timestamp: time.Unix(1696516597, 0), } - disputeFee, err := s.disputekeeper.GetDisputeFee(s.ctx, report.Reporter, types.Warning) + disputeFee, err := s.Setup.Disputekeeper.GetDisputeFee(s.Setup.Ctx, report, types.Warning) s.NoError(err) // Propose dispute pay half of the fee from account - _, err = msgServer.ProposeDispute(s.ctx, &types.MsgProposeDispute{ + _, err = msgServer.ProposeDispute(s.Setup.Ctx, &types.MsgProposeDispute{ Creator: disputer.String(), Report: &report, - Fee: sdk.NewCoin(s.denom, disputeFee), + Fee: sdk.NewCoin(s.Setup.Denom, disputeFee), DisputeCategory: types.Warning, }) s.NoError(err) vote := []types.MsgVote{ { - Voter: repAcc.String(), + Voter: repAddr.String(), Id: 1, Vote: types.VoteEnum_VOTE_INVALID, }, } // start vote - _, err = msgServer.Vote(s.ctx, &vote[0]) + _, err = msgServer.Vote(s.Setup.Ctx, &vote[0]) s.NoError(err) - ctx := s.ctx.WithBlockTime(s.ctx.BlockTime().Add(keeper.THREE_DAYS + 1)) - err = s.disputekeeper.Tallyvote(ctx, 1) + ctx := s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(keeper.THREE_DAYS + 1)) + err = s.Setup.Disputekeeper.Tallyvote(ctx, 1) s.NoError(err) - bond := reporter.Amount + bond := sdk.DefaultPowerReduction.MulRaw(report.Power) // execute vote - s.NoError(s.disputekeeper.ExecuteVote(ctx, 1)) + s.NoError(s.Setup.Disputekeeper.ExecuteVote(ctx, 1)) - voteInfo, err := s.disputekeeper.Votes.Get(s.ctx, 1) + voteInfo, err := s.Setup.Disputekeeper.Votes.Get(s.Setup.Ctx, 1) s.NoError(err) s.Equal(types.VoteResult_NO_QUORUM_MAJORITY_INVALID, voteInfo.VoteResult) - rep, err := s.reporterkeeper.Reporter(s.ctx, repAcc) + + val, err := s.Setup.Stakingkeeper.GetValidator(s.Setup.Ctx, valAddr) s.NoError(err) - s.True(rep.TotalTokens.Equal(bond)) + s.True(val.Tokens.Equal(bond)) } func (s *IntegrationTestSuite) TestExecuteVoteSupport() { - msgServer := keeper.NewMsgServerImpl(s.disputekeeper) + msgServer := keeper.NewMsgServerImpl(s.Setup.Disputekeeper) _, valAddrs, _ := s.createValidatorAccs([]int64{1000}) repAccs := s.CreateAccountsWithTokens(3, 100*1e6) - stakeAmount := math.NewInt(100 * 1e6) disputer := s.newKeysWithTokens() - repAcc := repAccs[0] - valAddr := valAddrs[0] delegators := repAccs - commission := reportertypes.NewCommissionWithTime(math.LegacyZeroDec(), math.LegacyZeroDec(), math.LegacyZeroDec(), s.ctx.BlockTime()) - reporter, err := createReporterStakedWithValidator(s.ctx, s.reporterkeeper, s.stakingKeeper, valAddr, delegators, commission, stakeAmount) + valAddr := valAddrs[0] + repAddr := sdk.AccAddress(valAddr) + + stake, err := s.Setup.Reporterkeeper.ReporterStake(s.Setup.Ctx, repAddr) s.NoError(err) - disputerBefore, err := s.stakingKeeper.GetAllDelegatorDelegations(s.ctx, disputer) + disputerBefore, err := s.Setup.Stakingkeeper.GetAllDelegatorDelegations(s.Setup.Ctx, disputer) s.NoError(err) s.True(len(disputerBefore) == 0) // mint tokens to voters - s.mintTokens(disputer, math.NewInt(100_000_000)) - oracleServer := oracleKeeper.NewMsgServerImpl(s.oraclekeeper) + s.Setup.MintTokens(disputer, math.NewInt(100_000_000)) + oracleServer := oraclekeeper.NewMsgServerImpl(s.Setup.Oraclekeeper) msg := oracletypes.MsgTip{ Tipper: disputer.String(), QueryData: ethQueryData, - Amount: sdk.NewCoin(s.denom, math.NewInt(1_000_000)), + Amount: sdk.NewCoin(s.Setup.Denom, math.NewInt(1_000_000)), } - _, err = oracleServer.Tip(s.ctx, &msg) + _, err = oracleServer.Tip(s.Setup.Ctx, &msg) s.Nil(err) qId, _ := hex.DecodeString("83a7f3d48786ac2667503a61e8c415438ed2922eb86a2906e4ee66d9a2ce4992") report := oracletypes.MicroReport{ - Reporter: repAcc.String(), - Power: 100, + Reporter: repAddr.String(), + Power: stake.Quo(sdk.DefaultPowerReduction).Int64(), QueryId: qId, Value: "000000000000000000000000000000000000000000000058528649cf80ee0000", Timestamp: time.Unix(1696516597, 0), } - disputeFee, err := s.disputekeeper.GetDisputeFee(s.ctx, repAcc.String(), types.Warning) + disputeFee, err := s.Setup.Disputekeeper.GetDisputeFee(s.Setup.Ctx, report, types.Warning) s.NoError(err) fivePercentBurn := disputeFee.MulRaw(1).QuoRaw(20) twoPercentBurn := fivePercentBurn.QuoRaw(2) - _, err = msgServer.ProposeDispute(s.ctx, &types.MsgProposeDispute{ + _, err = msgServer.ProposeDispute(s.Setup.Ctx, &types.MsgProposeDispute{ Creator: disputer.String(), Report: &report, - Fee: sdk.NewCoin(s.denom, disputeFee), + Fee: sdk.NewCoin(s.Setup.Denom, disputeFee), DisputeCategory: types.Warning, }) s.NoError(err) - s.NoError(dispute.CheckPrevoteDisputesForExpiration(s.ctx, s.disputekeeper)) + s.NoError(dispute.CheckPrevoteDisputesForExpiration(s.Setup.Ctx, s.Setup.Disputekeeper)) votersBalanceBefore := map[string]sdk.Coin{ - repAcc.String(): s.bankKeeper.GetBalance(s.ctx, repAcc, s.denom), - disputer.String(): s.bankKeeper.GetBalance(s.ctx, disputer, s.denom), - delegators[1].String(): s.bankKeeper.GetBalance(s.ctx, delegators[1], s.denom), - delegators[2].String(): s.bankKeeper.GetBalance(s.ctx, delegators[2], s.denom), + repAddr.String(): s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, repAddr, s.Setup.Denom), + disputer.String(): s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, disputer, s.Setup.Denom), + delegators[1].String(): s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, delegators[1], s.Setup.Denom), + delegators[2].String(): s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, delegators[2], s.Setup.Denom), } votes := []types.MsgVote{ { - Voter: repAcc.String(), + Voter: repAddr.String(), Id: 1, Vote: types.VoteEnum_VOTE_SUPPORT, }, @@ -413,42 +440,45 @@ func (s *IntegrationTestSuite) TestExecuteVoteSupport() { }, } for i := range votes { - _, err = msgServer.Vote(s.ctx, &votes[i]) + _, err = msgServer.Vote(s.Setup.Ctx, &votes[i]) if err != nil { s.Error(err, "voter power is zero") } } - err = s.disputekeeper.Tallyvote(s.ctx, 1) + fmt.Println("rep", repAddr.String()) + err = s.Setup.Disputekeeper.Tallyvote(s.Setup.Ctx, 1) s.NoError(err) // execute vote - s.NoError(s.disputekeeper.ExecuteVote(s.ctx, 1)) - reporterAfter, err := s.reporterkeeper.Reporter(s.ctx, repAcc) + s.NoError(s.Setup.Disputekeeper.ExecuteVote(s.Setup.Ctx, 1)) + reporterAfter, err := s.Setup.Reporterkeeper.Reporter(s.Setup.Ctx, repAddr) s.NoError(err) + // should still be jailed s.True(reporterAfter.Jailed) - s.True(reporterAfter.TotalTokens.LT(reporter.Amount)) + fmt.Println(reporterAfter.TotalTokens, stake) + // total tokens should be the same since reward goes to stake and there is only one validator + s.True(reporterAfter.TotalTokens.Equal(stake)) votersBalanceAfter := map[string]sdk.Coin{ - repAcc.String(): s.bankKeeper.GetBalance(s.ctx, repAcc, s.denom), - disputer.String(): s.bankKeeper.GetBalance(s.ctx, disputer, s.denom), - delegators[1].String(): s.bankKeeper.GetBalance(s.ctx, delegators[1], s.denom), - delegators[2].String(): s.bankKeeper.GetBalance(s.ctx, delegators[2], s.denom), + repAddr.String(): s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, repAddr, s.Setup.Denom), + disputer.String(): s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, disputer, s.Setup.Denom), + delegators[1].String(): s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, delegators[1], s.Setup.Denom), + delegators[2].String(): s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, delegators[2], s.Setup.Denom), } - iter, err := s.disputekeeper.Voter.Indexes.VotersById.MatchExact(s.ctx, uint64(1)) + iter, err := s.Setup.Disputekeeper.Voter.Indexes.VotersById.MatchExact(s.Setup.Ctx, uint64(1)) s.NoError(err) keys, err := iter.PrimaryKeys() s.NoError(err) voters := make([]keeper.VoterInfo, len(keys)) totalVoterPower := math.ZeroInt() for i := range keys { - v, err := s.disputekeeper.Voter.Get(s.ctx, keys[i]) + v, err := s.Setup.Disputekeeper.Voter.Get(s.Setup.Ctx, keys[i]) s.NoError(err) voters[i] = keeper.VoterInfo{Voter: keys[i].K2(), Power: v.VoterPower} totalVoterPower = totalVoterPower.Add(v.VoterPower) } - votersReward, _ := s.disputekeeper.CalculateVoterShare(s.ctx, voters, twoPercentBurn, totalVoterPower) + votersReward, _ := s.Setup.Disputekeeper.CalculateVoterShare(s.Setup.Ctx, voters, twoPercentBurn, totalVoterPower) for i, v := range votersReward { - // voterBal := votersBalanceBefore[i].Amount.Add(votersReward[addrs[i].String()]) voterBal := votersBalanceBefore[v.Voter.String()].AddAmount(votersReward[i].Share) if bytes.Equal(disputer, votersReward[i].Voter) { // disputer gets the dispute fee they paid minus the 5% burn for a one rounder dispute @@ -456,47 +486,46 @@ func (s *IntegrationTestSuite) TestExecuteVoteSupport() { } s.Equal(voterBal, votersBalanceAfter[v.Voter.String()]) } - disputerDelgation, err := s.stakingKeeper.GetDelegatorBonded(s.ctx, disputer) + disputerDelgation, err := s.Setup.Stakingkeeper.GetDelegatorBonded(s.Setup.Ctx, disputer) s.NoError(err) - s.True(disputerDelgation.Equal(math.NewInt(1_000_000))) + fmt.Println(disputerDelgation) + s.True(disputerDelgation.Equal(math.NewInt(20_000_000))) } func (s *IntegrationTestSuite) TestExecuteVoteAgainst() { - msgServer := keeper.NewMsgServerImpl(s.disputekeeper) + msgServer := keeper.NewMsgServerImpl(s.Setup.Disputekeeper) _, valAddrs, _ := s.createValidatorAccs([]int64{1000}) repAccs := s.CreateAccountsWithTokens(3, 100*1e6) - stakeAmount := math.NewInt(100 * 1e6) disputer := s.newKeysWithTokens() - repAcc := repAccs[0] valAddr := valAddrs[0] + repAddr := sdk.AccAddress(valAddr) delegators := repAccs - commission := reportertypes.NewCommissionWithTime(math.LegacyZeroDec(), math.LegacyZeroDec(), math.LegacyZeroDec(), s.ctx.BlockTime()) - reporterBefore, err := createReporterStakedWithValidator(s.ctx, s.reporterkeeper, s.stakingKeeper, valAddr, delegators, commission, stakeAmount) + stake, err := s.Setup.Reporterkeeper.ReporterStake(s.Setup.Ctx, repAddr) s.NoError(err) // tip to capture other group of voters 25% of the total power - s.mintTokens(disputer, math.NewInt(100_000_000)) - oracleServer := oracleKeeper.NewMsgServerImpl(s.oraclekeeper) + s.Setup.MintTokens(disputer, math.NewInt(100_000_000)) + oracleServer := oraclekeeper.NewMsgServerImpl(s.Setup.Oraclekeeper) msg := oracletypes.MsgTip{ Tipper: disputer.String(), QueryData: ethQueryData, - Amount: sdk.NewCoin(s.denom, math.NewInt(1_000_000)), + Amount: sdk.NewCoin(s.Setup.Denom, math.NewInt(1_000_000)), } - _, err = oracleServer.Tip(s.ctx, &msg) + _, err = oracleServer.Tip(s.Setup.Ctx, &msg) s.Nil(err) qId, _ := hex.DecodeString("83a7f3d48786ac2667503a61e8c415438ed2922eb86a2906e4ee66d9a2ce4992") report := oracletypes.MicroReport{ - Reporter: repAcc.String(), - Power: 100, + Reporter: repAddr.String(), + Power: stake.Quo(sdk.DefaultPowerReduction).Int64(), QueryId: qId, Value: "000000000000000000000000000000000000000000000058528649cf80ee0000", Timestamp: time.Unix(1696516597, 0), } - disputeFee, err := s.disputekeeper.GetDisputeFee(s.ctx, repAcc.String(), types.Warning) + disputeFee, err := s.Setup.Disputekeeper.GetDisputeFee(s.Setup.Ctx, report, types.Warning) s.NoError(err) fivePercentBurn := disputeFee.MulRaw(1).QuoRaw(20) @@ -504,22 +533,22 @@ func (s *IntegrationTestSuite) TestExecuteVoteAgainst() { disputeFeeMinusBurn := disputeFee.Sub(disputeFee.MulRaw(1).QuoRaw(20)) // Propose dispute pay half of the fee from account - _, err = msgServer.ProposeDispute(s.ctx, &types.MsgProposeDispute{ + _, err = msgServer.ProposeDispute(s.Setup.Ctx, &types.MsgProposeDispute{ Creator: disputer.String(), Report: &report, - Fee: sdk.NewCoin(s.denom, disputeFee), + Fee: sdk.NewCoin(s.Setup.Denom, disputeFee), DisputeCategory: types.Warning, }) s.NoError(err) votersBalanceBefore := map[string]sdk.Coin{ - repAcc.String(): s.bankKeeper.GetBalance(s.ctx, repAcc, s.denom), - disputer.String(): s.bankKeeper.GetBalance(s.ctx, disputer, s.denom), - delegators[1].String(): s.bankKeeper.GetBalance(s.ctx, delegators[1], s.denom), - delegators[2].String(): s.bankKeeper.GetBalance(s.ctx, delegators[2], s.denom), + repAddr.String(): s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, repAddr, s.Setup.Denom), + disputer.String(): s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, disputer, s.Setup.Denom), + delegators[1].String(): s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, delegators[1], s.Setup.Denom), + delegators[2].String(): s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, delegators[2], s.Setup.Denom), } votes := []types.MsgVote{ { - Voter: repAcc.String(), + Voter: repAddr.String(), Id: 1, Vote: types.VoteEnum_VOTE_AGAINST, }, @@ -540,41 +569,44 @@ func (s *IntegrationTestSuite) TestExecuteVoteAgainst() { }, } for i := range votes { - _, err = msgServer.Vote(s.ctx, &votes[i]) + _, err = msgServer.Vote(s.Setup.Ctx, &votes[i]) if err != nil { s.Error(err, "voter power is zero") } } + val, err := s.Setup.Stakingkeeper.GetValidator(s.Setup.Ctx, valAddr) + s.NoError(err) + fmt.Println(val.Tokens) // tally vote - err = s.disputekeeper.Tallyvote(s.ctx, 1) + err = s.Setup.Disputekeeper.Tallyvote(s.Setup.Ctx, 1) s.NoError(err) // execute vote - err = s.disputekeeper.ExecuteVote(s.ctx, 1) + err = s.Setup.Disputekeeper.ExecuteVote(s.Setup.Ctx, 1) s.NoError(err) - reporterAfterDispute, err := s.reporterkeeper.Reporter(s.ctx, repAcc) + reporterAfterDispute, err := s.Setup.Reporterkeeper.Reporter(s.Setup.Ctx, repAddr) s.NoError(err) - - s.Equal(reporterBefore.Amount.Add(disputeFeeMinusBurn), reporterAfterDispute.TotalTokens) + fmt.Println(reporterAfterDispute.TotalTokens, stake, disputeFeeMinusBurn) + s.Equal(stake.Add(disputeFeeMinusBurn), reporterAfterDispute.TotalTokens) votersBalanceAfter := map[string]sdk.Coin{ - repAcc.String(): s.bankKeeper.GetBalance(s.ctx, repAcc, s.denom), - disputer.String(): s.bankKeeper.GetBalance(s.ctx, disputer, s.denom), - delegators[1].String(): s.bankKeeper.GetBalance(s.ctx, delegators[1], s.denom), - delegators[2].String(): s.bankKeeper.GetBalance(s.ctx, delegators[2], s.denom), + repAddr.String(): s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, repAddr, s.Setup.Denom), + disputer.String(): s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, disputer, s.Setup.Denom), + delegators[1].String(): s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, delegators[1], s.Setup.Denom), + delegators[2].String(): s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, delegators[2], s.Setup.Denom), } - iter, err := s.disputekeeper.Voter.Indexes.VotersById.MatchExact(s.ctx, uint64(1)) + iter, err := s.Setup.Disputekeeper.Voter.Indexes.VotersById.MatchExact(s.Setup.Ctx, uint64(1)) s.NoError(err) keys, err := iter.PrimaryKeys() s.NoError(err) voters := make([]keeper.VoterInfo, len(keys)) totalVoterPower := math.ZeroInt() for i := range keys { - v, err := s.disputekeeper.Voter.Get(s.ctx, keys[i]) + v, err := s.Setup.Disputekeeper.Voter.Get(s.Setup.Ctx, keys[i]) s.NoError(err) voters[i] = keeper.VoterInfo{Voter: keys[i].K2(), Power: v.VoterPower, Share: math.ZeroInt()} totalVoterPower = totalVoterPower.Add(v.VoterPower) } - votersReward, _ := s.disputekeeper.CalculateVoterShare(s.ctx, voters, twoPercentBurn, totalVoterPower) + votersReward, _ := s.Setup.Disputekeeper.CalculateVoterShare(s.Setup.Ctx, voters, twoPercentBurn, totalVoterPower) for _, v := range votersReward { newBal := votersBalanceBefore[v.Voter.String()].Amount.Add(v.Share) @@ -584,43 +616,46 @@ func (s *IntegrationTestSuite) TestExecuteVoteAgainst() { } func (s *IntegrationTestSuite) TestDisputeMultipleRounds() { - reporter1Acc, reporter2Acc := s.Reporters() - msgServer := keeper.NewMsgServerImpl(s.disputekeeper) - reporter1, err := s.reporterkeeper.Reporter(s.ctx, reporter1Acc) + repAccs, _, _ := s.createValidatorAccs([]int64{100, 200}) + reporter1Acc := repAccs[0] + reporter2Acc := repAccs[1] + msgServer := keeper.NewMsgServerImpl(s.Setup.Disputekeeper) + reporter1StakeBefore, err := s.Setup.Reporterkeeper.ReporterStake(s.Setup.Ctx, reporter1Acc) s.NoError(err) - reporter1StakeBefore := reporter1.TotalTokens qId, _ := hex.DecodeString("83a7f3d48786ac2667503a61e8c415438ed2922eb86a2906e4ee66d9a2ce4992") report := oracletypes.MicroReport{ - Reporter: sdk.AccAddress(reporter1.Reporter).String(), - Power: reporter1.TotalTokens.Quo(sdk.DefaultPowerReduction).Int64(), + Reporter: reporter1Acc.String(), + Power: reporter1StakeBefore.Quo(sdk.DefaultPowerReduction).Int64(), QueryId: qId, Value: "000000000000000000000000000000000000000000000058528649cf80ee0000", Timestamp: time.Unix(1696516597, 0), - BlockNumber: s.ctx.BlockHeight(), + BlockNumber: s.Setup.Ctx.BlockHeight(), } - disputeFee, err := s.disputekeeper.GetDisputeFee(s.ctx, report.Reporter, types.Warning) + disputeFee, err := s.Setup.Disputekeeper.GetDisputeFee(s.Setup.Ctx, report, types.Warning) s.NoError(err) burnAmount := disputeFee.MulRaw(1).QuoRaw(20) - disputer := sample.AccAddressBytes() + disputer := s.newKeysWithTokens() // mint disputer tokens - s.mintTokens(disputer, math.NewInt(100_000_000)) + s.Setup.MintTokens(disputer, math.NewInt(100_000_000)) // disputer balance before proposing dispute - disputerBalanceBefore := s.bankKeeper.GetBalance(s.ctx, disputer, s.denom) + disputerBalanceBefore := s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, disputer, s.Setup.Denom) disputeMsg := types.MsgProposeDispute{ Creator: disputer.String(), Report: &report, - Fee: sdk.NewCoin(s.denom, disputeFee), + Fee: sdk.NewCoin(s.Setup.Denom, disputeFee), DisputeCategory: types.Warning, } - _, err = msgServer.ProposeDispute(s.ctx, &disputeMsg) + _, err = msgServer.ProposeDispute(s.Setup.Ctx, &disputeMsg) s.NoError(err) // check disputer balance after proposing dispute - disputerBalanceAfter1stRound := s.bankKeeper.GetBalance(s.ctx, disputer, s.denom) + disputerBalanceAfter1stRound := s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, disputer, s.Setup.Denom) s.True(disputerBalanceBefore.Amount.GT(disputerBalanceAfter1stRound.Amount)) // assert reporter tokens slashed and reporter jailed - reporter1, err = s.reporterkeeper.Reporter(s.ctx, reporter1Acc) + rep1Tokens, err := s.Setup.Stakingkeeper.GetDelegatorBonded(s.Setup.Ctx, reporter1Acc) + s.NoError(err) + reporter1, err := s.Setup.Reporterkeeper.Reporter(s.Setup.Ctx, reporter1Acc) s.NoError(err) - reporter1TokensAfterDispute1stround := reporter1.TotalTokens + reporter1TokensAfterDispute1stround := rep1Tokens s.True(reporter1.Jailed) s.True(reporter1.TotalTokens.LT(reporter1StakeBefore)) s.Equal(reporter1.TotalTokens, reporter1StakeBefore.Sub(disputeFee)) @@ -630,25 +665,25 @@ func (s *IntegrationTestSuite) TestDisputeMultipleRounds() { Id: 1, Vote: types.VoteEnum_VOTE_INVALID, } - _, err = msgServer.Vote(s.ctx, &voteMsg) + _, err = msgServer.Vote(s.Setup.Ctx, &voteMsg) s.NoError(err) - _, err = msgServer.ProposeDispute(s.ctx, &disputeMsg) + _, err = msgServer.ProposeDispute(s.Setup.Ctx, &disputeMsg) s.Error(err, "can't start a new round for this dispute 1; dispute status DISPUTE_STATUS_VOTING") // forward time to end voting period pre execute vote - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(keeper.TWO_DAYS + 1)) - s.NoError(s.disputekeeper.Tallyvote(s.ctx, 1)) - s.ErrorContains(s.disputekeeper.Tallyvote(s.ctx, 1), "vote already tallied") - s.Error(s.disputekeeper.ExecuteVote(s.ctx, 1), "dispute is not resolved yet") + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(keeper.TWO_DAYS + 1)) + s.NoError(s.Setup.Disputekeeper.Tallyvote(s.Setup.Ctx, 1)) + s.ErrorContains(s.Setup.Disputekeeper.Tallyvote(s.Setup.Ctx, 1), "vote already tallied") + s.Error(s.Setup.Disputekeeper.ExecuteVote(s.Setup.Ctx, 1), "dispute is not resolved yet") // start another dispute round - _, err = msgServer.ProposeDispute(s.ctx, &disputeMsg) + _, err = msgServer.ProposeDispute(s.Setup.Ctx, &disputeMsg) s.NoError(err) - disputerBalanceAfter2ndRound := s.bankKeeper.GetBalance(s.ctx, disputer, s.denom) + disputerBalanceAfter2ndRound := s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, disputer, s.Setup.Denom) s.Equal(disputerBalanceAfter1stRound.Amount.Sub(burnAmount.MulRaw(2)), disputerBalanceAfter2ndRound.Amount) - reporter1, err = s.reporterkeeper.Reporter(s.ctx, reporter1Acc) + reporter1, err = s.Setup.Reporterkeeper.Reporter(s.Setup.Ctx, reporter1Acc) s.NoError(err) s.Equal(reporter1.TotalTokens, reporter1TokensAfterDispute1stround) - s.Error(s.disputekeeper.Tallyvote(s.ctx, 2), "vote period not ended and quorum not reached") + s.Error(s.Setup.Disputekeeper.Tallyvote(s.Setup.Ctx, 2), "vote period not ended and quorum not reached") // voting that doesn't reach quorum voteMsg = types.MsgVote{ @@ -657,53 +692,56 @@ func (s *IntegrationTestSuite) TestDisputeMultipleRounds() { Vote: types.VoteEnum_VOTE_INVALID, } - _, err = msgServer.Vote(s.ctx, &voteMsg) + _, err = msgServer.Vote(s.Setup.Ctx, &voteMsg) s.NoError(err) // expire vote period - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(keeper.THREE_DAYS + 1)) - s.NoError(s.disputekeeper.Tallyvote(s.ctx, 2)) - s.NoError(s.disputekeeper.ExecuteVote(s.ctx, 2)) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(keeper.THREE_DAYS + 1)) + s.NoError(s.Setup.Disputekeeper.Tallyvote(s.Setup.Ctx, 2)) + s.NoError(s.Setup.Disputekeeper.ExecuteVote(s.Setup.Ctx, 2)) // attempt to start another round - _, err = msgServer.ProposeDispute(s.ctx, &disputeMsg) + _, err = msgServer.ProposeDispute(s.Setup.Ctx, &disputeMsg) s.Error(err, "can't start a new round for this dispute 2; dispute status DISPUTE_STATUS_RESOLVED") - dispute, err := s.disputekeeper.Disputes.Get(s.ctx, 2) + dispute, err := s.Setup.Disputekeeper.Disputes.Get(s.Setup.Ctx, 2) s.NoError(err) s.Equal(types.Resolved, dispute.DisputeStatus) - vote, err := s.disputekeeper.Votes.Get(s.ctx, 2) + vote, err := s.Setup.Disputekeeper.Votes.Get(s.Setup.Ctx, 2) s.NoError(err) s.True(vote.Executed) } func (s *IntegrationTestSuite) TestNoQorumSingleRound() { - reporter1Acc, reporter2Acc := s.Reporters() - msgServer := keeper.NewMsgServerImpl(s.disputekeeper) - reporter1, err := s.reporterkeeper.Reporter(s.ctx, reporter1Acc) + msgServer := keeper.NewMsgServerImpl(s.Setup.Disputekeeper) + repAccs, _, _ := s.createValidatorAccs([]int64{100, 200}) + reporter1Acc := repAccs[0] + reporter2Acc := repAccs[1] + + reporter1StakeBefore, err := s.Setup.Reporterkeeper.ReporterStake(s.Setup.Ctx, reporter1Acc) s.NoError(err) qId, _ := hex.DecodeString("83a7f3d48786ac2667503a61e8c415438ed2922eb86a2906e4ee66d9a2ce4992") report := oracletypes.MicroReport{ - Reporter: sdk.AccAddress(reporter1.Reporter).String(), - Power: reporter1.TotalTokens.Quo(sdk.DefaultPowerReduction).Int64(), + Reporter: reporter1Acc.String(), + Power: reporter1StakeBefore.Quo(sdk.DefaultPowerReduction).Int64(), QueryId: qId, Value: "000000000000000000000000000000000000000000000058528649cf80ee0000", Timestamp: time.Unix(1696516597, 0), - BlockNumber: s.ctx.BlockHeight(), + BlockNumber: s.Setup.Ctx.BlockHeight(), } - disputeFee, err := s.disputekeeper.GetDisputeFee(s.ctx, report.Reporter, types.Warning) + disputeFee, err := s.Setup.Disputekeeper.GetDisputeFee(s.Setup.Ctx, report, types.Warning) s.NoError(err) - disputer := sample.AccAddressBytes() + disputer := s.newKeysWithTokens() // mint disputer tokens - s.mintTokens(disputer, math.NewInt(100_000_000)) + s.Setup.MintTokens(disputer, math.NewInt(100_000_000)) disputeMsg := types.MsgProposeDispute{ Creator: disputer.String(), Report: &report, - Fee: sdk.NewCoin(s.denom, disputeFee), + Fee: sdk.NewCoin(s.Setup.Denom, disputeFee), DisputeCategory: types.Warning, } - _, err = msgServer.ProposeDispute(s.ctx, &disputeMsg) + _, err = msgServer.ProposeDispute(s.Setup.Ctx, &disputeMsg) s.NoError(err) voteMsg := types.MsgVote{ @@ -712,59 +750,60 @@ func (s *IntegrationTestSuite) TestNoQorumSingleRound() { Vote: types.VoteEnum_VOTE_INVALID, } - _, err = msgServer.Vote(s.ctx, &voteMsg) + _, err = msgServer.Vote(s.Setup.Ctx, &voteMsg) s.NoError(err) // forward time to expire dispute - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(keeper.THREE_DAYS + 1)) - s.NoError(s.disputekeeper.Tallyvote(s.ctx, 1)) - s.NoError(s.disputekeeper.ExecuteVote(s.ctx, 1)) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(keeper.THREE_DAYS + 1)) + s.NoError(s.Setup.Disputekeeper.Tallyvote(s.Setup.Ctx, 1)) + s.NoError(s.Setup.Disputekeeper.ExecuteVote(s.Setup.Ctx, 1)) } func (s *IntegrationTestSuite) TestDisputeButNoVotes() { - reporter1Acc, _ := s.Reporters() - msgServer := keeper.NewMsgServerImpl(s.disputekeeper) - reporter1, err := s.reporterkeeper.Reporter(s.ctx, reporter1Acc) - s.NoError(err) + msgServer := keeper.NewMsgServerImpl(s.Setup.Disputekeeper) + repAccs, _, _ := s.createValidatorAccs([]int64{100}) + reporter1Acc := repAccs[0] - reporterStakeBefore := reporter1.TotalTokens + reporterStakeBefore, err := s.Setup.Reporterkeeper.ReporterStake(s.Setup.Ctx, reporter1Acc) + s.NoError(err) qId, _ := hex.DecodeString("83a7f3d48786ac2667503a61e8c415438ed2922eb86a2906e4ee66d9a2ce4992") report := oracletypes.MicroReport{ - Reporter: sdk.AccAddress(reporter1.Reporter).String(), - Power: reporter1.TotalTokens.Quo(sdk.DefaultPowerReduction).Int64(), + Reporter: reporter1Acc.String(), + Power: reporterStakeBefore.Quo(sdk.DefaultPowerReduction).Int64(), QueryId: qId, Value: "000000000000000000000000000000000000000000000058528649cf80ee0000", Timestamp: time.Unix(1696516597, 0), - BlockNumber: s.ctx.BlockHeight(), + BlockNumber: s.Setup.Ctx.BlockHeight(), } - disputeFee, err := s.disputekeeper.GetDisputeFee(s.ctx, report.Reporter, types.Warning) + disputeFee, err := s.Setup.Disputekeeper.GetDisputeFee(s.Setup.Ctx, report, types.Warning) s.NoError(err) - disputer := sample.AccAddressBytes() + disputer := s.newKeysWithTokens() // mint disputer tokens - s.mintTokens(disputer, math.NewInt(100_000_000)) + s.Setup.MintTokens(disputer, math.NewInt(100_000_000)) disputeMsg := types.MsgProposeDispute{ Creator: disputer.String(), Report: &report, - Fee: sdk.NewCoin(s.denom, disputeFee), + Fee: sdk.NewCoin(s.Setup.Denom, disputeFee), DisputeCategory: types.Warning, } - _, err = msgServer.ProposeDispute(s.ctx, &disputeMsg) + _, err = msgServer.ProposeDispute(s.Setup.Ctx, &disputeMsg) s.NoError(err) - reporter1, err = s.reporterkeeper.Reporter(s.ctx, reporter1Acc) + reporter1, err := s.Setup.Reporterkeeper.Reporter(s.Setup.Ctx, reporter1Acc) s.NoError(err) + fmt.Println(reporter1.TotalTokens, reporterStakeBefore) s.NotEqual(reporterStakeBefore, reporter1.TotalTokens) // forward time to expire dispute - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(keeper.THREE_DAYS + 1)) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(keeper.THREE_DAYS + 1)) - s.NoError(s.disputekeeper.Tallyvote(s.ctx, 1)) - s.NoError(s.disputekeeper.ExecuteVote(s.ctx, 1)) + s.NoError(s.Setup.Disputekeeper.Tallyvote(s.Setup.Ctx, 1)) + s.NoError(s.Setup.Disputekeeper.ExecuteVote(s.Setup.Ctx, 1)) - reporter1, err = s.reporterkeeper.Reporter(s.ctx, reporter1Acc) + reporter1, err = s.Setup.Reporterkeeper.Reporter(s.Setup.Ctx, reporter1Acc) s.NoError(err) s.Equal(reporterStakeBefore, reporter1.TotalTokens) } diff --git a/tests/integration/keeper_test.go b/tests/integration/keeper_test.go index 1be0541ed..cf56ff5b6 100644 --- a/tests/integration/keeper_test.go +++ b/tests/integration/keeper_test.go @@ -2,66 +2,33 @@ package integration_test import ( "encoding/hex" - "fmt" "math/big" - "strings" + "strconv" "testing" - "time" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - "github.com/ethereum/go-ethereum/accounts/abi" "github.com/stretchr/testify/suite" - "github.com/tellor-io/layer/app/config" - integration "github.com/tellor-io/layer/tests" + setup "github.com/tellor-io/layer/tests" "github.com/tellor-io/layer/testutil/sample" _ "github.com/tellor-io/layer/x/dispute" - disputekeeper "github.com/tellor-io/layer/x/dispute/keeper" - disputetypes "github.com/tellor-io/layer/x/dispute/types" _ "github.com/tellor-io/layer/x/oracle" - oraclekeeper "github.com/tellor-io/layer/x/oracle/keeper" - oracletypes "github.com/tellor-io/layer/x/oracle/types" - registrykeeper "github.com/tellor-io/layer/x/registry/keeper" _ "github.com/tellor-io/layer/x/registry/module" - registrytypes "github.com/tellor-io/layer/x/registry/types" - reporterkeeper "github.com/tellor-io/layer/x/reporter/keeper" _ "github.com/tellor-io/layer/x/reporter/module" - reportertypes "github.com/tellor-io/layer/x/reporter/types" - authmodulev1 "cosmossdk.io/api/cosmos/auth/module/v1" - "cosmossdk.io/depinject" - "cosmossdk.io/log" "cosmossdk.io/math" - storetypes "cosmossdk.io/store/types" - "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" - "github.com/cosmos/cosmos-sdk/runtime" - "github.com/cosmos/cosmos-sdk/testutil/configurator" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" - moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" - "github.com/cosmos/cosmos-sdk/x/auth" - authcodec "github.com/cosmos/cosmos-sdk/x/auth/codec" - authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/cosmos/cosmos-sdk/x/bank" - bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" _ "github.com/cosmos/cosmos-sdk/x/consensus" _ "github.com/cosmos/cosmos-sdk/x/distribution" - distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" - distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" _ "github.com/cosmos/cosmos-sdk/x/genutil" _ "github.com/cosmos/cosmos-sdk/x/gov" - govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" _ "github.com/cosmos/cosmos-sdk/x/mint" _ "github.com/cosmos/cosmos-sdk/x/params" _ "github.com/cosmos/cosmos-sdk/x/slashing" - slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper" - "github.com/cosmos/cosmos-sdk/x/staking" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) @@ -74,196 +41,20 @@ var ( type IntegrationTestSuite struct { suite.Suite - - oraclekeeper oraclekeeper.Keeper - disputekeeper disputekeeper.Keeper - registrykeeper registrykeeper.Keeper - reporterkeeper reporterkeeper.Keeper - - accountKeeper authkeeper.AccountKeeper - bankKeeper bankkeeper.BaseKeeper - distrKeeper distrkeeper.Keeper - slashingKeeper slashingkeeper.Keeper - stakingKeeper *stakingkeeper.Keeper - govKeeper *govkeeper.Keeper - ctx sdk.Context - appCodec codec.Codec - authConfig *authmodulev1.Module - - interfaceRegistry codectypes.InterfaceRegistry - fetchStoreKey func(string) storetypes.StoreKey - - denom string - app *runtime.App -} - -func (suite *IntegrationTestSuite) initKeepersWithmAccPerms(blockedAddrs map[string]bool) { - maccPerms := map[string][]string{} - for _, permission := range suite.authConfig.ModuleAccountPermissions { - maccPerms[permission.Account] = permission.Permissions - } - - appCodec := moduletestutil.MakeTestEncodingConfig(auth.AppModuleBasic{}, bank.AppModuleBasic{}, staking.AppModuleBasic{}).Codec - cdc := moduletestutil.MakeTestEncodingConfig(auth.AppModuleBasic{}, bank.AppModuleBasic{}, staking.AppModuleBasic{}).Amino - - maccPerms[authtypes.Burner] = []string{authtypes.Burner} - maccPerms[authtypes.Minter] = []string{authtypes.Minter} - - suite.accountKeeper = authkeeper.NewAccountKeeper( - appCodec, - runtime.NewKVStoreService(suite.fetchStoreKey(banktypes.StoreKey).(*storetypes.KVStoreKey)), - authtypes.ProtoBaseAccount, - maccPerms, - authcodec.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix()), - sdk.GetConfig().GetBech32AccountAddrPrefix(), authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - - suite.bankKeeper = bankkeeper.NewBaseKeeper( - appCodec, - runtime.NewKVStoreService(suite.fetchStoreKey(banktypes.StoreKey).(*storetypes.KVStoreKey)), - suite.accountKeeper, - blockedAddrs, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - log.NewNopLogger(), - ) - - suite.stakingKeeper = stakingkeeper.NewKeeper( - appCodec, - runtime.NewKVStoreService(suite.fetchStoreKey(stakingtypes.StoreKey).(*storetypes.KVStoreKey)), - suite.accountKeeper, - suite.bankKeeper, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ValidatorAddrPrefix()), - authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ConsensusAddrPrefix()), - ) - - suite.slashingKeeper = slashingkeeper.NewKeeper( - appCodec, - cdc, - runtime.NewKVStoreService(suite.fetchStoreKey(banktypes.StoreKey).(*storetypes.KVStoreKey)), - suite.stakingKeeper, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - - suite.registrykeeper = registrykeeper.NewKeeper( - appCodec, - runtime.NewKVStoreService(suite.fetchStoreKey(registrytypes.StoreKey).(*storetypes.KVStoreKey)), - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - - suite.distrKeeper = distrkeeper.NewKeeper( - appCodec, runtime.NewKVStoreService(suite.fetchStoreKey(distrtypes.StoreKey).(*storetypes.KVStoreKey)), suite.accountKeeper, suite.bankKeeper, suite.stakingKeeper, authtypes.FeeCollectorName, authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - - suite.reporterkeeper = reporterkeeper.NewKeeper( - appCodec, runtime.NewKVStoreService(suite.fetchStoreKey(reportertypes.StoreKey).(*storetypes.KVStoreKey)), log.NewNopLogger(), authtypes.NewModuleAddress(govtypes.ModuleName).String(), suite.stakingKeeper, suite.bankKeeper, - ) - - suite.oraclekeeper = oraclekeeper.NewKeeper( - appCodec, runtime.NewKVStoreService(suite.fetchStoreKey(oracletypes.StoreKey).(*storetypes.KVStoreKey)), suite.accountKeeper, suite.bankKeeper, suite.registrykeeper, suite.reporterkeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - suite.disputekeeper = disputekeeper.NewKeeper( - appCodec, runtime.NewKVStoreService(suite.fetchStoreKey(disputetypes.StoreKey).(*storetypes.KVStoreKey)), suite.accountKeeper, suite.bankKeeper, suite.oraclekeeper, suite.reporterkeeper, - ) - suite.stakingKeeper.SetHooks( - stakingtypes.NewMultiStakingHooks( - suite.reporterkeeper.Hooks(), - ), - ) - suite.registrykeeper.SetHooks( - registrytypes.NewMultiRegistryHooks( - suite.oraclekeeper.Hooks(), - ), - ) + Setup *setup.SharedSetup } func (s *IntegrationTestSuite) SetupTest() { - sdk.DefaultBondDenom = "loya" - config.SetupConfig() - - app, err := simtestutil.SetupWithConfiguration( - depinject.Configs( - configurator.NewAppConfig( - integration.AuthModule(), - configurator.BankModule(), - configurator.StakingModule(), - configurator.SlashingModule(), - configurator.ParamsModule(), - configurator.ConsensusModule(), - configurator.DistributionModule(), - integration.OracleModule(), - integration.DisputeModule(), - integration.RegistryModule(), - integration.ReporterModule(), - configurator.GovModule(), - ), - depinject.Supply(log.NewNopLogger()), - ), - integration.DefaultStartUpConfig(), - &s.accountKeeper, &s.bankKeeper, &s.stakingKeeper, &s.slashingKeeper, - &s.interfaceRegistry, &s.appCodec, &s.authConfig, &s.oraclekeeper, - &s.disputekeeper, &s.registrykeeper, &s.govKeeper, &s.reporterkeeper) - - s.NoError(err) - s.ctx = sdk.UnwrapSDKContext(app.BaseApp.NewContextLegacy(false, tmproto.Header{Time: time.Now()})) - s.fetchStoreKey = app.UnsafeFindStoreKey - - s.denom = sdk.DefaultBondDenom - s.initKeepersWithmAccPerms(make(map[string]bool)) - s.app = app -} - -func (s *IntegrationTestSuite) mintTokens(addr sdk.AccAddress, amount math.Int) { - ctx := s.ctx - // s.accountKeeper.SetAccount(ctx, authtypes.NewBaseAccountWithAddress(addr)) - coins := sdk.NewCoins(sdk.NewCoin(s.denom, amount)) - s.NoError(s.bankKeeper.MintCoins(ctx, authtypes.Minter, coins)) - s.NoError(s.bankKeeper.SendCoinsFromModuleToAccount(ctx, authtypes.Minter, addr, coins)) + s.Setup = &setup.SharedSetup{} + s.Setup.SetupTest(s.T()) } func (s *IntegrationTestSuite) newKeysWithTokens() sdk.AccAddress { Addr := sample.AccAddressBytes() - s.mintTokens(Addr, math.NewInt(1_000_000)) + s.Setup.MintTokens(Addr, math.NewInt(1_000_000)) return Addr } -// func (s *IntegrationTestSuite) createValidators(powers []int64) ([]sdk.AccAddress, []sdk.ValAddress) { -// ctx := s.ctx -// acctNum := len(powers) -// base := new(big.Int).Exp(big.NewInt(10), big.NewInt(6), nil) -// amount := new(big.Int).Mul(big.NewInt(1000), base) -// testAddrs := simtestutil.CreateIncrementalAccounts(acctNum) -// addrs := s.addTestAddrs(math.NewIntFromBigInt(amount), testAddrs) -// valAddrs := simtestutil.ConvertAddrsToValAddrs(addrs) -// pks := simtestutil.CreateTestPubKeys(acctNum) - -// for i, pk := range pks { -// s.accountKeeper.NewAccountWithAddress(ctx, testAddrs[i]) - -// val, err := stakingtypes.NewValidator(valAddrs[i].String(), pk, stakingtypes.Description{}) -// s.NoError(err) -// s.stakingKeeper.SetValidator(ctx, val) -// s.stakingKeeper.SetValidatorByConsAddr(ctx, val) -// s.stakingKeeper.SetNewValidatorByPowerIndex(ctx, val) -// s.stakingKeeper.Delegate(ctx, addrs[i], s.stakingKeeper.TokensFromConsensusPower(ctx, powers[i]), stakingtypes.Unbonded, val, true) -// } - -// _, err := s.stakingKeeper.EndBlocker(ctx) -// s.NoError(err) - -// return addrs, valAddrs -// } - -func (s *IntegrationTestSuite) addTestAddrs(accAmt math.Int, testAddrs []sdk.AccAddress) []sdk.AccAddress { - initCoins := sdk.NewCoin(s.denom, accAmt) - for _, addr := range testAddrs { - s.NoError(s.bankKeeper.MintCoins(s.ctx, authtypes.Minter, sdk.NewCoins(initCoins))) - s.NoError(s.bankKeeper.SendCoinsFromModuleToAccount(s.ctx, authtypes.Minter, addr, sdk.NewCoins(initCoins))) - } - - return testAddrs -} - type ModuleAccs struct { staking sdk.AccountI dispute sdk.AccountI @@ -271,8 +62,8 @@ type ModuleAccs struct { func (s *IntegrationTestSuite) ModuleAccs() ModuleAccs { return ModuleAccs{ - staking: s.accountKeeper.GetModuleAccount(s.ctx, "bonded_tokens_pool"), - dispute: s.accountKeeper.GetModuleAccount(s.ctx, "dispute"), + staking: s.Setup.Accountkeeper.GetModuleAccount(s.Setup.Ctx, "bonded_tokens_pool"), + dispute: s.Setup.Accountkeeper.GetModuleAccount(s.Setup.Ctx, "dispute"), } } @@ -285,55 +76,53 @@ func CreateRandomPrivateKeys(accNum int) []ed25519.PrivKey { return testAddrs } -func (s *IntegrationTestSuite) convertToAccAddress(priv []ed25519.PrivKey) []sdk.AccAddress { - testAddrs := make([]sdk.AccAddress, len(priv)) - for i, pk := range priv { - testAddrs[i] = sdk.AccAddress(pk.PubKey().Address()) - } - return testAddrs -} - func (s *IntegrationTestSuite) createValidatorAccs(powers []int64) ([]sdk.AccAddress, []sdk.ValAddress, []ed25519.PrivKey) { - ctx := s.ctx + ctx := s.Setup.Ctx acctNum := len(powers) base := new(big.Int).Exp(big.NewInt(10), big.NewInt(6), nil) amount := new(big.Int).Mul(big.NewInt(1000), base) privKeys := CreateRandomPrivateKeys(acctNum) - testAddrs := s.convertToAccAddress(privKeys) - addrs := s.addTestAddrs(math.NewIntFromBigInt(amount), testAddrs) - valAddrs := simtestutil.ConvertAddrsToValAddrs(addrs) - + testAddrs := s.Setup.ConvertToAccAddress(privKeys) + for _, addr := range testAddrs { + s.Setup.MintTokens(addr, math.NewIntFromBigInt(amount)) + } + valAddrs := simtestutil.ConvertAddrsToValAddrs(testAddrs) + stakingServer := stakingkeeper.NewMsgServerImpl(s.Setup.Stakingkeeper) for i, pk := range privKeys { account := authtypes.BaseAccount{ Address: testAddrs[i].String(), PubKey: codectypes.UnsafePackAny(pk.PubKey()), AccountNumber: uint64(i + 1), } - s.accountKeeper.SetAccount(s.ctx, &account) - val, err := stakingtypes.NewValidator(valAddrs[i].String(), pk.PubKey(), stakingtypes.Description{}) - s.NoError(err) - s.NoError(s.stakingKeeper.SetValidator(ctx, val)) - s.NoError(s.stakingKeeper.SetValidatorByConsAddr(ctx, val)) - s.NoError(s.stakingKeeper.SetNewValidatorByPowerIndex(ctx, val)) - _, err = s.stakingKeeper.Delegate(ctx, addrs[i], s.stakingKeeper.TokensFromConsensusPower(ctx, powers[i]), stakingtypes.Unbonded, val, true) + s.Setup.Accountkeeper.SetAccount(s.Setup.Ctx, &account) + valMsg, err := stakingtypes.NewMsgCreateValidator( + valAddrs[i].String(), + pk.PubKey(), + sdk.NewInt64Coin(s.Setup.Denom, s.Setup.Stakingkeeper.TokensFromConsensusPower(ctx, powers[i]).Int64()), + stakingtypes.Description{Moniker: strconv.Itoa(i)}, + stakingtypes.CommissionRates{ + Rate: math.LegacyNewDecWithPrec(5, 1), + MaxRate: math.LegacyNewDecWithPrec(5, 1), + MaxChangeRate: math.LegacyNewDec(0), + }, + math.OneInt()) s.NoError(err) - // call hooks for distribution init - valBz, err := s.stakingKeeper.ValidatorAddressCodec().StringToBytes(val.GetOperator()) - if err != nil { - panic(err) - } - err = s.distrKeeper.Hooks().AfterValidatorCreated(ctx, valBz) + + _, err = stakingServer.CreateValidator(s.Setup.Ctx, valMsg) s.NoError(err) - err = s.distrKeeper.Hooks().BeforeDelegationCreated(ctx, addrs[i], valBz) + + val, err := s.Setup.Stakingkeeper.GetValidator(ctx, valAddrs[i]) s.NoError(err) - err = s.distrKeeper.Hooks().AfterDelegationModified(ctx, addrs[i], valBz) + s.Setup.MintTokens(testAddrs[i], s.Setup.Stakingkeeper.TokensFromConsensusPower(ctx, powers[i])) + msg := stakingtypes.MsgDelegate{DelegatorAddress: testAddrs[i].String(), ValidatorAddress: val.OperatorAddress, Amount: sdk.NewCoin(s.Setup.Denom, s.Setup.Stakingkeeper.TokensFromConsensusPower(ctx, powers[i]))} + _, err = stakingServer.Delegate(s.Setup.Ctx, &msg) s.NoError(err) } - _, err := s.stakingKeeper.EndBlocker(ctx) + _, err := s.Setup.Stakingkeeper.EndBlocker(ctx) s.NoError(err) - return addrs, valAddrs, privKeys + return testAddrs, valAddrs, privKeys } func (s *IntegrationTestSuite) CreateAccountsWithTokens(numofAccs int, amountOfTokens int64) []sdk.AccAddress { @@ -341,33 +130,11 @@ func (s *IntegrationTestSuite) CreateAccountsWithTokens(numofAccs int, amountOfT accs := make([]sdk.AccAddress, numofAccs) for i, pk := range privKeys { accs[i] = sdk.AccAddress(pk.PubKey().Address()) - s.mintTokens(accs[i], math.NewInt(amountOfTokens)) + s.Setup.MintTokens(accs[i], math.NewInt(amountOfTokens)) } return accs } -// inspired by telliot python code -func encodeValue(number float64) string { - strNumber := fmt.Sprintf("%.18f", number) - - parts := strings.Split(strNumber, ".") - if len(parts[1]) > 18 { - parts[1] = parts[1][:18] - } - truncatedStr := parts[0] + parts[1] - - bigIntNumber := new(big.Int) - bigIntNumber.SetString(truncatedStr, 10) - - uint256ABIType, _ := abi.NewType("uint256", "", nil) - - arguments := abi.Arguments{{Type: uint256ABIType}} - encodedBytes, _ := arguments.Pack(bigIntNumber) - - encodedString := hex.EncodeToString(encodedBytes) - return encodedString -} - func TestKeeperTestSuite(t *testing.T) { suite.Run(t, new(IntegrationTestSuite)) } diff --git a/tests/integration/oracle_keeper_test.go b/tests/integration/oracle_keeper_test.go index 7a30eaa61..8f31c5a70 100644 --- a/tests/integration/oracle_keeper_test.go +++ b/tests/integration/oracle_keeper_test.go @@ -25,137 +25,139 @@ import ( ) func (s *IntegrationTestSuite) TestTipping() { - msgServer := keeper.NewMsgServerImpl(s.oraclekeeper) + msgServer := keeper.NewMsgServerImpl(s.Setup.Oraclekeeper) addr := s.newKeysWithTokens() - tip := sdk.NewCoin(s.denom, math.NewInt(1000)) - twoPercent := sdk.NewCoin(s.denom, tip.Amount.Mul(math.NewInt(2)).Quo(math.NewInt(100))) + tip := sdk.NewCoin(s.Setup.Denom, math.NewInt(1000)) + twoPercent := sdk.NewCoin(s.Setup.Denom, tip.Amount.Mul(math.NewInt(2)).Quo(math.NewInt(100))) msg := types.MsgTip{ Tipper: addr.String(), QueryData: ethQueryData, Amount: tip, } - _, err := msgServer.Tip(s.ctx, &msg) + _, err := msgServer.Tip(s.Setup.Ctx, &msg) s.NoError(err) queryId := utils.QueryIDFromData(ethQueryData) - tips, err := s.oraclekeeper.GetQueryTip(s.ctx, queryId) + tips, err := s.Setup.Oraclekeeper.GetQueryTip(s.Setup.Ctx, queryId) s.NoError(err) s.Equal(tip.Sub(twoPercent).Amount, tips) - userTips, err := s.oraclekeeper.GetUserTips(s.ctx, addr) + userTips, err := s.Setup.Oraclekeeper.GetUserTips(s.Setup.Ctx, addr) s.NoError(err) s.Equal(userTips.Int64(), tips.Int64()) // tip same query again - _, err = msgServer.Tip(s.ctx, &msg) + _, err = msgServer.Tip(s.Setup.Ctx, &msg) s.NoError(err) - tips, err = s.oraclekeeper.GetQueryTip(s.ctx, queryId) + tips, err = s.Setup.Oraclekeeper.GetQueryTip(s.Setup.Ctx, queryId) s.NoError(err) // tips should be 2x s.Equal(tip.Sub(twoPercent).Amount.Mul(math.NewInt(2)), tips) // total tips overall - userTips, err = s.oraclekeeper.GetUserTips(s.ctx, addr) + userTips, err = s.Setup.Oraclekeeper.GetUserTips(s.Setup.Ctx, addr) s.NoError(err) s.Equal(userTips, tips) // // tip different query // btcQueryId := utils.QueryIDFromData(btcQueryData) - // _, err = msgServer.Tip(s.ctx, &types.MsgTip{QueryData: btcQueryData, Tipper: addr.String(), Amount: tip}) + // _, err = msgServer.Tip(s.Setup.Ctx, &types.MsgTip{QueryData: btcQueryData, Tipper: addr.String(), Amount: tip}) // s.NoError(err) - // tips, err = s.oraclekeeper.GetQueryTip(s.ctx, btcQueryId) + // tips, err = s.Setup.Oraclekeeper.GetQueryTip(s.Setup.Ctx, btcQueryId) // s.NoError(err) // s.Equal(tip.Sub(twoPercent).Amount, tips) - // userQueryTips, _ := s.oraclekeeper.Tips.Get(s.ctx, collections.Join(btcQueryId, addr.Bytes())) + // userQueryTips, _ := s.Setup.Oraclekeeper.Tips.Get(s.Setup.Ctx, collections.Join(btcQueryId, addr.Bytes())) // s.Equal(userQueryTips, tips) - // userTips, err = s.oraclekeeper.GetUserTips(s.ctx, addr) + // userTips, err = s.Setup.Oraclekeeper.GetUserTips(s.Setup.Ctx, addr) // s.NoError(err) // s.Equal(userTips.Address, addr.String()) // s.Equal(userTips.Total, tips.Add(tips).Add(tips)) } func (s *IntegrationTestSuite) TestGetCurrentTip() { - msgServer := keeper.NewMsgServerImpl(s.oraclekeeper) + msgServer := keeper.NewMsgServerImpl(s.Setup.Oraclekeeper) addr := s.newKeysWithTokens() - tip := sdk.NewCoin(s.denom, math.NewInt(1000)) - twoPercent := sdk.NewCoin(s.denom, tip.Amount.Mul(math.NewInt(2)).Quo(math.NewInt(100))) + tip := sdk.NewCoin(s.Setup.Denom, math.NewInt(1000)) + twoPercent := sdk.NewCoin(s.Setup.Denom, tip.Amount.Mul(math.NewInt(2)).Quo(math.NewInt(100))) msg := types.MsgTip{ Tipper: addr.String(), QueryData: ethQueryData, Amount: tip, } - _, err := msgServer.Tip(s.ctx, &msg) + _, err := msgServer.Tip(s.Setup.Ctx, &msg) s.NoError(err) // Get current tip - queryServer := keeper.NewQuerier(s.oraclekeeper) - resp, err := queryServer.GetCurrentTip(s.ctx, &types.QueryGetCurrentTipRequest{QueryData: hex.EncodeToString(ethQueryData)}) + queryServer := keeper.NewQuerier(s.Setup.Oraclekeeper) + resp, err := queryServer.GetCurrentTip(s.Setup.Ctx, &types.QueryGetCurrentTipRequest{QueryData: hex.EncodeToString(ethQueryData)}) s.NoError(err) s.Equal(tip.Amount.Sub(twoPercent.Amount), resp.Tips) } // test tipping, reporting and allocation of rewards func (s *IntegrationTestSuite) TestTippingReporting() { - s.ctx = s.ctx.WithBlockTime(time.Now()) - s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) - msgServer := keeper.NewMsgServerImpl(s.oraclekeeper) - + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(time.Now()) + s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(s.Setup.Ctx.BlockHeight() + 1) + msgServer := keeper.NewMsgServerImpl(s.Setup.Oraclekeeper) + repAccs, _, _ := s.createValidatorAccs([]int64{100, 200}) addr := s.newKeysWithTokens() - tip := sdk.NewCoin(s.denom, math.NewInt(1000)) - twoPercent := sdk.NewCoin(s.denom, tip.Amount.Mul(math.NewInt(2)).Quo(math.NewInt(100))) + tip := sdk.NewCoin(s.Setup.Denom, math.NewInt(1000)) + twoPercent := sdk.NewCoin(s.Setup.Denom, tip.Amount.Mul(math.NewInt(2)).Quo(math.NewInt(100))) msg := types.MsgTip{ Tipper: addr.String(), QueryData: ethQueryData, Amount: tip, } - _, err := msgServer.Tip(s.ctx, &msg) + _, err := msgServer.Tip(s.Setup.Ctx, &msg) s.NoError(err) queryId := utils.QueryIDFromData(ethQueryData) - tips, err := s.oraclekeeper.GetQueryTip(s.ctx, queryId) + tips, err := s.Setup.Oraclekeeper.GetQueryTip(s.Setup.Ctx, queryId) s.NoError(err) s.Equal(tip.Sub(twoPercent).Amount, tips) - newReporter, err := createReporter(s.ctx, int64(1), s.reporterkeeper) - s.Nil(err) + _, err = s.Setup.Reporterkeeper.ReporterStake(s.Setup.Ctx, repAccs[0]) + s.NoError(err) + _, err = s.Setup.Reporterkeeper.ReporterStake(s.Setup.Ctx, repAccs[1]) + s.NoError(err) salt, err := oracleutils.Salt(32) s.Nil(err) - value := encodeValue(29266) + value := testutil.EncodeValue(29266) hash := oracleutils.CalculateCommitment(value, salt) - commit, reveal := report(newReporter.String(), value, salt, hash, ethQueryData) - _, err = msgServer.CommitReport(s.ctx, &commit) + commit, reveal := report(repAccs[0].String(), value, salt, hash, ethQueryData) + _, err = msgServer.CommitReport(s.Setup.Ctx, &commit) s.Nil(err) - _, err = msgServer.SubmitValue(s.ctx, &reveal) + _, err = msgServer.SubmitValue(s.Setup.Ctx, &reveal) s.Nil(err) // advance time to expire the query and aggregate report - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Second * 7)) // bypassing offset that expires time to commit/reveal - err = s.oraclekeeper.SetAggregatedReport(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(time.Second * 7)) // bypassing offset that expires time to commit/reveal + err = s.Setup.Oraclekeeper.SetAggregatedReport(s.Setup.Ctx) s.Nil(err) - queryServer := keeper.NewQuerier(s.oraclekeeper) - res, err := queryServer.GetAggregatedReport(s.ctx, &types.QueryGetCurrentAggregatedReportRequest{QueryId: hex.EncodeToString(queryId)}) + queryServer := keeper.NewQuerier(s.Setup.Oraclekeeper) + res, err := queryServer.GetAggregatedReport(s.Setup.Ctx, &types.QueryGetCurrentAggregatedReportRequest{QueryId: hex.EncodeToString(queryId)}) s.Nil(err) - s.Equal(res.Report.AggregateReporter, newReporter.String()) + s.Equal(res.Report.AggregateReporter, repAccs[0].String()) // tip should be 0 after aggregated report - tips, err = s.oraclekeeper.GetQueryTip(s.ctx, queryId) + tips, err = s.Setup.Oraclekeeper.GetQueryTip(s.Setup.Ctx, queryId) s.Nil(err) s.Equal(tips, math.ZeroInt()) - totalTips, err := s.oraclekeeper.GetTotalTips(s.ctx) + totalTips, err := s.Setup.Oraclekeeper.GetTotalTips(s.Setup.Ctx) s.Nil(err) s.Equal(totalTips, tip.Sub(twoPercent).Amount) // total tips should be equal to the tipped amount minus 2% burned } func (s *IntegrationTestSuite) TestGetUserTipTotal() { - msgServer := keeper.NewMsgServerImpl(s.oraclekeeper) + msgServer := keeper.NewMsgServerImpl(s.Setup.Oraclekeeper) addr := s.newKeysWithTokens() @@ -164,50 +166,54 @@ func (s *IntegrationTestSuite) TestGetUserTipTotal() { msg := types.MsgTip{ Tipper: addr.String(), QueryData: ethQueryData, - Amount: sdk.NewCoin(s.denom, tip), + Amount: sdk.NewCoin(s.Setup.Denom, tip), } - _, err := msgServer.Tip(s.ctx, &msg) + _, err := msgServer.Tip(s.Setup.Ctx, &msg) s.NoError(err) - queryServer := keeper.NewQuerier(s.oraclekeeper) + queryServer := keeper.NewQuerier(s.Setup.Oraclekeeper) // Get current tip - resp, err := queryServer.GetUserTipTotal(s.ctx, &types.QueryGetUserTipTotalRequest{Tipper: addr.String()}) + resp, err := queryServer.GetUserTipTotal(s.Setup.Ctx, &types.QueryGetUserTipTotalRequest{Tipper: addr.String()}) s.NoError(err) s.Equal(resp.TotalTips, tip.Sub(twoPercent)) // Check total tips without a given query data - respUserTotal, err := queryServer.GetUserTipTotal(s.ctx, &types.QueryGetUserTipTotalRequest{Tipper: addr.String()}) + respUserTotal, err := queryServer.GetUserTipTotal(s.Setup.Ctx, &types.QueryGetUserTipTotalRequest{Tipper: addr.String()}) s.NoError(err) s.Equal(respUserTotal.TotalTips, tip.Sub(twoPercent)) } func (s *IntegrationTestSuite) TestSmallTip() { - msgServer := keeper.NewMsgServerImpl(s.oraclekeeper) + msgServer := keeper.NewMsgServerImpl(s.Setup.Oraclekeeper) addr := s.newKeysWithTokens() - tip := sdk.NewCoin(s.denom, math.NewInt(10)) - twoPercent := sdk.NewCoin(s.denom, tip.Amount.Mul(math.NewInt(2)).Quo(math.NewInt(100))) + tip := sdk.NewCoin(s.Setup.Denom, math.NewInt(10)) + twoPercent := sdk.NewCoin(s.Setup.Denom, tip.Amount.Mul(math.NewInt(2)).Quo(math.NewInt(100))) msg := types.MsgTip{ Tipper: addr.String(), QueryData: ethQueryData, Amount: tip, } - accBalanceBefore := s.bankKeeper.GetBalance(s.ctx, addr, s.denom) - modBalanceBefore := s.bankKeeper.GetBalance(s.ctx, authtypes.NewModuleAddress(types.ModuleName), s.denom) - _, err := msgServer.Tip(s.ctx, &msg) + accBalanceBefore := s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, addr, s.Setup.Denom) + modBalanceBefore := s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, authtypes.NewModuleAddress(types.ModuleName), s.Setup.Denom) + _, err := msgServer.Tip(s.Setup.Ctx, &msg) s.NoError(err) - accBalanceAfter := s.bankKeeper.GetBalance(s.ctx, addr, s.denom) - modBalanceAfter := s.bankKeeper.GetBalance(s.ctx, authtypes.NewModuleAddress(types.ModuleName), s.denom) + accBalanceAfter := s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, addr, s.Setup.Denom) + modBalanceAfter := s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, authtypes.NewModuleAddress(types.ModuleName), s.Setup.Denom) s.Equal(accBalanceBefore.Amount.Sub(tip.Amount), accBalanceAfter.Amount) s.Equal(modBalanceBefore.Amount.Add(tip.Amount).Sub(twoPercent.Amount), modBalanceAfter.Amount) } func (s *IntegrationTestSuite) TestMedianReports() { - s.ctx = s.ctx.WithBlockTime(time.Now()) - msgServer := keeper.NewMsgServerImpl(s.oraclekeeper) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(time.Now()) + msgServer := keeper.NewMsgServerImpl(s.Setup.Oraclekeeper) + repAccs, _, _ := s.createValidatorAccs([]int64{100, 200, 300, 400, 500}) tipper := s.newKeysWithTokens() - + for _, rep := range repAccs { + _, err := s.Setup.Reporterkeeper.ReporterStake(s.Setup.Ctx, rep) + s.NoError(err) + } reporters := []struct { name string reporterIndex int @@ -218,67 +224,65 @@ func (s *IntegrationTestSuite) TestMedianReports() { { name: "reporter 1", reporterIndex: 0, - value: encodeValue(162926), + value: testutil.EncodeValue(162926), stakeAmount: math.NewInt(1_000_000), power: 1, }, { name: "reporter 2", reporterIndex: 1, - value: encodeValue(362926), + value: testutil.EncodeValue(362926), stakeAmount: math.NewInt(2_000_000), power: 2, }, { name: "reporter 3", reporterIndex: 2, - value: encodeValue(262926), + value: testutil.EncodeValue(262926), stakeAmount: math.NewInt(3_000_000), power: 3, }, { name: "reporter 4", reporterIndex: 3, - value: encodeValue(562926), + value: testutil.EncodeValue(562926), stakeAmount: math.NewInt(4_000_000), power: 4, }, { name: "reporter 5", reporterIndex: 4, - value: encodeValue(462926), + value: testutil.EncodeValue(462926), stakeAmount: math.NewInt(5_000_000), power: 5, }, } - _, err := msgServer.Tip(s.ctx, &types.MsgTip{Tipper: tipper.String(), QueryData: ethQueryData, Amount: sdk.NewCoin(s.denom, math.NewInt(1000))}) + _, err := msgServer.Tip(s.Setup.Ctx, &types.MsgTip{Tipper: tipper.String(), QueryData: ethQueryData, Amount: sdk.NewCoin(s.Setup.Denom, math.NewInt(1000))}) s.Nil(err) addr := make([]sdk.AccAddress, len(reporters)) - for _, r := range reporters { + for i, r := range reporters { s.T().Run(r.name, func(t *testing.T) { // create reporter - newReporter, err := createReporter(s.ctx, r.power, s.reporterkeeper) - s.Nil(err) - addr[r.reporterIndex] = newReporter + addr[r.reporterIndex] = repAccs[i] salt, err := oracleutils.Salt(32) s.Nil(err) hash := oracleutils.CalculateCommitment(r.value, salt) s.Nil(err) - commit, reveal := report(newReporter.String(), r.value, salt, hash, ethQueryData) - _, err = msgServer.CommitReport(s.ctx, &commit) + commit, reveal := report(repAccs[i].String(), r.value, salt, hash, ethQueryData) + _, err = msgServer.CommitReport(s.Setup.Ctx, &commit) s.Nil(err) - _, err = msgServer.SubmitValue(s.ctx, &reveal) + _, err = msgServer.SubmitValue(s.Setup.Ctx, &reveal) s.Nil(err) }) } // advance time to expire query and aggregate report - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Second * 7)) // bypass time to expire query so it can be aggregated - _, err = s.app.EndBlocker(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(time.Second * 7)) // bypass time to expire query so it can be aggregated + _, err = s.Setup.App.EndBlocker(s.Setup.Ctx) s.Nil(err) // check median qId, _ := hex.DecodeString("83a7f3d48786ac2667503a61e8c415438ed2922eb86a2906e4ee66d9a2ce4992") - queryServer := keeper.NewQuerier(s.oraclekeeper) - res, err := queryServer.GetAggregatedReport(s.ctx, &types.QueryGetCurrentAggregatedReportRequest{QueryId: hex.EncodeToString(qId)}) + queryServer := keeper.NewQuerier(s.Setup.Oraclekeeper) + res, err := queryServer.GetAggregatedReport(s.Setup.Ctx, &types.QueryGetCurrentAggregatedReportRequest{QueryId: hex.EncodeToString(qId)}) s.Nil(err) expectedMedianReporterIndex := 4 expectedMedianReporter := addr[expectedMedianReporterIndex].String() @@ -304,7 +308,7 @@ func report(creator, value, salt, hash string, qdata []byte) (types.MsgCommitRep func (s *IntegrationTestSuite) TestGetCylceListQueries() { accs, _, _ := s.createValidatorAccs([]int64{100, 200, 300, 400, 500}) // Get supported queries - resp, err := s.oraclekeeper.GetCyclelist(s.ctx) + resp, err := s.Setup.Oraclekeeper.GetCyclelist(s.Setup.Ctx) s.NoError(err) s.Equal(resp, [][]byte{trbQueryData, ethQueryData, btcQueryData}) @@ -313,270 +317,274 @@ func (s *IntegrationTestSuite) TestGetCylceListQueries() { Authority: authtypes.NewModuleAddress(govtypes.ModuleName).String(), Cyclelist: [][]byte{matic}, } - proposal1, err := s.govKeeper.SubmitProposal(s.ctx, []sdk.Msg{msgContent}, "", "test", "description", accs[0], false) + proposal1, err := s.Setup.Govkeeper.SubmitProposal(s.Setup.Ctx, []sdk.Msg{msgContent}, "", "test", "description", accs[0], false) s.NoError(err) - govParams, err := s.govKeeper.Params.Get(s.ctx) + govParams, err := s.Setup.Govkeeper.Params.Get(s.Setup.Ctx) s.NoError(err) - votingStarted, err := s.govKeeper.AddDeposit(s.ctx, proposal1.Id, accs[0], govParams.MinDeposit) + votingStarted, err := s.Setup.Govkeeper.AddDeposit(s.Setup.Ctx, proposal1.Id, accs[0], govParams.MinDeposit) s.NoError(err) s.True(votingStarted) - proposal1, err = s.govKeeper.Proposals.Get(s.ctx, proposal1.Id) + proposal1, err = s.Setup.Govkeeper.Proposals.Get(s.Setup.Ctx, proposal1.Id) s.NoError(err) s.True(proposal1.Status == v1.StatusVotingPeriod) - err = s.govKeeper.AddVote(s.ctx, proposal1.Id, accs[0], v1.NewNonSplitVoteOption(v1.OptionYes), "") + err = s.Setup.Govkeeper.AddVote(s.Setup.Ctx, proposal1.Id, accs[0], v1.NewNonSplitVoteOption(v1.OptionYes), "") s.NoError(err) - err = s.govKeeper.AddVote(s.ctx, proposal1.Id, accs[1], v1.NewNonSplitVoteOption(v1.OptionYes), "") + err = s.Setup.Govkeeper.AddVote(s.Setup.Ctx, proposal1.Id, accs[1], v1.NewNonSplitVoteOption(v1.OptionYes), "") s.NoError(err) - err = s.govKeeper.AddVote(s.ctx, proposal1.Id, accs[2], v1.NewNonSplitVoteOption(v1.OptionYes), "") + err = s.Setup.Govkeeper.AddVote(s.Setup.Ctx, proposal1.Id, accs[2], v1.NewNonSplitVoteOption(v1.OptionYes), "") s.NoError(err) - proposal1, err = s.govKeeper.Proposals.Get(s.ctx, proposal1.Id) + proposal1, err = s.Setup.Govkeeper.Proposals.Get(s.Setup.Ctx, proposal1.Id) s.NoError(err) - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Hour * 24 * 2)) - s.NoError(gov.EndBlocker(s.ctx, s.govKeeper)) - proposal1, err = s.govKeeper.Proposals.Get(s.ctx, proposal1.Id) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(time.Hour * 24 * 2)) + s.NoError(gov.EndBlocker(s.Setup.Ctx, s.Setup.Govkeeper)) + proposal1, err = s.Setup.Govkeeper.Proposals.Get(s.Setup.Ctx, proposal1.Id) s.NoError(err) s.True(proposal1.Status == v1.StatusPassed) - resp, err = s.oraclekeeper.GetCyclelist(s.ctx) + resp, err = s.Setup.Oraclekeeper.GetCyclelist(s.Setup.Ctx) s.NoError(err) s.Equal([][]byte{matic}, resp) } func (s *IntegrationTestSuite) TestTimeBasedRewardsOneReporter() { + reporterPower := int64(1) + repAccs, valAddrs, _ := s.createValidatorAccs([]int64{reporterPower}) + stake, err := s.Setup.Reporterkeeper.ReporterStake(s.Setup.Ctx, repAccs[0]) + s.NoError(err) // send timebasedrewards tokens to oracle module to pay reporters with tipper := s.newKeysWithTokens() reward := math.NewInt(100) - err := s.bankKeeper.SendCoinsFromAccountToModule(s.ctx, tipper, minttypes.TimeBasedRewards, sdk.NewCoins(sdk.NewCoin(s.denom, reward))) + err = s.Setup.Bankkeeper.SendCoinsFromAccountToModule(s.Setup.Ctx, tipper, minttypes.TimeBasedRewards, sdk.NewCoins(sdk.NewCoin(s.Setup.Denom, reward))) s.NoError(err) // testing for a query id and check if the reporter gets the reward, bypassing the commit/reveal process qId := utils.QueryIDFromData(ethQueryData) value := []string{"000001"} - reporterPower := int64(1) - addr, err := createReporter(s.ctx, 1, s.reporterkeeper) - s.NoError(err) - - reports := testutil.GenerateReports([]sdk.AccAddress{addr}, value, []int64{reporterPower}, qId) + reports := testutil.GenerateReports([]sdk.AccAddress{repAccs[0]}, value, []int64{reporterPower}, qId) - bal1 := s.bankKeeper.GetBalance(s.ctx, addr, s.denom) - - _, err = s.oraclekeeper.WeightedMedian(s.ctx, reports[:1]) + _, err = s.Setup.Oraclekeeper.WeightedMedian(s.Setup.Ctx, reports[:1]) s.NoError(err) - queryServer := keeper.NewQuerier(s.oraclekeeper) - res, err := queryServer.GetAggregatedReport(s.ctx, &types.QueryGetCurrentAggregatedReportRequest{QueryId: hex.EncodeToString(qId)}) + queryServer := keeper.NewQuerier(s.Setup.Oraclekeeper) + res, err := queryServer.GetAggregatedReport(s.Setup.Ctx, &types.QueryGetCurrentAggregatedReportRequest{QueryId: hex.EncodeToString(qId)}) s.NoError(err) s.Equal(res.Report.AggregateReportIndex, int64(0), "single report should be at index 0") - tbr, err := queryServer.GetTimeBasedRewards(s.ctx, &types.QueryGetTimeBasedRewardsRequest{}) + tbr, err := queryServer.GetTimeBasedRewards(s.Setup.Ctx, &types.QueryGetTimeBasedRewardsRequest{}) s.NoError(err) - err = s.oraclekeeper.AllocateRewards(s.ctx, res.Report.Reporters, tbr.Reward.Amount, false) + err = s.Setup.Oraclekeeper.AllocateRewards(s.Setup.Ctx, res.Report.Reporters, tbr.Reward.Amount, minttypes.TimeBasedRewards) s.NoError(err) // advance height - s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) - amt, err := s.reporterkeeper.WithdrawDelegationRewards(s.ctx, addr.Bytes(), addr) - s.NoError(err) - s.True(amt.AmountOf(s.denom).GT(math.ZeroInt())) + s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(s.Setup.Ctx.BlockHeight() + 1) - bal2 := s.bankKeeper.GetBalance(s.ctx, addr, s.denom) - s.Equal(bal1.Amount.Add(reward), bal2.Amount, "current balance should be equal to previous balance + reward") + tip, err := s.Setup.Reporterkeeper.DelegatorTips.Get(s.Setup.Ctx, repAccs[0].Bytes()) + s.NoError(err) + s.Equal(tip, reward, "reporter should get the reward") + // withdraw the reward + repServer := reporterkeeper.NewMsgServerImpl(s.Setup.Reporterkeeper) + _, err = repServer.WithdrawTip(s.Setup.Ctx, &reportertypes.MsgWithdrawTip{DelegatorAddress: repAccs[0].String(), ValidatorAddress: valAddrs[0].String()}) + s.NoError(err) + bond, err := s.Setup.Stakingkeeper.GetDelegatorBonded(s.Setup.Ctx, repAccs[0]) + s.NoError(err) + s.Equal(stake.Add(reward), bond, "current balance should be equal to previous balance + reward") } func (s *IntegrationTestSuite) TestTimeBasedRewardsTwoReporters() { - // send timebasedrewards tokens to oracle module to pay reporters with - tipper := s.newKeysWithTokens() - reward := math.NewInt(100) - err := s.bankKeeper.SendCoinsFromAccountToModule(s.ctx, tipper, minttypes.TimeBasedRewards, sdk.NewCoins(sdk.NewCoin(s.denom, reward))) - s.NoError(err) - qId := utils.QueryIDFromData(ethQueryData) value := []string{"000001", "000002"} reporterPower1 := int64(1) reporterPower2 := int64(2) totalReporterPower := reporterPower1 + reporterPower2 - - reporterAddr, err := createReporter(s.ctx, 1, s.reporterkeeper) + repAccs, _, _ := s.createValidatorAccs([]int64{reporterPower1, reporterPower2}) + reporterStake, err := s.Setup.Reporterkeeper.ReporterStake(s.Setup.Ctx, repAccs[0]) s.NoError(err) - reporterAddr2, err := createReporter(s.ctx, 2, s.reporterkeeper) + reporterStake2, err := s.Setup.Reporterkeeper.ReporterStake(s.Setup.Ctx, repAccs[1]) + s.NoError(err) + // send timebasedrewards tokens to oracle module to pay reporters with + tipper := s.newKeysWithTokens() + reward := math.NewInt(100) + err = s.Setup.Bankkeeper.SendCoinsFromAccountToModule(s.Setup.Ctx, tipper, minttypes.TimeBasedRewards, sdk.NewCoins(sdk.NewCoin(s.Setup.Denom, reward))) s.NoError(err) - // generate 2 reports for ethQueryData - reports := testutil.GenerateReports([]sdk.AccAddress{reporterAddr, reporterAddr2}, value, []int64{reporterPower1, reporterPower2}, qId) + reports := testutil.GenerateReports([]sdk.AccAddress{repAccs[0], repAccs[1]}, value, []int64{reporterPower1, reporterPower2}, qId) testCases := []struct { name string reporterIndex int - beforeBalance sdk.Coin + beforeBalance math.Int afterBalanceIncrease math.Int delegator sdk.AccAddress }{ { name: "reporter with 1 voting power", reporterIndex: 0, - beforeBalance: s.bankKeeper.GetBalance(s.ctx, reporterAddr, s.denom), + beforeBalance: reporterStake, afterBalanceIncrease: keeper.CalculateRewardAmount(reporterPower1, 1, totalReporterPower, reward), - delegator: reporterAddr, + delegator: repAccs[0], }, { name: "reporter with 2 voting power", reporterIndex: 1, - beforeBalance: s.bankKeeper.GetBalance(s.ctx, reporterAddr2, s.denom), + beforeBalance: reporterStake2, afterBalanceIncrease: keeper.CalculateRewardAmount(reporterPower2, 1, totalReporterPower, reward), - delegator: reporterAddr2, + delegator: repAccs[1], }, } - _, err = s.oraclekeeper.WeightedMedian(s.ctx, reports) + _, err = s.Setup.Oraclekeeper.WeightedMedian(s.Setup.Ctx, reports) s.NoError(err) - queryServer := keeper.NewQuerier(s.oraclekeeper) - res, err := queryServer.GetAggregatedReport(s.ctx, &types.QueryGetCurrentAggregatedReportRequest{QueryId: hex.EncodeToString(qId)}) + queryServer := keeper.NewQuerier(s.Setup.Oraclekeeper) + res, err := queryServer.GetAggregatedReport(s.Setup.Ctx, &types.QueryGetCurrentAggregatedReportRequest{QueryId: hex.EncodeToString(qId)}) s.NoError(err, "error getting aggregated report") - tbr, err := queryServer.GetTimeBasedRewards(s.ctx, &types.QueryGetTimeBasedRewardsRequest{}) + tbr, err := queryServer.GetTimeBasedRewards(s.Setup.Ctx, &types.QueryGetTimeBasedRewardsRequest{}) s.NoError(err, "error getting time based rewards") - err = s.oraclekeeper.AllocateRewards(s.ctx, res.Report.Reporters, tbr.Reward.Amount, false) + err = s.Setup.Oraclekeeper.AllocateRewards(s.Setup.Ctx, res.Report.Reporters, tbr.Reward.Amount, minttypes.TimeBasedRewards) s.NoError(err, "error allocating rewards") - + reporterServer := reporterkeeper.NewMsgServerImpl(s.Setup.Reporterkeeper) // advance height - s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) + s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(s.Setup.Ctx.BlockHeight() + 1) for _, tc := range testCases { s.T().Run(tc.name, func(t *testing.T) { - _, err = s.reporterkeeper.WithdrawDelegationRewards(s.ctx, tc.delegator.Bytes(), tc.delegator) + _, err = reporterServer.WithdrawTip(s.Setup.Ctx, &reportertypes.MsgWithdrawTip{DelegatorAddress: tc.delegator.String(), ValidatorAddress: sdk.ValAddress(tc.delegator).String()}) + s.NoError(err) + afterBalance, err := s.Setup.Stakingkeeper.GetDelegatorBonded(s.Setup.Ctx, tc.delegator) s.NoError(err) - afterBalance := s.bankKeeper.GetBalance(s.ctx, tc.delegator, s.denom) - s.Equal(tc.beforeBalance.Amount.Add(tc.afterBalanceIncrease), afterBalance.Amount) + s.Equal(tc.beforeBalance.Add(tc.afterBalanceIncrease), afterBalance) }) } } func (s *IntegrationTestSuite) TestTimeBasedRewardsThreeReporters() { - tipper := s.newKeysWithTokens() - reward := math.NewInt(100) - err := s.bankKeeper.SendCoinsFromAccountToModule(s.ctx, tipper, minttypes.TimeBasedRewards, sdk.NewCoins(sdk.NewCoin(s.denom, reward))) - s.NoError(err) - values := []string{"000001", "000002", "000003", "000004"} reporterPower1 := int64(1) reporterPower2 := int64(2) reporterPower3 := int64(3) totalPower := reporterPower1 + reporterPower2 + reporterPower3 - - reporterAddr, err := createReporter(s.ctx, 1, s.reporterkeeper) + repAccs, _, _ := s.createValidatorAccs([]int64{reporterPower1, reporterPower2, reporterPower3}) + reporterStake, err := s.Setup.Reporterkeeper.ReporterStake(s.Setup.Ctx, repAccs[0]) s.NoError(err) - reporterAddr2, err := createReporter(s.ctx, 2, s.reporterkeeper) + reporterStake2, err := s.Setup.Reporterkeeper.ReporterStake(s.Setup.Ctx, repAccs[1]) s.NoError(err) - reporterAddr3, err := createReporter(s.ctx, 3, s.reporterkeeper) + reporterStake3, err := s.Setup.Reporterkeeper.ReporterStake(s.Setup.Ctx, repAccs[2]) s.NoError(err) + tipper := s.newKeysWithTokens() + reward := math.NewInt(100) + err = s.Setup.Bankkeeper.SendCoinsFromAccountToModule(s.Setup.Ctx, tipper, minttypes.TimeBasedRewards, sdk.NewCoins(sdk.NewCoin(s.Setup.Denom, reward))) + s.NoError(err) // generate 4 reports for ethQueryData qId := utils.QueryIDFromData(ethQueryData) - reports := testutil.GenerateReports([]sdk.AccAddress{reporterAddr, reporterAddr2, reporterAddr3}, values, []int64{reporterPower1, reporterPower2, reporterPower3}, qId) + reports := testutil.GenerateReports([]sdk.AccAddress{repAccs[0], repAccs[1], repAccs[2]}, values, []int64{reporterPower1, reporterPower2, reporterPower3}, qId) testCases := []struct { name string reporterIndex int - beforeBalance sdk.Coin + beforeBalance math.Int afterBalanceIncrease math.Int delegator sdk.AccAddress }{ { name: "reporter with 100 voting power", reporterIndex: 0, - beforeBalance: s.bankKeeper.GetBalance(s.ctx, reporterAddr, s.denom), + beforeBalance: reporterStake, afterBalanceIncrease: keeper.CalculateRewardAmount(reporterPower1, 1, totalPower, reward), - delegator: reporterAddr, + delegator: repAccs[0], }, { name: "reporter with 200 voting power", reporterIndex: 1, - beforeBalance: s.bankKeeper.GetBalance(s.ctx, reporterAddr2, s.denom), + beforeBalance: reporterStake2, afterBalanceIncrease: keeper.CalculateRewardAmount(reporterPower2, 1, totalPower, reward), - delegator: reporterAddr2, + delegator: repAccs[1], }, { name: "reporter with 300 voting power", reporterIndex: 2, - beforeBalance: s.bankKeeper.GetBalance(s.ctx, reporterAddr3, s.denom), + beforeBalance: reporterStake3, afterBalanceIncrease: keeper.CalculateRewardAmount(reporterPower3, 1, totalPower, reward), - delegator: reporterAddr3, + delegator: repAccs[2], }, } - _, err = s.oraclekeeper.WeightedMedian(s.ctx, reports[:3]) + _, err = s.Setup.Oraclekeeper.WeightedMedian(s.Setup.Ctx, reports[:3]) s.NoError(err) - queryServer := keeper.NewQuerier(s.oraclekeeper) - res, _ := queryServer.GetAggregatedReport(s.ctx, &types.QueryGetCurrentAggregatedReportRequest{QueryId: hex.EncodeToString(qId)}) - tbr, _ := queryServer.GetTimeBasedRewards(s.ctx, &types.QueryGetTimeBasedRewardsRequest{}) - err = s.oraclekeeper.AllocateRewards(s.ctx, res.Report.Reporters, tbr.Reward.Amount, false) + queryServer := keeper.NewQuerier(s.Setup.Oraclekeeper) + res, _ := queryServer.GetAggregatedReport(s.Setup.Ctx, &types.QueryGetCurrentAggregatedReportRequest{QueryId: hex.EncodeToString(qId)}) + tbr, _ := queryServer.GetTimeBasedRewards(s.Setup.Ctx, &types.QueryGetTimeBasedRewardsRequest{}) + err = s.Setup.Oraclekeeper.AllocateRewards(s.Setup.Ctx, res.Report.Reporters, tbr.Reward.Amount, minttypes.TimeBasedRewards) s.NoError(err) // advance height - s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) + s.Setup.Ctx = s.Setup.Ctx.WithBlockHeight(s.Setup.Ctx.BlockHeight() + 1) + reporterServer := reporterkeeper.NewMsgServerImpl(s.Setup.Reporterkeeper) for _, tc := range testCases { s.T().Run(tc.name, func(t *testing.T) { - _, err = s.reporterkeeper.WithdrawDelegationRewards(s.ctx, tc.delegator.Bytes(), tc.delegator) + _, err = reporterServer.WithdrawTip(s.Setup.Ctx, &reportertypes.MsgWithdrawTip{DelegatorAddress: tc.delegator.String(), ValidatorAddress: sdk.ValAddress(tc.delegator).String()}) s.NoError(err) - afterBalance := s.bankKeeper.GetBalance(s.ctx, tc.delegator, s.denom) - expectedAfterBalance := tc.beforeBalance.Amount.Add(tc.afterBalanceIncrease) + afterBalance, err := s.Setup.Stakingkeeper.GetDelegatorBonded(s.Setup.Ctx, tc.delegator) + s.NoError(err) + expectedAfterBalance := tc.beforeBalance.Add(tc.afterBalanceIncrease) tolerance := expectedAfterBalance.SubRaw(1) - withinTolerance := expectedAfterBalance.Equal(afterBalance.Amount) || tolerance.Equal(afterBalance.Amount) + withinTolerance := expectedAfterBalance.Equal(afterBalance) || tolerance.Equal(afterBalance) s.True(withinTolerance) }) } } func (s *IntegrationTestSuite) TestCommitQueryMixed() { - tipper := s.newKeysWithTokens() - msgServer := keeper.NewMsgServerImpl(s.oraclekeeper) - // accs, _, _ := s.createValidatorAccs([]int64{100, 200, 300, 400, 500}) - queryData1, err := s.oraclekeeper.GetCurrentQueryInCycleList(s.ctx) + msgServer := keeper.NewMsgServerImpl(s.Setup.Oraclekeeper) + repAccs, _, _ := s.createValidatorAccs([]int64{100}) + _, err := s.Setup.Reporterkeeper.ReporterStake(s.Setup.Ctx, repAccs[0]) + s.NoError(err) + queryData1, err := s.Setup.Oraclekeeper.GetCurrentQueryInCycleList(s.Setup.Ctx) s.Nil(err) + queryData2, _ := hex.DecodeString("00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706F745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C00000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000056D6174696300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000") queryData3, _ := hex.DecodeString("00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706F745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000005737465746800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000") + + tipper := s.newKeysWithTokens() msg := types.MsgTip{ Tipper: tipper.String(), QueryData: queryData2, - Amount: sdk.NewCoin(s.denom, math.NewInt(1000)), + Amount: sdk.NewCoin(s.Setup.Denom, math.NewInt(1000)), } - _, err = msgServer.Tip(s.ctx, &msg) - s.Nil(err) - reporterAddr, err := createReporter(s.ctx, 1, s.reporterkeeper) + _, err = msgServer.Tip(s.Setup.Ctx, &msg) s.Nil(err) + value := "000000000000000000000000000000000000000000000058528649cf80ee0000" salt, err := oracleutils.Salt(32) s.Nil(err) hash := oracleutils.CalculateCommitment(value, salt) s.Nil(err) // commit report with query data in cycle list - commit, _ := report(reporterAddr.String(), value, salt, hash, queryData1) - _, err = msgServer.CommitReport(s.ctx, &commit) + commit, _ := report(repAccs[0].String(), value, salt, hash, queryData1) + _, err = msgServer.CommitReport(s.Setup.Ctx, &commit) s.Nil(err) // commit report with query data not in cycle list but has a tip - commit, _ = report(reporterAddr.String(), value, salt, hash, queryData2) - _, err = msgServer.CommitReport(s.ctx, &commit) + commit, _ = report(repAccs[0].String(), value, salt, hash, queryData2) + _, err = msgServer.CommitReport(s.Setup.Ctx, &commit) s.Nil(err) // commit report with query data not in cycle list and has no tip - commit, _ = report(reporterAddr.String(), value, salt, hash, queryData3) - _, err = msgServer.CommitReport(s.ctx, &commit) + commit, _ = report(repAccs[0].String(), value, salt, hash, queryData3) + _, err = msgServer.CommitReport(s.Setup.Ctx, &commit) s.ErrorContains(err, "query not part of cyclelist") } // test tipping a query id not in cycle list and observe the reporters' delegators stake increase in staking module func (s *IntegrationTestSuite) TestTipQueryNotInCycleListSingleDelegator() { require := s.Require() - s.ctx = s.ctx.WithBlockTime(time.Now()) - msgServer := keeper.NewMsgServerImpl(s.oraclekeeper) - _, valAddrs, _ := s.createValidatorAccs([]int64{1000}) - repAccs := s.CreateAccountsWithTokens(2, 100*1e6) - - stakeAmount := math.NewInt(100 * 1e6) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(time.Now()) + msgServer := keeper.NewMsgServerImpl(s.Setup.Oraclekeeper) + repAccs, valAddrs, _ := s.createValidatorAccs([]int64{1000}) + stakeAmount, err := s.Setup.Reporterkeeper.ReporterStake(s.Setup.Ctx, repAccs[0]) + require.NoError(err) tipAmount := math.NewInt(1000) - tipper := repAccs[0] - repAcc := repAccs[1] + tipper := s.newKeysWithTokens() + valAddr := valAddrs[0] - delegators := repAccs[1:] queryData, _ := utils.QueryBytesFromString("00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706F745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000366696C000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000") queryId := utils.QueryIDFromData(queryData) @@ -585,71 +593,67 @@ func (s *IntegrationTestSuite) TestTipQueryNotInCycleListSingleDelegator() { msg := types.MsgTip{ Tipper: tipper.String(), QueryData: queryData, - Amount: sdk.NewCoin(s.denom, tipAmount), + Amount: sdk.NewCoin(s.Setup.Denom, tipAmount), } - _, err := msgServer.Tip(s.ctx, &msg) - s.Nil(err) - - // create createReporterStakedWithValidator handles the delegation and staking plus the reporter creation - commission := reportertypes.NewCommissionWithTime(math.LegacyZeroDec(), math.LegacyZeroDec(), math.LegacyZeroDec(), s.ctx.BlockTime()) - _, err = createReporterStakedWithValidator(s.ctx, s.reporterkeeper, s.stakingKeeper, valAddr, delegators, commission, stakeAmount) + _, err = msgServer.Tip(s.Setup.Ctx, &msg) s.Nil(err) // check delegation shares before reporting, should be equal to the stake amount - delBefore, err := s.stakingKeeper.Delegation(s.ctx, repAcc.Bytes(), valAddr) + delBefore, err := s.Setup.Stakingkeeper.Delegation(s.Setup.Ctx, repAccs[0].Bytes(), valAddr) s.Nil(err) s.True(delBefore.GetShares().Equal(math.LegacyNewDecFromInt(stakeAmount)), "delegation shares should be equal to the stake amount") reporterPower := int64(1) value := []string{"000001"} - reports := testutil.GenerateReports(repAccs[1:], value, []int64{reporterPower}, queryId) - query, err := s.oraclekeeper.Query.Get(s.ctx, queryId) + reports := testutil.GenerateReports(repAccs, value, []int64{reporterPower}, queryId) + query, err := s.Setup.Oraclekeeper.Query.Get(s.Setup.Ctx, queryId) s.Nil(err) query.HasRevealedReports = true - s.Nil(s.oraclekeeper.Query.Set(s.ctx, queryId, query)) - err = s.oraclekeeper.Reports.Set(s.ctx, collections.Join3(queryId, repAcc.Bytes(), query.Id), reports[0]) + s.Nil(s.Setup.Oraclekeeper.Query.Set(s.Setup.Ctx, queryId, query)) + err = s.Setup.Oraclekeeper.Reports.Set(s.Setup.Ctx, collections.Join3(queryId, repAccs[0].Bytes(), query.Id), reports[0]) s.Nil(err) - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Second * 7)) // bypassing offset that expires time to commit/reveal - err = s.oraclekeeper.SetAggregatedReport(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(time.Second * 7)) // bypassing offset that expires time to commit/reveal + err = s.Setup.Oraclekeeper.SetAggregatedReport(s.Setup.Ctx) s.Nil(err) // check that tip is in escrow - escrowAcct := s.accountKeeper.GetModuleAddress(reportertypes.TipsEscrowPool) + escrowAcct := s.Setup.Accountkeeper.GetModuleAddress(reportertypes.TipsEscrowPool) require.NotNil(escrowAcct) - escrowBalance := s.bankKeeper.GetBalance(s.ctx, escrowAcct, s.denom) + escrowBalance := s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, escrowAcct, s.Setup.Denom) require.NotNil(escrowBalance) - twoPercent := sdk.NewCoin(s.denom, tipAmount.Mul(math.NewInt(2)).Quo(math.NewInt(100))) + twoPercent := sdk.NewCoin(s.Setup.Denom, tipAmount.Mul(math.NewInt(2)).Quo(math.NewInt(100))) require.Equal(tipAmount.Sub(twoPercent.Amount), escrowBalance.Amount) // create reporterMsgServer - reporterMsgServer := reporterkeeper.NewMsgServerImpl(s.reporterkeeper) + reporterMsgServer := reporterkeeper.NewMsgServerImpl(s.Setup.Reporterkeeper) // withdraw tip - _, err = reporterMsgServer.WithdrawTip(s.ctx, &reportertypes.MsgWithdrawTip{DelegatorAddress: repAcc.String(), ValidatorAddress: valAddr.String()}) + _, err = reporterMsgServer.WithdrawTip(s.Setup.Ctx, &reportertypes.MsgWithdrawTip{DelegatorAddress: repAccs[0].String(), ValidatorAddress: valAddr.String()}) require.NoError(err) // delegation shares should increase after reporting and escrow balance should go back to 0 - delAfter, err := s.stakingKeeper.Delegation(s.ctx, repAcc.Bytes(), valAddr) + delAfter, err := s.Setup.Stakingkeeper.Delegation(s.Setup.Ctx, repAccs[0].Bytes(), valAddr) s.Nil(err) s.True(delAfter.GetShares().Equal(delBefore.GetShares().Add(math.LegacyNewDec(980))), "delegation shares plus the tip added") // 1000 - 2% tip - escrowBalance = s.bankKeeper.GetBalance(s.ctx, escrowAcct, s.denom) + escrowBalance = s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, escrowAcct, s.Setup.Denom) s.True(escrowBalance.IsZero()) } func (s *IntegrationTestSuite) TestTipQueryNotInCycleListTwoDelegators() { require := s.Require() - msgServer := keeper.NewMsgServerImpl(s.oraclekeeper) - _, valAddrs, _ := s.createValidatorAccs([]int64{1000}) - accs := s.CreateAccountsWithTokens(3, 100*1e6) + msgServer := keeper.NewMsgServerImpl(s.Setup.Oraclekeeper) + repAccs, valAddrs, _ := s.createValidatorAccs([]int64{1, 2}) + reporterStake1, err := s.Setup.Reporterkeeper.ReporterStake(s.Setup.Ctx, repAccs[0]) + require.NoError(err) + reporterStake2, err := s.Setup.Reporterkeeper.ReporterStake(s.Setup.Ctx, repAccs[1]) + require.NoError(err) - stakeAmount := math.NewInt(100 * 1e6) tipAmount := math.NewInt(1000) - tipper := accs[0] - repAcc := accs[1] - valAddr := valAddrs[0] - delegators := accs[1:] - delegator1 := accs[1] - delegator2 := accs[2] + tipper := s.newKeysWithTokens() + valAddr1 := valAddrs[0] + valAddr2 := valAddrs[1] + delegator1 := repAccs[0] + delegator2 := repAccs[1] queryData, _ := utils.QueryBytesFromString("00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706F745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000366696C000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000") queryId := utils.QueryIDFromData(queryData) @@ -658,66 +662,59 @@ func (s *IntegrationTestSuite) TestTipQueryNotInCycleListTwoDelegators() { msg := types.MsgTip{ Tipper: tipper.String(), QueryData: queryData, - Amount: sdk.NewCoin(s.denom, tipAmount), + Amount: sdk.NewCoin(s.Setup.Denom, tipAmount), } - _, err := msgServer.Tip(s.ctx, &msg) - s.Nil(err) - - // create createReporterStakedWithValidator handles the delegation and staking plus the reporter creation with 50 percent commission - commission := reportertypes.NewCommissionWithTime(math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDecWithPrec(5, 1), s.ctx.BlockTime()) - _, err = createReporterStakedWithValidator(s.ctx, s.reporterkeeper, s.stakingKeeper, valAddr, delegators, commission, stakeAmount) - s.Nil(err) - source := reportertypes.TokenOrigin{ValidatorAddress: valAddr.Bytes(), Amount: stakeAmount} - err = DelegateToReporterSingleValidator(s.ctx, s.reporterkeeper, repAcc, delegator2, valAddr, []*reportertypes.TokenOrigin{&source}, stakeAmount) + _, err = msgServer.Tip(s.Setup.Ctx, &msg) s.Nil(err) // check delegation shares before reporting, should be equal to the stake amount - del1Before, err := s.stakingKeeper.Delegation(s.ctx, delegator1.Bytes(), valAddr) + del1Before, err := s.Setup.Stakingkeeper.Delegation(s.Setup.Ctx, delegator1.Bytes(), valAddr1) s.Nil(err) - s.True(del1Before.GetShares().Equal(math.LegacyNewDecFromInt(stakeAmount)), "delegation 1 shares should be equal to the stake amount") + s.True(del1Before.GetShares().Equal(math.LegacyNewDecFromInt(reporterStake1)), "delegation 1 shares should be equal to the stake amount") - del2Before, err := s.stakingKeeper.Delegation(s.ctx, delegator2.Bytes(), valAddr) + del2Before, err := s.Setup.Stakingkeeper.Delegation(s.Setup.Ctx, delegator2.Bytes(), valAddr2) s.Nil(err) - s.True(del2Before.GetShares().Equal(math.LegacyNewDecFromInt(stakeAmount)), "delegation 2 shares should be equal to the stake amount") + s.True(del2Before.GetShares().Equal(math.LegacyNewDecFromInt(reporterStake2)), "delegation 2 shares should be equal to the stake amount") - reporterPower := int64(2) // normalize by sdk.DefaultPowerReduction - value := []string{"000001"} - reports := testutil.GenerateReports([]sdk.AccAddress{repAcc}, value, []int64{reporterPower}, queryId) - query, err := s.oraclekeeper.Query.Get(s.ctx, queryId) + reporterPower := int64(1) + reporterPower2 := int64(2) + value := []string{"000001", "000002"} + reports := testutil.GenerateReports([]sdk.AccAddress{repAccs[0], repAccs[1]}, value, []int64{reporterPower, reporterPower2}, queryId) + query, err := s.Setup.Oraclekeeper.Query.Get(s.Setup.Ctx, queryId) s.Nil(err) query.HasRevealedReports = true - s.NoError(s.oraclekeeper.Query.Set(s.ctx, queryId, query)) - err = s.oraclekeeper.Reports.Set(s.ctx, collections.Join3(queryId, repAcc.Bytes(), query.Id), reports[0]) + s.NoError(s.Setup.Oraclekeeper.Query.Set(s.Setup.Ctx, queryId, query)) + err = s.Setup.Oraclekeeper.Reports.Set(s.Setup.Ctx, collections.Join3(queryId, repAccs[0].Bytes(), query.Id), reports[0]) + s.Nil(err) + err = s.Setup.Oraclekeeper.Reports.Set(s.Setup.Ctx, collections.Join3(queryId, repAccs[1].Bytes(), query.Id), reports[1]) s.Nil(err) - s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Second * 7)) // bypassing offset that expires time to commit/reveal - err = s.oraclekeeper.SetAggregatedReport(s.ctx) + s.Setup.Ctx = s.Setup.Ctx.WithBlockTime(s.Setup.Ctx.BlockTime().Add(time.Second * 7)) // bypassing offset that expires time to commit/reveal + err = s.Setup.Oraclekeeper.SetAggregatedReport(s.Setup.Ctx) s.Nil(err) // check tip escrow account - escrowAcct := s.accountKeeper.GetModuleAddress(reportertypes.TipsEscrowPool) + escrowAcct := s.Setup.Accountkeeper.GetModuleAddress(reportertypes.TipsEscrowPool) require.NotNil(escrowAcct) - escrowBalance := s.bankKeeper.GetBalance(s.ctx, escrowAcct, s.denom) + escrowBalance := s.Setup.Bankkeeper.GetBalance(s.Setup.Ctx, escrowAcct, s.Setup.Denom) require.NotNil(escrowBalance) - twoPercent := sdk.NewCoin(s.denom, tipAmount.Mul(math.NewInt(2)).Quo(math.NewInt(100))) + twoPercent := sdk.NewCoin(s.Setup.Denom, tipAmount.Mul(math.NewInt(2)).Quo(math.NewInt(100))) require.Equal(tipAmount.Sub(twoPercent.Amount), escrowBalance.Amount) // withdraw self delegation from tip escrow - reporterMsgServer := reporterkeeper.NewMsgServerImpl(s.reporterkeeper) - _, err = reporterMsgServer.WithdrawTip(s.ctx, &reportertypes.MsgWithdrawTip{DelegatorAddress: delegator1.String(), ValidatorAddress: valAddr.String()}) + reporterMsgServer := reporterkeeper.NewMsgServerImpl(s.Setup.Reporterkeeper) + _, err = reporterMsgServer.WithdrawTip(s.Setup.Ctx, &reportertypes.MsgWithdrawTip{DelegatorAddress: delegator1.String(), ValidatorAddress: valAddr1.String()}) require.NoError(err) // delegation shares should increase after reporting and withdrawing - del1After, err := s.stakingKeeper.Delegation(s.ctx, delegator1.Bytes(), valAddr) + del1After, err := s.Setup.Stakingkeeper.Delegation(s.Setup.Ctx, delegator1.Bytes(), valAddr1) s.Nil(err) - // 980 = 1000 - 2% tip, 980 / 2 = 490 for each delegator but with 50 percent commission for the reporter would be 490 + (490 / 2) = 735 - s.True(del1After.GetShares().Equal(del1Before.GetShares().Add(math.LegacyNewDec(735))), "delegation 1 (self delegation) shares should be half the tip plus 50 percent commission") + s.True(del1After.GetShares().Equal(del1Before.GetShares().Add(math.LegacyNewDec(327))), "delegation 1 (self delegation) shares should be half the tip plus 50 percent commission") // withdraw del2 delegation from tip escrow - _, err = reporterMsgServer.WithdrawTip(s.ctx, &reportertypes.MsgWithdrawTip{DelegatorAddress: delegator2.String(), ValidatorAddress: valAddr.String()}) + _, err = reporterMsgServer.WithdrawTip(s.Setup.Ctx, &reportertypes.MsgWithdrawTip{DelegatorAddress: delegator2.String(), ValidatorAddress: valAddr2.String()}) require.NoError(err) - // 980 - 735 = 245 - del2After, err := s.stakingKeeper.Delegation(s.ctx, delegator2.Bytes(), valAddr) + del2After, err := s.Setup.Stakingkeeper.Delegation(s.Setup.Ctx, delegator2.Bytes(), valAddr2) s.Nil(err) - s.True(del2After.GetShares().Equal(del2Before.GetShares().Add(math.LegacyNewDec(245))), "delegation 2 shares should be half the tip minus 50 percent reporter commission") + s.True(del2After.GetShares().Equal(del2Before.GetShares().Add(math.LegacyNewDec(653))), "delegation 2 shares should be half the tip minus 50 percent reporter commission") } diff --git a/tests/integration/registry_keeper_test.go b/tests/integration/registry_keeper_test.go index fc546d41d..906cceae5 100644 --- a/tests/integration/registry_keeper_test.go +++ b/tests/integration/registry_keeper_test.go @@ -9,7 +9,7 @@ import ( ) func (s *IntegrationTestSuite) TestRegistryKeeper() { - ms := keeper.NewMsgServerImpl(s.registrykeeper) + ms := keeper.NewMsgServerImpl(s.Setup.Registrykeeper) authority := authtypes.NewModuleAddress(govtypes.ModuleName).String() queryType := "testQueryType" spec := types.DataSpec{ @@ -24,7 +24,7 @@ func (s *IntegrationTestSuite) TestRegistryKeeper() { QueryType: queryType, Spec: spec, } - _, err := ms.RegisterSpec(s.ctx, registerSpecInput) + _, err := ms.RegisterSpec(s.Setup.Ctx, registerSpecInput) s.NoError(err) // Update spec spec.ResponseValueType = "uint128" @@ -33,11 +33,11 @@ func (s *IntegrationTestSuite) TestRegistryKeeper() { QueryType: queryType, Spec: spec, } - _, err = ms.UpdateDataSpec(s.ctx, updateSpecInput) + _, err = ms.UpdateDataSpec(s.Setup.Ctx, updateSpecInput) s.NoError(err) // Check if spec is updated - getSpec, err := s.registrykeeper.GetSpec(s.ctx, queryType) + getSpec, err := s.Setup.Registrykeeper.GetSpec(s.Setup.Ctx, queryType) s.NoError(err) s.Equal("uint128", getSpec.ResponseValueType) @@ -50,6 +50,6 @@ func (s *IntegrationTestSuite) TestRegistryKeeper() { QueryType: queryType, Spec: spec, } - _, err = ms.UpdateDataSpec(s.ctx, updateSpecInput) + _, err = ms.UpdateDataSpec(s.Setup.Ctx, updateSpecInput) s.ErrorContains(err, "invalidAuthority") } diff --git a/tests/integration/reporter_keeper_test.go b/tests/integration/reporter_keeper_test.go index 446928128..f003ac216 100644 --- a/tests/integration/reporter_keeper_test.go +++ b/tests/integration/reporter_keeper_test.go @@ -1,8 +1,6 @@ package integration_test import ( - "fmt" - "github.com/tellor-io/layer/testutil/sample" "github.com/tellor-io/layer/x/reporter/keeper" reportertypes "github.com/tellor-io/layer/x/reporter/types" @@ -10,393 +8,51 @@ import ( "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" + stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) -const ( - reporter = "reporter" - delegatorI = "delegator1" - delegatorII = "delegator2" - delegatorIII = "delegator3" - delegatorIV = "delegator4" -) - -type Delegator struct { - delegatorAddress sdk.AccAddress - validator stakingtypes.Validator - tokenAmount math.Int -} - -func createdelegators(ctx sdk.Context, delegators map[string]Delegator, sk reportertypes.StakingKeeper) (map[string]Delegator, error) { - for _, del := range delegators { - _, err := sk.Delegate(ctx, del.delegatorAddress, del.tokenAmount, stakingtypes.Unbonded, del.validator, true) - if err != nil { - return nil, err - } - } - return delegators, nil -} - -func (s *IntegrationTestSuite) TestRegisteringReporterDelegators() map[string]Delegator { - _, valAddr, _ := s.createValidatorAccs([]int64{1000}) - val, err := s.stakingKeeper.GetValidator(s.ctx, valAddr[0]) - s.NoError(err) - // create delegator funded accounts - delAcc := s.CreateAccountsWithTokens(5, 100*1e6) - delegators := map[string]Delegator{ - reporter: {delegatorAddress: delAcc[0], validator: val, tokenAmount: math.NewInt(100 * 1e6)}, - delegatorI: {delegatorAddress: delAcc[1], validator: val, tokenAmount: math.NewInt(100 * 1e6)}, - delegatorII: {delegatorAddress: delAcc[2], validator: val, tokenAmount: math.NewInt(100 * 1e6)}, - delegatorIII: {delegatorAddress: delAcc[3], validator: val, tokenAmount: math.NewInt(100 * 1e6)}, - delegatorIV: {delegatorAddress: delAcc[4], validator: val, tokenAmount: math.NewInt(100 * 1e6)}, - } - delegators, err = createdelegators(s.ctx, delegators, s.stakingKeeper) - s.NoError(err) - - // register reporter in reporter module - commission := reportertypes.NewCommissionWithTime(math.LegacyNewDecWithPrec(1, 1), math.LegacyNewDecWithPrec(3, 1), - math.LegacyNewDecWithPrec(1, 1), s.ctx.BlockTime()) - source := reportertypes.TokenOrigin{ValidatorAddress: valAddr[0], Amount: math.NewIntFromUint64(100 * 1e6)} - createReporterMsg := reportertypes.NewMsgCreateReporter(delegators[reporter].delegatorAddress.String(), math.NewIntFromUint64(100*1e6), []*reportertypes.TokenOrigin{&source}, &commission) - server := keeper.NewMsgServerImpl(s.reporterkeeper) - _, err = server.CreateReporter(s.ctx, createReporterMsg) - s.NoError(err) - - oracleReporter, err := s.reporterkeeper.Reporters.Get(s.ctx, delegators[reporter].delegatorAddress) - s.NoError(err) - s.Equal(oracleReporter.Reporter, delegators[reporter].delegatorAddress.Bytes()) - s.Equal(oracleReporter.TotalTokens, math.NewInt(100*1e6)) - - // add delegation to reporter - source = reportertypes.TokenOrigin{ValidatorAddress: valAddr[0], Amount: math.NewInt(25 * 1e6)} - delegationI := reportertypes.NewMsgDelegateReporter( - delegators[delegatorI].delegatorAddress.String(), - delegators[reporter].delegatorAddress.String(), - math.NewInt(25*1e6), - []*reportertypes.TokenOrigin{&source}, - ) - _, err = server.DelegateReporter(s.ctx, delegationI) - s.NoError(err) - delegationIReporter, err := s.reporterkeeper.Delegators.Get(s.ctx, delegators[delegatorI].delegatorAddress) - s.NoError(err) - s.Equal(delegationIReporter.Reporter, delegators[reporter].delegatorAddress.Bytes()) - - oracleReporter, err = s.reporterkeeper.Reporters.Get(s.ctx, delegators[reporter].delegatorAddress) - s.NoError(err) - s.Equal(oracleReporter.TotalTokens, math.NewInt(125*1e6)) - // add 2nd delegation to reporter - delegationII := reportertypes.NewMsgDelegateReporter( - delegators[delegatorII].delegatorAddress.String(), - delegators[reporter].delegatorAddress.String(), - math.NewInt(25*1e6), - []*reportertypes.TokenOrigin{&source}, - ) - _, err = server.DelegateReporter(s.ctx, delegationII) - s.NoError(err) - delegationIIReporter, err := s.reporterkeeper.Delegators.Get(s.ctx, delegators[delegatorII].delegatorAddress) - s.NoError(err) - s.Equal(delegationIIReporter.Reporter, delegators[reporter].delegatorAddress.Bytes()) - - oracleReporter, err = s.reporterkeeper.Reporters.Get(s.ctx, delegators[reporter].delegatorAddress) - s.NoError(err) - s.Equal(oracleReporter.TotalTokens, math.NewInt(150*1e6)) - // add 3rd delegation to reporter - delegationIII := reportertypes.NewMsgDelegateReporter( - delegators[delegatorIII].delegatorAddress.String(), - delegators[reporter].delegatorAddress.String(), - math.NewInt(25*1e6), - []*reportertypes.TokenOrigin{&source}, - ) - _, err = server.DelegateReporter(s.ctx, delegationIII) - s.NoError(err) - delegationIIIReporter, err := s.reporterkeeper.Delegators.Get(s.ctx, delegators[delegatorIII].delegatorAddress) - s.NoError(err) - s.Equal(delegationIIIReporter.Reporter, delegators[reporter].delegatorAddress.Bytes()) - - oracleReporter, err = s.reporterkeeper.Reporters.Get(s.ctx, delegators[reporter].delegatorAddress) - s.NoError(err) - s.Equal(oracleReporter.TotalTokens, math.NewInt(175*1e6)) - // add 4th delegation to reporter - delegationIV := reportertypes.NewMsgDelegateReporter( - delegators[delegatorIV].delegatorAddress.String(), - delegators[reporter].delegatorAddress.String(), - math.NewInt(25*1e6), - []*reportertypes.TokenOrigin{&source}, +func (s *IntegrationTestSuite) TestCreatingReporter() { + msgServer := keeper.NewMsgServerImpl(s.Setup.Reporterkeeper) + stakingMsgServer := stakingkeeper.NewMsgServerImpl(s.Setup.Stakingkeeper) + valAccs, valAddrs, _ := s.createValidatorAccs([]int64{1000}) + + newDelegator := sample.AccAddressBytes() + s.Setup.MintTokens(newDelegator, math.NewInt(1000*1e6)) + msgDelegate := stakingtypes.NewMsgDelegate( + newDelegator.String(), + valAddrs[0].String(), + sdk.NewInt64Coin(s.Setup.Denom, 1000*1e6), ) - _, err = server.DelegateReporter(s.ctx, delegationIV) - s.NoError(err) - delegationIVReporter, err := s.reporterkeeper.Delegators.Get(s.ctx, delegators[delegatorIV].delegatorAddress) - s.NoError(err) - s.Equal(delegationIVReporter.Reporter, delegators[reporter].delegatorAddress.Bytes()) - - oracleReporter, err = s.reporterkeeper.Reporters.Get(s.ctx, delegators[reporter].delegatorAddress) - s.NoError(err) - s.Equal(oracleReporter.TotalTokens, math.NewInt(200*1e6)) - - return delegators -} - -func (s *IntegrationTestSuite) TestDelegatorIundelegatesFromValidator() { - delegators := s.TestRegisteringReporterDelegators() - // delegatorI undelegates from validator - shares, err := delegators[delegatorI].validator.SharesFromTokens(math.NewInt(10 * 1e6)) + _, err := stakingMsgServer.Delegate(s.Setup.Ctx, msgDelegate) s.NoError(err) - valBz, err := s.stakingKeeper.ValidatorAddressCodec().StringToBytes(delegators[delegatorI].validator.GetOperator()) + val1, err := s.Setup.Stakingkeeper.GetValidator(s.Setup.Ctx, valAddrs[0]) s.NoError(err) - // delegatorI undelegates from validator but is still has more tokens with validator than the reporter so reporter tokens should not be affected - _, amt, err := s.stakingKeeper.Undelegate(s.ctx, delegators[delegatorI].delegatorAddress, valBz, shares) + // check validator reporting status + validatorReporter, err := s.Setup.Reporterkeeper.Reporters.Get(s.Setup.Ctx, valAccs[0]) s.NoError(err) - s.Equal(amt, math.NewInt(10*1e6)) - // call the staking hook - err = s.stakingKeeper.Hooks().AfterDelegationModified(s.ctx, delegators[delegatorI].delegatorAddress, valBz) - s.NoError(err) - oracleReporter, err := s.reporterkeeper.Reporters.Get(s.ctx, delegators[reporter].delegatorAddress) - s.NoError(err) - s.Equal(oracleReporter.TotalTokens, math.NewInt(200*1e6)) - shares, err = delegators[delegatorI].validator.SharesFromTokens(math.NewInt(75 * 1e6)) - s.NoError(err) - // delegatorI undelegates from validator and is left with 15 tokens less than the 25 delegated with reporter - _, amt, err = s.stakingKeeper.Undelegate(s.ctx, delegators[delegatorI].delegatorAddress, valBz, shares) - s.NoError(err) - s.Equal(amt, math.NewInt(75*1e6)) - err = s.stakingKeeper.Hooks().AfterDelegationModified(s.ctx, delegators[delegatorI].delegatorAddress, valBz) - s.NoError(err) - // reporter total tokens should go down by 10 since delegatorI undelegated 85 total tokens - // from validator remaining 15, which also mean delegation should have only 15 tokens - oracleReporter, err = s.reporterkeeper.Reporters.Get(s.ctx, delegators[reporter].delegatorAddress) - s.NoError(err) - s.Equal(oracleReporter.TotalTokens, math.NewInt(190*1e6)) - delegationIReporter, err := s.reporterkeeper.Delegators.Get(s.ctx, delegators[delegatorI].delegatorAddress) - s.NoError(err) - s.Equal(delegationIReporter.Amount, math.NewInt(15*1e6)) -} - -func (s *IntegrationTestSuite) TestDelegatorIundelegatesFromReporter() { - delegators := s.TestRegisteringReporterDelegators() - server := keeper.NewMsgServerImpl(s.reporterkeeper) - valAcc, err := sdk.ValAddressFromBech32(delegators[delegatorI].validator.GetOperator()) - s.NoError(err) - source := reportertypes.TokenOrigin{ValidatorAddress: valAcc.Bytes()} - // delegatorI undelegates from reporter - source.Amount = math.NewInt(5 * 1e6) - delegationI := reportertypes.NewMsgUndelegateReporter( - delegators[delegatorI].delegatorAddress.String(), - []*reportertypes.TokenOrigin{&source}, - ) - _, err = server.UndelegateReporter(s.ctx, delegationI) + // validator reporter should have self tokens and delegator tokens as their total + s.Equal(validatorReporter.TotalTokens, val1.Tokens) + // delegator is not self reporting but delegated to another reporter + _, err = s.Setup.Reporterkeeper.Reporters.Get(s.Setup.Ctx, newDelegator) + s.Error(err) + _, err = msgServer.CreateReporter(s.Setup.Ctx, &reportertypes.MsgCreateReporter{ReporterAddress: newDelegator.String(), Commission: keeper.DefaultCommission()}) s.NoError(err) - delegationIReporter, err := s.reporterkeeper.Delegators.Get(s.ctx, delegators[delegatorI].delegatorAddress) + rep, err := s.Setup.Reporterkeeper.Reporters.Get(s.Setup.Ctx, newDelegator) s.NoError(err) - s.Equal(delegationIReporter.Amount, math.NewInt(20*1e6)) - // undelegate the remaining 15 tokens - source.Amount = math.NewInt(20 * 1e6) - delegationI.TokenOrigins[0] = &source - _, err = server.UndelegateReporter(s.ctx, delegationI) - s.NoError(err) - // delegatorI shouldn't exist in delegators table since they are fully undelegated - _, err = s.reporterkeeper.Delegators.Get(s.ctx, delegators[delegatorI].delegatorAddress) - s.Error(err) - // check if reporter total tokens went down by 25 - oracleReporter, err := s.reporterkeeper.Reporters.Get(s.ctx, delegators[reporter].delegatorAddress) + delBonded, err := s.Setup.Stakingkeeper.GetDelegatorBonded(s.Setup.Ctx, newDelegator) s.NoError(err) - s.Equal(oracleReporter.TotalTokens, math.NewInt(175*1e6)) -} - -func callrewardHooks(ctx sdk.Context, k keeper.Keeper, delegator sdk.AccAddress, stake math.Int, reporterAddr sdk.AccAddress, reporter reportertypes.OracleReporter) error { - err := k.AfterReporterCreated(ctx, reporter) - if err != nil { - return err - } - err = k.BeforeDelegationCreated(ctx, reporter) - if err != nil { - return err - } - return k.AfterDelegationModified(ctx, delegator, reporterAddr.Bytes(), stake) -} - -func createReporter(ctx sdk.Context, power int64, k keeper.Keeper) (sdk.AccAddress, error) { - reporterAddr := sample.AccAddressBytes() - stake := sdk.DefaultPowerReduction.MulRaw(power) - reporter := reportertypes.NewOracleReporter(reporterAddr.String(), stake, &stakingtypes.Commission{}) - err := k.Reporters.Set(ctx, reporterAddr, reporter) - if err != nil { - return nil, err - } - delegator := reportertypes.NewDelegation(reporterAddr.String(), stake) - err = k.Delegators.Set(ctx, reporterAddr, delegator) - if err != nil { - return nil, err - } - err = callrewardHooks(ctx, k, reporterAddr, delegator.Amount, reporterAddr, reporter) - if err != nil { - return nil, err - } - return reporterAddr, nil -} - -func createReporterStakedWithValidator(ctx sdk.Context, k keeper.Keeper, sk reportertypes.StakingKeeper, valAddr sdk.ValAddress, delAcc []sdk.AccAddress, commission stakingtypes.Commission, stake math.Int) (*reportertypes.MsgCreateReporter, error) { - val, err := sk.GetValidator(ctx, valAddr) - if err != nil { - return nil, err - } - // create delegator funded accounts - delegators := make(map[string]Delegator, len(delAcc)) - for i, addr := range delAcc { - key := fmt.Sprintf("delegator%d", i) - delegators[key] = Delegator{delegatorAddress: addr, validator: val, tokenAmount: stake} - - } - - delegators, err = createdelegators(ctx, delegators, sk) - if err != nil { - return nil, err - } - source := reportertypes.TokenOrigin{ValidatorAddress: valAddr.Bytes(), Amount: stake} - createReporterMsg := reportertypes.NewMsgCreateReporter(delegators["delegator0"].delegatorAddress.String(), stake, []*reportertypes.TokenOrigin{&source}, &commission) - server := keeper.NewMsgServerImpl(k) - _, err = server.CreateReporter(ctx, createReporterMsg) - if err != nil { - return nil, err - } - return createReporterMsg, nil -} - -func DelegateToReporterSingleValidator( - ctx sdk.Context, k keeper.Keeper, repAddr, delAddr sdk.AccAddress, valAddr sdk.ValAddress, sources []*reportertypes.TokenOrigin, stake math.Int, -) error { - delegation := reportertypes.NewMsgDelegateReporter( - delAddr.String(), - repAddr.String(), - stake, - sources, - ) - server := keeper.NewMsgServerImpl(k) - _, err := server.DelegateReporter(ctx, delegation) - if err != nil { - return err - } - return err -} - -type DelegatorSources struct { - Sources []int64 -} -type Sources struct { - ReporterSources []int64 - DelegatorSources []DelegatorSources -} - -type Return struct { - ReporterAcc sdk.AccAddress - DelegatorAccs []sdk.AccAddress -} - -func (s *IntegrationTestSuite) Reporters() (sdk.AccAddress, sdk.AccAddress) { - // create 5 validators - _, valAccs, _ := s.createValidatorAccs([]int64{1000, 900, 800, 700, 600, 500, 400, 300, 200, 100}) - reporterAddr := sample.AccAddressBytes() - delegatorI := sample.AccAddressBytes() - delegatorII := sample.AccAddressBytes() - delegatorIII := sample.AccAddressBytes() - delegatorIV := sample.AccAddressBytes() - reporter2Addr := sample.AccAddressBytes() - delegatorV := sample.AccAddressBytes() - delegatorVI := sample.AccAddressBytes() - delegatorVII := sample.AccAddressBytes() - delegatorVIII := sample.AccAddressBytes() - // mint tokens to reporter and delegators - s.mintTokens(reporterAddr, math.NewInt(1000*1e6)) - s.mintTokens(delegatorI, math.NewInt(1000*1e6)) - s.mintTokens(delegatorII, math.NewInt(1000*1e6)) - s.mintTokens(delegatorIII, math.NewInt(1000*1e6)) - s.mintTokens(delegatorIV, math.NewInt(1000*1e6)) - s.mintTokens(reporter2Addr, math.NewInt(1000*1e6)) - s.mintTokens(delegatorV, math.NewInt(1000*1e6)) - s.mintTokens(delegatorVI, math.NewInt(1000*1e6)) - s.mintTokens(delegatorVII, math.NewInt(1000*1e6)) - s.mintTokens(delegatorVIII, math.NewInt(1000*1e6)) + s.Equal(rep.TotalTokens, delBonded) - for _, n := range valAccs[:5] { - val, err := s.stakingKeeper.GetValidator(s.ctx, n) - s.NoError(err) - _, err = s.stakingKeeper.Delegate(s.ctx, reporterAddr, math.NewInt(200*1e6), stakingtypes.Unbonded, val, true) - s.NoError(err) - } - reporter1TokenSources := []*reportertypes.TokenOrigin{ - {ValidatorAddress: valAccs[0].Bytes(), Amount: math.NewInt(200 * 1e6)}, - {ValidatorAddress: valAccs[1].Bytes(), Amount: math.NewInt(200 * 1e6)}, - {ValidatorAddress: valAccs[2].Bytes(), Amount: math.NewInt(200 * 1e6)}, - {ValidatorAddress: valAccs[3].Bytes(), Amount: math.NewInt(200 * 1e6)}, - {ValidatorAddress: valAccs[4].Bytes(), Amount: math.NewInt(200 * 1e6)}, - } - reporter1Delegators := []sdk.AccAddress{delegatorI, delegatorII, delegatorIII, delegatorIV} - // reporter2 - for _, n := range valAccs[5:] { - val, err := s.stakingKeeper.GetValidator(s.ctx, n) - s.NoError(err) - _, err = s.stakingKeeper.Delegate(s.ctx, reporter2Addr, math.NewInt(100*1e6), stakingtypes.Unbonded, val, true) - s.NoError(err) - } - reporter2TokenSources := []*reportertypes.TokenOrigin{ - {ValidatorAddress: valAccs[5].Bytes(), Amount: math.NewInt(100 * 1e6)}, - {ValidatorAddress: valAccs[6].Bytes(), Amount: math.NewInt(100 * 1e6)}, - {ValidatorAddress: valAccs[7].Bytes(), Amount: math.NewInt(100 * 1e6)}, - {ValidatorAddress: valAccs[8].Bytes(), Amount: math.NewInt(100 * 1e6)}, - {ValidatorAddress: valAccs[9].Bytes(), Amount: math.NewInt(100 * 1e6)}, - } - reporter2Delegators := []sdk.AccAddress{delegatorV, delegatorVI, delegatorVII, delegatorVIII} - for _, n := range valAccs[:5] { - val, err := s.stakingKeeper.GetValidator(s.ctx, n) - s.NoError(err) - for _, del := range reporter1Delegators { - _, err = s.stakingKeeper.Delegate(s.ctx, del, math.NewInt(100*1e6), stakingtypes.Unbonded, val, true) - s.NoError(err) - } - } - - DelSources := []*reportertypes.TokenOrigin{ - {ValidatorAddress: valAccs[0].Bytes(), Amount: math.NewInt(100 * 1e6)}, - {ValidatorAddress: valAccs[1].Bytes(), Amount: math.NewInt(100 * 1e6)}, - {ValidatorAddress: valAccs[2].Bytes(), Amount: math.NewInt(100 * 1e6)}, - {ValidatorAddress: valAccs[3].Bytes(), Amount: math.NewInt(100 * 1e6)}, - {ValidatorAddress: valAccs[4].Bytes(), Amount: math.NewInt(100 * 1e6)}, - } - for _, n := range valAccs[5:] { - val, err := s.stakingKeeper.GetValidator(s.ctx, n) - s.NoError(err) - for _, del := range reporter2Delegators { - _, err = s.stakingKeeper.Delegate(s.ctx, del, math.NewInt(100*1e6), stakingtypes.Unbonded, val, true) - s.NoError(err) - } - } - Del2Sources := []*reportertypes.TokenOrigin{ - {ValidatorAddress: valAccs[5].Bytes(), Amount: math.NewInt(100 * 1e6)}, - {ValidatorAddress: valAccs[6].Bytes(), Amount: math.NewInt(100 * 1e6)}, - {ValidatorAddress: valAccs[7].Bytes(), Amount: math.NewInt(100 * 1e6)}, - {ValidatorAddress: valAccs[8].Bytes(), Amount: math.NewInt(100 * 1e6)}, - {ValidatorAddress: valAccs[9].Bytes(), Amount: math.NewInt(100 * 1e6)}, - } - - _ = Del2Sources - server := keeper.NewMsgServerImpl(s.reporterkeeper) - commission := reportertypes.NewCommissionWithTime(math.LegacyNewDecWithPrec(1, 1), math.LegacyNewDecWithPrec(3, 1), - math.LegacyNewDecWithPrec(1, 1), s.ctx.BlockTime()) - createReporter1Msg := reportertypes.NewMsgCreateReporter(reporterAddr.String(), math.NewIntFromUint64(1000*1e6), reporter1TokenSources, &commission) - _, err := server.CreateReporter(s.ctx, createReporter1Msg) + // check validator reporting tokens after delegator has moved + val2, err := s.Setup.Stakingkeeper.GetValidator(s.Setup.Ctx, valAddrs[0]) s.NoError(err) - createReporter2Msg := reportertypes.NewMsgCreateReporter(reporter2Addr.String(), math.NewIntFromUint64(500*1e6), reporter2TokenSources, &commission) - _, err = server.CreateReporter(s.ctx, createReporter2Msg) + // staked tokens should be same as before + s.Equal(val1.Tokens, val2.Tokens) + validatorReporter, err = s.Setup.Reporterkeeper.Reporters.Get(s.Setup.Ctx, valAccs[0]) s.NoError(err) - - for _, del := range reporter1Delegators { - _, err = server.DelegateReporter(s.ctx, reportertypes.NewMsgDelegateReporter(del.String(), reporterAddr.String(), math.NewIntFromUint64(500*1e6), DelSources)) - s.NoError(err) - } - for _, del := range reporter2Delegators { - _, err = server.DelegateReporter(s.ctx, reportertypes.NewMsgDelegateReporter(del.String(), reporter2Addr.String(), math.NewIntFromUint64(500*1e6), Del2Sources)) - s.NoError(err) - } - - return reporterAddr, reporter2Addr + // reporting tokens should be less than before + s.True(validatorReporter.TotalTokens.LT(val1.Tokens)) + s.True(validatorReporter.TotalTokens.Equal(val1.Tokens.Sub(delBonded))) } diff --git a/tests/setup.go b/tests/setup.go index d4fb6d4af..d3167ad4b 100644 --- a/tests/setup.go +++ b/tests/setup.go @@ -1,23 +1,76 @@ package setup import ( + "strconv" + "testing" + "time" + + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" dbm "github.com/cosmos/cosmos-db" + "github.com/stretchr/testify/require" disputemodulev1 "github.com/tellor-io/layer/api/layer/dispute/module" mintmodulev1 "github.com/tellor-io/layer/api/layer/mint/module" oraclemodulev1 "github.com/tellor-io/layer/api/layer/oracle/module" registrymodulev1 "github.com/tellor-io/layer/api/layer/registry/module" reportermodulev1 "github.com/tellor-io/layer/api/layer/reporter/module" + "github.com/tellor-io/layer/app/config" + _ "github.com/tellor-io/layer/x/dispute" + disputekeeper "github.com/tellor-io/layer/x/dispute/keeper" + disputetypes "github.com/tellor-io/layer/x/dispute/types" + _ "github.com/tellor-io/layer/x/mint" + mintkeeper "github.com/tellor-io/layer/x/mint/keeper" + minttypes "github.com/tellor-io/layer/x/mint/types" + _ "github.com/tellor-io/layer/x/oracle" + oraclekeeper "github.com/tellor-io/layer/x/oracle/keeper" + oracletypes "github.com/tellor-io/layer/x/oracle/types" + registrykeeper "github.com/tellor-io/layer/x/registry/keeper" + _ "github.com/tellor-io/layer/x/registry/module" + registrytypes "github.com/tellor-io/layer/x/registry/types" + reporterkeeper "github.com/tellor-io/layer/x/reporter/keeper" + _ "github.com/tellor-io/layer/x/reporter/module" + reportertypes "github.com/tellor-io/layer/x/reporter/types" appv1alpha1 "cosmossdk.io/api/cosmos/app/v1alpha1" authmodulev1 "cosmossdk.io/api/cosmos/auth/module/v1" "cosmossdk.io/core/appconfig" + "cosmossdk.io/depinject" + "cosmossdk.io/log" "cosmossdk.io/math" + storetypes "cosmossdk.io/store/types" + "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" + "github.com/cosmos/cosmos-sdk/runtime" "github.com/cosmos/cosmos-sdk/testutil/configurator" - "github.com/cosmos/cosmos-sdk/testutil/sims" + simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" + moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" + "github.com/cosmos/cosmos-sdk/x/auth" + authcodec "github.com/cosmos/cosmos-sdk/x/auth/codec" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/cosmos/cosmos-sdk/x/bank" + bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + _ "github.com/cosmos/cosmos-sdk/x/consensus" + _ "github.com/cosmos/cosmos-sdk/x/distribution" + distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" + distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" + _ "github.com/cosmos/cosmos-sdk/x/genutil" + _ "github.com/cosmos/cosmos-sdk/x/gov" + govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + _ "github.com/cosmos/cosmos-sdk/x/mint" + _ "github.com/cosmos/cosmos-sdk/x/params" + _ "github.com/cosmos/cosmos-sdk/x/slashing" + slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper" + "github.com/cosmos/cosmos-sdk/x/staking" + stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) func AuthModule() configurator.ModuleOption { @@ -85,9 +138,6 @@ func RegistryModule() configurator.ModuleOption { func MintModule() configurator.ModuleOption { return func(config *configurator.Config) { - // config.BeginBlockersOrder = append(config.BeginBlockersOrder, "mint") - // config.EndBlockersOrder = append(config.EndBlockersOrder, "mint") - // config.InitGenesisOrder = append(config.InitGenesisOrder, "mint") config.ModuleConfigs["mint"] = &appv1alpha1.ModuleConfig{ Name: "mint", Config: appconfig.WrapAny(&mintmodulev1.Module{}), @@ -119,14 +169,229 @@ func ReporterModule() configurator.ModuleOption { // } // } -func DefaultStartUpConfig() sims.StartupConfig { +func DefaultStartUpConfig() simtestutil.StartupConfig { priv := secp256k1.GenPrivKey() ba := authtypes.NewBaseAccount(priv.PubKey().Address().Bytes(), priv.PubKey(), 0, 0) - ga := sims.GenesisAccount{GenesisAccount: ba, Coins: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, math.ZeroInt()))} - return sims.StartupConfig{ - ValidatorSet: sims.CreateRandomValidatorSet, + ga := simtestutil.GenesisAccount{GenesisAccount: ba, Coins: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, math.ZeroInt()))} + return simtestutil.StartupConfig{ + ValidatorSet: simtestutil.CreateRandomValidatorSet, AtGenesis: false, - GenesisAccounts: []sims.GenesisAccount{ga}, + GenesisAccounts: []simtestutil.GenesisAccount{ga}, DB: dbm.NewMemDB(), } } + +type SharedSetup struct { + Oraclekeeper oraclekeeper.Keeper + Disputekeeper disputekeeper.Keeper + Registrykeeper registrykeeper.Keeper + Mintkeeper mintkeeper.Keeper + Reporterkeeper reporterkeeper.Keeper + + Accountkeeper authkeeper.AccountKeeper + Bankkeeper bankkeeper.BaseKeeper + distrKeeper distrkeeper.Keeper + slashingKeeper slashingkeeper.Keeper + Stakingkeeper *stakingkeeper.Keeper + Govkeeper *govkeeper.Keeper + Ctx sdk.Context + appCodec codec.Codec + authConfig *authmodulev1.Module + + queryHelper *baseapp.QueryServiceTestHelper + interfaceRegistry codectypes.InterfaceRegistry + fetchStoreKey func(string) storetypes.StoreKey + + Denom string + App *runtime.App + require *require.Assertions +} + +func (s *SharedSetup) initKeepersWithmAccPerms(blockedAddrs map[string]bool) { + maccPerms := map[string][]string{} + for _, permission := range s.authConfig.ModuleAccountPermissions { + maccPerms[permission.Account] = permission.Permissions + } + + appCodec := moduletestutil.MakeTestEncodingConfig(auth.AppModuleBasic{}, bank.AppModuleBasic{}, staking.AppModuleBasic{}).Codec + cdc := moduletestutil.MakeTestEncodingConfig(auth.AppModuleBasic{}, bank.AppModuleBasic{}, staking.AppModuleBasic{}).Amino + + maccPerms[authtypes.Burner] = []string{authtypes.Burner} + maccPerms[authtypes.Minter] = []string{authtypes.Minter} + + s.Accountkeeper = authkeeper.NewAccountKeeper( + appCodec, + runtime.NewKVStoreService(s.fetchStoreKey(banktypes.StoreKey).(*storetypes.KVStoreKey)), + authtypes.ProtoBaseAccount, + maccPerms, + authcodec.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix()), + sdk.GetConfig().GetBech32AccountAddrPrefix(), authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + s.Bankkeeper = bankkeeper.NewBaseKeeper( + appCodec, + runtime.NewKVStoreService(s.fetchStoreKey(banktypes.StoreKey).(*storetypes.KVStoreKey)), + s.Accountkeeper, + blockedAddrs, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + log.NewNopLogger(), + ) + + s.Stakingkeeper = stakingkeeper.NewKeeper( + appCodec, + runtime.NewKVStoreService(s.fetchStoreKey(stakingtypes.StoreKey).(*storetypes.KVStoreKey)), + s.Accountkeeper, + s.Bankkeeper, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ValidatorAddrPrefix()), + authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ConsensusAddrPrefix()), + ) + + s.slashingKeeper = slashingkeeper.NewKeeper( + appCodec, + cdc, + runtime.NewKVStoreService(s.fetchStoreKey(banktypes.StoreKey).(*storetypes.KVStoreKey)), + s.Stakingkeeper, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + s.Registrykeeper = registrykeeper.NewKeeper( + appCodec, + runtime.NewKVStoreService(s.fetchStoreKey(registrytypes.StoreKey).(*storetypes.KVStoreKey)), + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + s.distrKeeper = distrkeeper.NewKeeper( + appCodec, runtime.NewKVStoreService(s.fetchStoreKey(distrtypes.StoreKey).(*storetypes.KVStoreKey)), s.Accountkeeper, s.Bankkeeper, s.Stakingkeeper, authtypes.FeeCollectorName, authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + s.Reporterkeeper = reporterkeeper.NewKeeper( + appCodec, runtime.NewKVStoreService(s.fetchStoreKey(reportertypes.StoreKey).(*storetypes.KVStoreKey)), log.NewNopLogger(), authtypes.NewModuleAddress(govtypes.ModuleName).String(), s.Stakingkeeper, s.Bankkeeper, + ) + s.Oraclekeeper = oraclekeeper.NewKeeper( + appCodec, runtime.NewKVStoreService(s.fetchStoreKey(oracletypes.StoreKey).(*storetypes.KVStoreKey)), s.Accountkeeper, s.Bankkeeper, s.Registrykeeper, s.Reporterkeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + s.Disputekeeper = disputekeeper.NewKeeper( + appCodec, runtime.NewKVStoreService(s.fetchStoreKey(disputetypes.StoreKey).(*storetypes.KVStoreKey)), s.Accountkeeper, s.Bankkeeper, s.Oraclekeeper, s.Reporterkeeper, + ) + s.Mintkeeper = mintkeeper.NewKeeper( + appCodec, s.fetchStoreKey(minttypes.StoreKey), s.Accountkeeper, s.Bankkeeper, + ) + s.Stakingkeeper.SetHooks( + stakingtypes.NewMultiStakingHooks( + s.distrKeeper.Hooks(), + s.Reporterkeeper.Hooks(), + ), + ) + s.Registrykeeper.SetHooks( + registrytypes.NewMultiRegistryHooks( + s.Oraclekeeper.Hooks(), + ), + ) +} + +func (s *SharedSetup) SetupTest(t *testing.T) { + t.Helper() + s.require = require.New(t) + sdk.DefaultBondDenom = "loya" + config.SetupConfig() + + app, err := simtestutil.SetupWithConfiguration( + depinject.Configs( + configurator.NewAppConfig( + AuthModule(), + configurator.BankModule(), + configurator.StakingModule(), + configurator.SlashingModule(), + configurator.ParamsModule(), + configurator.ConsensusModule(), + configurator.DistributionModule(), + OracleModule(), + DisputeModule(), + RegistryModule(), + MintModule(), + ReporterModule(), + configurator.GovModule(), + ), + depinject.Supply(log.NewNopLogger()), + ), + DefaultStartUpConfig(), + &s.Accountkeeper, &s.Bankkeeper, &s.Stakingkeeper, &s.slashingKeeper, + &s.interfaceRegistry, &s.appCodec, &s.authConfig, &s.Oraclekeeper, + &s.Disputekeeper, &s.Registrykeeper, &s.Govkeeper, &s.distrKeeper, &s.Mintkeeper, &s.Reporterkeeper) + + s.require.NoError(err) + s.Ctx = sdk.UnwrapSDKContext(app.BaseApp.NewContextLegacy(false, tmproto.Header{Time: time.Now()})) + s.fetchStoreKey = app.UnsafeFindStoreKey + + s.queryHelper = baseapp.NewQueryServerTestHelper(s.Ctx, s.interfaceRegistry) + s.Denom = sdk.DefaultBondDenom + s.initKeepersWithmAccPerms(make(map[string]bool)) + s.App = app +} + +func (s *SharedSetup) CreateValidators(numValidators int) ([]sdk.AccAddress, []sdk.ValAddress, []stakingtypes.Validator) { + require := s.require + + // create account that will become a validator + accountsAddrs := simtestutil.CreateIncrementalAccounts(numValidators) + // mint numTrb for each validator + initCoins := sdk.NewCoin(s.Denom, math.NewInt(5000*1e6)) + for _, acc := range accountsAddrs { + // mint to module + require.NoError(s.Bankkeeper.MintCoins(s.Ctx, authtypes.Minter, sdk.NewCoins(initCoins))) + // send from module to account + require.NoError(s.Bankkeeper.SendCoinsFromModuleToAccount(s.Ctx, authtypes.Minter, acc, sdk.NewCoins(initCoins))) + require.Equal(initCoins, s.Bankkeeper.GetBalance(s.Ctx, acc, s.Denom)) + } + + // get val address for each account + validatorsAddrs := simtestutil.ConvertAddrsToValAddrs(accountsAddrs) + // create pub keys for validators + pubKeys := simtestutil.CreateTestPubKeys(numValidators) + validators := make([]stakingtypes.Validator, numValidators) + stakingServer := stakingkeeper.NewMsgServerImpl(s.Stakingkeeper) + // set each account with proper keepers + for i, pubKey := range pubKeys { + s.Accountkeeper.NewAccountWithAddress(s.Ctx, accountsAddrs[i]) + valMsg, err := stakingtypes.NewMsgCreateValidator( + validatorsAddrs[i].String(), + pubKey, + sdk.NewInt64Coin(s.Denom, 100), + stakingtypes.Description{Moniker: strconv.Itoa(i)}, + stakingtypes.CommissionRates{ + Rate: math.LegacyNewDecWithPrec(5, 1), + MaxRate: math.LegacyNewDecWithPrec(5, 1), + MaxChangeRate: math.LegacyNewDec(0), + }, + math.OneInt()) + require.NoError(err) + + _, err = stakingServer.CreateValidator(s.Ctx, valMsg) + require.NoError(err) + + val, err := s.Stakingkeeper.GetValidator(s.Ctx, validatorsAddrs[i]) + require.NoError(err) + s.MintTokens(accountsAddrs[i], math.NewInt(5000*1e6)) + msg := stakingtypes.MsgDelegate{DelegatorAddress: accountsAddrs[i].String(), ValidatorAddress: val.OperatorAddress, Amount: sdk.NewCoin(s.Denom, math.NewInt(5000*1e6))} + _, err = stakingServer.Delegate(s.Ctx, &msg) + require.NoError(err) + } + _, err := s.Stakingkeeper.EndBlocker(s.Ctx) + require.NoError(err) + return accountsAddrs, validatorsAddrs, validators +} + +func (s *SharedSetup) MintTokens(addr sdk.AccAddress, amount math.Int) { + require := s.require + Ctx := s.Ctx + coins := sdk.NewCoins(sdk.NewCoin(s.Denom, amount)) + require.NoError(s.Bankkeeper.MintCoins(Ctx, authtypes.Minter, coins)) + require.NoError(s.Bankkeeper.SendCoinsFromModuleToAccount(Ctx, authtypes.Minter, addr, coins)) +} + +func (s *SharedSetup) ConvertToAccAddress(priv []ed25519.PrivKey) []sdk.AccAddress { + testAddrs := make([]sdk.AccAddress, len(priv)) + for i, pk := range priv { + testAddrs[i] = sdk.AccAddress(pk.PubKey().Address()) + } + return testAddrs +} diff --git a/testutil/utils.go b/testutil/utils.go index 7774ede00..79ee2b52c 100644 --- a/testutil/utils.go +++ b/testutil/utils.go @@ -1,9 +1,13 @@ package testutil import ( + "encoding/hex" "fmt" "math" + "math/big" + "strings" + "github.com/ethereum/go-ethereum/accounts/abi" oracletypes "github.com/tellor-io/layer/x/oracle/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -59,3 +63,24 @@ func IntToHex(values []int) []string { } return hexValues } + +func EncodeValue(number float64) string { + strNumber := fmt.Sprintf("%.18f", number) + + parts := strings.Split(strNumber, ".") + if len(parts[1]) > 18 { + parts[1] = parts[1][:18] + } + truncatedStr := parts[0] + parts[1] + + bigIntNumber := new(big.Int) + bigIntNumber.SetString(truncatedStr, 10) + + uint256ABIType, _ := abi.NewType("uint256", "", nil) + + arguments := abi.Arguments{{Type: uint256ABIType}} + encodedBytes, _ := arguments.Pack(bigIntNumber) + + encodedString := hex.EncodeToString(encodedBytes) + return encodedString +} diff --git a/x/dispute/keeper/dispute.go b/x/dispute/keeper/dispute.go index 1ff1dbe43..84e60f880 100644 --- a/x/dispute/keeper/dispute.go +++ b/x/dispute/keeper/dispute.go @@ -70,7 +70,7 @@ func (k Keeper) SetNewDispute(ctx sdk.Context, sender sdk.AccAddress, msg types. disputeId := k.NextDisputeId(ctx) hashId := k.HashId(ctx, *msg.Report, msg.DisputeCategory) // slash amount - disputeFee, err := k.GetDisputeFee(ctx, msg.Report.Reporter, msg.DisputeCategory) + disputeFee, err := k.GetDisputeFee(ctx, *msg.Report, msg.DisputeCategory) if err != nil { return err } @@ -168,14 +168,8 @@ func GetSlashPercentageAndJailDuration(category types.DisputeCategory) (math.Leg } // Get dispute fee -func (k Keeper) GetDisputeFee(ctx sdk.Context, repAddr string, category types.DisputeCategory) (math.Int, error) { - reporterAddr := sdk.MustAccAddressFromBech32(repAddr) - reporter, err := k.reporterKeeper.Reporter(ctx, reporterAddr) - if err != nil { - return math.Int{}, err - } - - stake := reporter.TotalTokens +func (k Keeper) GetDisputeFee(ctx sdk.Context, rep oracletypes.MicroReport, category types.DisputeCategory) (math.Int, error) { + stake := layertypes.PowerReduction.MulRaw(rep.Power) switch category { case types.Warning: // calculate 1 percent of bond diff --git a/x/dispute/keeper/dispute_fee.go b/x/dispute/keeper/dispute_fee.go index a72f9743d..a679ff709 100644 --- a/x/dispute/keeper/dispute_fee.go +++ b/x/dispute/keeper/dispute_fee.go @@ -48,7 +48,7 @@ func (k Keeper) PayDisputeFee(ctx sdk.Context, proposer sdk.AccAddress, fee sdk. // return slashed tokens when reporter either wins dispute or dispute is invalid func (k Keeper) ReturnSlashedTokens(ctx context.Context, dispute types.Dispute) error { - err := k.reporterKeeper.ReturnSlashedTokens(ctx, dispute.ReportEvidence.Reporter, dispute.SlashAmount, dispute.HashId) + err := k.reporterKeeper.ReturnSlashedTokens(ctx, dispute.SlashAmount, dispute.HashId) if err != nil { return err } @@ -57,8 +57,8 @@ func (k Keeper) ReturnSlashedTokens(ctx context.Context, dispute types.Dispute) return k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, stakingtypes.BondedPoolName, coins) } -func (k Keeper) ReturnFeetoStake(ctx context.Context, repAcc sdk.AccAddress, hashId []byte, remainingAmt math.Int) error { - err := k.reporterKeeper.FeeRefund(ctx, repAcc, hashId, remainingAmt) +func (k Keeper) ReturnFeetoStake(ctx context.Context, hashId []byte, remainingAmt math.Int) error { + err := k.reporterKeeper.FeeRefund(ctx, hashId, remainingAmt) if err != nil { return err } diff --git a/x/dispute/keeper/dispute_fee_test.go b/x/dispute/keeper/dispute_fee_test.go index 3bf5641af..ebdde9f8d 100644 --- a/x/dispute/keeper/dispute_fee_test.go +++ b/x/dispute/keeper/dispute_fee_test.go @@ -44,14 +44,13 @@ func (s *KeeperTestSuite) TestPayDisputeFee() { func (k *KeeperTestSuite) TestReturnSlashedTokens() { dispute := k.dispute() - k.reporterKeeper.On("ReturnSlashedTokens", k.ctx, dispute.ReportEvidence.Reporter, dispute.SlashAmount, dispute.HashId).Return(nil) + k.reporterKeeper.On("ReturnSlashedTokens", k.ctx, dispute.SlashAmount, dispute.HashId).Return(nil) k.bankKeeper.On("SendCoinsFromModuleToModule", k.ctx, types.ModuleName, stakingtypes.BondedPoolName, sdk.NewCoins(sdk.NewCoin(layer.BondDenom, dispute.SlashAmount))).Return(nil) k.NoError(k.disputeKeeper.ReturnSlashedTokens(k.ctx, dispute)) } func (k *KeeperTestSuite) TestReturnFeetoStake() { - repAcc := sample.AccAddressBytes() - k.reporterKeeper.On("FeeRefund", k.ctx, repAcc, []byte("hash"), math.OneInt()).Return(nil) + k.reporterKeeper.On("FeeRefund", k.ctx, []byte("hash"), math.OneInt()).Return(nil) k.bankKeeper.On("SendCoinsFromModuleToModule", k.ctx, types.ModuleName, stakingtypes.BondedPoolName, sdk.NewCoins(sdk.NewCoin(layer.BondDenom, math.OneInt()))).Return(nil) - k.NoError(k.disputeKeeper.ReturnFeetoStake(k.ctx, repAcc, []byte("hash"), math.OneInt())) + k.NoError(k.disputeKeeper.ReturnFeetoStake(k.ctx, []byte("hash"), math.OneInt())) } diff --git a/x/dispute/keeper/dispute_test.go b/x/dispute/keeper/dispute_test.go index 2728a1712..3ea0f0386 100644 --- a/x/dispute/keeper/dispute_test.go +++ b/x/dispute/keeper/dispute_test.go @@ -128,11 +128,11 @@ func (s *KeeperTestSuite) TestSetNewDispute() types.MsgProposeDispute { Creator: creator.String(), Report: &report, DisputeCategory: types.Warning, - Fee: sdk.NewCoin("loya", math.NewInt(100)), + Fee: sdk.NewCoin("loya", math.NewInt(1000)), PayFromBond: false, } - reporter := &reportertypes.OracleReporter{Reporter: sdk.MustAccAddressFromBech32(report.Reporter).Bytes(), TotalTokens: math.NewInt(10000)} + reporter := &reportertypes.OracleReporter{TotalTokens: math.NewInt(10000)} // mock dependency modules s.reporterKeeper.On("Reporter", s.ctx, sdk.MustAccAddressFromBech32(report.Reporter)).Return(reporter, nil) s.bankKeeper.On("HasBalance", s.ctx, sdk.MustAccAddressFromBech32(disputeMsg.Creator), disputeMsg.Fee).Return(true) @@ -210,41 +210,36 @@ func (s *KeeperTestSuite) TestGetSlashPercentageAndJailDuration() { } func (s *KeeperTestSuite) TestGetDisputeFee() { - reporterAcc := sample.AccAddressBytes() - reporter := &reportertypes.OracleReporter{TotalTokens: math.OneInt()} - s.reporterKeeper.On("Reporter", s.ctx, reporterAcc).Return(reporter, nil) - disputeFee, err := s.disputeKeeper.GetDisputeFee(s.ctx, reporterAcc.String(), types.Warning) + rep := report() + rep.Power = 0 + disputeFee, err := s.disputeKeeper.GetDisputeFee(s.ctx, rep, types.Warning) s.NoError(err) s.Equal(math.ZeroInt(), disputeFee) - reporter.TotalTokens = math.OneInt() - s.reporterKeeper.On("Reporter", s.ctx, reporterAcc).Return(reporter, nil) - disputeFee, err = s.disputeKeeper.GetDisputeFee(s.ctx, reporterAcc.String(), types.Warning) + rep.Power = 1 + disputeFee, err = s.disputeKeeper.GetDisputeFee(s.ctx, rep, types.Warning) s.NoError(err) - s.Equal(math.ZeroInt(), disputeFee) + s.Equal(math.NewInt(10000), disputeFee) - reporter.TotalTokens = math.NewInt(100) - s.reporterKeeper.On("Reporter", s.ctx, reporterAcc).Return(reporter, nil) - disputeFee, err = s.disputeKeeper.GetDisputeFee(s.ctx, reporterAcc.String(), types.Warning) + rep.Power = 2 + disputeFee, err = s.disputeKeeper.GetDisputeFee(s.ctx, rep, types.Warning) s.NoError(err) - s.Equal(math.OneInt(), disputeFee) + s.Equal(math.NewInt(20000), disputeFee) - reporter.TotalTokens = math.NewInt(1000) - s.reporterKeeper.On("Reporter", s.ctx, reporterAcc).Return(reporter, nil) - disputeFee, err = s.disputeKeeper.GetDisputeFee(s.ctx, reporterAcc.String(), types.Warning) + rep.Power = 3 + disputeFee, err = s.disputeKeeper.GetDisputeFee(s.ctx, rep, types.Warning) s.NoError(err) - s.Equal(math.NewInt(10), disputeFee) + s.Equal(math.NewInt(30000), disputeFee) - reporter.TotalTokens = math.NewInt(10000) - s.reporterKeeper.On("Reporter", s.ctx, reporterAcc).Return(reporter, nil) - disputeFee, err = s.disputeKeeper.GetDisputeFee(s.ctx, reporterAcc.String(), types.Minor) + rep.Power = 4 + disputeFee, err = s.disputeKeeper.GetDisputeFee(s.ctx, rep, types.Minor) s.NoError(err) - s.Equal(math.NewInt(500), disputeFee) + s.Equal(math.NewInt(200000), disputeFee) // major - disputeFee, err = s.disputeKeeper.GetDisputeFee(s.ctx, reporterAcc.String(), types.Major) + disputeFee, err = s.disputeKeeper.GetDisputeFee(s.ctx, rep, types.Major) s.NoError(err) - s.Equal(reporter.TotalTokens, disputeFee) + s.Equal(math.NewInt(4000000), disputeFee) } func (s *KeeperTestSuite) TestAddDisputeRound() { @@ -255,9 +250,7 @@ func (s *KeeperTestSuite) TestAddDisputeRound() { dispute.DisputeStatus = types.Unresolved s.NoError(s.disputeKeeper.Disputes.Set(s.ctx, dispute.DisputeId, dispute)) - // disputeMsg := types.MsgProposeDispute{ - // Creator: sample.AccAddressBytes().String(), - // Report: &oracletypes.MicroReport{}, + fee := sdk.NewCoin("loya", math.NewInt(10)) s.bankKeeper.On("HasBalance", s.ctx, sender, fee).Return(true) s.bankKeeper.On("SendCoinsFromAccountToModule", s.ctx, sender, types.ModuleName, sdk.NewCoins(fee)).Return(nil) diff --git a/x/dispute/keeper/execute.go b/x/dispute/keeper/execute.go index 2caaeb562..5ab08ad67 100644 --- a/x/dispute/keeper/execute.go +++ b/x/dispute/keeper/execute.go @@ -174,7 +174,7 @@ func (k Keeper) RefundDisputeFee(ctx context.Context, feePayers []types.PayerInf accInputTotal = accInputTotal.Add(amt.TruncateInt()) outputs = append(outputs, banktypes.NewOutput(recipient.PayerAddress, coins)) } else { - if err := k.ReturnFeetoStake(ctx, recipient.PayerAddress, hashId, amt.TruncateInt()); err != nil { + if err := k.ReturnFeetoStake(ctx, hashId, amt.TruncateInt()); err != nil { return err } } diff --git a/x/dispute/keeper/execute_test.go b/x/dispute/keeper/execute_test.go index 06fe7998a..ecc5e71b8 100644 --- a/x/dispute/keeper/execute_test.go +++ b/x/dispute/keeper/execute_test.go @@ -49,7 +49,7 @@ func (k *KeeperTestSuite) TestExecuteVote() { // mocks k.bankKeeper.On("BurnCoins", k.ctx, types.ModuleName, sdk.NewCoins(sdk.NewCoin("loya", math.ZeroInt()))).Return(nil) k.accountKeeper.On("GetModuleAddress", types.ModuleName).Return(modulAddr, nil) - k.reporterKeeper.On("FeeRefund", k.ctx, sdk.AccAddress(dispute.FeePayers[0].PayerAddress), dispute.HashId, math.NewInt(8000)).Return(nil) + k.reporterKeeper.On("FeeRefund", k.ctx, dispute.HashId, math.NewInt(8000)).Return(nil) k.bankKeeper.On("SendCoinsFromModuleToModule", k.ctx, types.ModuleName, "bonded_tokens_pool", sdk.NewCoins(sdk.NewCoin("loya", math.NewInt(8000)))).Return(nil) k.bankKeeper.On( "InputOutputCoins", k.ctx, @@ -72,7 +72,7 @@ func (k *KeeperTestSuite) TestRefundDisputeFee() { } modulAddr := authtypes.NewModuleAddress(types.ModuleName) k.accountKeeper.On("GetModuleAddress", types.ModuleName).Return(modulAddr, nil) - k.reporterKeeper.On("FeeRefund", k.ctx, sdk.AccAddress(feePayers[0].PayerAddress), []byte("hash"), math.NewInt(760)).Return(nil) + k.reporterKeeper.On("FeeRefund", k.ctx, []byte("hash"), math.NewInt(760)).Return(nil) k.bankKeeper.On("SendCoinsFromModuleToModule", k.ctx, types.ModuleName, "bonded_tokens_pool", sdk.NewCoins(sdk.NewCoin("loya", math.NewInt(760)))).Return(nil) k.bankKeeper.On( "InputOutputCoins", k.ctx, diff --git a/x/dispute/keeper/msg_server_propose_dispute_test.go b/x/dispute/keeper/msg_server_propose_dispute_test.go index 9b2088080..e64014724 100644 --- a/x/dispute/keeper/msg_server_propose_dispute_test.go +++ b/x/dispute/keeper/msg_server_propose_dispute_test.go @@ -9,7 +9,6 @@ import ( layer "github.com/tellor-io/layer/types" "github.com/tellor-io/layer/x/dispute/types" oracletypes "github.com/tellor-io/layer/x/oracle/types" - reportertypes "github.com/tellor-io/layer/x/reporter/types" "cosmossdk.io/math" @@ -37,14 +36,7 @@ func (s *KeeperTestSuite) TestMsgProposeDisputeFromAccount() sdk.AccAddress { Fee: fee, PayFromBond: false, } - stakedReporter := reportertypes.NewOracleReporter( - addr.String(), - math.NewInt(1_000_000), - nil, - ) - // mock dependency modules - s.reporterKeeper.On("Reporter", s.ctx, addr).Return(&stakedReporter, nil) - s.reporterKeeper.On("FeefromReporterStake", s.ctx, addr, math.NewInt(10_000)).Return(nil) + s.reporterKeeper.On("EscrowReporterStake", s.ctx, addr, int64(1), int64(0), math.NewInt(10_000), mock.Anything).Return(nil) s.reporterKeeper.On("TotalReporterPower", s.ctx).Return(math.NewInt(1), nil) s.oracleKeeper.On("GetTotalTips", s.ctx).Return(math.NewInt(1), nil) diff --git a/x/dispute/mocks/ReporterKeeper.go b/x/dispute/mocks/ReporterKeeper.go index 5b5d0120d..0182be77a 100644 --- a/x/dispute/mocks/ReporterKeeper.go +++ b/x/dispute/mocks/ReporterKeeper.go @@ -71,13 +71,13 @@ func (_m *ReporterKeeper) EscrowReporterStake(ctx context.Context, reporterAddr return r0 } -// FeeRefund provides a mock function with given fields: ctx, repAcc, hashId, amt -func (_m *ReporterKeeper) FeeRefund(ctx context.Context, repAcc types.AccAddress, hashId []byte, amt math.Int) error { - ret := _m.Called(ctx, repAcc, hashId, amt) +// FeeRefund provides a mock function with given fields: ctx, hashId, amt +func (_m *ReporterKeeper) FeeRefund(ctx context.Context, hashId []byte, amt math.Int) error { + ret := _m.Called(ctx, hashId, amt) var r0 error - if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress, []byte, math.Int) error); ok { - r0 = rf(ctx, repAcc, hashId, amt) + if rf, ok := ret.Get(0).(func(context.Context, []byte, math.Int) error); ok { + r0 = rf(ctx, hashId, amt) } else { r0 = ret.Error(0) } @@ -161,39 +161,13 @@ func (_m *ReporterKeeper) JailReporter(ctx context.Context, reporterAddr types.A return r0 } -// Reporter provides a mock function with given fields: ctx, repAddr -func (_m *ReporterKeeper) Reporter(ctx context.Context, repAddr types.AccAddress) (*reportertypes.OracleReporter, error) { - ret := _m.Called(ctx, repAddr) - - var r0 *reportertypes.OracleReporter - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress) (*reportertypes.OracleReporter, error)); ok { - return rf(ctx, repAddr) - } - if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress) *reportertypes.OracleReporter); ok { - r0 = rf(ctx, repAddr) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*reportertypes.OracleReporter) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, types.AccAddress) error); ok { - r1 = rf(ctx, repAddr) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ReturnSlashedTokens provides a mock function with given fields: ctx, repAddr, amt, hashId -func (_m *ReporterKeeper) ReturnSlashedTokens(ctx context.Context, repAddr string, amt math.Int, hashId []byte) error { - ret := _m.Called(ctx, repAddr, amt, hashId) +// ReturnSlashedTokens provides a mock function with given fields: ctx, amt, hashId +func (_m *ReporterKeeper) ReturnSlashedTokens(ctx context.Context, amt math.Int, hashId []byte) error { + ret := _m.Called(ctx, amt, hashId) var r0 error - if rf, ok := ret.Get(0).(func(context.Context, string, math.Int, []byte) error); ok { - r0 = rf(ctx, repAddr, amt, hashId) + if rf, ok := ret.Get(0).(func(context.Context, math.Int, []byte) error); ok { + r0 = rf(ctx, amt, hashId) } else { r0 = ret.Error(0) } diff --git a/x/dispute/types/expected_keepers.go b/x/dispute/types/expected_keepers.go index e2a944821..488c4a3c1 100644 --- a/x/dispute/types/expected_keepers.go +++ b/x/dispute/types/expected_keepers.go @@ -40,14 +40,13 @@ type OracleKeeper interface { type ReporterKeeper interface { EscrowReporterStake(ctx context.Context, reporterAddr sdk.AccAddress, power, height int64, amt math.Int, hashId []byte) error - Reporter(ctx context.Context, repAddr sdk.AccAddress) (*reportertypes.OracleReporter, error) JailReporter(ctx context.Context, reporterAddr sdk.AccAddress, jailDuration int64) error TotalReporterPower(ctx context.Context) (math.Int, error) FeefromReporterStake(ctx context.Context, reporterAddr sdk.AccAddress, amt math.Int, hashId []byte) error - ReturnSlashedTokens(ctx context.Context, repAddr string, amt math.Int, hashId []byte) error + ReturnSlashedTokens(ctx context.Context, amt math.Int, hashId []byte) error AddAmountToStake(ctx context.Context, acc sdk.AccAddress, amt math.Int) error Delegation(ctx context.Context, delegator sdk.AccAddress) (reportertypes.Delegation, error) GetReporterTokensAtBlock(ctx context.Context, reporter []byte, blockNumber int64) (math.Int, error) GetDelegatorTokensAtBlock(ctx context.Context, delegator []byte, blockNumber int64) (math.Int, error) - FeeRefund(ctx context.Context, repAcc sdk.AccAddress, hashId []byte, amt math.Int) error + FeeRefund(ctx context.Context, hashId []byte, amt math.Int) error } diff --git a/x/oracle/keeper/aggregate.go b/x/oracle/keeper/aggregate.go index b1536257b..162c495a9 100644 --- a/x/oracle/keeper/aggregate.go +++ b/x/oracle/keeper/aggregate.go @@ -7,6 +7,7 @@ import ( "fmt" "time" + minttypes "github.com/tellor-io/layer/x/mint/types" "github.com/tellor-io/layer/x/oracle/types" "cosmossdk.io/collections" @@ -66,7 +67,7 @@ func (k Keeper) SetAggregatedReport(ctx context.Context) (err error) { } if !query.Amount.IsZero() { - err = k.AllocateRewards(ctx, report.Reporters, query.Amount, true) + err = k.AllocateRewards(ctx, report.Reporters, query.Amount, types.ModuleName) if err != nil { return err } @@ -88,8 +89,11 @@ func (k Keeper) SetAggregatedReport(ctx context.Context) (err error) { // Process time-based rewards for reporters. tbr := k.getTimeBasedRewards(ctx) + if len(reportersToPay) == 0 { + return nil + } // Allocate time-based rewards to all eligible reporters. - return k.AllocateRewards(ctx, reportersToPay, tbr, false) + return k.AllocateRewards(ctx, reportersToPay, tbr, minttypes.TimeBasedRewards) } func (k Keeper) SetAggregate(ctx context.Context, report *types.Aggregate) error { diff --git a/x/oracle/keeper/aggregate_test.go b/x/oracle/keeper/aggregate_test.go index 7939e94c1..d250237fc 100644 --- a/x/oracle/keeper/aggregate_test.go +++ b/x/oracle/keeper/aggregate_test.go @@ -133,7 +133,7 @@ func (s *KeeperTestSuite) TestSetAggregatedReport() { s.accountKeeper.On("GetModuleAccount", ctx, minttypes.TimeBasedRewards).Return(testModuleAccount) s.bankKeeper.On("GetBalance", mock.Anything, mock.Anything, layertypes.BondDenom).Return(sdk.Coin{Amount: math.NewInt(1 * 1e6)}) s.bankKeeper.On("SendCoinsFromModuleToModule", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil) - s.reporterKeeper.On("DivvyingTips", mock.Anything, mock.Anything, mock.Anything).Return(nil) + s.reporterKeeper.On("DivvyingTips", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil) s.reporterKeeper.On("AllocateTokensToReporter", mock.Anything, mock.Anything, mock.Anything).Return(nil) err = s.oracleKeeper.SetAggregatedReport(ctx) diff --git a/x/oracle/keeper/keeper.go b/x/oracle/keeper/keeper.go index 1190e92ca..a44b3d714 100644 --- a/x/oracle/keeper/keeper.go +++ b/x/oracle/keeper/keeper.go @@ -35,17 +35,17 @@ type ( Tips *collections.IndexedMap[collections.Pair[[]byte, []byte], math.Int, tipsIndex] // key: queryId, tipper TipperTotal *collections.IndexedMap[collections.Pair[[]byte, int64], math.Int, tipperTotalIndex] // key: tipperAcc, blockNumber // total tips given over time - TotalTips collections.Map[int64, math.Int] // key: blockNumber, value: total tips // key: queryId, timestamp - Nonces collections.Map[[]byte, uint64] // key: queryId - Reports *collections.IndexedMap[collections.Triple[[]byte, []byte, uint64], types.MicroReport, reportsIndex] // key: queryId, reporter, query.id - QuerySequencer collections.Sequence - Query *collections.IndexedMap[[]byte, types.QueryMeta, queryMetaIndex] - // the address capable of executing a MsgUpdateParams message. Typically, this - // should be the x/gov module account. // key: reporter, queryid // keep track of the total tips + TotalTips collections.Map[int64, math.Int] // key: blockNumber, value: total tips // key: queryId, timestamp + Nonces collections.Map[[]byte, uint64] // key: queryId + Reports *collections.IndexedMap[collections.Triple[[]byte, []byte, uint64], types.MicroReport, reportsIndex] // key: queryId, reporter, query.id + QuerySequencer collections.Sequence + Query *collections.IndexedMap[[]byte, types.QueryMeta, queryMetaIndex] // key: queryId Aggregates *collections.IndexedMap[collections.Pair[[]byte, int64], types.Aggregate, aggregatesIndex] // key: queryId, timestamp // key: queryId // keep track of the current cycle Cyclelist collections.Map[[]byte, []byte] CyclelistSequencer collections.Sequence - authority string + // the address capable of executing a MsgUpdateParams message. Typically, this + // should be the x/gov module account. + authority string } ) diff --git a/x/oracle/keeper/msg_server_commit_report.go b/x/oracle/keeper/msg_server_commit_report.go index ca23cb95a..d70ffb4a2 100644 --- a/x/oracle/keeper/msg_server_commit_report.go +++ b/x/oracle/keeper/msg_server_commit_report.go @@ -22,21 +22,18 @@ func (k msgServer) CommitReport(ctx context.Context, msg *types.MsgCommitReport) } // get reporter - reporter, err := k.keeper.reporterKeeper.Reporter(ctx, reporterAddr) + reporterStake, err := k.keeper.reporterKeeper.ReporterStake(ctx, reporterAddr) if err != nil { return nil, err } - if reporter.Jailed { - return nil, errorsmod.Wrapf(types.ErrReporterJailed, "reporter %s is in jail", reporterAddr) - } params, err := k.keeper.Params.Get(ctx) if err != nil { return nil, err } - if reporter.TotalTokens.LT(params.MinStakeAmount) { - return nil, errorsmod.Wrapf(types.ErrNotEnoughStake, "reporter has %s, required amount is %s", reporter.TotalTokens, params.MinStakeAmount) + if reporterStake.LT(params.MinStakeAmount) { + return nil, errorsmod.Wrapf(types.ErrNotEnoughStake, "reporter has %s, required amount is %s", reporterStake, params.MinStakeAmount) } // get query id bytes hash from query data diff --git a/x/oracle/keeper/msg_server_commit_report_test.go b/x/oracle/keeper/msg_server_commit_report_test.go index f49caf22b..d29531a26 100644 --- a/x/oracle/keeper/msg_server_commit_report_test.go +++ b/x/oracle/keeper/msg_server_commit_report_test.go @@ -17,7 +17,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -func (s *KeeperTestSuite) TestCommitValue() (reportertypes.OracleReporter, string, []byte) { +func (s *KeeperTestSuite) TestCommitValue() (sdk.AccAddress, string, []byte) { // get the current query in cycle list s.ctx = s.ctx.WithBlockTime(time.Now()) queryData, err := s.oracleKeeper.GetCurrentQueryInCycleList(s.ctx) @@ -28,13 +28,8 @@ func (s *KeeperTestSuite) TestCommitValue() (reportertypes.OracleReporter, strin addr := sample.AccAddressBytes() - stakedReporter := reportertypes.NewOracleReporter( - addr.String(), - math.NewInt(1_000_000), - nil, - ) _ = s.registryKeeper.On("GetSpec", s.ctx, "SpotPrice").Return(registrytypes.GenesisDataSpec(), nil) - _ = s.reporterKeeper.On("Reporter", s.ctx, addr).Return(&stakedReporter, nil) + _ = s.reporterKeeper.On("ReporterStake", s.ctx, addr).Return(math.NewInt(1_000_000), nil) commitreq := types.MsgCommitReport{ Creator: addr.String(), @@ -52,7 +47,7 @@ func (s *KeeperTestSuite) TestCommitValue() (reportertypes.OracleReporter, strin s.Nil(err) s.Equal(true, s.oracleKeeper.VerifyCommit(s.ctx, addr.String(), value, salt, hash)) s.Equal(commitValue.Reporter, addr.String()) - return stakedReporter, salt, queryData + return addr, salt, queryData } func (s *KeeperTestSuite) TestCommitQueryNotInCycleList() { @@ -65,14 +60,8 @@ func (s *KeeperTestSuite) TestCommitQueryNotInCycleList() { addr := sample.AccAddressBytes() - stakedReporter := reportertypes.NewOracleReporter( - addr.String(), - math.NewInt(1_000_000), - nil, - ) - _ = s.registryKeeper.On("GetSpec", s.ctx, "SpotPrice").Return(registrytypes.GenesisDataSpec(), nil) - _ = s.reporterKeeper.On("Reporter", s.ctx, addr).Return(&stakedReporter, nil) + _ = s.reporterKeeper.On("ReporterStake", s.ctx, addr).Return(math.NewInt(1_000_000), nil) commitreq := types.MsgCommitReport{ Creator: addr.String(), @@ -95,14 +84,8 @@ func (s *KeeperTestSuite) TestCommitQueryInCycleListPlusTippedQuery() { hash := oracleutils.CalculateCommitment(value, salt) addr := sample.AccAddressBytes() - - stakedReporter := reportertypes.NewOracleReporter( - addr.String(), - math.NewInt(1_000_000), - nil, - ) _ = s.registryKeeper.On("GetSpec", s.ctx, "SpotPrice").Return(registrytypes.GenesisDataSpec(), nil) - _ = s.reporterKeeper.On("Reporter", s.ctx, addr).Return(&stakedReporter, nil) + _ = s.reporterKeeper.On("ReporterStake", s.ctx, addr).Return(math.NewInt(1_000_000), nil) commitreq := types.MsgCommitReport{ Creator: addr.String(), @@ -148,13 +131,8 @@ func (s *KeeperTestSuite) TestCommitWithReporterWithLowStake() { randomAddr := sample.AccAddressBytes() - stakedReporter := reportertypes.NewOracleReporter( - randomAddr.String(), - math.NewInt(1), // below the min stake amount - nil, - ) _ = s.registryKeeper.On("GetSpec", s.ctx, "SpotPrice").Return(registrytypes.GenesisDataSpec(), nil) - _ = s.reporterKeeper.On("Reporter", s.ctx, randomAddr).Return(&stakedReporter, nil) + _ = s.reporterKeeper.On("ReporterStake", s.ctx, randomAddr).Return(math.OneInt(), nil) commitreq := types.MsgCommitReport{ Creator: randomAddr.String(), @@ -177,15 +155,7 @@ func (s *KeeperTestSuite) TestCommitWithJailedValidator() { randomAddr := sample.AccAddressBytes() - stakedReporter := reportertypes.NewOracleReporter( - randomAddr.String(), - math.NewInt(1_000_000), - nil, - ) - stakedReporter.Jailed = true - _ = s.reporterKeeper.On("Reporter", s.ctx, randomAddr).Return(&stakedReporter, nil) - - s.Equal(true, stakedReporter.Jailed) + _ = s.reporterKeeper.On("ReporterStake", s.ctx, randomAddr).Return(math.Int{}, reportertypes.ErrReporterJailed) commitreq := types.MsgCommitReport{ Creator: randomAddr.String(), @@ -194,7 +164,7 @@ func (s *KeeperTestSuite) TestCommitWithJailedValidator() { } _, err = s.msgServer.CommitReport(s.ctx, &commitreq) - s.ErrorContains(err, "reporter is jailed") + s.ErrorContains(err, "reporter jailed") } func (s *KeeperTestSuite) TestCommitWithMissingCreator() { diff --git a/x/oracle/keeper/msg_server_submit_value.go b/x/oracle/keeper/msg_server_submit_value.go index 37469c592..f5c457fde 100644 --- a/x/oracle/keeper/msg_server_submit_value.go +++ b/x/oracle/keeper/msg_server_submit_value.go @@ -29,23 +29,20 @@ func (k msgServer) SubmitValue(ctx context.Context, msg *types.MsgSubmitValue) ( } // get reporter - reporter, err := k.keeper.reporterKeeper.Reporter(ctx, reporterAddr) + reporterStake, err := k.keeper.reporterKeeper.ReporterStake(ctx, reporterAddr) if err != nil { return nil, err } - if reporter.Jailed { - return nil, errorsmod.Wrapf(types.ErrReporterJailed, "reporter %s is in jail", reporterAddr) - } params, err := k.keeper.Params.Get(ctx) if err != nil { return nil, err } - if reporter.TotalTokens.LT(params.MinStakeAmount) { - return nil, errorsmod.Wrapf(types.ErrNotEnoughStake, "reporter has %s, required %s", reporter.TotalTokens, params.MinStakeAmount) + if reporterStake.LT(params.MinStakeAmount) { + return nil, errorsmod.Wrapf(types.ErrNotEnoughStake, "reporter has %s, required %s", reporterStake, params.MinStakeAmount) } - votingPower := reporter.TotalTokens.Quo(layertypes.PowerReduction).Int64() + votingPower := reporterStake.Quo(layertypes.PowerReduction).Int64() // decode query data hex string to bytes queryId := utils.QueryIDFromData(msg.QueryData) @@ -91,12 +88,11 @@ func (k msgServer) SubmitValue(ctx context.Context, msg *types.MsgSubmitValue) ( if err != nil { return nil, err } - // todo: do we need to keep all the commits? also whats best do it here or aggregation? // remove commit from store - // err = k.Keeper.Commits.Remove(ctx, collections.Join(reporterAddr.Bytes(), query.Id)) - // if err != nil { - // return nil, err - // } + err = k.keeper.Commits.Remove(ctx, collections.Join(reporterAddr.Bytes(), query.Id)) + if err != nil { + return nil, err + } return &types.MsgSubmitValueResponse{}, nil } diff --git a/x/oracle/keeper/msg_server_submit_value_test.go b/x/oracle/keeper/msg_server_submit_value_test.go index b13073f48..c3110533b 100644 --- a/x/oracle/keeper/msg_server_submit_value_test.go +++ b/x/oracle/keeper/msg_server_submit_value_test.go @@ -8,23 +8,24 @@ import ( "github.com/tellor-io/layer/x/oracle/types" oracleutils "github.com/tellor-io/layer/x/oracle/utils" registrytypes "github.com/tellor-io/layer/x/registry/types" - reportertypes "github.com/tellor-io/layer/x/reporter/types" + + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" ) -func (s *KeeperTestSuite) TestSubmitValue() (reportertypes.OracleReporter, []byte) { +func (s *KeeperTestSuite) TestSubmitValue() (sdk.AccAddress, []byte) { require := s.Require() // Commit - stakedReporter, salt, queryData := s.TestCommitValue() + addr, salt, queryData := s.TestCommitValue() // forward block by 1 and reveal value s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) // Submit value transaction with value revealed, this checks if the value is correctly hashed - _ = s.reporterKeeper.On("Reporter", s.ctx, sdk.AccAddress(stakedReporter.GetReporter())).Return(&stakedReporter, nil) + _ = s.reporterKeeper.On("ReporterStake", s.ctx, addr).Return(math.NewInt(1_000_000), nil) _ = s.registryKeeper.On("GetSpec", s.ctx, "SpotPrice").Return(registrytypes.GenesisDataSpec(), nil) submitreq := types.MsgSubmitValue{ - Creator: sdk.AccAddress(stakedReporter.GetReporter()).String(), + Creator: addr.String(), QueryData: queryData, Value: value, Salt: salt, @@ -38,8 +39,8 @@ func (s *KeeperTestSuite) TestSubmitValue() (reportertypes.OracleReporter, []byt s.Nil(err) microReport := types.MicroReport{ - Reporter: sdk.AccAddress(stakedReporter.GetReporter()).String(), - Power: stakedReporter.TotalTokens.Quo(sdk.DefaultPowerReduction).Int64(), + Reporter: addr.String(), + Power: 1, QueryType: "SpotPrice", QueryId: queryId, AggregateMethod: "weighted-median", @@ -55,24 +56,24 @@ func (s *KeeperTestSuite) TestSubmitValue() (reportertypes.OracleReporter, []byt } require.Equal(&expectedReport, report) - return stakedReporter, queryId + return addr, queryId } func (s *KeeperTestSuite) TestSubmitWithBadQueryData() { // submit value with bad query data badQueryData := []byte("stupidQueryData") - stakedReporter, salt, _ := s.TestCommitValue() + addr, salt, _ := s.TestCommitValue() submitreq := types.MsgSubmitValue{ - Creator: sdk.AccAddress(stakedReporter.GetReporter()).String(), + Creator: addr.String(), QueryData: badQueryData, Value: value, Salt: salt, } s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) - _ = s.reporterKeeper.On("Reporter", s.ctx, sdk.AccAddress(stakedReporter.GetReporter())).Return(&stakedReporter, nil) + _ = s.reporterKeeper.On("ReporterStake", s.ctx, addr).Return(math.NewInt(1_000_000), nil) _, err := s.msgServer.SubmitValue(s.ctx, &submitreq) s.ErrorContains(err, "invalid query data") @@ -83,17 +84,17 @@ func (s *KeeperTestSuite) TestSubmitWithBadValue() { badValue := "00000F4240" - stakedReporter, salt, queryData := s.TestCommitValue() + addr, salt, queryData := s.TestCommitValue() submitreq := types.MsgSubmitValue{ - Creator: sdk.AccAddress(stakedReporter.GetReporter()).String(), + Creator: addr.String(), QueryData: queryData, Value: badValue, Salt: salt, } s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) - _ = s.reporterKeeper.On("Reporter", s.ctx, sdk.AccAddress(stakedReporter.GetReporter())).Return(&stakedReporter, nil) + _ = s.reporterKeeper.On("ReporterStake", s.ctx, addr).Return(math.NewInt(1_000_000), nil) _, err := s.msgServer.SubmitValue(s.ctx, &submitreq) s.ErrorContains(err, "submitted value doesn't match commitment, are you a cheater?") @@ -101,21 +102,20 @@ func (s *KeeperTestSuite) TestSubmitWithBadValue() { func (s *KeeperTestSuite) TestSubmitWithWrongSalt() { // submit correct value but wrong salt - - stakedReporter, _, queryData := s.TestCommitValue() + addr, _, queryData := s.TestCommitValue() badSalt, err := oracleutils.Salt(32) s.Nil(err) submitreq := types.MsgSubmitValue{ - Creator: sdk.AccAddress(stakedReporter.GetReporter()).String(), + Creator: addr.String(), QueryData: queryData, Value: value, Salt: badSalt, } s.ctx = s.ctx.WithBlockHeight(s.ctx.BlockHeight() + 1) - _ = s.reporterKeeper.On("Reporter", s.ctx, sdk.AccAddress(stakedReporter.GetReporter())).Return(&stakedReporter, nil) + _ = s.reporterKeeper.On("ReporterStake", s.ctx, addr).Return(math.NewInt(1_000_000), nil) _, err = s.msgServer.SubmitValue(s.ctx, &submitreq) s.ErrorContains(err, "submitted value doesn't match commitment, are you a cheater?") @@ -124,10 +124,10 @@ func (s *KeeperTestSuite) TestSubmitWithWrongSalt() { func (s *KeeperTestSuite) TestSubmitAtWrongBlock() { // try to submit value in same block as commit - stakedReporter, salt, queryData := s.TestCommitValue() + addr, salt, queryData := s.TestCommitValue() submitreq := types.MsgSubmitValue{ - Creator: sdk.AccAddress(stakedReporter.GetReporter()).String(), + Creator: addr.String(), QueryData: queryData, Value: value, Salt: salt, @@ -139,42 +139,12 @@ func (s *KeeperTestSuite) TestSubmitAtWrongBlock() { // try to submit value 2 blocks after commit s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Hour)) _ = s.registryKeeper.On("GetSpec", s.ctx, "SpotPrice").Return(registrytypes.GenesisDataSpec(), nil) - _ = s.reporterKeeper.On("Reporter", s.ctx, sdk.AccAddress(stakedReporter.GetReporter())).Return(&stakedReporter, nil) // submitreq.Salt = salt + _ = s.reporterKeeper.On("ReporterStake", s.ctx, addr).Return(math.NewInt(1_000_000), nil) // submitreq.Salt = salt _, err := s.msgServer.SubmitValue(s.ctx, &submitreq) s.ErrorContains(err, "missed commit reveal window") } -// Note: no longer relevant since you can reveal without commit - -// func (s *KeeperTestSuite) TestSubmitWithNoCommit() { - -// // try to submit value without commit -// queryData := "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706F745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003657468000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000" -// salt, err := oracleutils.Salt(32) -// s.Nil(err) - -// addr := sample.AccAddressBytes() - -// var submitreq = types.MsgSubmitValue{ -// Creator: addr.String(), -// QueryData: queryData, -// Value: value, -// Salt: salt, -// } -// s.ctx = s.ctx.WithBlockTime(s.ctx.BlockTime().Add(time.Hour)) - -// stakedReporter := reportertypes.NewOracleReporter( -// addr.String(), -// math.NewInt(1_000_000), -// nil, -// ) -// _ = s.reporterKeeper.On("Reporter", s.ctx, addr).Return(&stakedReporter, nil) - -// _, err = s.msgServer.SubmitValue(s.ctx, &submitreq) -// s.ErrorContains(err, "no commits to reveal found") -// } - func (s *KeeperTestSuite) TestSubmitWithNoCreator() { // submit value with no creator @@ -194,10 +164,10 @@ func (s *KeeperTestSuite) TestSubmitWithNoCreator() { func (s *KeeperTestSuite) TestSubmitWithNoQueryData() { // submit value with no query data - stakedReporter, salt, _ := s.TestCommitValue() + addr, salt, _ := s.TestCommitValue() submitreq := types.MsgSubmitValue{ - Creator: sdk.AccAddress(stakedReporter.GetReporter()).String(), + Creator: addr.String(), Value: value, Salt: salt, } @@ -209,10 +179,10 @@ func (s *KeeperTestSuite) TestSubmitWithNoQueryData() { func (s *KeeperTestSuite) TestSubmitWithNoValue() { // submit value with no value - stakedReporter, salt, queryData := s.TestCommitValue() + addr, salt, queryData := s.TestCommitValue() submitreq := types.MsgSubmitValue{ - Creator: sdk.AccAddress(stakedReporter.GetReporter()).String(), + Creator: addr.String(), QueryData: queryData, Salt: salt, } @@ -221,19 +191,3 @@ func (s *KeeperTestSuite) TestSubmitWithNoValue() { _, err := s.msgServer.SubmitValue(s.ctx, &submitreq) s.ErrorContains(err, "value cannot be empty") } - -// Note: this test fails because logic allows for submit value with no salt - -// func (s *KeeperTestSuite) TestSubmitWithbadSalt() { -// // submit value with no salt -// queryData := "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000953706F745072696365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000003657468000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000037573640000000000000000000000000000000000000000000000000000000000" -// stakedReporter, _, queryData := s.TestCommitValue() -// var submitreq = types.MsgSubmitValue{ -// Creator: stakedReporter.GetReporter(), -// QueryData: queryData, -// Value: value, -// } -// _, err := s.msgServer.SubmitValue(s.ctx, &submitreq) -// s.ErrorContains(err, "salt cannot be empty") - -// } diff --git a/x/oracle/keeper/query_get_reports_test.go b/x/oracle/keeper/query_get_reports_test.go index 517ae9e65..ff01b5b41 100644 --- a/x/oracle/keeper/query_get_reports_test.go +++ b/x/oracle/keeper/query_get_reports_test.go @@ -4,12 +4,10 @@ import ( "encoding/hex" "github.com/tellor-io/layer/x/oracle/types" - - sdk "github.com/cosmos/cosmos-sdk/types" ) func (s *KeeperTestSuite) TestGetReportsByQueryId() { - stakedReporter, queryIdStr := s.TestSubmitValue() + addr, queryIdStr := s.TestSubmitValue() req := &types.QueryGetReportsbyQidRequest{QueryId: hex.EncodeToString(queryIdStr)} @@ -17,8 +15,8 @@ func (s *KeeperTestSuite) TestGetReportsByQueryId() { s.Nil(err) MicroReport := &types.MicroReport{ - Reporter: sdk.AccAddress(stakedReporter.GetReporter()).String(), - Power: stakedReporter.TotalTokens.Quo(sdk.DefaultPowerReduction).Int64(), + Reporter: addr.String(), + Power: 1, QueryType: "SpotPrice", QueryId: queryIdStr, AggregateMethod: "weighted-median", @@ -33,11 +31,11 @@ func (s *KeeperTestSuite) TestGetReportsByQueryId() { s.Equal(expectedReports, report.Reports) - report2, err := s.queryClient.GetReportsbyReporter(s.ctx, &types.QueryGetReportsbyReporterRequest{Reporter: sdk.AccAddress(stakedReporter.GetReporter()).String()}) + report2, err := s.queryClient.GetReportsbyReporter(s.ctx, &types.QueryGetReportsbyReporterRequest{Reporter: addr.String()}) s.NoError(err) s.Equal(*expectedReports.MicroReports[0], report2.MicroReports[0]) - report3, err := s.queryClient.GetReportsbyReporterQid(s.ctx, &types.QueryGetReportsbyReporterQidRequest{Reporter: sdk.AccAddress(stakedReporter.GetReporter()).String(), QueryId: hex.EncodeToString(queryIdStr)}) + report3, err := s.queryClient.GetReportsbyReporterQid(s.ctx, &types.QueryGetReportsbyReporterQidRequest{Reporter: addr.String(), QueryId: hex.EncodeToString(queryIdStr)}) s.NoError(err) s.EqualValues(expectedReports.MicroReports, report3.Reports.MicroReports) diff --git a/x/oracle/keeper/rewards.go b/x/oracle/keeper/rewards.go index eb9e961b0..ddfc15bc3 100644 --- a/x/oracle/keeper/rewards.go +++ b/x/oracle/keeper/rewards.go @@ -16,12 +16,16 @@ import ( type ReportersReportCount struct { Power int64 Reports int + Height int64 } // AllocateRewards distributes rewards to reporters based on their power and number of reports. // It calculates the reward amount for each reporter and allocates the rewards. // Finally, it sends the allocated rewards to the apprppopriate module based on the source of the reward. -func (k Keeper) AllocateRewards(ctx context.Context, reporters []*types.AggregateReporter, reward math.Int, toStake bool) error { +func (k Keeper) AllocateRewards(ctx context.Context, reporters []*types.AggregateReporter, reward math.Int, fromPool string) error { + if reward.IsZero() { + return nil + } // Initialize totalPower to keep track of the total power of all reporters. totalPower := int64(0) // reportCounts maps reporter's address to their ValidatorReportCount. @@ -35,38 +39,26 @@ func (k Keeper) AllocateRewards(ctx context.Context, reporters []*types.Aggregat reporter.Reports++ } else { // If not found, add the reporter with their initial power and report count set to 1. - reporter = ReportersReportCount{Power: r.Power, Reports: 1} + reporter = ReportersReportCount{Power: r.Power, Reports: 1, Height: r.BlockNumber} } reportCounts[r.Reporter] = reporter // Add the reporter's power to the total power. totalPower += r.Power } - var allocateReward func(ctx context.Context, addr []byte, amount math.Int) error - var from, to string - if toStake { - allocateReward = k.AllocateTip - from = types.ModuleName - to = reportertypes.TipsEscrowPool - } else { - allocateReward = k.AllocateTBR - from = minttypes.TimeBasedRewards - to = reportertypes.ModuleName - - } for r, c := range reportCounts { amount := CalculateRewardAmount(c.Power, int64(c.Reports), totalPower, reward) repoterAddr, err := sdk.AccAddressFromBech32(r) if err != nil { return err } - err = allocateReward(ctx, repoterAddr.Bytes(), amount) + err = k.AllocateTip(ctx, repoterAddr.Bytes(), amount, c.Height) if err != nil { return err } } - return k.bankKeeper.SendCoinsFromModuleToModule(ctx, from, to, sdk.NewCoins(sdk.NewCoin(layer.BondDenom, reward))) + return k.bankKeeper.SendCoinsFromModuleToModule(ctx, fromPool, reportertypes.TipsEscrowPool, sdk.NewCoins(sdk.NewCoin(layer.BondDenom, reward))) } func (k Keeper) getTimeBasedRewards(ctx context.Context) math.Int { @@ -85,11 +77,6 @@ func CalculateRewardAmount(reporterPower, reportsCount, totalPower int64, reward return amount.RoundInt() } -func (k Keeper) AllocateTBR(ctx context.Context, addr []byte, amount math.Int) error { - reward := sdk.NewDecCoins(sdk.NewDecCoin(layer.BondDenom, amount)) - return k.reporterKeeper.AllocateTokensToReporter(ctx, addr, reward) -} - -func (k Keeper) AllocateTip(ctx context.Context, addr []byte, amount math.Int) error { - return k.reporterKeeper.DivvyingTips(ctx, addr, amount) +func (k Keeper) AllocateTip(ctx context.Context, addr []byte, amount math.Int, height int64) error { + return k.reporterKeeper.DivvyingTips(ctx, addr, amount, height) } diff --git a/x/oracle/keeper/tip_test.go b/x/oracle/keeper/tip_test.go index 0fab3568f..e687833c6 100644 --- a/x/oracle/keeper/tip_test.go +++ b/x/oracle/keeper/tip_test.go @@ -23,35 +23,6 @@ var ( ETH_queryId = []byte("0x83a7f3d48786ac2667503a61e8c415438ed2922eb86a2906e4ee66d9a2ce4992") ) -// func (s *KeeperTestSuite) CreateFiveTestAccounts() []Accounts { -// // accounts := make([]Accounts, 0, 5) -// // for i := 0; i < 5; i++ { -// // privKey := secp256k1.GenPrivKey() -// // accountAddress := sdk.AccAddress(privKey.PubKey().Address()) -// // account := authtypes.BaseAccount{ -// // Address: accountAddress.String(), -// // PubKey: codectypes.UnsafePackAny(privKey.PubKey()), -// // AccountNumber: uint64(i + 1), -// // } -// // existingAccount := s.accountKeeper.GetAccount(s.ctx, accountAddress) -// // if existingAccount == nil { -// // s.accountKeeper.SetAccount(s.ctx, &account) -// // accounts = append(accounts, Accounts{ -// // PrivateKey: *privKey, -// // Account: accountAddress, -// // }) -// // } -// // } -// } -// func (s *KeeperTestSuite) TestTransfer(t *testing.T) { -// s.SetupTest() -// privKey := secp256k1.GenPrivKey() -// accountAddress := sdk.AccAddress(privKey.PubKey().Address()) -// tip := sdk.NewCoin("loya", math.NewInt(1000000)) -// ctx := context.Background() -// res, err := s.oracleKeeper.transfer() -// } - func ReturnTestQueryMeta(tip math.Int) types.QueryMeta { return types.QueryMeta{ Id: 1, diff --git a/x/oracle/keeper/weighted_median.go b/x/oracle/keeper/weighted_median.go index 4228e9a0a..949dbe39f 100644 --- a/x/oracle/keeper/weighted_median.go +++ b/x/oracle/keeper/weighted_median.go @@ -31,7 +31,7 @@ func (k Keeper) WeightedMedian(ctx context.Context, reports []types.MicroReport) for _, r := range reports { weightedSum.Add(&weightedSum, new(big.Int).Mul(values[r.Reporter], big.NewInt(r.Power))) totalReporterPower.Add(&totalReporterPower, big.NewInt(r.Power)) - medianReport.Reporters = append(medianReport.Reporters, &types.AggregateReporter{Reporter: r.Reporter, Power: r.Power}) + medianReport.Reporters = append(medianReport.Reporters, &types.AggregateReporter{Reporter: r.Reporter, Power: r.Power, BlockNumber: r.BlockNumber}) } halfTotalPower := new(big.Int).Div(&totalReporterPower, big.NewInt(2)) diff --git a/x/oracle/keeper/weighted_mode.go b/x/oracle/keeper/weighted_mode.go index 2e29f6d9b..be1639e84 100644 --- a/x/oracle/keeper/weighted_mode.go +++ b/x/oracle/keeper/weighted_mode.go @@ -21,7 +21,7 @@ func (k Keeper) WeightedMode(ctx context.Context, reports []types.MicroReport) ( var totalReporterPower int64 // populate frequency map for _, r := range reports { - modeReporters = append(modeReporters, &types.AggregateReporter{Reporter: r.Reporter, Power: r.Power}) + modeReporters = append(modeReporters, &types.AggregateReporter{Reporter: r.Reporter, Power: r.Power, BlockNumber: r.BlockNumber}) entries := r.Power for i := int64(0); i < entries; i++ { frequencyMap[r.Value]++ diff --git a/x/oracle/mocks/ReporterKeeper.go b/x/oracle/mocks/ReporterKeeper.go index fdcb2f600..f571de665 100644 --- a/x/oracle/mocks/ReporterKeeper.go +++ b/x/oracle/mocks/ReporterKeeper.go @@ -9,8 +9,6 @@ import ( mock "github.com/stretchr/testify/mock" - reportertypes "github.com/tellor-io/layer/x/reporter/types" - types "github.com/cosmos/cosmos-sdk/types" ) @@ -19,27 +17,13 @@ type ReporterKeeper struct { mock.Mock } -// AllocateTokensToReporter provides a mock function with given fields: ctx, reporterAddr, tokens -func (_m *ReporterKeeper) AllocateTokensToReporter(ctx context.Context, reporterAddr types.ValAddress, tokens types.DecCoins) error { - ret := _m.Called(ctx, reporterAddr, tokens) - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, types.ValAddress, types.DecCoins) error); ok { - r0 = rf(ctx, reporterAddr, tokens) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// DivvyingTips provides a mock function with given fields: ctx, reporterAddr, reward -func (_m *ReporterKeeper) DivvyingTips(ctx context.Context, reporterAddr types.AccAddress, reward math.Int) error { - ret := _m.Called(ctx, reporterAddr, reward) +// DivvyingTips provides a mock function with given fields: ctx, reporterAddr, reward, height +func (_m *ReporterKeeper) DivvyingTips(ctx context.Context, reporterAddr types.AccAddress, reward math.Int, height int64) error { + ret := _m.Called(ctx, reporterAddr, reward, height) var r0 error - if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress, math.Int) error); ok { - r0 = rf(ctx, reporterAddr, reward) + if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress, math.Int, int64) error); ok { + r0 = rf(ctx, reporterAddr, reward, height) } else { r0 = ret.Error(0) } @@ -47,21 +31,19 @@ func (_m *ReporterKeeper) DivvyingTips(ctx context.Context, reporterAddr types.A return r0 } -// Reporter provides a mock function with given fields: ctx, repAddress -func (_m *ReporterKeeper) Reporter(ctx context.Context, repAddress types.AccAddress) (*reportertypes.OracleReporter, error) { +// ReporterStake provides a mock function with given fields: ctx, repAddress +func (_m *ReporterKeeper) ReporterStake(ctx context.Context, repAddress types.AccAddress) (math.Int, error) { ret := _m.Called(ctx, repAddress) - var r0 *reportertypes.OracleReporter + var r0 math.Int var r1 error - if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress) (*reportertypes.OracleReporter, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress) (math.Int, error)); ok { return rf(ctx, repAddress) } - if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress) *reportertypes.OracleReporter); ok { + if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress) math.Int); ok { r0 = rf(ctx, repAddress) } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*reportertypes.OracleReporter) - } + r0 = ret.Get(0).(math.Int) } if rf, ok := ret.Get(1).(func(context.Context, types.AccAddress) error); ok { diff --git a/x/oracle/types/aggregate_reporter.pb.go b/x/oracle/types/aggregate_reporter.pb.go index 3191be3e3..778683e7c 100644 --- a/x/oracle/types/aggregate_reporter.pb.go +++ b/x/oracle/types/aggregate_reporter.pb.go @@ -23,8 +23,9 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type AggregateReporter struct { - Reporter string `protobuf:"bytes,1,opt,name=reporter,proto3" json:"reporter,omitempty"` - Power int64 `protobuf:"varint,2,opt,name=power,proto3" json:"power,omitempty"` + Reporter string `protobuf:"bytes,1,opt,name=reporter,proto3" json:"reporter,omitempty"` + Power int64 `protobuf:"varint,2,opt,name=power,proto3" json:"power,omitempty"` + BlockNumber int64 `protobuf:"varint,3,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` } func (m *AggregateReporter) Reset() { *m = AggregateReporter{} } @@ -74,6 +75,13 @@ func (m *AggregateReporter) GetPower() int64 { return 0 } +func (m *AggregateReporter) GetBlockNumber() int64 { + if m != nil { + return m.BlockNumber + } + return 0 +} + func init() { proto.RegisterType((*AggregateReporter)(nil), "layer.oracle.AggregateReporter") } @@ -83,19 +91,20 @@ func init() { } var fileDescriptor_c1d4f41be31c27a7 = []byte{ - // 179 bytes of a gzipped FileDescriptorProto + // 204 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xcd, 0x49, 0xac, 0x4c, 0x2d, 0xd2, 0xcf, 0x2f, 0x4a, 0x4c, 0xce, 0x49, 0xd5, 0x4f, 0x4c, 0x4f, 0x2f, 0x4a, 0x4d, 0x4f, 0x2c, 0x49, 0x8d, 0x2f, 0x4a, 0x2d, 0xc8, 0x2f, 0x2a, 0x49, 0x2d, 0xd2, 0x2b, 0x28, 0xca, 0x2f, - 0xc9, 0x17, 0xe2, 0x01, 0x2b, 0xd3, 0x83, 0x28, 0x53, 0x72, 0xe5, 0x12, 0x74, 0x84, 0xa9, 0x0c, + 0xc9, 0x17, 0xe2, 0x01, 0x2b, 0xd3, 0x83, 0x28, 0x53, 0xca, 0xe0, 0x12, 0x74, 0x84, 0xa9, 0x0c, 0x82, 0x2a, 0x14, 0x92, 0xe2, 0xe2, 0x80, 0x69, 0x92, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x0c, 0x82, 0xf3, 0x85, 0x44, 0xb8, 0x58, 0x0b, 0xf2, 0xcb, 0x53, 0x8b, 0x24, 0x98, 0x14, 0x18, 0x35, 0x98, - 0x83, 0x20, 0x1c, 0x27, 0xe7, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, - 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0xd2, - 0x4c, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x2f, 0x49, 0xcd, 0xc9, 0xc9, - 0x2f, 0xd2, 0xcd, 0xcc, 0xd7, 0x87, 0x38, 0xb5, 0x02, 0xe6, 0xd8, 0x92, 0xca, 0x82, 0xd4, 0xe2, - 0x24, 0x36, 0xb0, 0x03, 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x52, 0x6d, 0xbc, 0x71, 0xc9, - 0x00, 0x00, 0x00, + 0x83, 0x20, 0x1c, 0x21, 0x45, 0x2e, 0x9e, 0xa4, 0x9c, 0xfc, 0xe4, 0xec, 0xf8, 0xbc, 0xd2, 0xdc, + 0xa4, 0xd4, 0x22, 0x09, 0x66, 0xb0, 0x24, 0x37, 0x58, 0xcc, 0x0f, 0x2c, 0xe4, 0xe4, 0x7c, 0xe2, + 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, + 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x9a, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, + 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0x25, 0xa9, 0x39, 0x39, 0xf9, 0x45, 0xba, 0x99, 0xf9, 0xfa, 0x10, + 0xdf, 0x54, 0xc0, 0xfc, 0x53, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0xf6, 0x83, 0x31, 0x20, + 0x00, 0x00, 0xff, 0xff, 0x0b, 0x5c, 0xd7, 0xdb, 0xec, 0x00, 0x00, 0x00, } func (m *AggregateReporter) Marshal() (dAtA []byte, err error) { @@ -118,6 +127,11 @@ func (m *AggregateReporter) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.BlockNumber != 0 { + i = encodeVarintAggregateReporter(dAtA, i, uint64(m.BlockNumber)) + i-- + dAtA[i] = 0x18 + } if m.Power != 0 { i = encodeVarintAggregateReporter(dAtA, i, uint64(m.Power)) i-- @@ -157,6 +171,9 @@ func (m *AggregateReporter) Size() (n int) { if m.Power != 0 { n += 1 + sovAggregateReporter(uint64(m.Power)) } + if m.BlockNumber != 0 { + n += 1 + sovAggregateReporter(uint64(m.BlockNumber)) + } return n } @@ -246,6 +263,25 @@ func (m *AggregateReporter) Unmarshal(dAtA []byte) error { break } } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockNumber", wireType) + } + m.BlockNumber = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAggregateReporter + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BlockNumber |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipAggregateReporter(dAtA[iNdEx:]) diff --git a/x/oracle/types/expected_keepers.go b/x/oracle/types/expected_keepers.go index 1949a5fc2..d6e68f7b9 100644 --- a/x/oracle/types/expected_keepers.go +++ b/x/oracle/types/expected_keepers.go @@ -4,7 +4,6 @@ import ( context "context" rktypes "github.com/tellor-io/layer/x/registry/types" - reportertypes "github.com/tellor-io/layer/x/reporter/types" "cosmossdk.io/math" @@ -34,9 +33,8 @@ type RegistryKeeper interface { type ReporterKeeper interface { // Methods imported from reporter should be defined here - AllocateTokensToReporter(ctx context.Context, reporterAddr sdk.ValAddress, tokens sdk.DecCoins) error - Reporter(ctx context.Context, repAddress sdk.AccAddress) (*reportertypes.OracleReporter, error) - DivvyingTips(ctx context.Context, reporterAddr sdk.AccAddress, reward math.Int) error + ReporterStake(ctx context.Context, repAddress sdk.AccAddress) (math.Int, error) + DivvyingTips(ctx context.Context, reporterAddr sdk.AccAddress, reward math.Int, height int64) error } type RegistryHooks interface { diff --git a/x/reporter/keeper/distribution.go b/x/reporter/keeper/distribution.go index 70e03496e..d2aaf5fb6 100644 --- a/x/reporter/keeper/distribution.go +++ b/x/reporter/keeper/distribution.go @@ -5,9 +5,6 @@ import ( "context" "errors" "fmt" - gomath "math" - - "github.com/tellor-io/layer/x/reporter/types" "cosmossdk.io/collections" "cosmossdk.io/math" @@ -15,831 +12,57 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) - -// WithdrawReporterCommission withdraws the accumulated commission of a reporter. -// It fetches the reporter's accumulated commission from the storage and checks if it is zero. -// If the commission is zero, it returns an error. -// Otherwise, it truncates the commission and updates the remainder in the storage for later withdrawal. -// It then updates the outstanding rewards by subtracting the commission from the reporter's rewards. -// If the commission is not zero, it sends the commission coins from the module to the reporter's account. -// Finally, it emits an event to indicate the successful withdrawal of the commission. -// Returns the withdrawn commission coins and any error encountered. -func (k Keeper) WithdrawReporterCommission(ctx context.Context, reporterVal sdk.ValAddress) (sdk.Coins, error) { - // fetch reporter accumulated commission - accumCommission, err := k.ReportersAccumulatedCommission.Get(ctx, reporterVal) - if err != nil && !errors.Is(err, collections.ErrNotFound) { - return nil, err - } - - if accumCommission.Commission.IsZero() { - return nil, types.ErrNoReporterCommission - } - - commission, remainder := accumCommission.Commission.TruncateDecimal() - err = k.ReportersAccumulatedCommission.Set(ctx, reporterVal, types.ReporterAccumulatedCommission{Commission: remainder}) // leave remainder to withdraw later - if err != nil { - return nil, err - } - // update outstanding - outstanding, err := k.ReporterOutstandingRewards.Get(ctx, reporterVal) - if err != nil { - return nil, err - } - - err = k.ReporterOutstandingRewards.Set(ctx, reporterVal, types.ReporterOutstandingRewards{Rewards: outstanding.Rewards.Sub(sdk.NewDecCoinsFromCoins(commission...))}) - if err != nil { - return nil, err - } - - if !commission.IsZero() { - - err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, reporterVal.Bytes(), commission) - if err != nil { - return nil, err - } - } - - sdkCtx := sdk.UnwrapSDKContext(ctx) - sdkCtx.EventManager().EmitEvent( - sdk.NewEvent( - types.EventTypeWithdrawCommission, - sdk.NewAttribute(sdk.AttributeKeyAmount, commission.String()), - ), - ) - - return commission, nil -} - -// AllocateTokensToReporter allocate tokens to a particular reporter, -// splitting according to commission. -// AllocateTokensToReporter allocates tokens to a reporter and updates the commission, rewards, and outstanding rewards. -// It splits the tokens between the reporter and delegators according to the commission rate. -// Parameters: -// - ctx: The context of the current operation. -// - reporterAcc: The account address of the reporter as AccAddress type. -// - tokens: The tokens to be allocated. -// Returns: -// - error: An error if the operation fails, nil otherwise. -func (k Keeper) AllocateTokensToReporter(ctx context.Context, reporterVal sdk.ValAddress, tokens sdk.DecCoins) error { - // split tokens between reporter and delegators according to commission - rep, err := k.Reporters.Get(ctx, reporterVal.Bytes()) - if err != nil { - return err - } - - commission := tokens.MulDec(rep.Commission.Rate) - shared := tokens.Sub(commission) - - // update current commission - sdkCtx := sdk.UnwrapSDKContext(ctx) - sdkCtx.EventManager().EmitEvent( - sdk.NewEvent( - types.EventTypeCommission, - sdk.NewAttribute(sdk.AttributeKeyAmount, commission.String()), - sdk.NewAttribute(types.AttributeKeyReporter, sdk.AccAddress(reporterVal).String()), - ), - ) - currentCommission, err := k.ReportersAccumulatedCommission.Get(ctx, reporterVal) - if err != nil && !errors.Is(err, collections.ErrNotFound) { - return err - } - - currentCommission.Commission = currentCommission.Commission.Add(commission...) - err = k.ReportersAccumulatedCommission.Set(ctx, reporterVal, currentCommission) - if err != nil { - return err - } - - // update current rewards - currentRewards, err := k.ReporterCurrentRewards.Get(ctx, reporterVal) - // if the rewards do not exist it's fine, we will just add to zero. - if err != nil && !errors.Is(err, collections.ErrNotFound) { - return err - } - - currentRewards.Rewards = currentRewards.Rewards.Add(shared...) - err = k.ReporterCurrentRewards.Set(ctx, reporterVal, currentRewards) - if err != nil { - return err - } - - // update outstanding rewards - sdkCtx.EventManager().EmitEvent( - sdk.NewEvent( - types.EventTypeRewards, - sdk.NewAttribute(sdk.AttributeKeyAmount, tokens.String()), - sdk.NewAttribute(types.AttributeKeyReporter, sdk.AccAddress(reporterVal).String()), - ), - ) - - outstanding, err := k.ReporterOutstandingRewards.Get(ctx, reporterVal) - if err != nil && !errors.Is(err, collections.ErrNotFound) { - return err - } - - outstanding.Rewards = outstanding.Rewards.Add(tokens...) - return k.ReporterOutstandingRewards.Set(ctx, reporterVal, outstanding) -} - -// WithdrawDelegationRewards withdraws the delegation rewards for a given delegator and reporter. -// It retrieves the reporter and delegator from the keeper and asserts that the reporter matches the delegator's reporter. -// Then, it calls the withdrawDelegationRewards function to actually withdraw the rewards. -// After that, it reinitializes the delegation by calling the initializeDelegation function. -// Finally, it returns the withdrawn rewards. -func (k Keeper) WithdrawDelegationRewards(ctx context.Context, reporterVal sdk.ValAddress, delAddr sdk.AccAddress) (sdk.Coins, error) { - reporter, err := k.Reporters.Get(ctx, reporterVal.Bytes()) - if err != nil { - return nil, err - } - - del, err := k.Delegators.Get(ctx, delAddr) - if err != nil { - return nil, err - } - // assert the right reporter for sanity - if !bytes.Equal(del.GetReporter(), reporter.GetReporter()) { - return nil, types.ErrReporterMismatch - } - - // withdraw rewards - rewards, err := k.withdrawDelegationRewards(ctx, reporter, delAddr, del) - if err != nil { - return nil, err - } - - // reinitialize the delegation - err = k.initializeDelegation(ctx, reporterVal, delAddr, del.Amount) - if err != nil { - return nil, err - } - return rewards, nil -} - -// initialize starting info for a new delegation -// initializeDelegation initializes a delegation by storing the period ended by the delegation action and updating the reference count for the period. -// It also sets the DelegatorStartingInfo for the delegation. -func (k Keeper) initializeDelegation(ctx context.Context, reporterVal sdk.ValAddress, delAddr sdk.AccAddress, stake math.Int) error { - // period has already been incremented - we want to store the period ended by this delegation action - repCurrentRewards, err := k.ReporterCurrentRewards.Get(ctx, reporterVal) - if err != nil { - return err - } - previousPeriod := repCurrentRewards.Period - 1 - - // increment reference count for the period we're going to track - err = k.incrementReferenceCount(ctx, reporterVal, previousPeriod) - if err != nil { - return err - } - - sdkCtx := sdk.UnwrapSDKContext(ctx) - return k.DelegatorStartingInfo.Set(ctx, collections.Join(reporterVal.Bytes(), delAddr.Bytes()), types.NewDelegatorStartingInfo(previousPeriod, stake, uint64(sdkCtx.BlockHeight()))) -} - -// increment the reference count for a historical rewards value -// incrementReferenceCount increments the reference count for a reporter's historical rewards for a specific period. -// It retrieves the historical rewards for the reporter and period from the store, increments the reference count, -// and updates the store with the modified historical rewards. -func (k Keeper) incrementReferenceCount(ctx context.Context, reporterVal sdk.ValAddress, period uint64) error { - historical, err := k.ReporterHistoricalRewards.Get(ctx, collections.Join(reporterVal.Bytes(), period)) - if err != nil { - return err - } - if historical.ReferenceCount > 2 { - panic("reference count should never exceed 2") - } - historical.ReferenceCount++ - return k.ReporterHistoricalRewards.Set(ctx, collections.Join(reporterVal.Bytes(), period), historical) -} - -// withdrawDelegationRewards withdraws the delegation rewards for a specific delegator. -// It calculates the rewards, truncates the decimal portion, adds the rewards to the delegator's account, -// updates the outstanding rewards, burns the remainder, decrements the reference count of the starting period, -// and removes the delegator starting info. Finally, it emits an event for the withdrawal of rewards. -func (k Keeper) withdrawDelegationRewards(ctx context.Context, reporter types.OracleReporter, delAddr sdk.AccAddress, del types.Delegation) (sdk.Coins, error) { - reporterVal := sdk.ValAddress(reporter.Reporter) - - // check existence of delegator starting info - hasInfo, err := k.DelegatorStartingInfo.Has(ctx, collections.Join(reporterVal.Bytes(), delAddr.Bytes())) - if err != nil { - return nil, err - } - - if !hasInfo { - return nil, types.ErrEmptyDelegationDistInfo - } - // end current period and calculate rewards - endingPeriod, err := k.IncrementReporterPeriod(ctx, reporter) - if err != nil { - return nil, err - } - - rewardsRaw, err := k.CalculateDelegationRewards(ctx, reporterVal, delAddr, del, endingPeriod) - if err != nil { - return nil, err - } - - outstanding, err := k.GetReporterOutstandingRewardsCoins(ctx, reporterVal) - if err != nil { - return nil, err - } - - // defensive edge case may happen on the very final digits - // of the decCoins due to operation order of the distribution mechanism. - rewards := rewardsRaw.Intersect(outstanding) - if !rewards.Equal(rewardsRaw) { - logger := k.Logger() - logger.Info( - "rounding error withdrawing rewards from reporter", - "delegator", delAddr.String(), - "reporter", reporter.GetReporter(), - "got", rewards.String(), - "expected", rewardsRaw.String(), - ) - } - - // truncate reward dec coins, return remainder to decimal pool - finalRewards, remainder := rewards.TruncateDecimal() - - // add coins to user account - if !finalRewards.IsZero() { - err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, delAddr, finalRewards) - if err != nil { - return nil, err - } - } - - // update the outstanding rewards and the decimal pool only if the transaction was successful - if err := k.ReporterOutstandingRewards.Set(ctx, reporterVal, types.ReporterOutstandingRewards{Rewards: outstanding.Sub(rewards)}); err != nil { - return nil, err - } - // TODO: burn remainder - _ = remainder - - // decrement reference count of starting period - startingInfo, err := k.DelegatorStartingInfo.Get(ctx, collections.Join(reporterVal.Bytes(), delAddr.Bytes())) - if err != nil && !errors.Is(err, collections.ErrNotFound) { - return nil, err - } - - startingPeriod := startingInfo.PreviousPeriod - err = k.decrementReferenceCount(ctx, reporterVal, startingPeriod) - if err != nil { - return nil, err - } - - // remove delegator starting info - err = k.DelegatorStartingInfo.Remove(ctx, collections.Join(reporterVal.Bytes(), delAddr.Bytes())) - if err != nil { - return nil, err - } - - if finalRewards.IsZero() { - // Note, we do not call the NewCoins constructor as we do not want the zero - // coin removed. - finalRewards = sdk.Coins{sdk.NewCoin(types.Denom, math.ZeroInt())} - } - - sdkCtx := sdk.UnwrapSDKContext(ctx) - sdkCtx.EventManager().EmitEvent( - sdk.NewEvent( - types.EventTypeWithdrawRewards, - sdk.NewAttribute(sdk.AttributeKeyAmount, finalRewards.String()), - sdk.NewAttribute(types.AttributeKeyReporter, sdk.AccAddress(reporter.GetReporter()).String()), - sdk.NewAttribute(types.AttributeKeyDelegator, delAddr.String()), - ), - ) - - return finalRewards, nil -} - -// CalculateDelegationRewards calculates the rewards for a delegation based on the starting and ending period. -// It takes the context, reporter ValAddress, delegator AccAddress, delegation information, and the ending period as input. -// It returns the rewards as sdk.DecCoins and an error if any. -func (k Keeper) CalculateDelegationRewards(ctx context.Context, reporterVal sdk.ValAddress, delAddr sdk.AccAddress, del types.Delegation, endingPeriod uint64) (rewards sdk.DecCoins, err error) { - // fetch starting info for delegation - startingInfo, err := k.DelegatorStartingInfo.Get(ctx, collections.Join(reporterVal.Bytes(), delAddr.Bytes())) - if err != nil && !errors.Is(err, collections.ErrNotFound) { - return sdk.DecCoins{}, err - } - - sdkCtx := sdk.UnwrapSDKContext(ctx) - if startingInfo.Height == uint64(sdkCtx.BlockHeight()) { - // started this height, no rewards yet - return sdk.DecCoins{}, nil - } - - startingPeriod := startingInfo.PreviousPeriod - stake := math.LegacyNewDecFromInt(startingInfo.Stake) - - // Iterate through disputes and withdraw with calculated staking for - // distribution periods. These period offsets are dependent on *when* disputes - // happen - startingHeight := startingInfo.Height - // Disputes this block happened after reward allocation, but we have to account - // for them for the stake sanity check below. - endingHeight := uint64(sdkCtx.BlockHeight()) - var iterErr error - if endingHeight > startingHeight { - err = k.IterateReporterDisputeEventsBetween(ctx, reporterVal, startingHeight, endingHeight, - func(height uint64, event types.ReporterDisputeEvent) (stop bool) { - endingPeriod := event.ReporterPeriod - if endingPeriod > startingPeriod { - delRewards, err := k.calculateDelegationRewardsBetween(ctx, reporterVal, startingPeriod, endingPeriod, stake.TruncateInt()) - if err != nil { - iterErr = err - return true - } - rewards = rewards.Add(delRewards...) - - // Note: It is necessary to truncate so we don't allow withdrawing - // more rewards than owed. - stake = stake.MulTruncate(math.LegacyOneDec().Sub(event.Fraction)) - startingPeriod = endingPeriod - } - return false - }, - ) - if iterErr != nil { - return sdk.DecCoins{}, iterErr - } - if err != nil { - return sdk.DecCoins{}, err - } - } - - // A total stake sanity check; Recalculated final stake should be less than or - // equal to current stake here. We cannot use Equals because stake is truncated - // when multiplied by slash fractions (see above). We could only use equals if - // we had arbitrary-precision rationals. - currentStake := math.LegacyNewDecFromInt(del.Amount) - - if stake.GT(currentStake) { - // AccountI for rounding inconsistencies between: - // - // currentStake: calculated as in staking with a single computation - // stake: calculated as an accumulation of stake - // calculations across reporter's distribution periods - // - // These inconsistencies are due to differing order of operations which - // will inevitably have different accumulated rounding and may lead to - // the smallest decimal place being one greater in stake than - // currentStake. When we calculated slashing by period, even if we - // round down for each slash fraction, it's possible due to how much is - // being rounded that we slash less when slashing by period instead of - // for when we slash without periods. In other words, the single slash, - // and the slashing by period could both be rounding down but the - // slashing by period is simply rounding down less, thus making stake > - // currentStake - // - // A small amount of this error is tolerated and corrected for, - // however any greater amount should be considered a breach in expected - // behavior. - marginOfErr := math.LegacySmallestDec().MulInt64(3) - if stake.LTE(currentStake.Add(marginOfErr)) { - stake = currentStake - } else { - return sdk.DecCoins{}, fmt.Errorf("calculated final stake for delegator %s greater than current stake"+ - "\n\tfinal stake:\t%s"+ - "\n\tcurrent stake:\t%s", - del.GetReporter(), stake, currentStake) - } - } - - // calculate rewards for final period - delRewards, err := k.calculateDelegationRewardsBetween(ctx, reporterVal, startingPeriod, endingPeriod, stake.TruncateInt()) - if err != nil { - return sdk.DecCoins{}, err - } - - rewards = rewards.Add(delRewards...) - return rewards, nil -} - -// increment reporter period, returning the period just ended -func (k Keeper) IncrementReporterPeriod(ctx context.Context, reporter types.OracleReporter) (uint64, error) { - // fetch current rewards - reporterVal := sdk.ValAddress(reporter.Reporter) - rewards, err := k.ReporterCurrentRewards.Get(ctx, reporterVal) - if err != nil && !errors.Is(err, collections.ErrNotFound) { - return 0, err - } - - // calculate current ratio - var current sdk.DecCoins - if reporter.TotalTokens.IsZero() { - - // can't calculate ratio for zero-token reporters - // ergo we instead add to ~~~the decimal pool~~ TODO: burn rewards.Rewards - - outstanding, err := k.ReporterOutstandingRewards.Get(ctx, reporterVal) - if err != nil && !errors.Is(err, collections.ErrNotFound) { - return 0, err - } - - outstanding.Rewards = outstanding.GetRewards().Sub(rewards.Rewards) - - err = k.ReporterOutstandingRewards.Set(ctx, reporterVal, outstanding) - if err != nil { - return 0, err - } - - current = sdk.DecCoins{} - } else { - // note: necessary to truncate so we don't allow withdrawing more rewards than owed - current = rewards.Rewards.QuoDecTruncate(math.LegacyNewDecFromInt(reporter.TotalTokens)) - } - - // fetch historical rewards for last period - historical, err := k.ReporterHistoricalRewards.Get(ctx, collections.Join(reporterVal.Bytes(), rewards.Period-1)) - if err != nil { - return 0, err - } - - cumRewardRatio := historical.CumulativeRewardRatio - - // decrement reference count - err = k.decrementReferenceCount(ctx, reporterVal, rewards.Period-1) - if err != nil { - return 0, err - } - - // set new historical rewards with reference count of 1 - err = k.ReporterHistoricalRewards.Set(ctx, collections.Join(reporterVal.Bytes(), rewards.Period), types.NewReporterHistoricalRewards(cumRewardRatio.Add(current...), 1)) - if err != nil { - return 0, err - } - - // set current rewards, incrementing period by 1 - err = k.ReporterCurrentRewards.Set(ctx, reporterVal, types.NewReporterCurrentRewards(sdk.DecCoins{}, rewards.Period+1)) - if err != nil { - return 0, err - } - - return rewards.Period, nil -} - -// calculate the rewards accrued by a delegation between two periods -func (k Keeper) calculateDelegationRewardsBetween(ctx context.Context, reporterVal sdk.ValAddress, - startingPeriod, endingPeriod uint64, stake math.Int, -) (sdk.DecCoins, error) { - // sanity check - if startingPeriod > endingPeriod { - return sdk.DecCoins{}, fmt.Errorf("startingPeriod cannot be greater than endingPeriod") - } - - // sanity check - if stake.IsNegative() { - return sdk.DecCoins{}, fmt.Errorf("stake should not be negative") - } - - // return staking * (ending - starting) - starting, err := k.ReporterHistoricalRewards.Get(ctx, collections.Join(reporterVal.Bytes(), startingPeriod)) - if err != nil { - return sdk.DecCoins{}, err - } - - ending, err := k.ReporterHistoricalRewards.Get(ctx, collections.Join(reporterVal.Bytes(), endingPeriod)) - if err != nil { - return sdk.DecCoins{}, err - } - - difference := ending.CumulativeRewardRatio.Sub(starting.CumulativeRewardRatio) - if difference.IsAnyNegative() { - return sdk.DecCoins{}, fmt.Errorf("negative rewards should not be possible") - } - // note: necessary to truncate so we don't allow withdrawing more rewards than owed - rewards := difference.MulDecTruncate(math.LegacyNewDecFromInt(stake)) - return rewards, nil -} - -// decrement the reference count for a historical rewards value, and delete if zero references remain -func (k Keeper) decrementReferenceCount(ctx context.Context, reporterAddr sdk.ValAddress, period uint64) error { - historical, err := k.ReporterHistoricalRewards.Get(ctx, collections.Join(reporterAddr.Bytes(), period)) - if err != nil { - return err - } - - if historical.ReferenceCount == 0 { - panic("cannot set negative reference count") - } - historical.ReferenceCount-- - if historical.ReferenceCount == 0 { - return k.ReporterHistoricalRewards.Remove(ctx, collections.Join(reporterAddr.Bytes(), period)) - } - - return k.ReporterHistoricalRewards.Set(ctx, collections.Join(reporterAddr.Bytes(), period), historical) -} - -// GetTotalRewards returns the total amount of fee distribution rewards held in the store -func (k Keeper) GetTotalRewards(ctx context.Context) (totalRewards sdk.DecCoins) { - err := k.ReporterOutstandingRewards.Walk(ctx, nil, func(_ []byte, rewards types.ReporterOutstandingRewards) (stop bool, err error) { - totalRewards = totalRewards.Add(rewards.Rewards...) - return false, nil - }, - ) - if err != nil { - panic(err) - } - - return totalRewards -} - -// get outstanding rewards -func (k Keeper) GetReporterOutstandingRewardsCoins(ctx context.Context, reporterVal sdk.ValAddress) (sdk.DecCoins, error) { - rewards, err := k.ReporterOutstandingRewards.Get(ctx, reporterVal) - if err != nil && !errors.Is(err, collections.ErrNotFound) { - return nil, err - } - - return rewards.Rewards, nil -} - -// iterate over slash events between heights, inclusive -func (k Keeper) IterateReporterDisputeEventsBetween(ctx context.Context, reporterVal sdk.ValAddress, startingHeight, endingHeight uint64, - handler func(height uint64, event types.ReporterDisputeEvent) (stop bool), -) error { - rng := new(collections.Range[collections.Triple[[]byte, uint64, uint64]]). - StartInclusive(collections.Join3(reporterVal.Bytes(), startingHeight, uint64(0))). - EndExclusive(collections.Join3(reporterVal.Bytes(), endingHeight+1, uint64(gomath.MaxUint64))) - - err := k.ReporterDisputeEvents.Walk(ctx, rng, func(k collections.Triple[[]byte, uint64, uint64], ev types.ReporterDisputeEvent) (stop bool, err error) { - height := k.K2() - if handler(height, ev) { - return true, nil - } - return false, nil - }) - if err != nil { - return err - } - - return nil -} - -func (k Keeper) initializeReporter(ctx context.Context, reporter types.OracleReporter) error { - valBz := sdk.ValAddress(reporter.Reporter) - // set initial historical rewards (period 0) with reference count of 1 - err := k.ReporterHistoricalRewards.Set(ctx, collections.Join(valBz.Bytes(), uint64(0)), types.NewReporterHistoricalRewards(sdk.DecCoins{}, 1)) - if err != nil { - return err - } - - // set current rewards (starting at period 1) - err = k.ReporterCurrentRewards.Set(ctx, valBz, types.NewReporterCurrentRewards(sdk.DecCoins{}, 1)) - if err != nil { - return err - } - - // set accumulated commission - err = k.ReportersAccumulatedCommission.Set(ctx, valBz, types.ReporterAccumulatedCommission{}) - if err != nil { - return err - } - - // set outstanding rewards - err = k.ReporterOutstandingRewards.Set(ctx, valBz, types.ReporterOutstandingRewards{Rewards: sdk.DecCoins{}}) - return err -} - -func (k Keeper) updateReporterDisputeFraction(ctx context.Context, reporterVal sdk.ValAddress, fraction math.LegacyDec) error { - if fraction.GT(math.LegacyOneDec()) || fraction.IsNegative() { - return fmt.Errorf("fraction must be >=0 and <=1, current fraction: %v", fraction) - } - - sdkCtx := sdk.UnwrapSDKContext(ctx) - reporter, err := k.Reporters.Get(ctx, sdk.AccAddress(reporterVal)) - if err != nil { - return err - } - // increment current period - newPeriod, err := k.IncrementReporterPeriod(ctx, reporter) - if err != nil { - return err - } - - // increment reference count on period we need to track - err = k.incrementReferenceCount(ctx, reporterVal, newPeriod) - if err != nil { - return err - } - - slashEvent := types.NewReporterDisputeEvent(newPeriod, fraction) - height := uint64(sdkCtx.BlockHeight()) - - return k.ReporterDisputeEvents.Set( - ctx, - collections.Join3[[]byte, uint64, uint64]( - reporterVal.Bytes(), - height, - newPeriod, - ), - slashEvent, - ) -} - -// Hooks to implement part of reporter crud operations -func (k Keeper) AfterReporterRemoved(ctx context.Context, reporterVal sdk.ValAddress) error { - // fetch outstanding - outstanding, err := k.GetReporterOutstandingRewardsCoins(ctx, reporterVal) - if err != nil { - return err - } - - // force-withdraw commission - reporterCommission, err := k.ReportersAccumulatedCommission.Get(ctx, reporterVal) - if err != nil && !errors.Is(err, collections.ErrNotFound) { - return err - } - - commission := reporterCommission.Commission - - if !commission.IsZero() { - // subtract from outstanding - outstanding = outstanding.Sub(commission) - - // split into integral & remainder - coins, remainder := commission.TruncateDecimal() - // TODO: burn remainder (inflationary?) - _ = remainder - - // add to reporter account - if !coins.IsZero() { - if err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, sdk.AccAddress(reporterVal), coins); err != nil { - return err - } - } - } - - // "TODO: burn outstanding dust" - _ = outstanding - - // delete outstanding - err = k.ReporterOutstandingRewards.Remove(ctx, reporterVal) - if err != nil { - return err - } - - // remove commission record - err = k.ReportersAccumulatedCommission.Remove(ctx, reporterVal) - if err != nil { - return err - } - - // clear disputes - err = k.ReporterDisputeEvents.Clear(ctx, collections.NewPrefixedTripleRange[[]byte, uint64, uint64](reporterVal.Bytes())) - if err != nil { - return err - } - - // clear historical rewards - err = k.ReporterHistoricalRewards.Clear(ctx, collections.NewPrefixedPairRange[[]byte, uint64](reporterVal.Bytes())) - if err != nil { - return err - } - // clear current rewards - err = k.ReporterCurrentRewards.Remove(ctx, reporterVal) - if err != nil { - return err - } - - return nil -} - -// initialize reporter -func (k Keeper) AfterReporterCreated(ctx context.Context, reporter types.OracleReporter) error { - return k.initializeReporter(ctx, reporter) -} - -// increment period -func (k Keeper) BeforeDelegationCreated(ctx context.Context, reporter types.OracleReporter) error { - _, err := k.IncrementReporterPeriod(ctx, reporter) - return err -} - -// withdraw delegation rewards (which also increments period) -func (k Keeper) BeforeDelegationModified(ctx context.Context, delAddr sdk.AccAddress, del types.Delegation, reporter types.OracleReporter) error { - _, err := k.withdrawDelegationRewards(ctx, reporter, delAddr, del) - return err -} - -// create new delegation period record -func (k Keeper) AfterDelegationModified(ctx context.Context, delAddr sdk.AccAddress, reporterVal sdk.ValAddress, stake math.Int) error { - return k.initializeDelegation(ctx, reporterVal, delAddr, stake) -} - -func (k Keeper) AfterReporterModified(ctx context.Context, repAddr sdk.AccAddress) error { - snapshotKey := collections.Join(repAddr.Bytes(), sdk.UnwrapSDKContext(ctx).BlockHeight()) - // get all the token origins for the reporter - tokenSources, err := k.GetTokenSourcesForReporter(ctx, repAddr) - if err != nil { - return err - } - return k.TokenOriginSnapshot.Set(ctx, snapshotKey, tokenSources) -} - -// record the dispute event -func (k Keeper) BeforeReporterDisputed(ctx context.Context, valAddr sdk.ValAddress, fraction math.LegacyDec) error { - return k.updateReporterDisputeFraction(ctx, valAddr, fraction) -} - -func (k Keeper) GetTokenOriginsAtHeight(ctx context.Context, repAddr sdk.AccAddress, height int64) (types.DelegationsPreUpdate, error) { - return k.TokenOriginSnapshot.Get(ctx, collections.Join(repAddr.Bytes(), height)) -} - -func (k Keeper) DivvyingTips(ctx context.Context, reporterAddr sdk.AccAddress, reward math.Int) error { - reporter, err := k.Reporters.Get(ctx, reporterAddr) - if err != nil { - return err - } - // Calculate commission - commission := math.LegacyNewDecFromInt(reward).Mul(reporter.Commission.Rate) - - // Calculate net reward - netReward := math.LegacyNewDecFromInt(reward).Sub(commission) - - // Calculate each delegator's share (including the reporter as a self-delegator) - repAddr := sdk.AccAddress(reporter.Reporter) - delAddrs, err := k.Delegators.Indexes.Reporter.MatchExact(ctx, repAddr) - if err != nil { - return err - } - defer delAddrs.Close() - for ; delAddrs.Valid(); delAddrs.Next() { - key, err := delAddrs.PrimaryKey() - if err != nil { - return err - } - del, err := k.Delegators.Get(ctx, key) - if err != nil { - return err - } - delegatorShare := netReward.Mul(math.LegacyNewDecFromInt(del.Amount)).Quo(math.LegacyNewDecFromInt(reporter.TotalTokens)) - if bytes.Equal(key, repAddr.Bytes()) { - delegatorShare = delegatorShare.Add(commission) - } - err = k.DelegatorTips.Set(ctx, key, delegatorShare.TruncateInt()) - if err != nil { - return err - } + +// distributes tips paid in oracle module to delegators that were part of reporting the tip's report +func (k Keeper) DivvyingTips(ctx context.Context, reporterAddr sdk.AccAddress, reward math.Int, height int64) error { + reporter, err := k.Reporters.Get(ctx, reporterAddr) + if err != nil { + return err } + // Calculate commission + commission := math.LegacyNewDecFromInt(reward).Mul(reporter.Commission.Rate) - return nil -} + // Calculate net reward + netReward := math.LegacyNewDecFromInt(reward).Sub(commission) -func (k Keeper) returnSlashedTokens(ctx context.Context, hashId []byte) error { - snapshot, err := k.DisputedDelegationAmounts.Get(ctx, hashId) + delAddrs, err := k.Report.Get(ctx, collections.Join(reporterAddr.Bytes(), height)) if err != nil { return err } - // amt should be equal to sum of snapshot origins - for _, source := range snapshot.TokenOrigins { - // totalAmt = totalAmt.Add(source.Amount) - valAddr := sdk.ValAddress(source.ValidatorAddress) - var val stakingtypes.Validator - val, err = k.stakingKeeper.GetValidator(ctx, valAddr) + for _, del := range delAddrs.TokenOrigins { + delegatorShare := netReward.Mul(math.LegacyNewDecFromInt(del.Amount)).Quo(math.LegacyNewDecFromInt(reporter.TotalTokens)) + if bytes.Equal(del.DelegatorAddress, reporterAddr.Bytes()) { + delegatorShare = delegatorShare.Add(commission) + } + // get delegator's tips and add the new tip + oldTips, err := k.DelegatorTips.Get(ctx, del.DelegatorAddress) if err != nil { - if !errors.Is(err, stakingtypes.ErrNoValidatorFound) { - return err - } - vals, err := k.GetBondedValidators(ctx, 1) - if err != nil { + if errors.Is(err, collections.ErrNotFound) { + oldTips = math.ZeroInt() + } else { return err } - if len(vals) == 0 { - return errors.New("no validators found in staking module to return tokens to") - } - val = vals[0] } - delAddr := sdk.AccAddress(source.DelegatorAddress) - - _, err = k.stakingKeeper.Delegate(ctx, delAddr, source.Amount, stakingtypes.Unbonded, val, false) + err = k.DelegatorTips.Set(ctx, del.DelegatorAddress, oldTips.Add(delegatorShare.TruncateInt())) if err != nil { return err } - } - return k.DisputedDelegationAmounts.Remove(ctx, hashId) + return nil } -func (k Keeper) feeRefundNoReporter(ctx context.Context, hashId []byte, amt math.Int) error { - refundTo, err := k.FeePaidFromStake.Get(ctx, hashId) +// ReturnSlashedTokens returns the slashed tokens to the delegators, +// called in dispute module after dispute is resolved with result invalid or reporter wins +func (k Keeper) ReturnSlashedTokens(ctx context.Context, amt math.Int, hashId []byte) error { + snapshot, err := k.DisputedDelegationAmounts.Get(ctx, hashId) if err != nil { return err } - initialTotalAmount := math.ZeroInt() - - for _, recipient := range refundTo.TokenOrigins { - initialTotalAmount = initialTotalAmount.Add(recipient.Amount) - } - - for _, source := range refundTo.TokenOrigins { - // divide amounts depending on how much source paid - share := amt.Mul(source.Amount).Quo(initialTotalAmount) - share = share.Mul(amt) - + // possible additional tokens to give reporter in case of a dispute for the reporter + extra := amt.Sub(snapshot.Total) + for _, source := range snapshot.TokenOrigins { valAddr := sdk.ValAddress(source.ValidatorAddress) var val stakingtypes.Validator @@ -859,224 +82,64 @@ func (k Keeper) feeRefundNoReporter(ctx context.Context, hashId []byte, amt math } delAddr := sdk.AccAddress(source.DelegatorAddress) - _, err = k.stakingKeeper.Delegate(ctx, delAddr, share, stakingtypes.Unbonded, val, false) + // set token source to bonded if validator is bonded + // if not, set to unbonded + // this causes the delegate method to not transfer tokens since tokens + // are transferred via dispute module where ReturnSlashedTokens is called + var tokenSrc stakingtypes.BondStatus + if val.IsBonded() { + tokenSrc = stakingtypes.Bonded + } else { + tokenSrc = stakingtypes.Unbonded + } + shareAmt := math.LegacyNewDecFromInt(source.Amount) + if extra.IsPositive() { + // add extra tokens based on the share of the delegator + shareAmt = math.LegacyNewDecFromInt(source.Amount).Quo(math.LegacyNewDecFromInt(snapshot.Total)).Mul(math.LegacyNewDecFromInt(amt)) + } + _, err = k.stakingKeeper.Delegate(ctx, delAddr, shareAmt.TruncateInt(), tokenSrc, val, false) if err != nil { return err } } - return k.FeePaidFromStake.Remove(ctx, hashId) + return k.DisputedDelegationAmounts.Remove(ctx, hashId) } -func (k Keeper) FeeRefund(ctx context.Context, repAcc sdk.AccAddress, hashId []byte, amt math.Int) error { - reporter, err := k.Reporters.Get(ctx, repAcc) - if err != nil { - if !errors.Is(err, collections.ErrNotFound) { - return err - } - return k.feeRefundNoReporter(ctx, hashId, amt) - } - - snapshot, err := k.FeePaidFromStake.Get(ctx, hashId) +// called in dispute module after dispute is resolved +// returns the fee to the delegators that paid minus burn amount +func (k Keeper) FeeRefund(ctx context.Context, hashId []byte, amt math.Int) error { + trackedFees, err := k.FeePaidFromStake.Get(ctx, hashId) if err != nil { return err } - initialTotalAmount := math.ZeroInt() - for _, source := range snapshot.TokenOrigins { - initialTotalAmount = initialTotalAmount.Add(source.Amount) - } - - for _, source := range snapshot.TokenOrigins { - - // attempt to get delegation in reporter module first - valAddr := sdk.ValAddress(source.ValidatorAddress) - delAddr := sdk.AccAddress(source.DelegatorAddress) - del, err := k.Delegators.Get(ctx, delAddr) + for _, source := range trackedFees.TokenOrigins { + val, err := k.stakingKeeper.GetValidator(ctx, sdk.ValAddress(source.ValidatorAddress)) if err != nil { - if !errors.Is(err, collections.ErrNotFound) { - return err - } - // if delegator no longer exists, create a new one and - // delegate tokens to a randomly selected bonded validator - del.Amount = source.Amount - del.Reporter = repAcc.Bytes() - - if err := k.BeforeDelegationCreated(ctx, reporter); err != nil { - return err - } - - if err := k.DelegatorCheckpoint.Set(ctx, collections.Join(delAddr.Bytes(), sdk.UnwrapSDKContext(ctx).BlockHeight()), del.Amount); err != nil { - return err - } - if err := k.Delegators.Set(ctx, delAddr, del); err != nil { - return err - } - - if err := k.AfterDelegationModified(ctx, delAddr, repAcc.Bytes(), del.Amount); err != nil { + if !errors.Is(err, stakingtypes.ErrNoValidatorFound) { return err } vals, err := k.GetBondedValidators(ctx, 1) if err != nil { return err } - // this should never happen since chains need validators to run if len(vals) == 0 { return errors.New("no validators found in staking module to return tokens to") } - newVal, err := sdk.ValAddressFromBech32(vals[0].GetOperator()) - if err != nil { - return err - } - - if err := k.TokenOrigin.Set(ctx, collections.Join(delAddr.Bytes(), newVal.Bytes()), source.Amount); err != nil { - return err - } - _, err = k.stakingKeeper.Delegate(ctx, delAddr, source.Amount, stakingtypes.Bonded, vals[0], false) - if err != nil { - return err - } - continue - } - // if delegator exists, add tokens to it - if err := k.BeforeDelegationModified(ctx, delAddr, del, reporter); err != nil { - return err - } - del.Amount = del.Amount.Add(source.Amount) - if err := k.DelegatorCheckpoint.Set(ctx, collections.Join(delAddr.Bytes(), sdk.UnwrapSDKContext(ctx).BlockHeight()), del.Amount); err != nil { - return err - } - if err := k.Delegators.Set(ctx, delAddr, del); err != nil { - return err - } - - if err := k.AfterDelegationModified(ctx, delAddr, repAcc.Bytes(), del.Amount); err != nil { - return err - } - // get token origin and see if it still exists - prevAmt, err := k.TokenOrigin.Get(ctx, collections.Join(delAddr.Bytes(), valAddr.Bytes())) - if err != nil { - if !errors.Is(err, collections.ErrNotFound) { - return err - } - - vals, err := k.GetBondedValidators(ctx, 1) - if err != nil { - return err - } - randoValidator := vals[0] - randoValAddr, err := sdk.ValAddressFromBech32(randoValidator.GetOperator()) - if err != nil { - return err - } - // should probably make sure the random validator is not in tokenOrigin store first - // to avoid overwriting - randoAmt, err := k.TokenOrigin.Get(ctx, collections.Join(delAddr.Bytes(), randoValAddr.Bytes())) - if err != nil { - if !errors.Is(err, collections.ErrNotFound) { - return err - } - } - if randoAmt.IsNil() { - randoAmt = math.ZeroInt() - } - - randoAmt = randoAmt.Add(source.Amount) - - // if token origin no longer exists, set it - if err := k.TokenOrigin.Set(ctx, collections.Join(delAddr.Bytes(), valAddr.Bytes()), randoAmt); err != nil { - return err - } - _, err = k.stakingKeeper.Delegate(ctx, delAddr, source.Amount, stakingtypes.Bonded, randoValidator, false) - if err != nil { - return err - } - continue - - } - // at this stage the validator exists in tokenorigin store meaning key(delagator, validator) exists - // first we see if stored validator is bonded - validator, err := k.stakingKeeper.GetValidator(ctx, valAddr) - if err != nil { - if !errors.Is(err, stakingtypes.ErrNoValidatorFound) { - return err - } - } - if err != nil || !validator.IsBonded() { - vals, err := k.GetBondedValidators(ctx, 1) - if err != nil { - return err - } - validator = vals[0] - valAddr, err = sdk.ValAddressFromBech32(validator.GetOperator()) - if err != nil { - return err - } - // double check to make sure the random validator is not in tokenOrigin store first - prevAmt, err = k.TokenOrigin.Get(ctx, collections.Join(delAddr.Bytes(), valAddr.Bytes())) - if err != nil { - if !errors.Is(err, collections.ErrNotFound) { - return err - } - } - } - if prevAmt.IsNil() { - prevAmt = math.ZeroInt() - } - prevAmt = prevAmt.Add(source.Amount) - - if err := k.TokenOrigin.Set(ctx, collections.Join(delAddr.Bytes(), valAddr.Bytes()), prevAmt); err != nil { - return err + val = vals[0] } - _, err = k.stakingKeeper.Delegate(ctx, delAddr, source.Amount, stakingtypes.Bonded, validator, false) + // since fee paid is returned minus the voter/burned amount, calculate by accordingly + shareAmt := math.LegacyNewDecFromInt(source.Amount).Quo(math.LegacyNewDecFromInt(trackedFees.Total)).Mul(math.LegacyNewDecFromInt(amt)) + _, err = k.stakingKeeper.Delegate(ctx, sdk.AccAddress(source.DelegatorAddress), shareAmt.TruncateInt(), stakingtypes.Bonded, val, false) if err != nil { return err } - continue - - } - reporter.TotalTokens = reporter.TotalTokens.Add(amt) - - if err := k.ReporterCheckpoint.Set(ctx, collections.Join(repAcc.Bytes(), sdk.UnwrapSDKContext(ctx).BlockHeight()), reporter.TotalTokens); err != nil { - return err - } - if err := k.Reporters.Set(ctx, repAcc, reporter); err != nil { - return err - } - if err := k.UpdateTotalPower(ctx, amt, false); err != nil { - return err - } - if err := k.AfterReporterModified(ctx, repAcc); err != nil { - return err } return k.FeePaidFromStake.Remove(ctx, hashId) } -func (k Keeper) UpdateTotalPower(ctx context.Context, amt math.Int, subtract bool) error { - rng := new(collections.Range[int64]).EndInclusive(sdk.UnwrapSDKContext(ctx).BlockHeight()).Descending() - totalPower := math.ZeroInt() - err := k.TotalPower.Walk(ctx, rng, func(_ int64, power math.Int) (stop bool, err error) { - totalPower = power - return true, nil - }) - if err != nil { - return err - } - height := sdk.UnwrapSDKContext(ctx).BlockHeight() - if subtract { - if totalPower.IsZero() || totalPower.LT(amt) { - panic("total power should never be below zero") - } - - totalPower = totalPower.Sub(amt) - return k.TotalPower.Set(ctx, height, totalPower) - } - - totalPower = totalPower.Add(amt) - return k.TotalPower.Set(ctx, height, totalPower) -} - func (k Keeper) GetBondedValidators(ctx context.Context, max uint32) ([]stakingtypes.Validator, error) { validators := make([]stakingtypes.Validator, max) @@ -1103,183 +166,6 @@ func (k Keeper) GetBondedValidators(ctx context.Context, max uint32) ([]stakingt return validators[:i], nil // trim } -func (k Keeper) ReturnSlashedTokens(ctx context.Context, reporterAddr string, reward math.Int, hashId []byte) error { - repAcc, err := sdk.AccAddressFromBech32(reporterAddr) - if err != nil { - return err - } - reporter, err := k.Reporters.Get(ctx, repAcc) - if err != nil { - if !errors.Is(err, collections.ErrNotFound) { - return err - } - return k.returnSlashedTokens(ctx, hashId) - } - - snapshot, err := k.DisputedDelegationAmounts.Get(ctx, hashId) - if err != nil { - return err - } - - for _, source := range snapshot.TokenOrigins { - // attempt to get delegation in reporter module first - valAddr := sdk.ValAddress(source.ValidatorAddress) - delAddr := sdk.AccAddress(source.DelegatorAddress) - - del, err := k.Delegators.Get(ctx, delAddr) - if err != nil { - if !errors.Is(err, collections.ErrNotFound) { - return err - } - // if delegator no longer exists, create a new one and - // delegate tokens to a randomly selected bonded validator - del.Amount = source.Amount - del.Reporter = repAcc.Bytes() - // call hooks :todo - if err := k.BeforeDelegationCreated(ctx, reporter); err != nil { - return err - } - - if err := k.DelegatorCheckpoint.Set(ctx, collections.Join(delAddr.Bytes(), sdk.UnwrapSDKContext(ctx).BlockHeight()), del.Amount); err != nil { - return err - } - if err := k.Delegators.Set(ctx, delAddr, del); err != nil { - return err - } - if err := k.AfterDelegationModified(ctx, delAddr, repAcc.Bytes(), del.Amount); err != nil { - return err - } - vals, err := k.GetBondedValidators(ctx, 1) - if err != nil { - return err - } - // this should never happen since chains need validators to run - if len(vals) == 0 { - return errors.New("no validators found in staking module to return tokens to") - } - newVal, err := sdk.ValAddressFromBech32(vals[0].GetOperator()) - if err != nil { - return err - } - if err := k.TokenOrigin.Set(ctx, collections.Join(delAddr.Bytes(), newVal.Bytes()), source.Amount); err != nil { - return err - } - _, err = k.stakingKeeper.Delegate(ctx, delAddr, source.Amount, stakingtypes.Bonded, vals[0], false) - if err != nil { - return err - } - continue - } - // if delegator exists, add tokens to it - if err := k.BeforeDelegationModified(ctx, delAddr, del, reporter); err != nil { - return err - } - del.Amount = del.Amount.Add(source.Amount) - if err := k.DelegatorCheckpoint.Set(ctx, collections.Join(delAddr.Bytes(), sdk.UnwrapSDKContext(ctx).BlockHeight()), del.Amount); err != nil { - return err - } - if err := k.Delegators.Set(ctx, delAddr, del); err != nil { - return err - } - if err := k.AfterDelegationModified(ctx, delAddr, repAcc.Bytes(), del.Amount); err != nil { - return err - } - // get token origin and see if it still exists - prevAmt, err := k.TokenOrigin.Get(ctx, collections.Join(delAddr.Bytes(), valAddr.Bytes())) - if err != nil { - if !errors.Is(err, collections.ErrNotFound) { - return err - } - - vals, err := k.GetBondedValidators(ctx, 1) - if err != nil { - return err - } - randoValidator := vals[0] - randoValAddr, err := sdk.ValAddressFromBech32(randoValidator.GetOperator()) - if err != nil { - return err - } - // should probably make sure the random validator is not in tokenOrigin store first - // to avoid overwriting - randoAmt, err := k.TokenOrigin.Get(ctx, collections.Join(delAddr.Bytes(), randoValAddr.Bytes())) - if err != nil { - if !errors.Is(err, collections.ErrNotFound) { - return err - } - } - if randoAmt.IsNil() { - randoAmt = math.ZeroInt() - } - randoAmt = randoAmt.Add(source.Amount) - // if token origin no longer exists, set it - if err := k.TokenOrigin.Set(ctx, collections.Join(delAddr.Bytes(), valAddr.Bytes()), randoAmt); err != nil { - return err - } - _, err = k.stakingKeeper.Delegate(ctx, delAddr, source.Amount, stakingtypes.Bonded, randoValidator, false) - if err != nil { - return err - } - continue - - } - // at this stage the validator exists in tokenorigin store meaning key(delagator, validator) exists - // first we see if stored validator is bonded - validator, err := k.stakingKeeper.GetValidator(ctx, valAddr) - if err != nil { - if !errors.Is(err, stakingtypes.ErrNoValidatorFound) { - return err - } - } - if err != nil || !validator.IsBonded() { - vals, err := k.GetBondedValidators(ctx, 1) - if err != nil { - return err - } - validator = vals[0] - valAddr, err = sdk.ValAddressFromBech32(validator.GetOperator()) - if err != nil { - return err - } - // double check to make sure the random validator is not in tokenOrigin store first - prevAmt, err = k.TokenOrigin.Get(ctx, collections.Join(delAddr.Bytes(), valAddr.Bytes())) - if err != nil { - if !errors.Is(err, collections.ErrNotFound) { - return err - } - } - } - if prevAmt.IsNil() { - prevAmt = math.ZeroInt() - } - prevAmt = prevAmt.Add(source.Amount) - if err := k.TokenOrigin.Set(ctx, collections.Join(delAddr.Bytes(), valAddr.Bytes()), prevAmt); err != nil { - return err - } - _, err = k.stakingKeeper.Delegate(ctx, delAddr, source.Amount, stakingtypes.Bonded, validator, false) - if err != nil { - return err - } - continue - - } - reporter.TotalTokens = reporter.TotalTokens.Add(reward) - if err := k.UpdateTotalPower(ctx, reward, false); err != nil { - return err - } - - if err := k.ReporterCheckpoint.Set(ctx, collections.Join(repAcc.Bytes(), sdk.UnwrapSDKContext(ctx).BlockHeight()), reporter.TotalTokens); err != nil { - return err - } - if err := k.Reporters.Set(ctx, repAcc, reporter); err != nil { - return err - } - if err := k.AfterReporterModified(ctx, repAcc); err != nil { - return err - } - return k.DisputedDelegationAmounts.Remove(ctx, hashId) -} - func (k Keeper) AddAmountToStake(ctx context.Context, acc sdk.AccAddress, amt math.Int) error { vals, err := k.GetBondedValidators(ctx, 1) if err != nil { diff --git a/x/reporter/keeper/distribution_test.go b/x/reporter/keeper/distribution_test.go deleted file mode 100644 index 6ccaa45b2..000000000 --- a/x/reporter/keeper/distribution_test.go +++ /dev/null @@ -1,923 +0,0 @@ -package keeper_test - -import ( - "fmt" - "testing" - "time" - - "github.com/stretchr/testify/require" - "github.com/tellor-io/layer/x/reporter/keeper" - "github.com/tellor-io/layer/x/reporter/types" - - "cosmossdk.io/collections" - "cosmossdk.io/math" - - sdk "github.com/cosmos/cosmos-sdk/types" -) - -func TestAllocateTokensToReporterWithCommission(t *testing.T) { - k, _, _, ctx := setupKeeper(t) - // create reporter with 50% commission - reporterAcc := sdk.AccAddress([]byte("reporter")) - commission := types.NewCommissionWithTime(math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDecWithPrec(5, 1), - math.LegacyNewDec(0), time.Time{}) - reporter := types.NewOracleReporter(reporterAcc.String(), math.NewInt(100), &commission) - err := k.Reporters.Set(ctx, reporterAcc, reporter) - require.NoError(t, err) - // allocate tokens - tokens := sdk.DecCoins{ - {Denom: types.Denom, Amount: math.LegacyNewDec(10)}, - } - require.NoError(t, k.AllocateTokensToReporter(ctx, reporterAcc.Bytes(), tokens)) - - // check commission - expected := sdk.DecCoins{ - {Denom: types.Denom, Amount: math.LegacyNewDec(5)}, - } - - repCommission, err := k.ReportersAccumulatedCommission.Get(ctx, reporterAcc.Bytes()) - require.NoError(t, err) - require.Equal(t, expected, repCommission.Commission) - - // check current rewards - currentRewards, err := k.ReporterCurrentRewards.Get(ctx, reporterAcc.Bytes()) - require.NoError(t, err) - require.Equal(t, expected, currentRewards.Rewards) -} - -func TestAllocateTokensToManyReporters(t *testing.T) { - k, _, _, ctx := setupKeeper(t) - // create reporter with 50% commission - reporterAccI := sdk.AccAddress([]byte("reporter1")) - commission := types.NewCommissionWithTime(math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDecWithPrec(5, 1), - math.LegacyNewDec(0), time.Time{}) - reporter := types.NewOracleReporter(reporterAccI.String(), math.NewInt(100), &commission) - err := k.Reporters.Set(ctx, reporterAccI, reporter) - require.NoError(t, err) - // create second reporter with 0% commission - reporterAccII := sdk.AccAddress([]byte("reporter2")) - commission = types.NewCommissionWithTime(math.LegacyNewDec(0), math.LegacyNewDec(0), - math.LegacyNewDec(0), time.Time{}) - reporter = types.NewOracleReporter(reporterAccII.String(), math.NewInt(100), &commission) - err = k.Reporters.Set(ctx, reporterAccII, reporter) - require.NoError(t, err) - - // assert initial state: zero outstanding rewards, zero commission, zero current rewards - _, err = k.ReporterOutstandingRewards.Get(ctx, reporterAccI.Bytes()) - require.ErrorIs(t, err, collections.ErrNotFound) - - _, err = k.ReporterOutstandingRewards.Get(ctx, reporterAccII.Bytes()) - require.ErrorIs(t, err, collections.ErrNotFound) - - _, err = k.ReportersAccumulatedCommission.Get(ctx, reporterAccI.Bytes()) - require.ErrorIs(t, err, collections.ErrNotFound) - - _, err = k.ReportersAccumulatedCommission.Get(ctx, reporterAccII.Bytes()) - require.ErrorIs(t, err, collections.ErrNotFound) - - _, err = k.ReporterCurrentRewards.Get(ctx, reporterAccI.Bytes()) - require.ErrorIs(t, err, collections.ErrNotFound) // require no rewards - - _, err = k.ReporterCurrentRewards.Get(ctx, reporterAccII.Bytes()) - require.ErrorIs(t, err, collections.ErrNotFound) // require no rewards - - require.NoError(t, k.AllocateTokensToReporter(ctx, reporterAccI.Bytes(), sdk.DecCoins{{Denom: types.Denom, Amount: math.LegacyNewDec(50)}})) - require.NoError(t, k.AllocateTokensToReporter(ctx, reporterAccII.Bytes(), sdk.DecCoins{{Denom: types.Denom, Amount: math.LegacyNewDec(50)}})) - - // 100 outstanding rewards - repIOutstandingRewards, err := k.ReporterOutstandingRewards.Get(ctx, reporterAccI.Bytes()) - require.NoError(t, err) - require.Equal(t, sdk.DecCoins{{Denom: types.Denom, Amount: math.LegacyNewDec(50)}}, repIOutstandingRewards.Rewards) - - repIIOutstandingRewards, err := k.ReporterOutstandingRewards.Get(ctx, reporterAccII.Bytes()) - require.NoError(t, err) - require.Equal(t, sdk.DecCoins{{Denom: types.Denom, Amount: math.LegacyNewDec(50)}}, repIIOutstandingRewards.Rewards) - - // 50% commission for first reporter - repICommission, err := k.ReportersAccumulatedCommission.Get(ctx, reporterAccI.Bytes()) - require.NoError(t, err) - require.Equal(t, sdk.DecCoins{{Denom: types.Denom, Amount: math.LegacyNewDec(25)}}, repICommission.Commission) - - // zero commission for second reporter - repIICommission, err := k.ReportersAccumulatedCommission.Get(ctx, reporterAccII.Bytes()) - require.NoError(t, err) - require.True(t, repIICommission.Commission.IsZero()) - - // just staking.proportional for first reporter less commission = (0.5 * 100%) * 100 / 2 = 25.00 - repICurrentRewards, err := k.ReporterCurrentRewards.Get(ctx, reporterAccI.Bytes()) - require.NoError(t, err) - require.Equal(t, sdk.DecCoins{{Denom: types.Denom, Amount: math.LegacyNewDec(25)}}, repICurrentRewards.Rewards) - - // reporter reward + staking.proportional for second reporter = (0.5 * (100%)) * 100 = 50 - repIICurrentRewards, err := k.ReporterCurrentRewards.Get(ctx, reporterAccII.Bytes()) - require.NoError(t, err) - require.Equal(t, sdk.DecCoins{{Denom: types.Denom, Amount: math.LegacyNewDec(50)}}, repIICurrentRewards.Rewards) -} - -func TestCalculateRewardsBasic(t *testing.T) { - k, _, _, ctx := setupKeeper(t) - sdkCtx := sdk.UnwrapSDKContext(ctx) - sdkCtx = sdkCtx.WithBlockHeight(sdkCtx.BlockHeight() + 1) - // create reporter with 50% commission - reporterAccI := sdk.AccAddress([]byte("reporter1")) - commission := types.NewCommissionWithTime(math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDecWithPrec(5, 1), - math.LegacyNewDec(0), time.Time{}) - reporter := types.NewOracleReporter(reporterAccI.String(), math.NewInt(100), &commission) - err := k.Reporters.Set(sdkCtx, reporterAccI, reporter) - require.NoError(t, err) - - // delegation mock - // self delegation - delegatorI := reporterAccI - delegationI := types.Delegation{Reporter: reporterAccI.Bytes(), Amount: math.NewInt(100)} - err = k.Delegators.Set(sdkCtx, delegatorI, delegationI) - require.NoError(t, err) - - // hooks - err = CallCreateReporterHooks(sdkCtx, k, delegatorI, reporter, delegationI.Amount) - require.NoError(t, err) - - // historical count should be 2 (once for reporter init, once for delegation init) - sdkCtx = sdkCtx.WithBlockHeight(sdkCtx.BlockHeight() + 1) - require.Equal(t, 2, getRepHistoricalReferenceCount(k, sdkCtx)) - - // end period - endingPeriod, _ := k.IncrementReporterPeriod(sdkCtx, reporter) - - // historical count should be 2 still - require.Equal(t, 2, getRepHistoricalReferenceCount(k, sdkCtx)) - - // calculate delegation rewards - rewards, err := k.CalculateDelegationRewards(sdkCtx, reporterAccI.Bytes(), delegatorI, delegationI, endingPeriod) - require.NoError(t, err) - - // rewards should be zero - require.True(t, rewards.IsZero()) - - // // allocate some rewards - initial := int64(10) - tokens := sdk.DecCoins{{Denom: types.Denom, Amount: math.LegacyNewDec(initial)}} - require.NoError(t, k.AllocateTokensToReporter(sdkCtx, reporterAccI.Bytes(), tokens)) - - // // end period - endingPeriod, _ = k.IncrementReporterPeriod(sdkCtx, reporter) - - // calculate delegation rewards - rewards, err = k.CalculateDelegationRewards(sdkCtx, reporterAccI.Bytes(), delegatorI, delegationI, endingPeriod) - require.NoError(t, err) - // rewards should be half the tokens - require.Equal(t, sdk.DecCoins{{Denom: types.Denom, Amount: math.LegacyNewDec(initial / 2)}}, rewards) - - // commission should be the other half - repCommission, err := k.ReportersAccumulatedCommission.Get(sdkCtx, reporterAccI.Bytes()) - require.NoError(t, err) - require.Equal(t, sdk.DecCoins{{Denom: types.Denom, Amount: math.LegacyNewDec(initial / 2)}}, repCommission.Commission) -} - -func TestCalculateRewardsAfterSlash(t *testing.T) { - k, _, _, ctx := setupKeeper(t) - sdkCtx := sdk.UnwrapSDKContext(ctx) - // create reporter with 50% commission - reporterAccI := sdk.AccAddress([]byte("reporter1")) - commission := types.NewCommissionWithTime(math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDecWithPrec(5, 1), - math.LegacyNewDec(0), time.Time{}) - reporter := types.NewOracleReporter(reporterAccI.String(), math.NewInt(100), &commission) - err := k.Reporters.Set(sdkCtx, reporterAccI, reporter) - require.NoError(t, err) - - // self delegation - delegatorI := reporterAccI - delegationI := types.Delegation{Reporter: reporterAccI.Bytes(), Amount: math.NewInt(100)} - err = k.Delegators.Set(sdkCtx, delegatorI, delegationI) - require.NoError(t, err) - - // run the necessary hooks manually (given that we are not running an actual staking module) - err = CallCreateReporterHooks(sdkCtx, k, delegatorI, reporter, delegationI.Amount) - require.NoError(t, err) - - // next block - sdkCtx = sdkCtx.WithBlockHeight(sdkCtx.BlockHeight() + 1) - - // end period - endingPeriod, _ := k.IncrementReporterPeriod(sdkCtx, reporter) - - // calculate delegation rewards - rewards, err := k.CalculateDelegationRewards(sdkCtx, reporterAccI.Bytes(), delegatorI, delegationI, endingPeriod) - require.NoError(t, err) - - // rewards should be zero - require.True(t, rewards.IsZero()) - - // start out block height - sdkCtx = sdkCtx.WithBlockHeight(sdkCtx.BlockHeight() + 3) - - // slash the reporter by 50% (simulated with manual calls; we assume the reporter is bonded) - reporter, burned := SlashReporter(sdkCtx, reporterAccI.Bytes(), sdkCtx.BlockHeight(), math.LegacyNewDecWithPrec(5, 1), reporter, k) - require.True(t, burned.IsPositive(), "expected positive slashed tokens, got: %s", burned) - - // increase block height - sdkCtx = sdkCtx.WithBlockHeight(sdkCtx.BlockHeight() + 3) - - // allocate some rewards - initial := math.NewInt(10) - tokens := sdk.DecCoins{{Denom: types.Denom, Amount: math.LegacyNewDecFromInt(initial)}} - require.NoError(t, k.AllocateTokensToReporter(sdkCtx, reporterAccI.Bytes(), tokens)) - - // end period - endingPeriod, _ = k.IncrementReporterPeriod(sdkCtx, reporter) - - // calculate delegation rewards - rewards, err = k.CalculateDelegationRewards(sdkCtx, reporterAccI.Bytes(), delegatorI, delegationI, endingPeriod) - require.NoError(t, err) - - // rewards should be half the tokens - require.Equal(t, sdk.DecCoins{{Denom: types.Denom, Amount: math.LegacyNewDecFromInt(initial.QuoRaw(2))}}, rewards) - - // commission should be the other half - repCommission, err := k.ReportersAccumulatedCommission.Get(sdkCtx, reporterAccI.Bytes()) - require.NoError(t, err) - require.Equal(t, sdk.DecCoins{{Denom: types.Denom, Amount: math.LegacyNewDecFromInt(initial.QuoRaw(2))}}, - repCommission.Commission) -} - -func TestCalculateRewardsAfterManySlashes(t *testing.T) { - k, _, _, ctx := setupKeeper(t) - sdkCtx := sdk.UnwrapSDKContext(ctx) - // create reporter with 50% commission - reporterAccI := sdk.AccAddress([]byte("reporter1")) - commission := types.NewCommissionWithTime(math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDecWithPrec(5, 1), - math.LegacyNewDec(0), time.Time{}) - reporter := types.NewOracleReporter(reporterAccI.String(), math.NewInt(100), &commission) - err := k.Reporters.Set(sdkCtx, reporterAccI, reporter) - require.NoError(t, err) - - // self delegation - delegatorI := reporterAccI - delegationI := types.Delegation{Reporter: reporterAccI.Bytes(), Amount: math.NewInt(100)} - err = k.Delegators.Set(sdkCtx, delegatorI, delegationI) - require.NoError(t, err) - - // run the necessary hooks manually (given that we are not running an actual staking module) - err = CallCreateReporterHooks(sdkCtx, k, delegatorI, reporter, delegationI.Amount) - require.NoError(t, err) - - // next block - sdkCtx = sdkCtx.WithBlockHeight(sdkCtx.BlockHeight() + 1) - - // end period - endingPeriod, _ := k.IncrementReporterPeriod(sdkCtx, reporter) - - // calculate delegation rewards - rewards, err := k.CalculateDelegationRewards(sdkCtx, reporterAccI.Bytes(), delegatorI, delegationI, endingPeriod) - require.NoError(t, err) - - // rewards should be zero - require.True(t, rewards.IsZero()) - - // start out block height - sdkCtx = sdkCtx.WithBlockHeight(sdkCtx.BlockHeight() + 3) - - // slash the reporter by 50% (simulated with manual calls; we assume the reporter is bonded) - reporter, burned := SlashReporter(sdkCtx, reporterAccI.Bytes(), sdkCtx.BlockHeight(), math.LegacyNewDecWithPrec(5, 1), reporter, k) - require.True(t, burned.IsPositive(), "expected positive slashed tokens, got: %s", burned) - - // increase block height - sdkCtx = sdkCtx.WithBlockHeight(sdkCtx.BlockHeight() + 3) - - // // allocate some rewards - initial := sdk.TokensFromConsensusPower(10, sdk.DefaultPowerReduction) - tokens := sdk.DecCoins{{Denom: types.Denom, Amount: math.LegacyNewDecFromInt(initial)}} - require.NoError(t, k.AllocateTokensToReporter(sdkCtx, reporterAccI.Bytes(), tokens)) - - // slash the reporter by 50% (simulated with manual calls; we assume the reporter is bonded) - reporter, burned = SlashReporter(sdkCtx, reporterAccI.Bytes(), sdkCtx.BlockHeight(), math.LegacyNewDecWithPrec(2, 1), reporter, k) - - require.True(t, burned.IsPositive(), "expected positive slashed tokens, got: %s", burned) - - // increase block height - sdkCtx = sdkCtx.WithBlockHeight(sdkCtx.BlockHeight() + 3) - - // allocate some more rewards - require.NoError(t, k.AllocateTokensToReporter(sdkCtx, reporterAccI.Bytes(), tokens)) - - // end period - endingPeriod, _ = k.IncrementReporterPeriod(sdkCtx, reporter) - - // calculate delegation rewards - rewards, err = k.CalculateDelegationRewards(sdkCtx, reporterAccI.Bytes(), delegatorI, delegationI, endingPeriod) - require.NoError(t, err) - - // rewards should be half the tokens - require.Equal(t, sdk.DecCoins{{Denom: types.Denom, Amount: math.LegacyNewDecFromInt(initial)}}, rewards) - - // commission should be the other half - repCommission, err := k.ReportersAccumulatedCommission.Get(sdkCtx, reporterAccI.Bytes()) - require.NoError(t, err) - require.Equal(t, sdk.DecCoins{{Denom: types.Denom, Amount: math.LegacyNewDecFromInt(initial)}}, repCommission.Commission) -} - -func TestCalculateRewardsMultiDelegator(t *testing.T) { - k, _, _, ctx := setupKeeper(t) - - // create reporter with 50% commission - sdkCtx := sdk.UnwrapSDKContext(ctx) - // create reporter with 50% commission - reporterAccI := sdk.AccAddress([]byte("reporter1")) - commission := types.NewCommissionWithTime(math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDecWithPrec(5, 1), - math.LegacyNewDec(0), time.Time{}) - reporter := types.NewOracleReporter(reporterAccI.String(), math.NewInt(100), &commission) - err := k.Reporters.Set(sdkCtx, reporterAccI, reporter) - require.NoError(t, err) - - // self delegation - delegatorI := reporterAccI - delegationI := types.Delegation{Reporter: reporterAccI.Bytes(), Amount: math.NewInt(100)} - err = k.Delegators.Set(sdkCtx, delegatorI, delegationI) - require.NoError(t, err) - - // run the necessary hooks manually (given that we are not running an actual staking module) - err = CallCreateReporterHooks(sdkCtx, k, delegatorI, reporter, delegationI.Amount) - require.NoError(t, err) - - // next block - sdkCtx = sdkCtx.WithBlockHeight(sdkCtx.BlockHeight() + 1) - - // allocate some rewards - initial := int64(20) - tokens := sdk.DecCoins{{Denom: types.Denom, Amount: math.LegacyNewDec(initial)}} - require.NoError(t, k.AllocateTokensToReporter(sdkCtx, reporterAccI.Bytes(), tokens)) - - // second delegation - delegatorII := sdk.AccAddress([]byte("delegator2")) - delegationII := types.Delegation{Reporter: reporterAccI.Bytes(), Amount: math.NewInt(100)} - err = k.BeforeDelegationCreated(sdkCtx, reporter) - require.NoError(t, err) - err = k.Delegators.Set(sdkCtx, delegatorII, delegationII) - require.NoError(t, err) - // call necessary hooks to update a delegation - // end period - err = k.AfterDelegationModified(sdkCtx, delegatorII, reporterAccI.Bytes(), delegationII.Amount) - require.NoError(t, err) - - // update reporter with new total tokens from the second delegation - reporter.TotalTokens = reporter.TotalTokens.Add(delegationII.Amount) - err = k.Reporters.Set(sdkCtx, reporterAccI, reporter) - require.NoError(t, err) - - // next block - sdkCtx = sdkCtx.WithBlockHeight(sdkCtx.BlockHeight() + 1) - - // allocate some more rewards - require.NoError(t, k.AllocateTokensToReporter(sdkCtx, reporterAccI.Bytes(), tokens)) - - // end period - endingPeriod, _ := k.IncrementReporterPeriod(sdkCtx, reporter) - - // calculate delegation rewards for del1 - rewards, err := k.CalculateDelegationRewards(sdkCtx, reporterAccI.Bytes(), delegatorI, delegationI, endingPeriod) - require.NoError(t, err) - - // rewards for del0 should be 3/4 initial - require.Equal(t, sdk.DecCoins{{Denom: types.Denom, Amount: math.LegacyNewDec(initial * 3 / 4)}}, rewards) - - // calculate delegation rewards for del2 - rewards, err = k.CalculateDelegationRewards(sdkCtx, reporterAccI.Bytes(), delegatorII, delegationII, endingPeriod) - require.NoError(t, err) - - // rewards for del2 should be 1/4 initial - require.Equal(t, sdk.DecCoins{{Denom: types.Denom, Amount: math.LegacyNewDec(initial * 1 / 4)}}, rewards) - - // commission should be equal to initial (50% twice) - repCommission, err := k.ReportersAccumulatedCommission.Get(sdkCtx, reporterAccI.Bytes()) - require.NoError(t, err) - require.Equal(t, sdk.DecCoins{{Denom: types.Denom, Amount: math.LegacyNewDec(initial)}}, repCommission.Commission) -} - -func TestWithdrawDelegationRewardsBasic(t *testing.T) { - k, _, bk, ctx := setupKeeper(t) - sdkCtx := sdk.UnwrapSDKContext(ctx) - // create reporter with 50% commission - reporterAccI := sdk.AccAddress([]byte("reporter1")) - commission := types.NewCommissionWithTime(math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDecWithPrec(5, 1), - math.LegacyNewDec(0), time.Time{}) - reporter := types.NewOracleReporter(reporterAccI.String(), math.NewInt(100), &commission) - err := k.Reporters.Set(sdkCtx, reporterAccI, reporter) - require.NoError(t, err) - - // self delegation - delegatorI := reporterAccI - delegationI := types.Delegation{Reporter: reporterAccI.Bytes(), Amount: math.NewInt(100)} - err = k.Delegators.Set(sdkCtx, delegatorI, delegationI) - require.NoError(t, err) - - // run the necessary hooks manually (given that we are not running an actual staking module) - err = CallCreateReporterHooks(sdkCtx, k, delegatorI, reporter, delegationI.Amount) - require.NoError(t, err) - - // next block - sdkCtx = sdkCtx.WithBlockHeight(sdkCtx.BlockHeight() + 1) - - // allocate some rewards - initial := sdk.TokensFromConsensusPower(10, sdk.DefaultPowerReduction) - tokens := sdk.DecCoins{sdk.NewDecCoin(types.Denom, initial)} - - require.NoError(t, k.AllocateTokensToReporter(sdkCtx, reporterAccI.Bytes(), tokens)) - - // historical count should be 2 (initial + latest for delegation) - require.Equal(t, 2, getRepHistoricalReferenceCount(k, sdkCtx)) - - // withdraw rewards (the bank keeper should be called with the right amount of tokens to transfer) - expRewards := sdk.Coins{sdk.NewCoin(types.Denom, initial.QuoRaw(2))} - bk.On("SendCoinsFromModuleToAccount", sdkCtx, types.ModuleName, delegatorI, expRewards).Return(nil) - - _, err = k.WithdrawDelegationRewards(sdkCtx, reporterAccI.Bytes(), delegatorI) - require.Nil(t, err) - - // historical count should still be 2 (added one record, cleared one) - require.Equal(t, 2, getRepHistoricalReferenceCount(k, sdkCtx)) - - // withdraw commission (the bank keeper should be called with the right amount of tokens to transfer) - expCommission := sdk.Coins{sdk.NewCoin(types.Denom, initial.QuoRaw(2))} - bk.On("SendCoinsFromModuleToAccount", sdkCtx, types.ModuleName, reporterAccI, expCommission).Return(nil) - _, err = k.WithdrawReporterCommission(sdkCtx, reporterAccI.Bytes()) - require.Nil(t, err) -} - -func TestCalculateRewardsAfterManySlashesInSameBlock(t *testing.T) { - k, _, _, ctx := setupKeeper(t) - sdkCtx := sdk.UnwrapSDKContext(ctx) - // create reporter with 50% commission - reporterAccI := sdk.AccAddress([]byte("reporter1")) - commission := types.NewCommissionWithTime(math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDecWithPrec(5, 1), - math.LegacyNewDec(0), time.Time{}) - reporter := types.NewOracleReporter(reporterAccI.String(), math.NewInt(100), &commission) - err := k.Reporters.Set(sdkCtx, reporterAccI, reporter) - require.NoError(t, err) - - // self delegation - delegatorI := reporterAccI - delegationI := types.Delegation{Reporter: reporterAccI.Bytes(), Amount: math.NewInt(100)} - err = k.Delegators.Set(sdkCtx, delegatorI, delegationI) - require.NoError(t, err) - - // run the necessary hooks manually (given that we are not running an actual staking module) - err = CallCreateReporterHooks(sdkCtx, k, delegatorI, reporter, delegationI.Amount) - require.NoError(t, err) - - // next block - sdkCtx = sdkCtx.WithBlockHeight(sdkCtx.BlockHeight() + 1) - - // end period - endingPeriod, _ := k.IncrementReporterPeriod(sdkCtx, reporter) - - // calculate delegation rewards for del1 - rewards, err := k.CalculateDelegationRewards(sdkCtx, reporterAccI.Bytes(), delegatorI, delegationI, endingPeriod) - require.NoError(t, err) - - // rewards should be zero - require.True(t, rewards.IsZero()) - - // start out block height - sdkCtx = sdkCtx.WithBlockHeight(sdkCtx.BlockHeight() + 3) - - // allocate some rewards - initial := math.LegacyNewDecFromInt(sdk.TokensFromConsensusPower(10, sdk.DefaultPowerReduction)) - tokens := sdk.DecCoins{{Denom: types.Denom, Amount: initial}} - require.NoError(t, k.AllocateTokensToReporter(sdkCtx, reporterAccI.Bytes(), tokens)) - - // slash the reporter by 50% (simulated with manual calls; we assume the reporter is bonded) - reporter, burned := SlashReporter(sdkCtx, reporterAccI.Bytes(), sdkCtx.BlockHeight(), math.LegacyNewDecWithPrec(5, 1), reporter, k) - require.True(t, burned.IsPositive(), "expected positive slashed tokens, got: %s", burned) - // slash the reporter by 50% again - reporter, burned = SlashReporter(sdkCtx, reporterAccI.Bytes(), sdkCtx.BlockHeight(), math.LegacyNewDecWithPrec(5, 1), reporter, k) - require.True(t, burned.IsPositive(), "expected positive slashed tokens, got: %s", burned) - - // increase block height - sdkCtx = sdkCtx.WithBlockHeight(sdkCtx.BlockHeight() + 3) - - // allocate some more rewards - require.NoError(t, k.AllocateTokensToReporter(sdkCtx, reporterAccI.Bytes(), tokens)) - - // end period - endingPeriod, _ = k.IncrementReporterPeriod(sdkCtx, reporter) - - // calculate delegation rewards - rewards, err = k.CalculateDelegationRewards(sdkCtx, reporterAccI.Bytes(), delegatorI, delegationI, endingPeriod) - require.NoError(t, err) - - // rewards should be half the tokens - require.Equal(t, sdk.DecCoins{{Denom: types.Denom, Amount: initial}}, rewards) - - // commission should be the other half - repCommission, err := k.ReportersAccumulatedCommission.Get(sdkCtx, reporterAccI.Bytes()) - require.NoError(t, err) - require.Equal(t, sdk.DecCoins{{Denom: types.Denom, Amount: initial}}, repCommission.Commission) -} - -func TestCalculateRewardsMultiDelegatorMultiSlash(t *testing.T) { - k, _, _, ctx := setupKeeper(t) - sdkCtx := sdk.UnwrapSDKContext(ctx) - // create reporter with 50% commission - reporterAccI := sdk.AccAddress([]byte("reporter1")) - commission := types.NewCommissionWithTime(math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDecWithPrec(5, 1), - math.LegacyNewDec(0), time.Time{}) - reporter := types.NewOracleReporter(reporterAccI.String(), math.NewInt(100), &commission) - err := k.Reporters.Set(sdkCtx, reporterAccI, reporter) - require.NoError(t, err) - - // self delegation - delegatorI := reporterAccI - delegationI := types.Delegation{Reporter: reporterAccI.Bytes(), Amount: math.NewInt(100)} - err = k.Delegators.Set(sdkCtx, delegatorI, delegationI) - require.NoError(t, err) - - // run the necessary hooks manually (given that we are not running an actual staking module) - err = CallCreateReporterHooks(sdkCtx, k, delegatorI, reporter, delegationI.Amount) - require.NoError(t, err) - - // next block - sdkCtx = sdkCtx.WithBlockHeight(sdkCtx.BlockHeight() + 1) - - // allocate some rewards - initial := math.LegacyNewDecFromInt(sdk.TokensFromConsensusPower(30, sdk.DefaultPowerReduction)) - tokens := sdk.DecCoins{{Denom: types.Denom, Amount: initial}} - require.NoError(t, k.AllocateTokensToReporter(sdkCtx, reporterAccI.Bytes(), tokens)) - - // slash the reporter - sdkCtx = sdkCtx.WithBlockHeight(sdkCtx.BlockHeight() + 3) - // slash the reporter by 50% (simulated with manual calls; we assume the reporter is bonded) - reporter, burned := SlashReporter(sdkCtx, reporterAccI.Bytes(), sdkCtx.BlockHeight(), math.LegacyNewDecWithPrec(5, 1), reporter, k) - require.True(t, burned.IsPositive(), "expected positive slashed tokens, got: %s", burned) - - sdkCtx = sdkCtx.WithBlockHeight(sdkCtx.BlockHeight() + 3) - - // second delegation - delegatorII := sdk.AccAddress([]byte("delegator2")) - delegationII := types.Delegation{Reporter: reporterAccI.Bytes(), Amount: math.NewInt(100)} - err = k.BeforeDelegationCreated(sdkCtx, reporter) - require.NoError(t, err) - err = k.Delegators.Set(sdkCtx, delegatorII, delegationII) - require.NoError(t, err) - // call necessary hooks to update a delegation - // end period - err = k.AfterDelegationModified(sdkCtx, delegatorII, reporterAccI.Bytes(), delegationII.Amount) - require.NoError(t, err) - // update reporter with new total tokens from the second delegation - reporter.TotalTokens = reporter.TotalTokens.Add(delegationII.Amount) - err = k.Reporters.Set(sdkCtx, reporterAccI, reporter) - require.NoError(t, err) - - // next block - sdkCtx = sdkCtx.WithBlockHeight(sdkCtx.BlockHeight() + 1) - - // allocate some more rewards - require.NoError(t, k.AllocateTokensToReporter(sdkCtx, reporterAccI.Bytes(), tokens)) - - // slash the reporter again - sdkCtx = sdkCtx.WithBlockHeight(sdkCtx.BlockHeight() + 3) - reporter, burned = SlashReporter(sdkCtx, reporterAccI.Bytes(), sdkCtx.BlockHeight(), math.LegacyNewDecWithPrec(5, 1), reporter, k) - require.True(t, burned.IsPositive(), "expected positive slashed tokens, got: %s", burned) - - sdkCtx = sdkCtx.WithBlockHeight(sdkCtx.BlockHeight() + 3) - - // end period - endingPeriod, _ := k.IncrementReporterPeriod(sdkCtx, reporter) - - // calculate delegation rewards for del1 - rewards, err := k.CalculateDelegationRewards(sdkCtx, reporterAccI.Bytes(), delegatorI, delegationI, endingPeriod) - require.NoError(t, err) - - // rewards for del1 should be 2/3 initial (half initial first period, 1/6 initial second period) - require.Equal(t, sdk.DecCoins{{Denom: types.Denom, Amount: initial.QuoInt64(2).Add(initial.QuoInt64(6))}}, rewards) - - // calculate delegation rewards for del2 - rewards, err = k.CalculateDelegationRewards(sdkCtx, reporterAccI.Bytes(), delegatorII, delegationII, endingPeriod) - require.NoError(t, err) - - // rewards for del2 should be initial / 3 - require.Equal(t, sdk.DecCoins{{Denom: types.Denom, Amount: initial.QuoInt64(3)}}, rewards) - - // commission should be equal to initial (twice 50% commission, unaffected by slashing) - repCommission, err := k.ReportersAccumulatedCommission.Get(sdkCtx, reporterAccI.Bytes()) - require.NoError(t, err) - require.Equal(t, sdk.DecCoins{{Denom: types.Denom, Amount: initial}}, repCommission.Commission) -} - -func TestCalculateRewardsMultiDelegatorMultWithdraw(t *testing.T) { - k, _, bk, ctx := setupKeeper(t) - sdkCtx := sdk.UnwrapSDKContext(ctx) - // create reporter with 50% commission - reporterAccI := sdk.AccAddress([]byte("reporter1")) - commission := types.NewCommissionWithTime(math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDecWithPrec(5, 1), - math.LegacyNewDec(0), time.Time{}) - reporter := types.NewOracleReporter(reporterAccI.String(), math.NewInt(100), &commission) - err := k.Reporters.Set(sdkCtx, reporterAccI, reporter) - require.NoError(t, err) - - // self delegation - delegatorI := reporterAccI - delegationI := types.Delegation{Reporter: reporterAccI.Bytes(), Amount: math.NewInt(100)} - err = k.Delegators.Set(sdkCtx, delegatorI, delegationI) - require.NoError(t, err) - - // run the necessary hooks manually (given that we are not running an actual staking module) - err = CallCreateReporterHooks(sdkCtx, k, delegatorI, reporter, delegationI.Amount) - require.NoError(t, err) - - // next block - sdkCtx = sdkCtx.WithBlockHeight(sdkCtx.BlockHeight() + 1) - - // allocate some rewards - initial := int64(20) - tokens := sdk.DecCoins{sdk.NewDecCoin(types.Denom, math.NewInt(initial))} - require.NoError(t, k.AllocateTokensToReporter(sdkCtx, reporterAccI.Bytes(), tokens)) - - // historical count should be 2 (reporter init, delegation init) - require.Equal(t, 2, getRepHistoricalReferenceCount(k, sdkCtx)) - - // second delegation - delegatorII := sdk.AccAddress([]byte("delegator2")) - delegationII := types.Delegation{Reporter: reporterAccI.Bytes(), Amount: math.NewInt(100)} - err = k.BeforeDelegationCreated(sdkCtx, reporter) - require.NoError(t, err) - err = k.Delegators.Set(sdkCtx, delegatorII, delegationII) - require.NoError(t, err) - // call necessary hooks to update a delegation - // end period - err = k.AfterDelegationModified(sdkCtx, delegatorII, reporterAccI.Bytes(), delegationII.Amount) - require.NoError(t, err) - // update reporter with new total tokens from the second delegation - reporter.TotalTokens = reporter.TotalTokens.Add(delegationII.Amount) - err = k.Reporters.Set(sdkCtx, reporterAccI, reporter) - require.NoError(t, err) - - // historical count should be 3 (second delegation init) - require.Equal(t, 3, getRepHistoricalReferenceCount(k, sdkCtx)) - - // next block - sdkCtx = sdkCtx.WithBlockHeight(sdkCtx.BlockHeight() + 1) - - // allocate some more rewards - require.NoError(t, k.AllocateTokensToReporter(sdkCtx, reporterAccI.Bytes(), tokens)) - - // first delegator withdraws - expRewards := sdk.Coins{sdk.NewCoin(types.Denom, math.NewInt(initial*3/4))} - bk.On("SendCoinsFromModuleToAccount", sdkCtx, types.ModuleName, delegatorI, expRewards).Return(nil) - _, err = k.WithdrawDelegationRewards(sdkCtx, reporterAccI.Bytes(), delegatorI) - require.Nil(t, err) - - // second delegator withdraws - expRewards = sdk.Coins{sdk.NewCoin(types.Denom, math.NewInt(initial*1/4))} - bk.On("SendCoinsFromModuleToAccount", sdkCtx, types.ModuleName, delegatorII, expRewards).Return(nil) - _, err = k.WithdrawDelegationRewards(sdkCtx, reporterAccI.Bytes(), delegatorII) - require.Nil(t, err) - - // historical count should be 3 (reporter init + two delegations) - require.Equal(t, 3, getRepHistoricalReferenceCount(k, sdkCtx)) - - // reporter withdraws commission - expCommission := sdk.Coins{sdk.NewCoin(types.Denom, math.NewInt(initial))} - bk.On("SendCoinsFromModuleToAccount", sdkCtx, types.ModuleName, reporterAccI, expCommission).Return(nil) - _, err = k.WithdrawReporterCommission(sdkCtx, reporterAccI.Bytes()) - require.Nil(t, err) - - // end period - endingPeriod, _ := k.IncrementReporterPeriod(sdkCtx, reporter) - - // calculate delegation rewards for del1 - rewards, err := k.CalculateDelegationRewards(sdkCtx, reporterAccI.Bytes(), delegatorI, delegationI, endingPeriod) - require.NoError(t, err) - - // rewards for del1 should be zero - require.True(t, rewards.IsZero()) - - // calculate delegation rewards for del2 - rewards, err = k.CalculateDelegationRewards(sdkCtx, reporterAccI.Bytes(), delegatorII, delegationII, endingPeriod) - require.NoError(t, err) - - // rewards for del2 should be zero - require.True(t, rewards.IsZero()) - - // commission should be zero - repCommission, err := k.ReportersAccumulatedCommission.Get(sdkCtx, reporterAccI.Bytes()) - require.NoError(t, err) - require.True(t, repCommission.Commission.IsZero()) - - // next block - sdkCtx = sdkCtx.WithBlockHeight(sdkCtx.BlockHeight() + 1) - - // allocate some more rewards - require.NoError(t, k.AllocateTokensToReporter(ctx, reporterAccI.Bytes(), tokens)) - - // first delegator withdraws again - expRewards = sdk.Coins{sdk.NewCoin(types.Denom, math.NewInt(initial*1/4))} - bk.On("SendCoinsFromModuleToAccount", sdkCtx, types.ModuleName, delegatorI, expRewards).Return(nil) - _, err = k.WithdrawDelegationRewards(sdkCtx, reporterAccI.Bytes(), delegatorI) - require.Nil(t, err) - - // end period - endingPeriod, _ = k.IncrementReporterPeriod(sdkCtx, reporter) - - // calculate delegation rewards for del1 - rewards, err = k.CalculateDelegationRewards(sdkCtx, reporterAccI.Bytes(), delegatorI, delegationI, endingPeriod) - require.NoError(t, err) - - // rewards for del1 should be zero - require.True(t, rewards.IsZero()) - - // calculate delegation rewards for del2 - rewards, err = k.CalculateDelegationRewards(sdkCtx, reporterAccI.Bytes(), delegatorII, delegationII, endingPeriod) - require.NoError(t, err) - - // rewards for del2 should be 1/4 initial - require.Equal(t, sdk.DecCoins{{Denom: types.Denom, Amount: math.LegacyNewDec(initial / 4)}}, rewards) - - // commission should be half initial - repCommission, err = k.ReportersAccumulatedCommission.Get(sdkCtx, reporterAccI.Bytes()) - require.NoError(t, err) - require.Equal(t, sdk.DecCoins{{Denom: types.Denom, Amount: math.LegacyNewDec(initial / 2)}}, repCommission.Commission) - - // next block - sdkCtx = sdkCtx.WithBlockHeight(sdkCtx.BlockHeight() + 1) - - // allocate some more rewards - require.NoError(t, k.AllocateTokensToReporter(sdkCtx, reporterAccI.Bytes(), tokens)) - - // withdraw commission - expCommission = sdk.Coins{sdk.NewCoin(types.Denom, math.NewInt(initial))} - bk.On("SendCoinsFromModuleToAccount", sdkCtx, types.ModuleName, reporterAccI, expCommission).Return(nil) - _, err = k.WithdrawReporterCommission(sdkCtx, reporterAccI.Bytes()) - require.NoError(t, err) - - // end period - endingPeriod, _ = k.IncrementReporterPeriod(sdkCtx, reporter) - - // calculate delegation rewards for del1 - rewards, err = k.CalculateDelegationRewards(sdkCtx, reporterAccI.Bytes(), delegatorI, delegationI, endingPeriod) - require.NoError(t, err) - - // rewards for del1 should be 1/4 initial - require.Equal(t, sdk.DecCoins{{Denom: types.Denom, Amount: math.LegacyNewDec(initial / 4)}}, rewards) - - // calculate delegation rewards for del2 - rewards, err = k.CalculateDelegationRewards(sdkCtx, reporterAccI.Bytes(), delegatorII, delegationII, endingPeriod) - require.NoError(t, err) - - // rewards for del2 should be 1/2 initial - require.Equal(t, sdk.DecCoins{{Denom: types.Denom, Amount: math.LegacyNewDec(initial / 2)}}, rewards) - - // commission should be zero - repCommission, err = k.ReportersAccumulatedCommission.Get(sdkCtx, reporterAccI.Bytes()) - require.NoError(t, err) - require.True(t, repCommission.Commission.IsZero()) -} - -func Test100PercentCommissionReward(t *testing.T) { - k, _, _, ctx := setupKeeper(t) - sdkCtx := sdk.UnwrapSDKContext(ctx) - // create reporter with 50% commission - reporterAccI := sdk.AccAddress([]byte("reporter1")) - commission := types.NewCommissionWithTime(math.LegacyNewDecWithPrec(10, 1), math.LegacyNewDecWithPrec(10, 1), - math.LegacyNewDec(0), time.Time{}) - reporter := types.NewOracleReporter(reporterAccI.String(), math.NewInt(100), &commission) - err := k.Reporters.Set(sdkCtx, reporterAccI, reporter) - require.NoError(t, err) - - // self delegation - delegatorI := reporterAccI - delegationI := types.Delegation{Reporter: reporterAccI.Bytes(), Amount: math.NewInt(100)} - err = k.Delegators.Set(sdkCtx, delegatorI, delegationI) - require.NoError(t, err) - - // run the necessary hooks manually (given that we are not running an actual staking module) - err = CallCreateReporterHooks(sdkCtx, k, delegatorI, reporter, delegationI.Amount) - require.NoError(t, err) - - // next block - sdkCtx = sdkCtx.WithBlockHeight(sdkCtx.BlockHeight() + 1) - - // allocate some rewards - initial := int64(20) - tokens := sdk.DecCoins{sdk.NewDecCoin(types.Denom, math.NewInt(initial))} - require.NoError(t, k.AllocateTokensToReporter(sdkCtx, reporterAccI.Bytes(), tokens)) - - // next block - sdkCtx = sdkCtx.WithBlockHeight(sdkCtx.BlockHeight() + 1) - - // allocate some rewards - require.NoError(t, k.AllocateTokensToReporter(sdkCtx, reporterAccI.Bytes(), tokens)) - - // next block - sdkCtx = sdkCtx.WithBlockHeight(sdkCtx.BlockHeight() + 1) - - // allocate some more rewards - require.NoError(t, k.AllocateTokensToReporter(sdkCtx, reporterAccI.Bytes(), tokens)) - - // next block - sdkCtx = sdkCtx.WithBlockHeight(sdkCtx.BlockHeight() + 1) - - // allocate some more rewards - require.NoError(t, k.AllocateTokensToReporter(sdkCtx, reporterAccI.Bytes(), tokens)) - rewards, err := k.WithdrawDelegationRewards(sdkCtx, reporterAccI.Bytes(), delegatorI) - require.NoError(t, err) - - zeroRewards := sdk.Coins{sdk.NewCoin(types.Denom, math.ZeroInt())} - require.True(t, rewards.Equal(zeroRewards)) - - events := sdkCtx.EventManager().Events() - lastEvent := events[len(events)-1] - - var hasValue bool - for _, attr := range lastEvent.Attributes { - if attr.Key == "amount" && attr.Value == "0loya" { - hasValue = true - } - } - require.True(t, hasValue) -} - -// ******************** helpers ********************* - -// SlashReporter copies what x/staking Slash does. It should be used for testing only. -// And it must be updated whenever the original function is updated. -// The passed reporter will get its tokens updated. -func SlashReporter( - ctx sdk.Context, - reporterVal sdk.ValAddress, - infractionHeight int64, - slashFactor math.LegacyDec, - reporter types.OracleReporter, - k keeper.Keeper, -) (types.OracleReporter, math.Int) { - if slashFactor.IsNegative() { - panic(fmt.Errorf("attempted to slash with a negative slash factor: %v", slashFactor)) - } - - // we simplify this part, as we won't be able to test redelegations or - // unbonding delegations - if infractionHeight != ctx.BlockHeight() { - // if a new test lands here we might need to update this function to handle redelegations and unbonding - // or just make it an integration test. - panic("we can't test any other case here") - } - - slashAmountDec := math.LegacyNewDecFromInt(reporter.TotalTokens).Mul(math.LegacyNewDecWithPrec(5, 1)) - slashAmount := slashAmountDec.TruncateInt() - - // cannot decrease balance below zero - tokensToBurn := math.MinInt(slashAmount, reporter.TotalTokens) - tokensToBurn = math.MaxInt(tokensToBurn, math.ZeroInt()) // defensive. - - // we need to calculate the *effective* slash fraction for distribution - if reporter.TotalTokens.IsPositive() { - effectiveFraction := math.LegacyNewDecFromInt(tokensToBurn).QuoRoundUp(math.LegacyNewDecFromInt(reporter.TotalTokens)) - // possible if power has changed - if effectiveFraction.GT(math.LegacyOneDec()) { - effectiveFraction = math.LegacyOneDec() - } - // call the before-slashed hook - err := k.BeforeReporterDisputed(ctx, reporterVal, effectiveFraction) - if err != nil { - panic(err) - } - } - // Deduct from reporter's bonded tokens and update the reporter. - // Burn the slashed tokens from the pool account and decrease the total supply. - reporter.TotalTokens = reporter.TotalTokens.Sub(tokensToBurn) - err := k.Reporters.Set(ctx, sdk.AccAddress(reporterVal), reporter) - if err != nil { - panic(err) - } - - return reporter, tokensToBurn -} - -func getRepHistoricalReferenceCount(k keeper.Keeper, ctx sdk.Context) int { - count := 0 - err := k.ReporterHistoricalRewards.Walk( - ctx, nil, func(key collections.Pair[[]byte, uint64], rewards types.ReporterHistoricalRewards) (stop bool, err error) { - count += int(rewards.ReferenceCount) - return false, nil - }, - ) - if err != nil { - panic(err) - } - - return count -} - -func CallCreateReporterHooks(sdkCtx sdk.Context, k keeper.Keeper, delegator sdk.AccAddress, reporter types.OracleReporter, stake math.Int) error { - // hooks - err := k.AfterReporterCreated(sdkCtx, reporter) - if err != nil { - return err - } - - _, err = k.IncrementReporterPeriod(sdkCtx, reporter) - if err != nil { - return err - } - - return k.AfterDelegationModified(sdkCtx, delegator, reporter.GetReporter(), stake) -} diff --git a/x/reporter/keeper/hooks.go b/x/reporter/keeper/hooks.go index bd2d516e6..437ac7423 100644 --- a/x/reporter/keeper/hooks.go +++ b/x/reporter/keeper/hooks.go @@ -10,6 +10,7 @@ import ( cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) var _ types.StakingHooks = Hooks{} @@ -24,136 +25,192 @@ func (k Keeper) Hooks() Hooks { return Hooks{k} } -// AfterValidatorBonded updates the signing info start height or create a new signing info -func (h Hooks) AfterValidatorBonded(_ context.Context, _ sdk.ConsAddress, _ sdk.ValAddress) error { +func (h Hooks) AfterValidatorBonded(ctx context.Context, _ sdk.ConsAddress, _ sdk.ValAddress) error { return nil } -// AfterValidatorRemoved deletes the address-pubkey relation when a validator is removed, -func (h Hooks) AfterValidatorRemoved(_ context.Context, _ sdk.ConsAddress, _ sdk.ValAddress) error { +func (h Hooks) AfterValidatorBeginUnbonding(ctx context.Context, _ sdk.ConsAddress, _ sdk.ValAddress) error { return nil } -// AfterValidatorCreated adds the address-pubkey relation when a validator is created. -func (h Hooks) AfterValidatorCreated(_ context.Context, _ sdk.ValAddress) error { +func (h Hooks) AfterValidatorRemoved(_ context.Context, _ sdk.ConsAddress, _ sdk.ValAddress) error { return nil } -func (h Hooks) AfterValidatorBeginUnbonding(_ context.Context, _ sdk.ConsAddress, _ sdk.ValAddress) error { - return nil -} +func (h Hooks) AfterValidatorCreated(_ context.Context, _ sdk.ValAddress) error { return nil } -func (h Hooks) BeforeValidatorModified(_ context.Context, _ sdk.ValAddress) error { - return nil -} +func (h Hooks) BeforeValidatorModified(_ context.Context, _ sdk.ValAddress) error { return nil } -func (h Hooks) BeforeDelegationCreated(_ context.Context, _ sdk.AccAddress, _ sdk.ValAddress) error { +func (h Hooks) BeforeValidatorSlashed(_ context.Context, _ sdk.ValAddress, _ sdkmath.LegacyDec) error { return nil -} +} // todo: handle for dispute event + +func (h Hooks) AfterUnbondingInitiated(_ context.Context, _ uint64) error { return nil } -func (h Hooks) BeforeDelegationSharesModified(_ context.Context, _ sdk.AccAddress, _ sdk.ValAddress) error { +func (h Hooks) AfterConsensusPubKeyUpdate(_ context.Context, _, _ cryptotypes.PubKey, _ sdk.Coin) error { return nil } -func (h Hooks) BeforeDelegationRemoved(_ context.Context, _ sdk.AccAddress, _ sdk.ValAddress) error { +func (h Hooks) BeforeDelegationSharesModified(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { + // current shares + del, err := h.k.stakingKeeper.GetDelegation(ctx, delAddr, valAddr) + if err != nil { + return err + } + + val, err := h.k.stakingKeeper.GetValidator(ctx, valAddr) + if err != nil { + return err + } + tokens := val.TokensFromShares(del.Shares).TruncateInt() + // set temp + if err := h.k.TempStore.Set(ctx, collections.Join(delAddr.Bytes(), valAddr.Bytes()), tokens); err != nil { + return err + } return nil } func (h Hooks) AfterDelegationModified(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { - // reflect changes only when token/power decreases - // update the reporter tokens and the delegator's tokens to reflect the new power numbers - // also need to update the token origins to reflect the new changes when the delegator's tokens are updated - exists, err := h.k.TokenOrigin.Has(ctx, collections.Join(delAddr.Bytes(), valAddr.Bytes())) + // current shares + sDel, err := h.k.stakingKeeper.GetDelegation(ctx, delAddr, valAddr) if err != nil { return err } - if exists { - // get delegation - delegation, err := h.k.stakingKeeper.Delegation(ctx, delAddr, valAddr) - if err != nil { - return err - } - // get validator to calculate token amount from shares - validator, err := h.k.stakingKeeper.GetValidator(ctx, valAddr) + + val, err := h.k.stakingKeeper.GetValidator(ctx, valAddr) + if err != nil { + return err + } + tokens := val.TokensFromShares(sDel.Shares).TruncateInt() + // get temp + temp, err := h.k.TempStore.Get(ctx, collections.Join(delAddr.Bytes(), valAddr.Bytes())) + if err != nil { + return err + } + diff := tokens.Sub(temp) + + // update the delegator's total tokens + del, err := h.k.Delegators.Get(ctx, delAddr.Bytes()) + if err != nil { + return err + } + del.Amount = del.Amount.Add(diff) + if err := h.k.Delegators.Set(ctx, delAddr.Bytes(), del); err != nil { + return err + } + // update reporter's total tokens + reporter, err := h.k.Reporters.Get(ctx, del.Reporter) + if err != nil { + return err + } + reporter.TotalTokens = reporter.TotalTokens.Add(diff) + return h.k.Reporters.Set(ctx, del.Reporter, reporter) +} + +// Check if validator is a reporter and if they have reached the maximum number of delegators of 100 for now +// if they have, then make the new delegator a reporter since they are new they shouldn't have been a reporter before +// also tracks the total tokens of the delegator +func (h Hooks) BeforeDelegationCreated(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { + if err := h.k.TempStore.Set(ctx, collections.Join(delAddr.Bytes(), valAddr.Bytes()), sdkmath.ZeroInt()); err != nil { + return err + } + reporterKey := valAddr.Bytes() + iter, err := h.k.Delegators.Indexes.Reporter.MatchExact(ctx, reporterKey) + if err != nil { + return err + } + // todo: this is an iteration and should be optimized, perhaps we can use a counter + pks, err := iter.FullKeys() + if err != nil { + return err + } + + if len(pks) == 0 { + val, err := h.k.stakingKeeper.GetValidator(ctx, valAddr) if err != nil { return err } - tokenAmount := validator.TokensFromSharesTruncated(delegation.GetShares()).TruncateInt() - // get token origin - sourced, err := h.k.TokenOrigin.Get(ctx, collections.Join(delAddr.Bytes(), valAddr.Bytes())) - if err != nil { + if err := h.k.Reporters.Set(ctx, reporterKey, types.OracleReporter{ + // inherit the commission rates from the validator + Commission: &val.Commission, + TotalTokens: sdkmath.ZeroInt(), + }); err != nil { return err } - // update token origin if the staked amount becomes less than what is written in the token origin struct - if tokenAmount.LT(sourced) { - delegator, err := h.k.Delegators.Get(ctx, delAddr) - if err != nil { - return err - } - repAddr := delegator.Reporter - - // get the difference in the token change to reduce delegation and reporter tokens by. - diff := sourced.Sub(tokenAmount) - if err := h.k.UpdateOrRemoveSource(ctx, collections.Join(delAddr.Bytes(), valAddr.Bytes()), sourced, tokenAmount); err != nil { - return err - } - - // update reporter - reporter, err := h.k.Reporters.Get(ctx, repAddr) - if err != nil { - return err - } - if err := h.k.UpdateOrRemoveDelegator(ctx, delAddr, delegator, reporter, diff); err != nil { - return err - } - if err := h.k.UpdateOrRemoveReporter(ctx, repAddr, reporter, diff); err != nil { - return err - } - } } - return nil -} -func (h Hooks) BeforeValidatorSlashed(_ context.Context, _ sdk.ValAddress, _ sdkmath.LegacyDec) error { - return nil -} + if len(pks) >= 100 { + reporterKey = delAddr.Bytes() + // add reporter with default commission rates + if err := h.k.Reporters.Set(ctx, reporterKey, types.OracleReporter{ + Commission: &stakingtypes.Commission{CommissionRates: stakingtypes.CommissionRates{ + Rate: sdkmath.LegacyMustNewDecFromStr("0.1"), + MaxRate: sdkmath.LegacyMustNewDecFromStr("0.2"), + MaxChangeRate: sdkmath.LegacyMustNewDecFromStr("0.01"), + }}, + TotalTokens: sdkmath.ZeroInt(), + }); err != nil { + return err + } + } -func (h Hooks) AfterUnbondingInitiated(_ context.Context, _ uint64) error { - return nil + return h.k.Delegators.Set(ctx, delAddr.Bytes(), types.Delegation{ + Reporter: reporterKey, + Amount: sdkmath.ZeroInt(), + DelegationCount: 1, + }) } -// AfterConsensusPubKeyUpdate triggers the functions to rotate the signing-infos also sets address pubkey relation. -func (h Hooks) AfterConsensusPubKeyUpdate(_ context.Context, _, _ cryptotypes.PubKey, _ sdk.Coin) error { - return nil -} - -func (k Keeper) GetTokenSourcesForReporter(ctx context.Context, repAddr sdk.AccAddress) (types.DelegationsPreUpdate, error) { - delegators, err := k.Delegators.Indexes.Reporter.MatchExact(ctx, repAddr) +// when BeforeDelegationRemoved is called, reduce the delegation count of the delegator, also +// we need to check if the delegator has any more delegations, if not remove the delegator plus check if the reporter +// has any more delegators, if not remove the reporter as well +// else just reduce the delegation count of the delegator +// Also, update the total tokens of the delegator +func (h Hooks) BeforeDelegationRemoved(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error { + // get temp + temp, err := h.k.TempStore.Get(ctx, collections.Join(delAddr.Bytes(), valAddr.Bytes())) if err != nil { - return types.DelegationsPreUpdate{}, err + return err } - var tokenSources []*types.TokenOriginInfo - for ; delegators.Valid(); delegators.Next() { - key, err := delegators.PrimaryKey() + del, err := h.k.Delegators.Get(ctx, delAddr) + if err != nil { + return err + } + del.Amount = del.Amount.Sub(temp) + del.DelegationCount-- + if del.DelegationCount == 0 { + err = h.k.Delegators.Remove(ctx, delAddr) + if err != nil { + return err + } + iter, err := h.k.Delegators.Indexes.Reporter.MatchExact(ctx, del.Reporter) + if err != nil { + return err + } + pks, err := iter.FullKeys() if err != nil { - return types.DelegationsPreUpdate{}, err + return err + } + if len(pks) == 0 { + return h.k.Reporters.Remove(ctx, del.Reporter) } - rng := collections.NewPrefixedPairRange[[]byte, []byte](key) - err = k.TokenOrigin.Walk(ctx, rng, func(key collections.Pair[[]byte, []byte], value sdkmath.Int) (bool, error) { - tokenSources = append(tokenSources, &types.TokenOriginInfo{ - DelegatorAddress: key.K1(), - ValidatorAddress: key.K2(), - Amount: value, - }) - return false, nil - }) + rep, err := h.k.Reporters.Get(ctx, del.Reporter) if err != nil { - return types.DelegationsPreUpdate{}, err + return err } + rep.TotalTokens = rep.TotalTokens.Sub(temp) + return h.k.Reporters.Set(ctx, del.Reporter, rep) + } + rep, err := h.k.Reporters.Get(ctx, del.Reporter) + if err != nil { + return err + } + rep.TotalTokens = rep.TotalTokens.Sub(temp) + err = h.k.Reporters.Set(ctx, del.Reporter, rep) + if err != nil { + return err } - return types.DelegationsPreUpdate{ - TokenOrigins: tokenSources, - }, nil + return h.k.Delegators.Set(ctx, delAddr, del) } diff --git a/x/reporter/keeper/indexes_test.go b/x/reporter/keeper/indexes_test.go index 1591af2f0..f847c339f 100644 --- a/x/reporter/keeper/indexes_test.go +++ b/x/reporter/keeper/indexes_test.go @@ -16,7 +16,7 @@ func TestReporterDelegatorIndex(t *testing.T) { repAddr := sample.AccAddressBytes() // set reporter - reporter := types.NewOracleReporter(repAddr.String(), math.NewInt(300), nil) + reporter := types.NewOracleReporter(repAddr.String(), math.ZeroInt(), nil) err := k.Reporters.Set(ctx, repAddr, reporter) require.NoError(t, err) diff --git a/x/reporter/keeper/jail.go b/x/reporter/keeper/jail.go index 99cea0391..8349f49d5 100644 --- a/x/reporter/keeper/jail.go +++ b/x/reporter/keeper/jail.go @@ -7,8 +7,6 @@ import ( "github.com/tellor-io/layer/x/reporter/types" - "cosmossdk.io/collections" - sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -24,9 +22,6 @@ func (k Keeper) JailReporter(ctx context.Context, reporterAddr sdk.AccAddress, j sdkctx := sdk.UnwrapSDKContext(ctx) reporter.JailedUntil = sdkctx.BlockTime().Add(time.Second * time.Duration(jailDuration)) reporter.Jailed = true - if err := k.ReporterCheckpoint.Set(ctx, collections.Join(reporterAddr.Bytes(), sdk.UnwrapSDKContext(ctx).BlockHeight()), reporter.TotalTokens); err != nil { - return err - } err = k.Reporters.Set(ctx, reporterAddr, reporter) if err != nil { return err @@ -53,8 +48,5 @@ func (k Keeper) unjailReporter(ctx context.Context, reporterAddr sdk.AccAddress, } reporter.Jailed = false - if err := k.ReporterCheckpoint.Set(ctx, collections.Join(reporterAddr.Bytes(), sdkctx.BlockHeight()), reporter.TotalTokens); err != nil { - return err - } return k.Reporters.Set(ctx, reporterAddr, reporter) } diff --git a/x/reporter/keeper/keeper.go b/x/reporter/keeper/keeper.go index c3a178e21..260044ccb 100644 --- a/x/reporter/keeper/keeper.go +++ b/x/reporter/keeper/keeper.go @@ -1,6 +1,7 @@ package keeper import ( + "bytes" "context" "fmt" "time" @@ -14,28 +15,22 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) type ( Keeper struct { - cdc codec.BinaryCodec - storeService store.KVStoreService - Params collections.Item[types.Params] - Tracker collections.Item[types.StakeTracker] - Reporters collections.Map[[]byte, types.OracleReporter] - DelegatorTips collections.Map[[]byte, math.Int] - Delegators *collections.IndexedMap[[]byte, types.Delegation, ReporterDelegatorsIndex] - TokenOrigin collections.Map[collections.Pair[[]byte, []byte], math.Int] - ReportersAccumulatedCommission collections.Map[[]byte, types.ReporterAccumulatedCommission] - ReporterOutstandingRewards collections.Map[[]byte, types.ReporterOutstandingRewards] - ReporterCurrentRewards collections.Map[[]byte, types.ReporterCurrentRewards] - DelegatorStartingInfo collections.Map[collections.Pair[[]byte, []byte], types.DelegatorStartingInfo] - ReporterHistoricalRewards collections.Map[collections.Pair[[]byte, uint64], types.ReporterHistoricalRewards] - ReporterDisputeEvents collections.Map[collections.Triple[[]byte, uint64, uint64], types.ReporterDisputeEvent] - TokenOriginSnapshot collections.Map[collections.Pair[[]byte, int64], types.DelegationsPreUpdate] - DisputedDelegationAmounts collections.Map[[]byte, types.DelegationsPreUpdate] - FeePaidFromStake collections.Map[[]byte, types.DelegationsPreUpdate] - TotalPower collections.Map[int64, math.Int] + cdc codec.BinaryCodec + storeService store.KVStoreService + Params collections.Item[types.Params] + Tracker collections.Item[types.StakeTracker] + Reporters collections.Map[[]byte, types.OracleReporter] + DelegatorTips collections.Map[[]byte, math.Int] + Delegators *collections.IndexedMap[[]byte, types.Delegation, ReporterDelegatorsIndex] + DisputedDelegationAmounts collections.Map[[]byte, types.DelegationsAmounts] + FeePaidFromStake collections.Map[[]byte, types.DelegationsAmounts] + Report collections.Map[collections.Pair[[]byte, int64], types.DelegationsAmounts] + TempStore collections.Map[collections.Pair[[]byte, []byte], math.Int] Schema collections.Schema logger log.Logger @@ -46,9 +41,6 @@ type ( stakingKeeper types.StakingKeeper bankKeeper types.BankKeeper - - ReporterCheckpoint collections.Map[collections.Pair[[]byte, int64], math.Int] - DelegatorCheckpoint collections.Map[collections.Pair[[]byte, int64], math.Int] } ) @@ -69,28 +61,19 @@ func NewKeeper( cdc: cdc, storeService: storeService, - Params: collections.NewItem(sb, types.ParamsKey, "params", codec.CollValue[types.Params](cdc)), - Tracker: collections.NewItem(sb, types.StakeTrackerPrefix, "tracker", codec.CollValue[types.StakeTracker](cdc)), - Reporters: collections.NewMap(sb, types.ReportersKey, "reporters_by_reporter", collections.BytesKey, codec.CollValue[types.OracleReporter](cdc)), - Delegators: collections.NewIndexedMap(sb, types.DelegatorsKey, "delegations_by_delegator", collections.BytesKey, codec.CollValue[types.Delegation](cdc), NewDelegatorsIndex(sb)), - TokenOrigin: collections.NewMap(sb, types.TokenOriginsKey, "token_origins_by_delegator_validator", collections.PairKeyCodec(collections.BytesKey, collections.BytesKey), sdk.IntValue), - ReportersAccumulatedCommission: collections.NewMap(sb, types.ReporterAccumulatedCommissionPrefix, "reporters_accumulated_commission", collections.BytesKey, codec.CollValue[types.ReporterAccumulatedCommission](cdc)), - ReporterOutstandingRewards: collections.NewMap(sb, types.ReporterOutstandingRewardsPrefix, "reporter_outstanding_rewards", collections.BytesKey, codec.CollValue[types.ReporterOutstandingRewards](cdc)), - ReporterCurrentRewards: collections.NewMap(sb, types.ReporterCurrentRewardsPrefix, "reporters_current_rewards", collections.BytesKey, codec.CollValue[types.ReporterCurrentRewards](cdc)), - DelegatorStartingInfo: collections.NewMap(sb, types.DelegatorStartingInfoPrefix, "delegators_starting_info", collections.PairKeyCodec(collections.BytesKey, collections.BytesKey), codec.CollValue[types.DelegatorStartingInfo](cdc)), - ReporterHistoricalRewards: collections.NewMap(sb, types.ReporterHistoricalRewardsPrefix, "reporter_historical_rewards", collections.PairKeyCodec(collections.BytesKey, collections.Uint64Key), codec.CollValue[types.ReporterHistoricalRewards](cdc)), - ReporterDisputeEvents: collections.NewMap(sb, types.ReporterDisputeEventPrefix, "reporter_dispute_events", collections.TripleKeyCodec(collections.BytesKey, collections.Uint64Key, collections.Uint64Key), codec.CollValue[types.ReporterDisputeEvent](cdc)), - TokenOriginSnapshot: collections.NewMap(sb, types.TokenOriginSnapshotPrefix, "token_origin_snapshot", collections.PairKeyCodec(collections.BytesKey, collections.Int64Key), codec.CollValue[types.DelegationsPreUpdate](cdc)), - authority: authority, - logger: logger, - stakingKeeper: stakingKeeper, - bankKeeper: bankKeeper, - DelegatorTips: collections.NewMap(sb, types.DelegatorTipsPrefix, "delegator_tips", collections.BytesKey, sdk.IntValue), - ReporterCheckpoint: collections.NewMap(sb, types.ReporterCheckpointPrefix, "reporter_checkpoint", collections.PairKeyCodec(collections.BytesKey, collections.Int64Key), sdk.IntValue), - DelegatorCheckpoint: collections.NewMap(sb, types.DelegatorCheckpointPrefix, "delegator_checkpoint", collections.PairKeyCodec(collections.BytesKey, collections.Int64Key), sdk.IntValue), - DisputedDelegationAmounts: collections.NewMap(sb, types.DisputedDelegationAmountsPrefix, "disputed_delegation_amounts", collections.BytesKey, codec.CollValue[types.DelegationsPreUpdate](cdc)), - FeePaidFromStake: collections.NewMap(sb, types.FeePaidFromStakePrefix, "fee_paid_from_stake", collections.BytesKey, codec.CollValue[types.DelegationsPreUpdate](cdc)), - TotalPower: collections.NewMap(sb, types.TotalPowerPrefix, "total_power", collections.Int64Key, sdk.IntValue), + Params: collections.NewItem(sb, types.ParamsKey, "params", codec.CollValue[types.Params](cdc)), + Tracker: collections.NewItem(sb, types.StakeTrackerPrefix, "tracker", codec.CollValue[types.StakeTracker](cdc)), + Reporters: collections.NewMap(sb, types.ReportersKey, "reporters_by_reporter", collections.BytesKey, codec.CollValue[types.OracleReporter](cdc)), + Delegators: collections.NewIndexedMap(sb, types.DelegatorsKey, "delegations_by_delegator", collections.BytesKey, codec.CollValue[types.Delegation](cdc), NewDelegatorsIndex(sb)), + DelegatorTips: collections.NewMap(sb, types.DelegatorTipsPrefix, "delegator_tips", collections.BytesKey, sdk.IntValue), + DisputedDelegationAmounts: collections.NewMap(sb, types.DisputedDelegationAmountsPrefix, "disputed_delegation_amounts", collections.BytesKey, codec.CollValue[types.DelegationsAmounts](cdc)), + FeePaidFromStake: collections.NewMap(sb, types.FeePaidFromStakePrefix, "fee_paid_from_stake", collections.BytesKey, codec.CollValue[types.DelegationsAmounts](cdc)), + Report: collections.NewMap(sb, types.ReporterPrefix, "report", collections.PairKeyCodec(collections.BytesKey, collections.Int64Key), codec.CollValue[types.DelegationsAmounts](cdc)), + TempStore: collections.NewMap(sb, types.TempPrefix, "temp", collections.PairKeyCodec(collections.BytesKey, collections.BytesKey), sdk.IntValue), + authority: authority, + logger: logger, + stakingKeeper: stakingKeeper, + bankKeeper: bankKeeper, } schema, err := sb.Build() if err != nil { @@ -111,29 +94,38 @@ func (k Keeper) Logger() log.Logger { } func (k Keeper) GetDelegatorTokensAtBlock(ctx context.Context, delegator []byte, blockNumber int64) (math.Int, error) { - rng := collections.NewPrefixedPairRange[[]byte, int64](delegator).EndInclusive(blockNumber).Descending() - tokens := math.ZeroInt() - err := k.DelegatorCheckpoint.Walk(ctx, rng, func(key collections.Pair[[]byte, int64], value math.Int) (stop bool, err error) { - tokens = value + del, err := k.Delegators.Get(ctx, delegator) + if err != nil { + return math.Int{}, err + } + rng := collections.NewPrefixedPairRange[[]byte, int64](del.Reporter).EndInclusive(blockNumber).Descending() + rep := types.DelegationsAmounts{} + err = k.Report.Walk(ctx, rng, func(key collections.Pair[[]byte, int64], value types.DelegationsAmounts) (bool, error) { + rep = value return true, nil }) if err != nil { return math.Int{}, err } - return tokens, nil + for _, r := range rep.TokenOrigins { + if bytes.Equal(r.DelegatorAddress, delegator) { + return r.Amount, nil + } + } + return math.ZeroInt(), nil } func (k Keeper) GetReporterTokensAtBlock(ctx context.Context, reporter []byte, blockNumber int64) (math.Int, error) { rng := collections.NewPrefixedPairRange[[]byte, int64](reporter).EndInclusive(blockNumber).Descending() - tokens := math.ZeroInt() - err := k.ReporterCheckpoint.Walk(ctx, rng, func(key collections.Pair[[]byte, int64], value math.Int) (stop bool, err error) { - tokens = value + total := math.ZeroInt() + err := k.Report.Walk(ctx, rng, func(key collections.Pair[[]byte, int64], value types.DelegationsAmounts) (bool, error) { + total = value.Total return true, nil }) if err != nil { return math.Int{}, err } - return tokens, nil + return total, nil } func (k Keeper) TrackStakeChange(ctx context.Context) error { @@ -157,3 +149,11 @@ func (k Keeper) TrackStakeChange(ctx context.Context) error { maxStake.Amount = total return k.Tracker.Set(ctx, maxStake) } + +func DefaultCommission() *stakingtypes.Commission { + return &stakingtypes.Commission{CommissionRates: stakingtypes.CommissionRates{ + Rate: math.LegacyMustNewDecFromStr("0.1"), + MaxRate: math.LegacyMustNewDecFromStr("0.2"), + MaxChangeRate: math.LegacyMustNewDecFromStr("0.01"), + }} +} diff --git a/x/reporter/keeper/msg_server.go b/x/reporter/keeper/msg_server.go index f91b991ef..92a8a738b 100644 --- a/x/reporter/keeper/msg_server.go +++ b/x/reporter/keeper/msg_server.go @@ -2,10 +2,15 @@ package keeper import ( "context" + "errors" + layertypes "github.com/tellor-io/layer/types" "github.com/tellor-io/layer/x/reporter/types" + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) type msgServer struct { @@ -20,27 +25,110 @@ func NewMsgServerImpl(keeper Keeper) types.MsgServer { var _ types.MsgServer = msgServer{} -func (k msgServer) WithdrawDelegatorReward(ctx context.Context, msg *types.MsgWithdrawDelegatorReward) (*types.MsgWithdrawDelegatorRewardResponse, error) { - reporterVal := sdk.MustAccAddressFromBech32(msg.ReporterAddress) - delAddr := sdk.MustAccAddressFromBech32(msg.DelegatorAddress) +func (k msgServer) CreateReporter(goCtx context.Context, msg *types.MsgCreateReporter) (*types.MsgCreateReporterResponse, error) { + reporter := sdk.MustAccAddressFromBech32(msg.ReporterAddress) + reporterExists, err := k.Reporters.Has(goCtx, reporter.Bytes()) + if err != nil { + return nil, err + } + if reporterExists { + return nil, errorsmod.Wrapf(types.ErrReporterExists, "cannot create reporter with address %s, it already exists", msg.ReporterAddress) + } + delegation, err := k.Keeper.Delegators.Get(goCtx, reporter.Bytes()) + if err != nil { + return nil, err + } + // remove tokens from reporter + // get old reporter + oldReporter, err := k.Reporters.Get(goCtx, delegation.Reporter) + if err != nil { + return nil, err + } + oldReporter.TotalTokens = oldReporter.TotalTokens.Sub(delegation.Amount) + if err := k.Reporters.Set(goCtx, delegation.Reporter, oldReporter); err != nil { + return nil, err + } + delegation.Reporter = reporter.Bytes() + if err := k.Keeper.Delegators.Set(goCtx, reporter.Bytes(), delegation); err != nil { + return nil, err + } - amount, err := k.WithdrawDelegationRewards(ctx, reporterVal.Bytes(), delAddr) + minCommRate, err := k.MinCommissionRate(goCtx) if err != nil { return nil, err } + if msg.Commission.Rate.LT(minCommRate) { + return nil, errorsmod.Wrapf(types.ErrCommissionLTMinRate, "cannot set commission to less than minimum rate of %s", minCommRate) + } + + commission := types.NewCommissionWithTime(msg.Commission.Rate, msg.Commission.MaxRate, + msg.Commission.MaxChangeRate, sdk.UnwrapSDKContext(goCtx).HeaderInfo().Time) - return &types.MsgWithdrawDelegatorRewardResponse{Amount: amount}, nil + if err := commission.Validate(); err != nil { + return nil, err + } + // create a new reporter + newReporter := types.NewOracleReporter(msg.ReporterAddress, delegation.Amount, &commission) + if err := k.Reporters.Set(goCtx, reporter.Bytes(), newReporter); err != nil { + return nil, err + } + return &types.MsgCreateReporterResponse{}, nil } -func (k msgServer) WithdrawReporterCommission(ctx context.Context, msg *types.MsgWithdrawReporterCommission) (*types.MsgWithdrawReporterCommissionResponse, error) { - reporterVal := sdk.MustAccAddressFromBech32(msg.ReporterAddress) +func (k msgServer) ChangeReporter(goCtx context.Context, msg *types.MsgChangeReporter) (*types.MsgChangeReporterResponse, error) { + newReporterAddr := sdk.MustAccAddressFromBech32(msg.ReporterAddress) + // get delegation + delAddr := sdk.MustAccAddressFromBech32(msg.DelegatorAddress) + delegation, err := k.Keeper.Delegators.Get(goCtx, delAddr.Bytes()) + if err != nil { + return nil, err + } + // move tokens + rep, err := k.Reporters.Get(goCtx, delegation.Reporter) + if err != nil { + return nil, err + } + rep.TotalTokens = rep.TotalTokens.Sub(delegation.Amount) + if err := k.Reporters.Set(goCtx, delegation.Reporter, rep); err != nil { + return nil, err + } + + reporterExists, err := k.Keeper.Reporters.Has(goCtx, newReporterAddr) + if err != nil { + return nil, err + } + + if !reporterExists { + return nil, errors.New("reporter does not exist") + } + + iter, err := k.Keeper.Delegators.Indexes.Reporter.MatchExact(goCtx, newReporterAddr.Bytes()) + if err != nil { + return nil, err + } + + keys, err := iter.FullKeys() + if err != nil { + return nil, err + } - amount, err := k.Keeper.WithdrawReporterCommission(ctx, reporterVal.Bytes()) + if len(keys) >= 100 { + return nil, errors.New("reporter is at max cap") + } + rep, err = k.Reporters.Get(goCtx, newReporterAddr.Bytes()) if err != nil { return nil, err } + rep.TotalTokens = rep.TotalTokens.Add(delegation.Amount) + if err := k.Reporters.Set(goCtx, newReporterAddr.Bytes(), rep); err != nil { + return nil, err + } + delegation.Reporter = newReporterAddr.Bytes() + if err := k.Keeper.Delegators.Set(goCtx, delAddr.Bytes(), delegation); err != nil { + return nil, err + } - return &types.MsgWithdrawReporterCommissionResponse{Amount: amount}, nil + return &types.MsgChangeReporterResponse{}, nil } func (k msgServer) UnjailReporter(goCtx context.Context, msg *types.MsgUnjailReporter) (*types.MsgUnjailReporterResponse, error) { @@ -59,3 +147,42 @@ func (k msgServer) UnjailReporter(goCtx context.Context, msg *types.MsgUnjailRep return &types.MsgUnjailReporterResponse{}, nil } + +func (k msgServer) WithdrawTip(goCtx context.Context, msg *types.MsgWithdrawTip) (*types.MsgWithdrawTipResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + delAddr := sdk.MustAccAddressFromBech32(msg.DelegatorAddress) + shares, err := k.Keeper.DelegatorTips.Get(ctx, delAddr) + if err != nil { + return nil, err + } + + valAddr, err := sdk.ValAddressFromBech32(msg.ValidatorAddress) + if err != nil { + return nil, err + } + val, err := k.stakingKeeper.GetValidator(ctx, valAddr) + if err != nil { + return nil, err + } + + if !val.IsBonded() { + return nil, errors.New("chosen validator must be bonded") + } + _, err = k.Keeper.stakingKeeper.Delegate(ctx, delAddr, shares, val.Status, val, false) + if err != nil { + return nil, err + } + + err = k.Keeper.DelegatorTips.Remove(ctx, delAddr) + if err != nil { + return nil, err + } + + // send coins + err = k.Keeper.bankKeeper.SendCoinsFromModuleToModule(ctx, types.TipsEscrowPool, stakingtypes.BondedPoolName, sdk.NewCoins(sdk.NewCoin(layertypes.BondDenom, shares))) + if err != nil { + return nil, err + } + + return &types.MsgWithdrawTipResponse{}, nil +} diff --git a/x/reporter/keeper/msg_server_create_reporter.go b/x/reporter/keeper/msg_server_create_reporter.go deleted file mode 100644 index b8c6d09c1..000000000 --- a/x/reporter/keeper/msg_server_create_reporter.go +++ /dev/null @@ -1,87 +0,0 @@ -package keeper - -import ( - "context" - - "github.com/tellor-io/layer/x/reporter/types" - - "cosmossdk.io/collections" - "cosmossdk.io/errors" - - sdk "github.com/cosmos/cosmos-sdk/types" -) - -func (k msgServer) CreateReporter(goCtx context.Context, msg *types.MsgCreateReporter) (*types.MsgCreateReporterResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - reporter := sdk.MustAccAddressFromBech32(msg.Reporter) - reporterExists, err := k.Reporters.Has(ctx, reporter) - if err != nil { - return nil, err - } - if reporterExists { - return nil, errors.Wrapf(types.ErrReporterExists, "cannot create reporter with address %s, it already exists", msg.Reporter) - } - // check if reporter is delegated somewhere - delegatorExists, err := k.Delegators.Has(ctx, reporter) - if err != nil { - return nil, err - } - if delegatorExists { - return nil, errors.Wrapf(types.ErrAddressDelegated, "cannot use address %s as reporter as it is already delegated", msg.Reporter) - } - if err := k.Keeper.ValidateAndSetAmount(ctx, reporter, msg.TokenOrigins, msg.Amount); err != nil { - return nil, err - } - minCommRate, err := k.MinCommissionRate(ctx) - if err != nil { - return nil, err - } - if msg.Commission.Rate.LT(minCommRate) { - return nil, errors.Wrapf(types.ErrCommissionLTMinRate, "cannot set validator commission to less than minimum rate of %s", minCommRate) - } - - commission := types.NewCommissionWithTime(msg.Commission.Rate, msg.Commission.MaxRate, - msg.Commission.MaxChangeRate, ctx.HeaderInfo().Time) - - if err := commission.Validate(); err != nil { - return nil, err - } - // create a new reporter - newOracleReporter := types.NewOracleReporter(msg.Reporter, msg.Amount, &commission) - if err := k.ReporterCheckpoint.Set(ctx, collections.Join(reporter.Bytes(), sdk.UnwrapSDKContext(ctx).BlockHeight()), newOracleReporter.TotalTokens); err != nil { - return nil, err - } - if err := k.UpdateTotalPower(ctx, newOracleReporter.TotalTokens, false); err != nil { - return nil, err - } - if err := k.Reporters.Set(ctx, reporter, newOracleReporter); err != nil { - return nil, err - } - // ********************** AfterReporterCreated hook ************************************** - if err := k.Keeper.AfterReporterCreated(ctx, newOracleReporter); err != nil { - return nil, err - } - // ************************************************************************************************ - // create a new delegation - // ********************** BeforeDelegationCreated hook ************************************** - if err := k.Keeper.BeforeDelegationCreated(ctx, newOracleReporter); err != nil { - return nil, err - } - // ************************************************************************************************ - newDelegation := types.NewDelegation(msg.Reporter, msg.Amount) - if err := k.DelegatorCheckpoint.Set(ctx, collections.Join(reporter.Bytes(), sdk.UnwrapSDKContext(ctx).BlockHeight()), newDelegation.Amount); err != nil { - return nil, err - } - if err := k.Delegators.Set(ctx, reporter, newDelegation); err != nil { - return nil, err - } - // ********************** AfterDelegationModified hook ************************************** - if err := k.Keeper.AfterDelegationModified(ctx, reporter, sdk.ValAddress(reporter), newDelegation.Amount); err != nil { - return nil, err - } - if err := k.AfterReporterModified(ctx, reporter); err != nil { - return nil, err - } - // ************************************************************************************************ - return &types.MsgCreateReporterResponse{}, nil -} diff --git a/x/reporter/keeper/msg_server_create_reporter_test.go b/x/reporter/keeper/msg_server_create_reporter_test.go deleted file mode 100644 index e86ed9ec8..000000000 --- a/x/reporter/keeper/msg_server_create_reporter_test.go +++ /dev/null @@ -1,84 +0,0 @@ -package keeper_test - -import ( - "testing" - "time" - - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" - "github.com/tellor-io/layer/x/reporter/types" - - "cosmossdk.io/math" - - sdk "github.com/cosmos/cosmos-sdk/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" -) - -func TestCreateReporter(t *testing.T) { - k, sk, _, ms, ctx := setupMsgServer(t) - - // setup delegator and validators - reporterAddr := sdk.AccAddress([]byte("reporter")) - reporterBech32 := reporterAddr.String() - amount := math.NewInt(100) - commission := types.NewCommissionWithTime(math.LegacyNewDecWithPrec(1, 1), math.LegacyNewDecWithPrec(3, 1), - math.LegacyNewDecWithPrec(1, 1), time.Time{}) - - validatorI := sdk.ValAddress([]byte("validator1")) - validatorII := sdk.ValAddress([]byte("validator2")) - validatorIII := sdk.ValAddress([]byte("validator3")) - delegationI := stakingtypes.Delegation{Shares: math.LegacyNewDec(50), DelegatorAddress: reporterBech32, ValidatorAddress: validatorI.String()} - valI := stakingtypes.Validator{OperatorAddress: validatorI.String(), Tokens: math.NewInt(100), DelegatorShares: math.LegacyNewDec(50)} - delegationII := stakingtypes.Delegation{Shares: math.LegacyNewDec(30), DelegatorAddress: reporterBech32, ValidatorAddress: validatorII.String()} - valII := stakingtypes.Validator{OperatorAddress: validatorII.String(), Tokens: math.NewInt(100), DelegatorShares: math.LegacyNewDec(50)} - delegationIII := stakingtypes.Delegation{Shares: math.LegacyNewDec(20), DelegatorAddress: reporterBech32, ValidatorAddress: validatorIII.String()} - valIII := stakingtypes.Validator{OperatorAddress: validatorIII.String(), Tokens: math.NewInt(100), DelegatorShares: math.LegacyNewDec(50)} - originAmounts := []*types.TokenOrigin{ - { - ValidatorAddress: validatorI, - Amount: math.NewInt(50), - }, - { - ValidatorAddress: validatorII, - Amount: math.NewInt(30), - }, - { - ValidatorAddress: validatorIII, - Amount: math.NewInt(20), - }, - } - // mock the staking keeper - sk.On("GetValidator", mock.Anything, validatorI).Return(valI, nil) - sk.On("GetValidator", mock.Anything, validatorII).Return(valII, nil) - sk.On("GetValidator", mock.Anything, validatorIII).Return(valIII, nil) - sk.On("Delegation", mock.Anything, reporterAddr, validatorI).Return(delegationI, nil) - sk.On("Delegation", mock.Anything, reporterAddr, validatorII).Return(delegationII, nil) - sk.On("Delegation", mock.Anything, reporterAddr, validatorIII).Return(delegationIII, nil) - - msg := types.NewMsgCreateReporter(reporterBech32, amount, originAmounts, &commission) - res, err := ms.CreateReporter(ctx, msg) - require.NoError(t, err) - require.NotNil(t, res) - - // verify that the reporter exists in the keeper - exists, err := k.Reporters.Has(ctx, reporterAddr) - require.NoError(t, err) - require.True(t, exists) - - // verify that the delegation exists in the keeper - exists, err = k.Delegators.Has(ctx, reporterAddr) - require.NoError(t, err) - require.True(t, exists) - - // verify that the delegation exists in the keeper - delegatorExists, err := k.Delegators.Has(ctx, reporterAddr) - require.NoError(t, err) - require.True(t, delegatorExists) - - // verify that the commission is set correctly - reporter, err := k.Reporters.Get(ctx, reporterAddr) - require.NoError(t, err) - require.Equal(t, commission.Rate, reporter.Commission.Rate) - require.Equal(t, commission.MaxRate, reporter.Commission.MaxRate) - require.Equal(t, commission.MaxChangeRate, reporter.Commission.MaxChangeRate) -} diff --git a/x/reporter/keeper/msg_server_delegate_reporter.go b/x/reporter/keeper/msg_server_delegate_reporter.go deleted file mode 100644 index f25e66f99..000000000 --- a/x/reporter/keeper/msg_server_delegate_reporter.go +++ /dev/null @@ -1,83 +0,0 @@ -package keeper - -import ( - "bytes" - "context" - "errors" - - "github.com/tellor-io/layer/x/reporter/types" - - "cosmossdk.io/collections" - errorsmod "cosmossdk.io/errors" - - sdk "github.com/cosmos/cosmos-sdk/types" -) - -func (k msgServer) DelegateReporter(goCtx context.Context, msg *types.MsgDelegateReporter) (*types.MsgDelegateReporterResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - delAddr := sdk.MustAccAddressFromBech32(msg.Delegator) - repAddr := sdk.MustAccAddressFromBech32(msg.Reporter) - - // fetch reporter - reporter, err := k.Reporters.Get(ctx, repAddr) - if err != nil { - return nil, err - } - delegation, err := k.Delegators.Get(ctx, delAddr) - if err != nil { - if !errors.Is(err, collections.ErrNotFound) { - return nil, err - } else { - // create a new delegation - // ********************** BeforeDelegationCreated hook ************************************** - if err := k.BeforeDelegationCreated(ctx, reporter); err != nil { - return nil, err - } - delegation.Reporter = repAddr - delegation.Amount = msg.Amount - } - } - if err == nil { - // found delegation, update the amount - // validate right reporter selected - if !bytes.Equal(delegation.Reporter, repAddr.Bytes()) { - return nil, errorsmod.Wrapf(types.ErrInvalidReporter, "Reporter mismatch for delegated address %s, expected %s, got %s", msg.Delegator, delegation.Reporter, msg.Reporter) - } - // ********************** BeforeDelegationModified hook ************************************** - if err := k.BeforeDelegationModified(ctx, delAddr, delegation, reporter); err != nil { - return nil, err - } - delegation.Amount = delegation.Amount.Add(msg.Amount) - } - if err := k.Keeper.ValidateAndSetAmount(ctx, delAddr, msg.TokenOrigins, msg.Amount); err != nil { - return nil, err - } - if err := k.DelegatorCheckpoint.Set(ctx, collections.Join(delAddr.Bytes(), sdk.UnwrapSDKContext(ctx).BlockHeight()), delegation.Amount); err != nil { - return nil, err - } - if err := k.Delegators.Set(ctx, delAddr, delegation); err != nil { - return nil, err - } - // ********************** AfterDelegationModified hook ************************************** - if err := k.AfterDelegationModified(ctx, delAddr, sdk.ValAddress(repAddr), delegation.Amount); err != nil { - return nil, err - } - // update reporter total tokens - reporter.TotalTokens = reporter.TotalTokens.Add(msg.Amount) - if err := k.UpdateTotalPower(ctx, msg.Amount, false); err != nil { - return nil, err - } - - if err := k.ReporterCheckpoint.Set(ctx, collections.Join(repAddr.Bytes(), sdk.UnwrapSDKContext(ctx).BlockHeight()), reporter.TotalTokens); err != nil { - return nil, err - } - if err := k.Reporters.Set(ctx, repAddr, reporter); err != nil { - return nil, err - } - if err := k.AfterReporterModified(ctx, repAddr); err != nil { - return nil, err - } - - return &types.MsgDelegateReporterResponse{}, nil -} diff --git a/x/reporter/keeper/msg_server_delegate_reporter_test.go b/x/reporter/keeper/msg_server_delegate_reporter_test.go deleted file mode 100644 index cb0d10d58..000000000 --- a/x/reporter/keeper/msg_server_delegate_reporter_test.go +++ /dev/null @@ -1,72 +0,0 @@ -package keeper_test - -import ( - "testing" - - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" - "github.com/tellor-io/layer/x/reporter/types" - - "cosmossdk.io/math" - - sdk "github.com/cosmos/cosmos-sdk/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" -) - -func TestDelegateReporter(t *testing.T) { - k, sk, _, ms, ctx := setupMsgServer(t) - - delAddr := sdk.AccAddress([]byte("delegator")) - repAddr := sdk.AccAddress([]byte("reporter")) - validatorI := sdk.ValAddress([]byte("validator1")) - validatorII := sdk.ValAddress([]byte("validator2")) - - msg := types.MsgDelegateReporter{ - Delegator: delAddr.String(), - Reporter: repAddr.String(), - Amount: math.NewInt(100), - TokenOrigins: []*types.TokenOrigin{ - { - ValidatorAddress: validatorI, - Amount: math.NewInt(50), - }, - { - ValidatorAddress: validatorII, - Amount: math.NewInt(50), - }, - }, - } - - // add the reporter to the keeper - reporter := types.OracleReporter{Reporter: repAddr, TotalTokens: math.NewInt(200)} - err := k.Reporters.Set(ctx, repAddr, reporter) - require.NoError(t, err) - // call distr hooks - err = k.AfterReporterCreated(ctx, reporter) - require.NoError(t, err) - - err = k.BeforeDelegationCreated(ctx, reporter) - require.NoError(t, err) - - // set up mock for ValidateAndSetAmount method of Keeper - delegationI := stakingtypes.Delegation{Shares: math.LegacyNewDec(50), DelegatorAddress: delAddr.String(), ValidatorAddress: validatorI.String()} - valI := stakingtypes.Validator{OperatorAddress: validatorI.String(), Tokens: math.NewInt(100), DelegatorShares: math.LegacyNewDec(50)} - delegationII := stakingtypes.Delegation{Shares: math.LegacyNewDec(50), DelegatorAddress: delAddr.String(), ValidatorAddress: validatorII.String()} - valII := stakingtypes.Validator{OperatorAddress: validatorII.String(), Tokens: math.NewInt(100), DelegatorShares: math.LegacyNewDec(50)} - - // mock the staking keeper - sk.On("GetValidator", mock.Anything, validatorI).Return(valI, nil) - sk.On("GetValidator", mock.Anything, validatorII).Return(valII, nil) - sk.On("Delegation", mock.Anything, delAddr, validatorI).Return(delegationI, nil) - sk.On("Delegation", mock.Anything, delAddr, validatorII).Return(delegationII, nil) - - // Call the DelegateReporter function - res, err := ms.DelegateReporter(ctx, &msg) - require.NoError(t, err) - require.NotNil(t, res) - - // Check if the delegation was added correctly - delegation, err := k.Delegators.Get(ctx, delAddr) - require.NoError(t, err) - require.Equal(t, repAddr.Bytes(), delegation.Reporter) -} diff --git a/x/reporter/keeper/msg_server_undelegate_reporter.go b/x/reporter/keeper/msg_server_undelegate_reporter.go deleted file mode 100644 index a5e9f42b1..000000000 --- a/x/reporter/keeper/msg_server_undelegate_reporter.go +++ /dev/null @@ -1,51 +0,0 @@ -package keeper - -import ( - "context" - - "github.com/tellor-io/layer/x/reporter/types" - - "cosmossdk.io/collections" - "cosmossdk.io/math" - - sdk "github.com/cosmos/cosmos-sdk/types" -) - -func (k msgServer) UndelegateReporter(goCtx context.Context, msg *types.MsgUndelegateReporter) (*types.MsgUndelegateReporterResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - // fetch delegation - delAddr := sdk.MustAccAddressFromBech32(msg.DelegatorAddress) - delegation, err := k.Delegators.Get(ctx, delAddr) - if err != nil { - return nil, err - } - // fetch reporter - repAddr := sdk.AccAddress(delegation.Reporter) - reporter, err := k.Reporters.Get(ctx, repAddr) - if err != nil { - return nil, err - } - reducedbyAmount := math.ZeroInt() - for _, source := range msg.TokenOrigins { - valAddr := sdk.ValAddress(source.ValidatorAddress) - currentSourceAmt, err := k.TokenOrigin.Get(ctx, collections.Join(delAddr.Bytes(), valAddr.Bytes())) - if err != nil { - return nil, err - } - err = k.UndelegateSource(ctx, collections.Join(delAddr.Bytes(), valAddr.Bytes()), currentSourceAmt, source.Amount) - if err != nil { - return nil, err - } - reducedbyAmount = reducedbyAmount.Add(source.Amount) - } - - if err := k.UpdateOrRemoveDelegator(ctx, delAddr, delegation, reporter, reducedbyAmount); err != nil { - return nil, err - } - if err := k.UpdateOrRemoveReporter(ctx, repAddr, reporter, reducedbyAmount); err != nil { - return nil, err - } - - return &types.MsgUndelegateReporterResponse{}, nil -} diff --git a/x/reporter/keeper/msg_server_undelegate_reporter_test.go b/x/reporter/keeper/msg_server_undelegate_reporter_test.go deleted file mode 100644 index c1eab2d7b..000000000 --- a/x/reporter/keeper/msg_server_undelegate_reporter_test.go +++ /dev/null @@ -1,68 +0,0 @@ -package keeper_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - "github.com/tellor-io/layer/x/reporter/types" - - "cosmossdk.io/collections" - "cosmossdk.io/math" - - sdk "github.com/cosmos/cosmos-sdk/types" -) - -func TestUndelegateReporter(t *testing.T) { - k, _, _, ms, ctx := setupMsgServer(t) - - delAddr := sdk.AccAddress([]byte("delegator")) - repAddr := sdk.AccAddress([]byte("reporter")) - valAddr := sdk.ValAddress([]byte("validator")) - - reporter := types.OracleReporter{ - Reporter: repAddr, - TotalTokens: math.NewInt(50), - } - delegation := types.Delegation{ - Reporter: repAddr, - Amount: math.NewInt(50), - } - err := k.Delegators.Set(ctx, delAddr, delegation) - require.NoError(t, err) - tokenOrigin := types.TokenOrigin{ - ValidatorAddress: valAddr, - Amount: math.NewInt(50), - } - err = k.TokenOrigin.Set(ctx, collections.Join(delAddr.Bytes(), valAddr.Bytes()), math.NewInt(50)) - require.NoError(t, err) - err = k.Reporters.Set(ctx, repAddr, reporter) - require.NoError(t, err) - // distr hooks - err = k.AfterReporterCreated(ctx, reporter) - require.NoError(t, err) - err = k.BeforeDelegationCreated(ctx, reporter) - require.NoError(t, err) - err = k.AfterDelegationModified(ctx, delAddr, sdk.ValAddress(repAddr), delegation.Amount) - require.NoError(t, err) - - // check if delegation and reporter exist - delegation, err = k.Delegators.Get(ctx, delAddr) - require.NoError(t, err) - require.Equal(t, math.NewInt(50), delegation.Amount) - reporter, err = k.Reporters.Get(ctx, repAddr) - require.NoError(t, err) - require.Equal(t, math.NewInt(50), reporter.TotalTokens) - - // call undelgate reporter - msg := types.NewMsgUndelegateReporter(delAddr.String(), []*types.TokenOrigin{&tokenOrigin}) - res, err := ms.UndelegateReporter(ctx, msg) - require.NoError(t, err) - require.NotNil(t, res) - - // check if delegation and reporter are removed - // check if delegation and reporter exist - delegation, err = k.Delegators.Get(ctx, delAddr) - require.ErrorIs(t, err, collections.ErrNotFound) - reporter, err = k.Reporters.Get(ctx, repAddr) - require.ErrorIs(t, err, collections.ErrNotFound) -} diff --git a/x/reporter/keeper/msg_server_withdraw_tip.go b/x/reporter/keeper/msg_server_withdraw_tip.go deleted file mode 100644 index 33eabef33..000000000 --- a/x/reporter/keeper/msg_server_withdraw_tip.go +++ /dev/null @@ -1,51 +0,0 @@ -package keeper - -import ( - "context" - "errors" - - layertypes "github.com/tellor-io/layer/types" - "github.com/tellor-io/layer/x/reporter/types" - - sdk "github.com/cosmos/cosmos-sdk/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" -) - -func (k msgServer) WithdrawTip(goCtx context.Context, msg *types.MsgWithdrawTip) (*types.MsgWithdrawTipResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - delAddr := sdk.MustAccAddressFromBech32(msg.DelegatorAddress) - shares, err := k.Keeper.DelegatorTips.Get(ctx, delAddr) - if err != nil { - return nil, err - } - - valAddr, err := sdk.ValAddressFromBech32(msg.ValidatorAddress) - if err != nil { - return nil, err - } - val, err := k.stakingKeeper.GetValidator(ctx, valAddr) - if err != nil { - return nil, err - } - - if !val.IsBonded() { - return nil, errors.New("chosen validator must be bonded") - } - _, err = k.Keeper.stakingKeeper.Delegate(ctx, delAddr, shares, val.Status, val, false) - if err != nil { - return nil, err - } - - err = k.Keeper.DelegatorTips.Remove(ctx, delAddr) - if err != nil { - return nil, err - } - - // send coins - err = k.Keeper.bankKeeper.SendCoinsFromModuleToModule(ctx, types.TipsEscrowPool, stakingtypes.BondedPoolName, sdk.NewCoins(sdk.NewCoin(layertypes.BondDenom, shares))) - if err != nil { - return nil, err - } - - return &types.MsgWithdrawTipResponse{}, nil -} diff --git a/x/reporter/keeper/query.go b/x/reporter/keeper/query.go index 669122f0f..453e23594 100644 --- a/x/reporter/keeper/query.go +++ b/x/reporter/keeper/query.go @@ -1,17 +1,12 @@ package keeper import ( - "bytes" "context" - "errors" "github.com/tellor-io/layer/x/reporter/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - "cosmossdk.io/collections" - errorsmod "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -25,21 +20,6 @@ func NewQuerier(keeper Keeper) Querier { return Querier{Keeper: keeper} } -// Reporter queries a reporter by address -func (k Querier) Reporter(ctx context.Context, req *types.QueryReporterRequest) (*types.QueryReporterResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - reporterAddr := sdk.MustAccAddressFromBech32(req.ReporterAddress) - - reporter, err := k.Keeper.Reporter(ctx, reporterAddr) - if err != nil { - return nil, err - } - return &types.QueryReporterResponse{Reporter: reporter}, nil -} - // Reporters queries all the reporters func (k Querier) Reporters(ctx context.Context, req *types.QueryReportersRequest) (*types.QueryReportersResponse, error) { if req == nil { @@ -77,107 +57,3 @@ func (k Querier) DelegatorReporter(ctx context.Context, req *types.QueryDelegato return &types.QueryDelegatorReporterResponse{Reporter: sdk.AccAddress(delegator.GetReporter()).String()}, nil } - -// ReporterStake queries the total tokens of a reporter -func (k Querier) ReporterStake(ctx context.Context, req *types.QueryReporterStakeRequest) (*types.QueryReporterStakeResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - reporterAddr := sdk.MustAccAddressFromBech32(req.ReporterAddress) - - reporter, err := k.Keeper.Reporters.Get(ctx, reporterAddr) - if err != nil { - if errors.Is(err, collections.ErrNotFound) { - return nil, types.ErrReporterDoesNotExist - } - return nil, err - } - - return &types.QueryReporterStakeResponse{Stake: reporter.TotalTokens}, nil -} - -// DelegationRewards the total rewards accrued by a delegation -func (k Querier) DelegationRewards(ctx context.Context, req *types.QueryDelegationRewardsRequest) (*types.QueryDelegationRewardsResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - reporterAddr := sdk.MustAccAddressFromBech32(req.ReporterAddress) - delAddr := sdk.MustAccAddressFromBech32(req.DelegatorAddress) - - reporter, err := k.Keeper.Reporters.Get(ctx, reporterAddr) - if err != nil { - return nil, err - } - - delegation, err := k.Keeper.Delegators.Get(ctx, delAddr) - if err != nil { - return nil, err - } - - if !bytes.Equal(reporter.GetReporter(), delegation.GetReporter()) { - return nil, types.ErrReporterMismatch - } - - endingPeriod, err := k.Keeper.IncrementReporterPeriod(ctx, reporter) - if err != nil { - return nil, err - } - - rewards, err := k.Keeper.CalculateDelegationRewards(ctx, reporterAddr.Bytes(), delAddr, delegation, endingPeriod) - if err != nil { - return nil, err - } - - return &types.QueryDelegationRewardsResponse{Rewards: rewards}, nil -} - -// ReporterOutstandingRewards queries rewards of a reporter address -func (k Querier) ReporterOutstandingRewards(ctx context.Context, req *types.QueryReporterOutstandingRewardsRequest) (*types.QueryReporterOutstandingRewardsResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - reporterAddr := sdk.MustAccAddressFromBech32(req.ReporterAddress) - - exists, err := k.Keeper.Reporters.Has(ctx, reporterAddr) - if err != nil { - return nil, err - } - - if !exists { - return nil, errorsmod.Wrapf(types.ErrReporterDoesNotExist, req.ReporterAddress) - } - - rewards, err := k.Keeper.ReporterOutstandingRewards.Get(ctx, reporterAddr.Bytes()) - if err != nil { - return nil, err - } - - return &types.QueryReporterOutstandingRewardsResponse{Rewards: rewards}, nil -} - -// RporterCommission queries accumulated commission for a reporter -func (k Querier) ReporterCommission(ctx context.Context, req *types.QueryReporterCommissionRequest) (*types.QueryReporterCommissionResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - reporterAddr := sdk.MustAccAddressFromBech32(req.ReporterAddress) - - exists, err := k.Keeper.Reporters.Has(ctx, reporterAddr) - if err != nil { - return nil, err - } - - if !exists { - return nil, errorsmod.Wrapf(types.ErrReporterDoesNotExist, req.ReporterAddress) - } - commission, err := k.Keeper.ReportersAccumulatedCommission.Get(ctx, reporterAddr.Bytes()) - if err != nil { - return nil, err - } - - return &types.QueryReporterCommissionResponse{Commission: commission}, nil -} diff --git a/x/reporter/keeper/reporter.go b/x/reporter/keeper/reporter.go index db60aa5fa..b4020c53d 100644 --- a/x/reporter/keeper/reporter.go +++ b/x/reporter/keeper/reporter.go @@ -2,7 +2,6 @@ package keeper import ( "context" - "errors" "github.com/tellor-io/layer/x/reporter/types" @@ -11,136 +10,101 @@ import ( "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) -func (k Keeper) ValidateAndSetAmount(ctx context.Context, delegator sdk.AccAddress, originAmounts []*types.TokenOrigin, amount math.Int) error { - _amt := math.ZeroInt() - for _, origin := range originAmounts { - _amt = _amt.Add(origin.Amount) +// Reporter returns the total power of a reporter that is bonded at time of the call +// Store the set of delegations for the reporter at the current block height for dispute purposes to be referenced by block height +func (k Keeper) ReporterStake(ctx context.Context, repAddr sdk.AccAddress) (math.Int, error) { + reporter, err := k.Reporters.Get(ctx, repAddr.Bytes()) + if err != nil { + return math.Int{}, err } - - if !amount.Equal(_amt) { - return errorsmod.Wrapf(types.ErrTokenAmountMismatch, "got %v as amount, but sum of token origins is %v", amount, _amt) + if reporter.Jailed { + return math.Int{}, errorsmod.Wrapf(types.ErrReporterJailed, "reporter %s is in jail", repAddr.String()) } - for _, origin := range originAmounts { - valAddr := sdk.ValAddress(origin.ValidatorAddress) - - tokenSource, err := k.TokenOrigin.Get(ctx, collections.Join(delegator.Bytes(), valAddr.Bytes())) + totalPower := math.ZeroInt() + delegators, err := k.Delegators.Indexes.Reporter.MatchExact(ctx, repAddr) + if err != nil { + return math.Int{}, err + } + defer delegators.Close() + delegates := make([]*types.TokenOriginInfo, 0) + for ; delegators.Valid(); delegators.Next() { + key, err := delegators.PrimaryKey() if err != nil { - if !errors.Is(err, collections.ErrNotFound) { - return errorsmod.Wrapf(err, "unable to fetch token origin") - } else { - // not found so initialize - tokenSource = math.ZeroInt() - } + return math.Int{}, err } - validator, err := k.stakingKeeper.GetValidator(ctx, valAddr) + valSet := k.stakingKeeper.GetValidatorSet() + maxVal, err := valSet.MaxValidators(ctx) if err != nil { - return errorsmod.Wrapf(err, "failed to fetch validator for source tokens %v", origin) + return math.Int{}, err } - delegation, err := k.stakingKeeper.Delegation(ctx, delegator, valAddr) + // get delegator count + delCount, err := k.Delegators.Get(ctx, key) if err != nil { - return err - } - // check if the delegator has enough tokens bonded with validator, this would be the sum - // of what is currently delegated to reporter plus the amount being added in this transaction - sum := tokenSource.Add(origin.Amount) - tokensFromShares := validator.TokensFromShares(delegation.GetShares()).TruncateInt() - if tokensFromShares.LT(sum) { - return errorsmod.Wrapf(types.ErrInsufficientTokens, "insufficient tokens bonded with validator %v", valAddr) + return math.Int{}, err } - tokenSource = sum - if err := k.TokenOrigin.Set(ctx, collections.Join(delegator.Bytes(), valAddr.Bytes()), tokenSource); err != nil { - return err - } - } - return nil -} - -func (k Keeper) UpdateOrRemoveDelegator(ctx context.Context, delAddr sdk.AccAddress, del types.Delegation, reporter types.OracleReporter, amt math.Int) error { - if err := k.BeforeDelegationModified(ctx, delAddr, del, reporter); err != nil { - return err - } - if del.Amount.LTE(amt) { - return k.Delegators.Remove(ctx, delAddr) - } - del.Amount = del.Amount.Sub(amt) - if err := k.DelegatorCheckpoint.Set(ctx, collections.Join(delAddr.Bytes(), sdk.UnwrapSDKContext(ctx).BlockHeight()), del.Amount); err != nil { - return err - } - err := k.Delegators.Set(ctx, delAddr, del) - if err != nil { - return err - } - reporterVal := sdk.ValAddress(reporter.GetReporter()) - return k.AfterDelegationModified(ctx, delAddr, reporterVal, del.Amount) -} - -func (k Keeper) UpdateOrRemoveReporter(ctx context.Context, key sdk.AccAddress, rep types.OracleReporter, amt math.Int) error { - if rep.TotalTokens.LTE(amt) { - if err := k.Reporters.Remove(ctx, key); err != nil { - return err + // if the delegator has more than the max validators, iterate over all bonded validators + // else iterate over the delegations, so that can we iterate over the shorter list + if delCount.DelegationCount > uint64(maxVal) { + // iterate over bonded validators + err = valSet.IterateBondedValidatorsByPower(ctx, func(index int64, validator stakingtypes.ValidatorI) (stop bool) { + valAddrr, err := sdk.ValAddressFromBech32(validator.GetOperator()) + if err != nil { + return true + } + del, err := k.stakingKeeper.GetDelegation(ctx, key, valAddrr) + if err != nil { + return true + } + // get the token amount + tokens := validator.TokensFromSharesTruncated(del.Shares).TruncateInt() + totalPower = totalPower.Add(tokens) + delegates = append(delegates, &types.TokenOriginInfo{DelegatorAddress: key, ValidatorAddress: valAddrr.Bytes(), Amount: tokens}) + return false + }) + if err != nil { + return math.Int{}, err + } + } else { + err := k.stakingKeeper.IterateDelegatorDelegations(ctx, key, func(delegation stakingtypes.Delegation) bool { + validatorAddr, err := sdk.ValAddressFromBech32(delegation.ValidatorAddress) + if err != nil { + panic(err) + } + validator, err := k.stakingKeeper.GetValidator(ctx, validatorAddr) + if err == nil && validator.IsBonded() { + shares := delegation.Shares + tokens := validator.TokensFromSharesTruncated(shares).TruncateInt() + totalPower = totalPower.Add(tokens) + delegates = append(delegates, &types.TokenOriginInfo{DelegatorAddress: key, ValidatorAddress: validatorAddr.Bytes(), Amount: tokens}) + } + return false + }) + if err != nil { + return math.Int{}, err + } } - reporterVal := sdk.ValAddress(key) - return k.AfterReporterRemoved(ctx, reporterVal) - } - rep.TotalTokens = rep.TotalTokens.Sub(amt) - if err := k.ReporterCheckpoint.Set(ctx, collections.Join(key.Bytes(), sdk.UnwrapSDKContext(ctx).BlockHeight()), rep.TotalTokens); err != nil { - return err - } - - if err := k.Reporters.Set(ctx, key, rep); err != nil { - return err - } - if err := k.UpdateTotalPower(ctx, amt, true); err != nil { - return err } - return k.AfterReporterModified(ctx, key) -} - -func (k Keeper) UpdateOrRemoveSource(ctx context.Context, key collections.Pair[[]byte, []byte], srcAmount, amt math.Int) (err error) { - // amount is the current staked amount in staking mod - // so if current amount is zero remove the source - if amt.IsZero() { - return k.TokenOrigin.Remove(ctx, key) - } - return k.TokenOrigin.Set(ctx, key, amt) -} - -func (k Keeper) UndelegateSource(ctx context.Context, key collections.Pair[[]byte, []byte], currentAmount, newAmount math.Int) error { - if newAmount.GTE(currentAmount) { - return k.TokenOrigin.Remove(ctx, key) - } - return k.TokenOrigin.Set(ctx, key, currentAmount.Sub(newAmount)) -} - -func (k Keeper) Reporter(ctx context.Context, repAddr sdk.AccAddress) (*types.OracleReporter, error) { - reporter, err := k.Reporters.Get(ctx, repAddr) + err = k.Report.Set(ctx, collections.Join(repAddr.Bytes(), sdk.UnwrapSDKContext(ctx).BlockHeight()), types.DelegationsAmounts{TokenOrigins: delegates, Total: totalPower}) if err != nil { - if errors.Is(err, collections.ErrNotFound) { - return nil, types.ErrReporterDoesNotExist - } - return nil, err + return math.Int{}, err } - return &reporter, nil + return totalPower, nil } func (k Keeper) TotalReporterPower(ctx context.Context) (math.Int, error) { - return k.TotalPowerAtBlock(ctx, sdk.UnwrapSDKContext(ctx).BlockHeight()) -} - -func (k Keeper) TotalPowerAtBlock(ctx context.Context, blockHeight int64) (math.Int, error) { - totalPower := math.ZeroInt() - rng := new(collections.Range[int64]).EndInclusive(blockHeight).Descending() - err := k.TotalPower.Walk(ctx, rng, func(key int64, value math.Int) (stop bool, err error) { - totalPower = value - return true, nil - }) - return totalPower, err + valSet := k.stakingKeeper.GetValidatorSet() + return valSet.TotalBondedTokens(ctx) } // alias func (k Keeper) Delegation(ctx context.Context, delegator sdk.AccAddress) (types.Delegation, error) { return k.Delegators.Get(ctx, delegator) } + +func (k Keeper) Reporter(ctx context.Context, reporter sdk.AccAddress) (types.OracleReporter, error) { + return k.Reporters.Get(ctx, reporter.Bytes()) +} diff --git a/x/reporter/keeper/reporter_test.go b/x/reporter/keeper/reporter_test.go deleted file mode 100644 index b7c5ab031..000000000 --- a/x/reporter/keeper/reporter_test.go +++ /dev/null @@ -1,194 +0,0 @@ -package keeper_test - -import ( - "testing" - - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" - "github.com/tellor-io/layer/x/reporter/types" - - "cosmossdk.io/collections" - "cosmossdk.io/math" - - sdk "github.com/cosmos/cosmos-sdk/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" -) - -func TestUndelegateSource(t *testing.T) { - k, _, _, ctx := setupKeeper(t) - - // Create a test key - reporterAddr := sdk.AccAddress([]byte("reporter")) - validatorAddr := sdk.ValAddress([]byte("validator")) - key := collections.Join(reporterAddr.Bytes(), validatorAddr.Bytes()) - - // Add the token origin to the keeper - err := k.TokenOrigin.Set(ctx, key, math.NewInt(100)) - require.NoError(t, err) - - // Call the updateOrRemoveSource function with a reduced amount of 50 - err = k.UndelegateSource(ctx, key, math.NewInt(100), math.NewInt(50)) - require.NoError(t, err) - - // Check if the token origin was updated correctly - updatedTokenOrigin, err := k.TokenOrigin.Get(ctx, key) - require.NoError(t, err) - require.Equal(t, math.NewInt(50), updatedTokenOrigin) - - // Call the updateOrRemoveSource function with a reduced amount of 60 - err = k.UndelegateSource(ctx, key, updatedTokenOrigin, math.NewInt(60)) - require.NoError(t, err) - - // Check if the token origin was removed - _, err = k.TokenOrigin.Get(ctx, key) - require.Error(t, err) -} - -func TestUpdateOrRemoveReporter(t *testing.T) { - k, _, _, ctx := setupKeeper(t) - - // Create a test reporter - reporterAddr := sdk.AccAddress([]byte("reporter")) - rep := types.OracleReporter{ - Reporter: reporterAddr, - TotalTokens: math.NewInt(100), - } - - // Add the reporter to the keeper - err := k.Reporters.Set(ctx, reporterAddr, rep) - require.NoError(t, err) - err = k.UpdateTotalPower(ctx, rep.TotalTokens, false) - require.NoError(t, err) - // Call the UpdateOrRemoveReporter function with a reduction amount of 50 - err = k.UpdateOrRemoveReporter(ctx, reporterAddr, rep, math.NewInt(50)) - require.NoError(t, err) - - // Check if the reporter was updated correctly - updatedReporter, err := k.Reporters.Get(ctx, reporterAddr) - require.NoError(t, err) - require.Equal(t, math.NewInt(50), updatedReporter.TotalTokens) - - // Call the UpdateOrRemoveReporter function with a reduction amount of 60 - err = k.UpdateOrRemoveReporter(ctx, reporterAddr, updatedReporter, math.NewInt(60)) - require.NoError(t, err) - - // Check if the reporter was removed - _, err = k.Reporters.Get(ctx, reporterAddr) - require.Error(t, err) -} - -func TestUpdateOrRemoveDelegator(t *testing.T) { - k, _, _, ctx := setupKeeper(t) - - // Create a test key - delegatorAddr := sdk.AccAddress([]byte("delegator")) - key := delegatorAddr - - // Create a test delegation - delegation := types.Delegation{ - Reporter: delegatorAddr, - Amount: math.NewInt(100), - } - reporter := types.OracleReporter{ - Reporter: key, - TotalTokens: math.NewInt(100), - } - err := k.Reporters.Set(ctx, key, reporter) - require.NoError(t, err) - // hooks - err = k.AfterReporterCreated(ctx, reporter) - require.NoError(t, err) - - err = k.BeforeDelegationCreated(ctx, reporter) - require.NoError(t, err) - - // Add the delegation to the keeper - err = k.Delegators.Set(ctx, key, delegation) - require.NoError(t, err) - err = k.AfterDelegationModified(ctx, key, sdk.ValAddress(key), delegation.Amount) - require.NoError(t, err) - - // Call the UpdateOrRemoveDelegator function with a reduction amount of 50 - err = k.UpdateOrRemoveDelegator(ctx, key, delegation, reporter, math.NewInt(50)) - require.NoError(t, err) - - // Check if the delegation was updated correctly - updatedDelegation, err := k.Delegators.Get(ctx, key) - require.NoError(t, err) - require.Equal(t, math.NewInt(50), updatedDelegation.Amount) - - // Call the UpdateOrRemoveDelegator function with a reduction amount of 60 - err = k.UpdateOrRemoveDelegator(ctx, key, updatedDelegation, reporter, math.NewInt(60)) - require.NoError(t, err) - - // Check if the delegation was removed - _, err = k.Delegators.Get(ctx, key) - require.Error(t, err) -} - -func TestValidateAndSetAmount(t *testing.T) { - k, sk, _, ctx := setupKeeper(t) - // setup - delegator := sdk.AccAddress([]byte("delegator")) - validatorI := sdk.ValAddress([]byte("validator1")) - validatorII := sdk.ValAddress([]byte("validator2")) - validatorIII := sdk.ValAddress([]byte("validator3")) - delegationI := stakingtypes.Delegation{Shares: math.LegacyNewDec(50), DelegatorAddress: delegator.String(), ValidatorAddress: validatorI.String()} - valI := stakingtypes.Validator{OperatorAddress: validatorI.String(), Tokens: math.NewInt(100), DelegatorShares: math.LegacyNewDec(50)} - delegationII := stakingtypes.Delegation{Shares: math.LegacyNewDec(30), DelegatorAddress: delegator.String(), ValidatorAddress: validatorII.String()} - valII := stakingtypes.Validator{OperatorAddress: validatorII.String(), Tokens: math.NewInt(100), DelegatorShares: math.LegacyNewDec(50)} - delegationIII := stakingtypes.Delegation{Shares: math.LegacyNewDec(20), DelegatorAddress: delegator.String(), ValidatorAddress: validatorIII.String()} - valIII := stakingtypes.Validator{OperatorAddress: validatorIII.String(), Tokens: math.NewInt(100), DelegatorShares: math.LegacyNewDec(50)} - originAmounts := []*types.TokenOrigin{ - { - ValidatorAddress: validatorI, - Amount: math.NewInt(50), - }, - { - ValidatorAddress: validatorII, - Amount: math.NewInt(30), - }, - { - ValidatorAddress: validatorIII, - Amount: math.NewInt(20), - }, - } - - sk.On("GetValidator", mock.Anything, validatorI).Return(valI, nil) - sk.On("GetValidator", mock.Anything, validatorII).Return(valII, nil) - sk.On("GetValidator", mock.Anything, validatorIII).Return(valIII, nil) - - sk.On("Delegation", mock.Anything, delegator, validatorI).Return(delegationI, nil) - sk.On("Delegation", mock.Anything, delegator, validatorII).Return(delegationII, nil) - sk.On("Delegation", mock.Anything, delegator, validatorIII).Return(delegationIII, nil) - - // call ValidateAndSetAmount with amount not matching the sum of token origins - err := k.ValidateAndSetAmount(ctx, delegator, originAmounts, math.NewInt(1000)) - require.ErrorIs(t, err, types.ErrTokenAmountMismatch) - - // call ValidateAndSetAmount with amount matching the sum of token origins - // and no token origins set so it will treat it as a new origin - // and check if the token origin is set correctly - err = k.ValidateAndSetAmount(ctx, delegator, originAmounts, math.NewInt(100)) - require.NoError(t, err) - // check if the token origin is set correctly for validatorI - amt, err := k.TokenOrigin.Get(ctx, collections.Join(delegator.Bytes(), validatorI.Bytes())) - require.NoError(t, err) - require.Equal(t, math.NewInt(50), amt) - - // set origin amount before calling ValidateAndSetAmount - // and check if the token origin is updated correctly - // should not treat it as a new origin - require.NoError(t, k.TokenOrigin.Set(ctx, collections.Join(delegator.Bytes(), validatorI.Bytes()), math.NewInt(50))) - err = k.ValidateAndSetAmount(ctx, delegator, originAmounts, math.NewInt(100)) - require.NoError(t, err) - amt, err = k.TokenOrigin.Get(ctx, collections.Join(delegator.Bytes(), validatorI.Bytes())) - require.NoError(t, err) - require.Equal(t, math.NewInt(100), amt) - - // call ValidateAndSetAmount with insufficient tokens bonded with validator - // and check if the error is ErrInsufficientTokens - originAmounts[0].Amount = math.NewInt(950) - err = k.ValidateAndSetAmount(ctx, delegator, originAmounts, math.NewInt(1000)) - require.ErrorIs(t, err, types.ErrInsufficientTokens) -} diff --git a/x/reporter/keeper/withdraw.go b/x/reporter/keeper/withdraw.go index 32186d4f3..39a7a4313 100644 --- a/x/reporter/keeper/withdraw.go +++ b/x/reporter/keeper/withdraw.go @@ -17,82 +17,63 @@ import ( ) // FeefromReporterStake deducts the fee from the reporter's stake used mainly for paying dispute from bond +// checks total tokens of delegators given to reporter and deducts the fee proportionally among them func (k Keeper) FeefromReporterStake(ctx context.Context, reporterAddr sdk.AccAddress, amt math.Int, hashId []byte) error { reporter, err := k.Reporters.Get(ctx, reporterAddr) if err != nil { return err } - // Calculate each delegator's share (including the reporter as a self-delegator) - repAddr := sdk.AccAddress(reporter.Reporter) + if amt.GT(reporter.TotalTokens) { + return errors.New("insufficient stake to pay fee") + } - delAddrs, err := k.Delegators.Indexes.Reporter.MatchExact(ctx, repAddr) + // Calculate each delegator's share (including the reporter as a self-delegator) + delAddrs, err := k.Delegators.Indexes.Reporter.MatchExact(ctx, reporterAddr) if err != nil { return err } totaltokens := math.LegacyNewDecFromInt(reporter.TotalTokens) + + feeTracker := make([]*types.TokenOriginInfo, 0) + totalTracked := math.ZeroInt() + defer delAddrs.Close() + for ; delAddrs.Valid(); delAddrs.Next() { key, err := delAddrs.PrimaryKey() if err != nil { return err } - - rng := collections.NewPrefixedPairRange[[]byte, []byte](key) - iter, err := k.TokenOrigin.Iterate(ctx, rng) + del, err := k.Delegators.Get(ctx, key) if err != nil { return err } - delegatorSources, err := iter.KeyValues() + srcAmt := math.LegacyNewDecFromInt(del.Amount) + shareAmt := srcAmt.Quo(totaltokens).Mul(math.LegacyNewDecFromInt(amt)) + fees, err := k.DeductTokensFromDelegator(ctx, key, shareAmt) if err != nil { return err } - feeTracker := make([]*types.TokenOriginInfo, 0, len(delegatorSources)) - for _, source := range delegatorSources { - srcAmt := math.LegacyNewDecFromInt(source.Value) - share := srcAmt.Quo(totaltokens).Mul(math.LegacyNewDecFromInt(amt)) - _, err = k.feeFromStake(ctx, source.Key.K1(), source.Key.K2(), share) - if err != nil { - return err - } - feeTracker = append(feeTracker, &types.TokenOriginInfo{ - DelegatorAddress: source.Key.K1(), - ValidatorAddress: source.Key.K2(), - Amount: share.TruncateInt(), - }) - } - - has, err := k.FeePaidFromStake.Has(ctx, hashId) + totalTracked = totalTracked.Add(shareAmt.TruncateInt()) + feeTracker = append(feeTracker, fees...) + } + has, err := k.FeePaidFromStake.Has(ctx, hashId) + if err != nil { + return err + } + if has { + preFeeTracker, err := k.FeePaidFromStake.Get(ctx, hashId) if err != nil { return err } - if has { - preFeeTracker, err := k.FeePaidFromStake.Get(ctx, hashId) - if err != nil { - return err - } - feeTracker = append(feeTracker, preFeeTracker.TokenOrigins...) - } - if err := k.FeePaidFromStake.Set(ctx, hashId, types.DelegationsPreUpdate{TokenOrigins: feeTracker}); err != nil { - return err - } + feeTracker = append(feeTracker, preFeeTracker.TokenOrigins...) } - return nil -} - -func (k Keeper) feeFromStake( - ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, sharesAmount math.LegacyDec, -) (math.Int, error) { - returnAmount, err := k.stakingKeeper.Unbond(ctx, delAddr, valAddr, sharesAmount) - if err != nil { - return math.Int{}, err - } - if err := k.moveTokensFromValidator(ctx, valAddr, returnAmount); err != nil { - return math.Int{}, err + if err := k.FeePaidFromStake.Set(ctx, hashId, types.DelegationsAmounts{TokenOrigins: feeTracker, Total: totalTracked}); err != nil { + return err } - - return returnAmount, nil + return nil } // get dst validator for a redelegated delegator @@ -196,43 +177,123 @@ func (k Keeper) moveTokensFromValidator(ctx context.Context, valAddr sdk.ValAddr return k.tokensToDispute(ctx, fromPool, amount) } -func (k Keeper) undelegate(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, delTokens math.LegacyDec) (math.Int, error) { - remainingFromdel, err := k.deductFromdelegation(ctx, delAddr, valAddr, delTokens) - if err != nil { - if !errors.Is(err, stakingtypes.ErrNoDelegation) { - return math.Int{}, err - } +func (k Keeper) MoveTokensFromValidator(ctx context.Context, validator stakingtypes.Validator, amount math.Int) error { + var fromPool string + switch { + case validator.IsBonded(): + fromPool = stakingtypes.BondedPoolName + case validator.IsUnbonding(): + fromPool = stakingtypes.NotBondedPoolName + default: + return fmt.Errorf("unknown validator status: %s", validator.GetStatus()) } + return k.tokensToDispute(ctx, fromPool, amount) +} - if remainingFromdel.IsZero() { - if err := k.moveTokensFromValidator(ctx, valAddr, delTokens.TruncateInt()); err != nil { - return math.Int{}, err +func (k Keeper) DeductTokensFromDelegator(ctx context.Context, delAddr sdk.AccAddress, amt math.LegacyDec) ([]*types.TokenOriginInfo, error) { + feeTracker := make([]*types.TokenOriginInfo, 0) + remainder := amt + err := k.stakingKeeper.IterateDelegatorDelegations(ctx, delAddr, func(delegation stakingtypes.Delegation) bool { + if remainder.IsZero() { + return false } - return remainingFromdel.TruncateInt(), nil - } else { - remainingUnbonding, err := k.deductUnbondingDelegation(ctx, delAddr, valAddr, remainingFromdel.TruncateInt()) + valAddr, err := sdk.ValAddressFromBech32(delegation.ValidatorAddress) if err != nil { - return math.Int{}, err + panic(err) } - if remainingUnbonding.IsZero() { - if err := k.tokensToDispute(ctx, stakingtypes.NotBondedPoolName, remainingFromdel.TruncateInt()); err != nil { - return math.Int{}, err + val, err := k.stakingKeeper.GetValidator(ctx, valAddr) + if err != nil { + panic(err) + } + tokens := val.TokensFromShares(delegation.Shares) + + unbondAmt := tokens + if tokens.GTE(remainder) { + unbondAmt = remainder + } + + shares, err := val.SharesFromTokens(unbondAmt.TruncateInt()) + if err != nil { + panic(err) + } + + // Unbond and move tokens from validator + _, err = k.stakingKeeper.Unbond(ctx, delAddr, valAddr, shares) + if err != nil { + panic(err) + } + err = k.MoveTokensFromValidator(ctx, val, unbondAmt.TruncateInt()) + if err != nil { + panic(err) + } + // Reduce the remainder by the amount unbonded + remainder = remainder.Sub(unbondAmt) + // Add the unbonded amount to the fee tracker + feeTracker = append(feeTracker, &types.TokenOriginInfo{ + DelegatorAddress: delAddr.Bytes(), + ValidatorAddress: valAddr.Bytes(), + Amount: unbondAmt.TruncateInt(), + }) + return false + }) + return feeTracker, err +} + +func (k Keeper) tokensToDispute(ctx context.Context, fromPool string, amount math.Int) error { + return k.bankKeeper.SendCoinsFromModuleToModule(ctx, fromPool, disputetypes.ModuleName, sdk.NewCoins(sdk.NewCoin(layertypes.BondDenom, amount))) +} + +func (k Keeper) SlashUnbondingDelegation(ctx context.Context, delAddrs sdk.AccAddress, slashAmount math.Int) (totalSlashAmount math.Int, err error) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + now := sdkCtx.BlockHeader().Time + totalSlashAmount = math.ZeroInt() + burnedAmount := math.ZeroInt() + remainder := slashAmount + err = k.stakingKeeper.IterateDelegatorUnbondingDelegations(ctx, delAddrs, func(ubd stakingtypes.UnbondingDelegation) (stop bool) { + // perform slashing on all entries within the unbonding delegation + for i, entry := range ubd.Entries { + if remainder.IsZero() { + return true + } + if entry.IsMature(now) && !entry.OnHold() { + // Unbonding delegation no longer eligible for slashing, skip it + continue + } + + slashAmount := math.MinInt(remainder, entry.Balance) + remainder = remainder.Sub(slashAmount) + totalSlashAmount = totalSlashAmount.Add(slashAmount) + + // Don't slash more tokens than held + // Possible since the unbonding delegation may already + // have been slashed, and slash amounts are calculated + // according to stake held at time of infraction + unbondingSlashAmount := slashAmount + + // Update unbonding delegation if necessary + if unbondingSlashAmount.IsZero() { + continue + } + + burnedAmount = burnedAmount.Add(unbondingSlashAmount) + entry.Balance = entry.Balance.Sub(unbondingSlashAmount) + ubd.Entries[i] = entry + if err = k.stakingKeeper.SetUnbondingDelegation(ctx, ubd); err != nil { + panic(err) } } - return remainingUnbonding, nil + return false + }) + if err := k.tokensToDispute(ctx, stakingtypes.NotBondedPoolName, burnedAmount); err != nil { + return math.ZeroInt(), err } + + return totalSlashAmount, nil } func (k Keeper) EscrowReporterStake(ctx context.Context, reporterAddr sdk.AccAddress, power, height int64, amt math.Int, hashId []byte) error { - // get origins at height - rng := collections.NewPrefixedPairRange[[]byte, int64](reporterAddr).EndInclusive(height).Descending() - var firstValue *types.DelegationsPreUpdate - - err := k.TokenOriginSnapshot.Walk(ctx, rng, func(key collections.Pair[[]byte, int64], value types.DelegationsPreUpdate) (stop bool, err error) { - firstValue = &value - return true, nil - }) + report, err := k.Report.Get(ctx, collections.Join(reporterAddr.Bytes(), height)) if err != nil { return err } @@ -240,13 +301,13 @@ func (k Keeper) EscrowReporterStake(ctx context.Context, reporterAddr sdk.AccAdd totalTokens := layertypes.PowerReduction.MulRaw(power) disputeTokens := make([]*types.TokenOriginInfo, 0) leftover := amt - for i, del := range firstValue.TokenOrigins { + for i, del := range report.TokenOrigins { delegatorShare := math.LegacyNewDecFromInt(del.Amount).Quo(math.LegacyNewDecFromInt(totalTokens)).Mul(math.LegacyNewDecFromInt(amt)) leftover = leftover.Sub(delegatorShare.TruncateInt()) - if i == len(firstValue.TokenOrigins)-1 { + if i == len(report.TokenOrigins)-1 { delegatorShare = delegatorShare.Add(leftover.ToLegacyDec()) } @@ -281,9 +342,33 @@ func (k Keeper) EscrowReporterStake(ctx context.Context, reporterAddr sdk.AccAdd // after escrow you should keep a new snapshot of the amounts from each that were taken instead of relying on the original snapshot // then you can delete it after the slashed tokens are returned - return k.DisputedDelegationAmounts.Set(ctx, hashId, types.DelegationsPreUpdate{TokenOrigins: disputeTokens}) + return k.DisputedDelegationAmounts.Set(ctx, hashId, types.DelegationsAmounts{TokenOrigins: disputeTokens, Total: amt}) } -func (k Keeper) tokensToDispute(ctx context.Context, fromPool string, amount math.Int) error { - return k.bankKeeper.SendCoinsFromModuleToModule(ctx, fromPool, disputetypes.ModuleName, sdk.NewCoins(sdk.NewCoin(layertypes.BondDenom, amount))) +func (k Keeper) undelegate(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, delTokens math.LegacyDec) (math.Int, error) { + remainingFromdel, err := k.deductFromdelegation(ctx, delAddr, valAddr, delTokens) + if err != nil { + if !errors.Is(err, stakingtypes.ErrNoDelegation) { + return math.Int{}, err + } + } + + if remainingFromdel.IsZero() { + if err := k.moveTokensFromValidator(ctx, valAddr, delTokens.TruncateInt()); err != nil { + return math.Int{}, err + } + return remainingFromdel.TruncateInt(), nil + + } else { + remainingUnbonding, err := k.deductUnbondingDelegation(ctx, delAddr, valAddr, remainingFromdel.TruncateInt()) + if err != nil { + return math.Int{}, err + } + if remainingUnbonding.IsZero() { + if err := k.tokensToDispute(ctx, stakingtypes.NotBondedPoolName, remainingFromdel.TruncateInt()); err != nil { + return math.Int{}, err + } + } + return remainingUnbonding, nil + } } diff --git a/x/reporter/mocks/StakingKeeper.go b/x/reporter/mocks/StakingKeeper.go index 48c85bbb0..cecb8cb8a 100644 --- a/x/reporter/mocks/StakingKeeper.go +++ b/x/reporter/mocks/StakingKeeper.go @@ -44,32 +44,6 @@ func (_m *StakingKeeper) Delegate(ctx context.Context, delAddr types.AccAddress, return r0, r1 } -// Delegation provides a mock function with given fields: _a0, _a1, _a2 -func (_m *StakingKeeper) Delegation(_a0 context.Context, _a1 types.AccAddress, _a2 types.ValAddress) (stakingtypes.DelegationI, error) { - ret := _m.Called(_a0, _a1, _a2) - - var r0 stakingtypes.DelegationI - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress, types.ValAddress) (stakingtypes.DelegationI, error)); ok { - return rf(_a0, _a1, _a2) - } - if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress, types.ValAddress) stakingtypes.DelegationI); ok { - r0 = rf(_a0, _a1, _a2) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(stakingtypes.DelegationI) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, types.AccAddress, types.ValAddress) error); ok { - r1 = rf(_a0, _a1, _a2) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - // GetDelegation provides a mock function with given fields: ctx, delAddr, valAddr func (_m *StakingKeeper) GetDelegation(ctx context.Context, delAddr types.AccAddress, valAddr types.ValAddress) (stakingtypes.Delegation, error) { ret := _m.Called(ctx, delAddr, valAddr) @@ -168,30 +142,48 @@ func (_m *StakingKeeper) GetValidator(ctx context.Context, addr types.ValAddress return r0, r1 } -// GetValidators provides a mock function with given fields: ctx, maxRetrieve -func (_m *StakingKeeper) GetValidators(ctx context.Context, maxRetrieve uint32) ([]stakingtypes.Validator, error) { - ret := _m.Called(ctx, maxRetrieve) +// GetValidatorSet provides a mock function with given fields: +func (_m *StakingKeeper) GetValidatorSet() stakingtypes.ValidatorSet { + ret := _m.Called() - var r0 []stakingtypes.Validator - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, uint32) ([]stakingtypes.Validator, error)); ok { - return rf(ctx, maxRetrieve) - } - if rf, ok := ret.Get(0).(func(context.Context, uint32) []stakingtypes.Validator); ok { - r0 = rf(ctx, maxRetrieve) + var r0 stakingtypes.ValidatorSet + if rf, ok := ret.Get(0).(func() stakingtypes.ValidatorSet); ok { + r0 = rf() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]stakingtypes.Validator) + r0 = ret.Get(0).(stakingtypes.ValidatorSet) } } - if rf, ok := ret.Get(1).(func(context.Context, uint32) error); ok { - r1 = rf(ctx, maxRetrieve) + return r0 +} + +// IterateDelegatorDelegations provides a mock function with given fields: ctx, delegator, cb +func (_m *StakingKeeper) IterateDelegatorDelegations(ctx context.Context, delegator types.AccAddress, cb func(stakingtypes.Delegation) bool) error { + ret := _m.Called(ctx, delegator, cb) + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress, func(stakingtypes.Delegation) bool) error); ok { + r0 = rf(ctx, delegator, cb) } else { - r1 = ret.Error(1) + r0 = ret.Error(0) } - return r0, r1 + return r0 +} + +// IterateDelegatorUnbondingDelegations provides a mock function with given fields: ctx, delegator, cb +func (_m *StakingKeeper) IterateDelegatorUnbondingDelegations(ctx context.Context, delegator types.AccAddress, cb func(stakingtypes.UnbondingDelegation) bool) error { + ret := _m.Called(ctx, delegator, cb) + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, types.AccAddress, func(stakingtypes.UnbondingDelegation) bool) error); ok { + r0 = rf(ctx, delegator, cb) + } else { + r0 = ret.Error(0) + } + + return r0 } // RemoveUnbondingDelegation provides a mock function with given fields: ctx, ubd diff --git a/x/reporter/module/autocli.go b/x/reporter/module/autocli.go index 839678dc8..731cfb6fe 100644 --- a/x/reporter/module/autocli.go +++ b/x/reporter/module/autocli.go @@ -17,12 +17,6 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { Use: "params", Short: "Shows the parameters of the module", }, - { - RpcMethod: "Reporter", - Use: "reporter [reporter-addr]", - Short: "Query staked reporter by address", - PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "reporter_address"}}, - }, { RpcMethod: "Reporters", Use: "reporters", @@ -35,30 +29,6 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { Short: "Query reporter of a delegator", PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "delegator_address"}}, }, - { - RpcMethod: "ReporterStake", - Use: "reporter-stake [reporter-addr]", - Short: "Query total tokens of a reporter", - PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "reporter_address"}}, - }, - { - RpcMethod: "DelegationRewards", - Use: "delegation-rewards [delegator-addr] [reporter-addr]", - Short: "Query delegator rewards from a particular reporter", - PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "delegator_address"}, {ProtoField: "reporter_address"}}, - }, - { - RpcMethod: "ReporterOutstandingRewards", - Use: "outstanding-rewards [reporter]", - Short: "Query outstanding rewards for a reporter and all their delegations", - PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "reporter_address"}}, - }, - { - RpcMethod: "ReporterCommission", - Use: "commission [reporter]", - Short: "Query distribution reporter commission", - PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "reporter_address"}}, - }, // this line is used by ignite scaffolding # autocli/query }, }, @@ -72,21 +42,15 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { }, { RpcMethod: "CreateReporter", - Use: "create-reporter [amount] [token-origins]", + Use: "create-reporter", Short: "Execute the CreateReporter RPC method", - PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "amount"}, {ProtoField: "token_origins"}}, - }, - { - RpcMethod: "DelegateReporter", - Use: "delegate-reporter [reporter] [amount] [token-origin]", - Short: "Execute the DelegateReporter RPC method", - PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "reporter"}, {ProtoField: "amount"}, {ProtoField: "token_origins"}}, + PositionalArgs: []*autocliv1.PositionalArgDescriptor{}, }, { - RpcMethod: "UndelegateReporter", - Use: "undelegate-reporter [amount]", + RpcMethod: "ChangeReporter", + Use: "change-reporter [reporter-addr]", Short: "Execute the UndelegateReporter RPC method", - PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "token_origins"}}, + PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "reporter_address"}}, }, { RpcMethod: "UnjailReporter", diff --git a/x/reporter/module/simulation.go b/x/reporter/module/simulation.go index 507683e96..0bb5420b0 100644 --- a/x/reporter/module/simulation.go +++ b/x/reporter/module/simulation.go @@ -27,13 +27,9 @@ const ( // TODO: Determine the simulation weight value defaultWeightMsgCreateReporter int = 100 - opWeightMsgDelegateReporter = "op_weight_msg_delegate_reporter" - // TODO: Determine the simulation weight value - defaultWeightMsgDelegateReporter int = 100 + opWeightMsgChangeReporter = "op_weight_msg_change_reporter" - opWeightMsgUndelegateReporter = "op_weight_msg_undelegate_reporter" - // TODO: Determine the simulation weight value - defaultWeightMsgUndelegateReporter int = 100 + defaultWeightMsgChangeReporter int = 100 opWeightMsgWithdrawTip = "op_weight_msg_withdraw_tip" // TODO: Determine the simulation weight value @@ -78,26 +74,15 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp reportersimulation.SimulateMsgCreateReporter(am.accountKeeper, am.bankKeeper, am.keeper), )) - var weightMsgDelegateReporter int - simState.AppParams.GetOrGenerate(opWeightMsgDelegateReporter, &weightMsgDelegateReporter, nil, + var weightMsgChangeReporter int + simState.AppParams.GetOrGenerate(opWeightMsgChangeReporter, &weightMsgChangeReporter, nil, func(_ *rand.Rand) { - weightMsgDelegateReporter = defaultWeightMsgDelegateReporter + weightMsgChangeReporter = defaultWeightMsgChangeReporter }, ) operations = append(operations, simulation.NewWeightedOperation( - weightMsgDelegateReporter, - reportersimulation.SimulateMsgDelegateReporter(am.accountKeeper, am.bankKeeper, am.keeper), - )) - - var weightMsgUndelegateReporter int - simState.AppParams.GetOrGenerate(opWeightMsgUndelegateReporter, &weightMsgUndelegateReporter, nil, - func(_ *rand.Rand) { - weightMsgUndelegateReporter = defaultWeightMsgUndelegateReporter - }, - ) - operations = append(operations, simulation.NewWeightedOperation( - weightMsgUndelegateReporter, - reportersimulation.SimulateMsgUndelegateReporter(am.accountKeeper, am.bankKeeper, am.keeper), + weightMsgChangeReporter, + reportersimulation.SimulateMsgChangeReporter(am.accountKeeper, am.bankKeeper, am.keeper), )) var weightMsgWithdrawTip int @@ -128,18 +113,10 @@ func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.Wei }, ), simulation.NewWeightedProposalMsg( - opWeightMsgDelegateReporter, - defaultWeightMsgDelegateReporter, - func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { - reportersimulation.SimulateMsgDelegateReporter(am.accountKeeper, am.bankKeeper, am.keeper) - return nil - }, - ), - simulation.NewWeightedProposalMsg( - opWeightMsgUndelegateReporter, - defaultWeightMsgUndelegateReporter, + opWeightMsgChangeReporter, + defaultWeightMsgChangeReporter, func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { - reportersimulation.SimulateMsgUndelegateReporter(am.accountKeeper, am.bankKeeper, am.keeper) + reportersimulation.SimulateMsgChangeReporter(am.accountKeeper, am.bankKeeper, am.keeper) return nil }, ), diff --git a/x/reporter/simulation/undelegate_reporter.go b/x/reporter/simulation/change_reporter.go similarity index 79% rename from x/reporter/simulation/undelegate_reporter.go rename to x/reporter/simulation/change_reporter.go index d40bc5caf..c24f3b061 100644 --- a/x/reporter/simulation/undelegate_reporter.go +++ b/x/reporter/simulation/change_reporter.go @@ -11,7 +11,7 @@ import ( simtypes "github.com/cosmos/cosmos-sdk/types/simulation" ) -func SimulateMsgUndelegateReporter( +func SimulateMsgChangeReporter( ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper, @@ -19,12 +19,12 @@ func SimulateMsgUndelegateReporter( return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { simAccount, _ := simtypes.RandomAcc(r, accs) - msg := &types.MsgUndelegateReporter{ + msg := &types.MsgChangeReporter{ DelegatorAddress: simAccount.Address.String(), } - // TODO: Handling the UndelegateReporter simulation + // TODO: Handling the ChangeReporter simulation - return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(msg), "UndelegateReporter simulation not implemented"), nil, nil + return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(msg), "ChangeReporter simulation not implemented"), nil, nil } } diff --git a/x/reporter/simulation/create_reporter.go b/x/reporter/simulation/create_reporter.go index a9bc4597b..40e6fe710 100644 --- a/x/reporter/simulation/create_reporter.go +++ b/x/reporter/simulation/create_reporter.go @@ -20,7 +20,7 @@ func SimulateMsgCreateReporter( ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { simAccount, _ := simtypes.RandomAcc(r, accs) msg := &types.MsgCreateReporter{ - Reporter: simAccount.Address.String(), + ReporterAddress: simAccount.Address.String(), } // TODO: Handling the CreateReporter simulation diff --git a/x/reporter/simulation/delegate_reporter.go b/x/reporter/simulation/delegate_reporter.go deleted file mode 100644 index 1c5b52a2b..000000000 --- a/x/reporter/simulation/delegate_reporter.go +++ /dev/null @@ -1,30 +0,0 @@ -package simulation - -import ( - "math/rand" - - "github.com/tellor-io/layer/x/reporter/keeper" - "github.com/tellor-io/layer/x/reporter/types" - - "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" -) - -func SimulateMsgDelegateReporter( - ak types.AccountKeeper, - bk types.BankKeeper, - k keeper.Keeper, -) simtypes.Operation { - return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, - ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { - simAccount, _ := simtypes.RandomAcc(r, accs) - msg := &types.MsgDelegateReporter{ - Delegator: simAccount.Address.String(), - } - - // TODO: Handling the DelegateReporter simulation - - return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(msg), "DelegateReporter simulation not implemented"), nil, nil - } -} diff --git a/x/reporter/types/codec.go b/x/reporter/types/codec.go index c9900843f..cf0e649a5 100644 --- a/x/reporter/types/codec.go +++ b/x/reporter/types/codec.go @@ -9,11 +9,8 @@ import ( func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { registry.RegisterImplementations((*sdk.Msg)(nil), &MsgCreateReporter{}, - &MsgDelegateReporter{}, - &MsgUndelegateReporter{}, + &MsgChangeReporter{}, &MsgUpdateParams{}, - &MsgWithdrawDelegatorReward{}, - &MsgWithdrawReporterCommission{}, &MsgWithdrawTip{}, ) // this line is used by starport scaffolding # 3 diff --git a/x/reporter/types/delegation.pb.go b/x/reporter/types/delegation.pb.go index 2092d6392..af9a6678c 100644 --- a/x/reporter/types/delegation.pb.go +++ b/x/reporter/types/delegation.pb.go @@ -31,7 +31,8 @@ type Delegation struct { // reporter is the address of the reporter being delegated to Reporter []byte `protobuf:"bytes,1,opt,name=reporter,proto3" json:"reporter,omitempty"` // amount is the amount of tokens delegated - Amount cosmossdk_io_math.Int `protobuf:"bytes,2,opt,name=amount,proto3,customtype=cosmossdk.io/math.Int" json:"amount"` + Amount cosmossdk_io_math.Int `protobuf:"bytes,2,opt,name=amount,proto3,customtype=cosmossdk.io/math.Int" json:"amount"` + DelegationCount uint64 `protobuf:"varint,3,opt,name=delegation_count,json=delegationCount,proto3" json:"delegation_count,omitempty"` } func (m *Delegation) Reset() { *m = Delegation{} } @@ -74,6 +75,13 @@ func (m *Delegation) GetReporter() []byte { return nil } +func (m *Delegation) GetDelegationCount() uint64 { + if m != nil { + return m.DelegationCount + } + return 0 +} + func init() { proto.RegisterType((*Delegation)(nil), "layer.reporter.Delegation") } @@ -81,23 +89,24 @@ func init() { func init() { proto.RegisterFile("layer/reporter/delegation.proto", fileDescriptor_66d928de90a17af7) } var fileDescriptor_66d928de90a17af7 = []byte{ - // 246 bytes of a gzipped FileDescriptorProto + // 269 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcf, 0x49, 0xac, 0x4c, 0x2d, 0xd2, 0x2f, 0x4a, 0x2d, 0xc8, 0x2f, 0x2a, 0x49, 0x2d, 0xd2, 0x4f, 0x49, 0xcd, 0x49, 0x4d, 0x4f, 0x2c, 0xc9, 0xcc, 0xcf, 0xd3, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x03, 0x2b, 0xd0, 0x83, 0x29, 0x90, 0x12, 0x4c, 0xcc, 0xcd, 0xcc, 0xcb, 0xd7, 0x07, 0x93, 0x10, 0x25, 0x52, 0x92, 0xc9, 0xf9, 0xc5, 0xb9, 0xf9, 0xc5, 0xf1, 0x60, 0x9e, 0x3e, 0x84, 0x03, 0x95, 0x12, 0x49, 0xcf, - 0x4f, 0xcf, 0x87, 0x88, 0x83, 0x58, 0x10, 0x51, 0xa5, 0x5c, 0x2e, 0x2e, 0x17, 0xb8, 0x3d, 0x42, - 0x52, 0x5c, 0x1c, 0x30, 0xd3, 0x25, 0x18, 0x15, 0x18, 0x35, 0x78, 0x82, 0xe0, 0x7c, 0x21, 0x67, - 0x2e, 0xb6, 0xc4, 0xdc, 0xfc, 0xd2, 0xbc, 0x12, 0x09, 0x26, 0x05, 0x46, 0x0d, 0x4e, 0x27, 0xed, - 0x13, 0xf7, 0xe4, 0x19, 0x6e, 0xdd, 0x93, 0x17, 0x85, 0xd8, 0x52, 0x9c, 0x92, 0xad, 0x97, 0x99, - 0xaf, 0x9f, 0x9b, 0x58, 0x92, 0xa1, 0xe7, 0x99, 0x57, 0x72, 0x69, 0x8b, 0x2e, 0x17, 0xd4, 0x7a, - 0xcf, 0xbc, 0x92, 0x20, 0xa8, 0x56, 0x27, 0xd7, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, - 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, - 0x63, 0x88, 0xd2, 0x4e, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x2f, 0x49, - 0xcd, 0xc9, 0xc9, 0x2f, 0xd2, 0xcd, 0xcc, 0xd7, 0x87, 0x04, 0x49, 0x05, 0x22, 0x50, 0x4a, 0x2a, - 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0x8e, 0x37, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x67, 0x38, - 0x08, 0x27, 0x33, 0x01, 0x00, 0x00, + 0x4f, 0xcf, 0x87, 0x88, 0x83, 0x58, 0x10, 0x51, 0xa5, 0x19, 0x8c, 0x5c, 0x5c, 0x2e, 0x70, 0x8b, + 0x84, 0xa4, 0xb8, 0x38, 0x60, 0xc6, 0x4b, 0x30, 0x2a, 0x30, 0x6a, 0xf0, 0x04, 0xc1, 0xf9, 0x42, + 0xce, 0x5c, 0x6c, 0x89, 0xb9, 0xf9, 0xa5, 0x79, 0x25, 0x12, 0x4c, 0x0a, 0x8c, 0x1a, 0x9c, 0x4e, + 0xda, 0x27, 0xee, 0xc9, 0x33, 0xdc, 0xba, 0x27, 0x2f, 0x0a, 0xb1, 0xa6, 0x38, 0x25, 0x5b, 0x2f, + 0x33, 0x5f, 0x3f, 0x37, 0xb1, 0x24, 0x43, 0xcf, 0x33, 0xaf, 0xe4, 0xd2, 0x16, 0x5d, 0x2e, 0xa8, + 0xfd, 0x9e, 0x79, 0x25, 0x41, 0x50, 0xad, 0x42, 0x9a, 0x5c, 0x02, 0x08, 0x7f, 0xc5, 0x27, 0x83, + 0x8d, 0x63, 0x56, 0x60, 0xd4, 0x60, 0x09, 0xe2, 0x47, 0x88, 0x3b, 0x83, 0x84, 0x9d, 0x5c, 0x4f, + 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, + 0x2e, 0x3c, 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0x4a, 0x3b, 0x3d, 0xb3, 0x24, 0xa3, 0x34, + 0x49, 0x2f, 0x39, 0x3f, 0x57, 0xbf, 0x24, 0x35, 0x27, 0x27, 0xbf, 0x48, 0x37, 0x33, 0x5f, 0x1f, + 0x12, 0x7c, 0x15, 0x88, 0x00, 0x2c, 0xa9, 0x2c, 0x48, 0x2d, 0x4e, 0x62, 0x03, 0x7b, 0xd4, 0x18, + 0x10, 0x00, 0x00, 0xff, 0xff, 0x10, 0xae, 0xac, 0x0c, 0x5f, 0x01, 0x00, 0x00, } func (m *Delegation) Marshal() (dAtA []byte, err error) { @@ -120,6 +129,11 @@ func (m *Delegation) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.DelegationCount != 0 { + i = encodeVarintDelegation(dAtA, i, uint64(m.DelegationCount)) + i-- + dAtA[i] = 0x18 + } { size := m.Amount.Size() i -= size @@ -163,6 +177,9 @@ func (m *Delegation) Size() (n int) { } l = m.Amount.Size() n += 1 + l + sovDelegation(uint64(l)) + if m.DelegationCount != 0 { + n += 1 + sovDelegation(uint64(m.DelegationCount)) + } return n } @@ -269,6 +286,25 @@ func (m *Delegation) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegationCount", wireType) + } + m.DelegationCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDelegation + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DelegationCount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipDelegation(dAtA[iNdEx:]) diff --git a/x/reporter/types/expected_keepers.go b/x/reporter/types/expected_keepers.go index 9435bbe6f..4f0a357d9 100644 --- a/x/reporter/types/expected_keepers.go +++ b/x/reporter/types/expected_keepers.go @@ -12,13 +12,11 @@ import ( // StakingKeeper defines the expected interface for the Staking module. type StakingKeeper interface { - Delegation(context.Context, sdk.AccAddress, sdk.ValAddress) (stakingtypes.DelegationI, error) GetValidator(ctx context.Context, addr sdk.ValAddress) (validator stakingtypes.Validator, err error) Delegate( ctx context.Context, delAddr sdk.AccAddress, bondAmt math.Int, tokenSrc stakingtypes.BondStatus, validator stakingtypes.Validator, subtractAccount bool, ) (newShares math.LegacyDec, err error) - GetValidators(ctx context.Context, maxRetrieve uint32) (validators []stakingtypes.Validator, err error) GetUnbondingDelegation(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) (ubd stakingtypes.UnbondingDelegation, err error) GetRedelegationsFromSrcValidator(ctx context.Context, valAddr sdk.ValAddress) (reds []stakingtypes.Redelegation, err error) RemoveUnbondingDelegation(ctx context.Context, ubd stakingtypes.UnbondingDelegation) error @@ -29,6 +27,9 @@ type StakingKeeper interface { ) (amount math.Int, err error) ValidatorsPowerStoreIterator(ctx context.Context) (store.Iterator, error) TotalBondedTokens(context.Context) (math.Int, error) + GetValidatorSet() stakingtypes.ValidatorSet + IterateDelegatorDelegations(ctx context.Context, delegator sdk.AccAddress, cb func(delegation stakingtypes.Delegation) (stop bool)) error + IterateDelegatorUnbondingDelegations(ctx context.Context, delegator sdk.AccAddress, cb func(ubd stakingtypes.UnbondingDelegation) (stop bool)) error // Methods imported from account should be defined here } @@ -46,12 +47,6 @@ type BankKeeper interface { // Methods imported from bank should be defined here } -// ParamSubspace defines the expected Subspace interface for parameters. -type ParamSubspace interface { - Get(context.Context, []byte, interface{}) - Set(context.Context, []byte, interface{}) -} - // StakingHooks event hooks for staking validator object (noalias) type StakingHooks interface { AfterValidatorCreated(ctx context.Context, valAddr sdk.ValAddress) error // Must be called when a validator is created diff --git a/x/reporter/types/keys.go b/x/reporter/types/keys.go index bffe70701..3f3f39886 100644 --- a/x/reporter/types/keys.go +++ b/x/reporter/types/keys.go @@ -18,24 +18,15 @@ const ( ) var ( - ParamsKey = []byte("p_reporter") - ReportersKey = collections.NewPrefix(11) - DelegatorsKey = collections.NewPrefix(12) - TokenOriginsKey = collections.NewPrefix(13) - ReporterAccumulatedCommissionPrefix = collections.NewPrefix(14) - ReporterOutstandingRewardsPrefix = collections.NewPrefix(15) - ReporterCurrentRewardsPrefix = collections.NewPrefix(16) - DelegatorStartingInfoPrefix = collections.NewPrefix(17) - ReporterHistoricalRewardsPrefix = collections.NewPrefix(18) - ReporterDisputeEventPrefix = collections.NewPrefix(19) - ReporterDelegatorsIndexPrefix = collections.NewPrefix(20) - TokenOriginSnapshotPrefix = collections.NewPrefix(21) - DelegatorTipsPrefix = collections.NewPrefix(22) - DelegatorBlockIndexPrefix = collections.NewPrefix(23) - DelegatorCheckpointPrefix = collections.NewPrefix(24) - ReporterCheckpointPrefix = collections.NewPrefix(25) - DisputedDelegationAmountsPrefix = collections.NewPrefix(26) - FeePaidFromStakePrefix = collections.NewPrefix(27) - TotalPowerPrefix = collections.NewPrefix(28) - StakeTrackerPrefix = collections.NewPrefix(29) + ParamsKey = []byte("p_reporter") + ReportersKey = collections.NewPrefix(11) + DelegatorsKey = collections.NewPrefix(12) + ReporterDelegatorsIndexPrefix = collections.NewPrefix(13) + DelegatorTipsPrefix = collections.NewPrefix(14) + DisputedDelegationAmountsPrefix = collections.NewPrefix(15) + FeePaidFromStakePrefix = collections.NewPrefix(16) + StakeTrackerPrefix = collections.NewPrefix(17) + ReporterPrefix = collections.NewPrefix(18) + TempPrefix = collections.NewPrefix(19) + DelegatorAmountPrefix = collections.NewPrefix(20) ) diff --git a/x/reporter/types/message_create_reporter.go b/x/reporter/types/message_create_reporter.go index c28b67cbc..d303d8296 100644 --- a/x/reporter/types/message_create_reporter.go +++ b/x/reporter/types/message_create_reporter.go @@ -2,7 +2,6 @@ package types import ( errorsmod "cosmossdk.io/errors" - "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -11,17 +10,15 @@ import ( var _ sdk.Msg = &MsgCreateReporter{} -func NewMsgCreateReporter(reporter string, amount math.Int, tokenOrigins []*TokenOrigin, commission *stakingtypes.Commission) *MsgCreateReporter { +func NewMsgCreateReporter(reporter string, commission *stakingtypes.Commission) *MsgCreateReporter { return &MsgCreateReporter{ - Reporter: reporter, - Amount: amount, - TokenOrigins: tokenOrigins, - Commission: commission, + ReporterAddress: reporter, + Commission: commission, } } func (msg *MsgCreateReporter) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(msg.Reporter) + _, err := sdk.AccAddressFromBech32(msg.ReporterAddress) if err != nil { return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) } diff --git a/x/reporter/types/message_create_reporter_test.go b/x/reporter/types/message_create_reporter_test.go index e4f0b854b..1bf73a10d 100644 --- a/x/reporter/types/message_create_reporter_test.go +++ b/x/reporter/types/message_create_reporter_test.go @@ -12,19 +12,19 @@ import ( func TestMsgCreateReporter_ValidateBasic(t *testing.T) { tests := []struct { name string - msg MsgCreateReporter + msg MsgChangeReporter err error }{ { name: "invalid address", - msg: MsgCreateReporter{ - Reporter: "invalid_address", + msg: MsgChangeReporter{ + DelegatorAddress: "invalid_address", }, err: sdkerrors.ErrInvalidAddress, }, { name: "valid address", - msg: MsgCreateReporter{ - Reporter: sample.AccAddress(), + msg: MsgChangeReporter{ + DelegatorAddress: sample.AccAddress(), }, }, } diff --git a/x/reporter/types/message_delegate_reporter.go b/x/reporter/types/message_delegate_reporter.go deleted file mode 100644 index 80d0c9dac..000000000 --- a/x/reporter/types/message_delegate_reporter.go +++ /dev/null @@ -1,28 +0,0 @@ -package types - -import ( - errorsmod "cosmossdk.io/errors" - "cosmossdk.io/math" - - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" -) - -var _ sdk.Msg = &MsgDelegateReporter{} - -func NewMsgDelegateReporter(delegator, reporter string, amount math.Int, tokenOrigin []*TokenOrigin) *MsgDelegateReporter { - return &MsgDelegateReporter{ - Delegator: delegator, - Reporter: reporter, - Amount: amount, - TokenOrigins: tokenOrigin, - } -} - -func (msg *MsgDelegateReporter) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(msg.Delegator) - if err != nil { - return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid delegator address (%s)", err) - } - return nil -} diff --git a/x/reporter/types/message_delegate_reporter_test.go b/x/reporter/types/message_delegate_reporter_test.go deleted file mode 100644 index ce27ec7d2..000000000 --- a/x/reporter/types/message_delegate_reporter_test.go +++ /dev/null @@ -1,41 +0,0 @@ -package types - -import ( - "testing" - - "github.com/stretchr/testify/require" - "github.com/tellor-io/layer/testutil/sample" - - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" -) - -func TestMsgDelegateReporter_ValidateBasic(t *testing.T) { - tests := []struct { - name string - msg MsgDelegateReporter - err error - }{ - { - name: "invalid address", - msg: MsgDelegateReporter{ - Delegator: "invalid_address", - }, - err: sdkerrors.ErrInvalidAddress, - }, { - name: "valid address", - msg: MsgDelegateReporter{ - Delegator: sample.AccAddress(), - }, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - err := tt.msg.ValidateBasic() - if tt.err != nil { - require.ErrorIs(t, err, tt.err) - return - } - require.NoError(t, err) - }) - } -} diff --git a/x/reporter/types/message_undelegate_reporter.go b/x/reporter/types/message_undelegate_reporter.go index 6b2162031..0fd674afe 100644 --- a/x/reporter/types/message_undelegate_reporter.go +++ b/x/reporter/types/message_undelegate_reporter.go @@ -7,16 +7,16 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) -var _ sdk.Msg = &MsgUndelegateReporter{} +var _ sdk.Msg = &MsgChangeReporter{} -func NewMsgUndelegateReporter(delegator string, tokenOrigin []*TokenOrigin) *MsgUndelegateReporter { - return &MsgUndelegateReporter{ +func NewMsgChangeReporter(delegator, reporter string) *MsgChangeReporter { + return &MsgChangeReporter{ DelegatorAddress: delegator, - TokenOrigins: tokenOrigin, + ReporterAddress: reporter, } } -func (msg *MsgUndelegateReporter) ValidateBasic() error { +func (msg *MsgChangeReporter) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.DelegatorAddress) if err != nil { return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid delegator address (%s)", err) diff --git a/x/reporter/types/message_undelegate_reporter_test.go b/x/reporter/types/message_undelegate_reporter_test.go index 265752f34..792f09e7a 100644 --- a/x/reporter/types/message_undelegate_reporter_test.go +++ b/x/reporter/types/message_undelegate_reporter_test.go @@ -9,21 +9,21 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) -func TestMsgUndelegateReporter_ValidateBasic(t *testing.T) { +func TestMsgChangeReporter_ValidateBasic(t *testing.T) { tests := []struct { name string - msg MsgUndelegateReporter + msg MsgChangeReporter err error }{ { name: "invalid address", - msg: MsgUndelegateReporter{ + msg: MsgChangeReporter{ DelegatorAddress: "invalid_address", }, err: sdkerrors.ErrInvalidAddress, }, { name: "valid address", - msg: MsgUndelegateReporter{ + msg: MsgChangeReporter{ DelegatorAddress: sample.AccAddress(), }, }, diff --git a/x/reporter/types/oracle_reporter.go b/x/reporter/types/oracle_reporter.go index 9f226b787..7896445c0 100644 --- a/x/reporter/types/oracle_reporter.go +++ b/x/reporter/types/oracle_reporter.go @@ -9,12 +9,10 @@ import ( stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) -func NewOracleReporter(reporter string, totalAmount math.Int, commission *stakingtypes.Commission) OracleReporter { - repAcc := sdk.MustAccAddressFromBech32(reporter) +func NewOracleReporter(reporter string, tokens math.Int, commission *stakingtypes.Commission) OracleReporter { return OracleReporter{ - Reporter: repAcc, - TotalTokens: totalAmount, Commission: commission, + TotalTokens: tokens, } } diff --git a/x/reporter/types/oracle_reporter.pb.go b/x/reporter/types/oracle_reporter.pb.go index d7dbdce4c..aec582e44 100644 --- a/x/reporter/types/oracle_reporter.pb.go +++ b/x/reporter/types/oracle_reporter.pb.go @@ -33,16 +33,14 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // OracleReporter is the struct that holds the data for a reporter type OracleReporter struct { - // reporter is the address of the reporter - Reporter []byte `protobuf:"bytes,1,opt,name=reporter,proto3" json:"reporter,omitempty"` // tokens is the amount of tokens the reporter has - TotalTokens cosmossdk_io_math.Int `protobuf:"bytes,2,opt,name=total_tokens,json=totalTokens,proto3,customtype=cosmossdk.io/math.Int" json:"total_tokens"` + TotalTokens cosmossdk_io_math.Int `protobuf:"bytes,1,opt,name=total_tokens,json=totalTokens,proto3,customtype=cosmossdk.io/math.Int" json:"total_tokens"` // commission for the reporter - Commission *types.Commission `protobuf:"bytes,3,opt,name=commission,proto3" json:"commission,omitempty"` + Commission *types.Commission `protobuf:"bytes,2,opt,name=commission,proto3" json:"commission,omitempty"` // jailed is a bool whether the reporter is jailed or not - Jailed bool `protobuf:"varint,4,opt,name=jailed,proto3" json:"jailed,omitempty"` + Jailed bool `protobuf:"varint,3,opt,name=jailed,proto3" json:"jailed,omitempty"` // jailed_until is the time the reporter is jailed until - JailedUntil time.Time `protobuf:"bytes,5,opt,name=jailed_until,json=jailedUntil,proto3,stdtime" json:"jailed_until"` + JailedUntil time.Time `protobuf:"bytes,4,opt,name=jailed_until,json=jailedUntil,proto3,stdtime" json:"jailed_until"` } func (m *OracleReporter) Reset() { *m = OracleReporter{} } @@ -78,13 +76,6 @@ func (m *OracleReporter) XXX_DiscardUnknown() { var xxx_messageInfo_OracleReporter proto.InternalMessageInfo -func (m *OracleReporter) GetReporter() []byte { - if m != nil { - return m.Reporter - } - return nil -} - func (m *OracleReporter) GetCommission() *types.Commission { if m != nil { return m.Commission @@ -115,32 +106,32 @@ func init() { } var fileDescriptor_28310cb3dcf79802 = []byte{ - // 398 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x52, 0xc1, 0x6e, 0xd4, 0x30, - 0x10, 0x5d, 0x17, 0xa8, 0x8a, 0x77, 0xa9, 0x44, 0x04, 0x28, 0xec, 0x21, 0x89, 0xaa, 0x1e, 0x22, - 0xaa, 0xda, 0x2a, 0xfc, 0x41, 0x10, 0x87, 0x4a, 0x08, 0xa4, 0xa8, 0x5c, 0xb8, 0x44, 0x4e, 0x6a, - 0x52, 0xb3, 0x76, 0x26, 0x8a, 0x67, 0x11, 0xfd, 0x8b, 0x7e, 0x05, 0xe2, 0xc8, 0x81, 0x8f, 0xe8, - 0xb1, 0xe2, 0x84, 0x38, 0x14, 0xb4, 0x7b, 0xe0, 0x37, 0xd0, 0xda, 0x4e, 0xe9, 0x25, 0x9a, 0x37, - 0x79, 0x6f, 0xfc, 0xe6, 0x69, 0xe8, 0xbe, 0x16, 0xe7, 0x72, 0xe0, 0x83, 0xec, 0x61, 0x40, 0x39, - 0x70, 0x18, 0x44, 0xa3, 0x65, 0x35, 0x62, 0xd6, 0x0f, 0x80, 0x10, 0xed, 0x3a, 0x16, 0x1b, 0xbb, - 0xf3, 0x87, 0xc2, 0xa8, 0x0e, 0xb8, 0xfb, 0x7a, 0xca, 0x7c, 0xbf, 0x01, 0x6b, 0xc0, 0x72, 0x8b, - 0x62, 0xa1, 0xba, 0x96, 0x7f, 0x3a, 0xaa, 0x25, 0x8a, 0xa3, 0x11, 0x07, 0xd6, 0x53, 0xcf, 0xaa, - 0x1c, 0xe2, 0x1e, 0x84, 0x5f, 0x8f, 0x5a, 0x68, 0xc1, 0xf7, 0x37, 0x55, 0xe8, 0xa6, 0x2d, 0x40, - 0xab, 0x25, 0x77, 0xa8, 0x5e, 0x7e, 0xe0, 0xa8, 0x8c, 0xb4, 0x28, 0x4c, 0xef, 0x09, 0x7b, 0x5f, - 0xb6, 0xe8, 0xee, 0x5b, 0x67, 0xba, 0x0c, 0xee, 0xa2, 0x39, 0xdd, 0x19, 0x9d, 0xc6, 0x24, 0x23, - 0xf9, 0xac, 0xbc, 0xc1, 0xd1, 0x1b, 0x3a, 0x43, 0x40, 0xa1, 0x2b, 0x84, 0x85, 0xec, 0x6c, 0xbc, - 0x95, 0x91, 0xfc, 0x7e, 0x71, 0x70, 0x79, 0x9d, 0x4e, 0x7e, 0x5d, 0xa7, 0x8f, 0xbd, 0x23, 0x7b, - 0xba, 0x60, 0x0a, 0xb8, 0x11, 0x78, 0xc6, 0x8e, 0x3b, 0xfc, 0xf1, 0xfd, 0x90, 0x06, 0xab, 0xc7, - 0x1d, 0x96, 0x53, 0x37, 0xe0, 0xc4, 0xe9, 0xa3, 0x82, 0xd2, 0x06, 0x8c, 0x51, 0xd6, 0x2a, 0xe8, - 0xe2, 0x3b, 0x19, 0xc9, 0xa7, 0xcf, 0xf7, 0x58, 0x60, 0x8f, 0xbb, 0x87, 0x2c, 0xd8, 0xcb, 0x1b, - 0x66, 0x79, 0x4b, 0x15, 0x3d, 0xa1, 0xdb, 0x1f, 0x85, 0xd2, 0xf2, 0x34, 0xbe, 0x9b, 0x91, 0x7c, - 0xa7, 0x0c, 0x28, 0x7a, 0x4d, 0x67, 0xbe, 0xaa, 0x96, 0x1d, 0x2a, 0x1d, 0xdf, 0x73, 0xd3, 0xe7, - 0xcc, 0x47, 0xc2, 0xc6, 0x48, 0xd8, 0xc9, 0x18, 0x49, 0xf1, 0x60, 0xb3, 0xc7, 0xc5, 0xef, 0x94, - 0x7c, 0xfd, 0xfb, 0xed, 0x19, 0x29, 0xa7, 0x5e, 0xfe, 0x6e, 0xa3, 0x2e, 0x5e, 0x5d, 0xae, 0x12, - 0x72, 0xb5, 0x4a, 0xc8, 0x9f, 0x55, 0x42, 0x2e, 0xd6, 0xc9, 0xe4, 0x6a, 0x9d, 0x4c, 0x7e, 0xae, - 0x93, 0xc9, 0xfb, 0x83, 0x56, 0xe1, 0xd9, 0xb2, 0x66, 0x0d, 0x18, 0x8e, 0x52, 0x6b, 0x18, 0x0e, - 0x15, 0x70, 0x7f, 0x18, 0x9f, 0xff, 0x9f, 0x06, 0x9e, 0xf7, 0xd2, 0xd6, 0xdb, 0xee, 0xd9, 0x17, - 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0xe7, 0x81, 0x83, 0xb4, 0x39, 0x02, 0x00, 0x00, + // 385 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x91, 0xc1, 0x8e, 0xd3, 0x30, + 0x10, 0x86, 0xe3, 0x05, 0xad, 0xc0, 0x5d, 0x56, 0x22, 0x02, 0x14, 0x7a, 0x48, 0xaa, 0xd5, 0x1e, + 0x2a, 0x56, 0x6b, 0x6b, 0xe1, 0x0d, 0x82, 0x38, 0xac, 0x84, 0x40, 0x8a, 0x96, 0x0b, 0x97, 0xc8, + 0xc9, 0x9a, 0xac, 0xa9, 0x9d, 0x89, 0xe2, 0x29, 0xa2, 0xaf, 0xc0, 0xa9, 0x8f, 0xc1, 0x91, 0x03, + 0x0f, 0xd1, 0x63, 0xc5, 0x09, 0x71, 0x28, 0xa8, 0x3d, 0xf0, 0x1a, 0xa8, 0xb6, 0x03, 0x5c, 0x22, + 0xff, 0x93, 0xef, 0x9f, 0x99, 0x5f, 0x43, 0x4f, 0xb5, 0x58, 0xc8, 0x9e, 0xf7, 0xb2, 0x83, 0x1e, + 0x65, 0xcf, 0xa1, 0x17, 0xb5, 0x96, 0xe5, 0xa0, 0x59, 0xd7, 0x03, 0x42, 0x7c, 0xec, 0x28, 0x36, + 0x54, 0xc7, 0xf7, 0x85, 0x51, 0x2d, 0x70, 0xf7, 0xf5, 0xc8, 0xf8, 0xb4, 0x06, 0x6b, 0xc0, 0x72, + 0x8b, 0x62, 0xa6, 0xda, 0x86, 0x7f, 0xb8, 0xa8, 0x24, 0x8a, 0x8b, 0x41, 0x07, 0xea, 0xb1, 0xa7, + 0x4a, 0xa7, 0xb8, 0x17, 0xe1, 0xd7, 0x83, 0x06, 0x1a, 0xf0, 0xf5, 0xfd, 0x2b, 0x54, 0xb3, 0x06, + 0xa0, 0xd1, 0x92, 0x3b, 0x55, 0xcd, 0xdf, 0x71, 0x54, 0x46, 0x5a, 0x14, 0xa6, 0xf3, 0xc0, 0xc9, + 0xa7, 0x03, 0x7a, 0xfc, 0xda, 0x2d, 0x5d, 0x84, 0xed, 0xe2, 0x57, 0xf4, 0x08, 0x01, 0x85, 0x2e, + 0x11, 0x66, 0xb2, 0xb5, 0x09, 0x99, 0x90, 0xe9, 0xdd, 0xfc, 0x6c, 0xb5, 0xc9, 0xa2, 0x1f, 0x9b, + 0xec, 0xa1, 0x9f, 0x6a, 0xaf, 0x67, 0x4c, 0x01, 0x37, 0x02, 0x6f, 0xd8, 0x65, 0x8b, 0xdf, 0xbe, + 0x9e, 0xd3, 0xb0, 0xce, 0x65, 0x8b, 0xc5, 0xc8, 0x35, 0xb8, 0x72, 0xfe, 0x38, 0xa7, 0xb4, 0x06, + 0x63, 0x94, 0xb5, 0x0a, 0xda, 0xe4, 0x60, 0x42, 0xa6, 0xa3, 0xa7, 0x27, 0x2c, 0xd0, 0x43, 0xbe, + 0x90, 0x97, 0x3d, 0xff, 0x4b, 0x16, 0xff, 0xb9, 0xe2, 0x47, 0xf4, 0xf0, 0xbd, 0x50, 0x5a, 0x5e, + 0x27, 0xb7, 0x26, 0x64, 0x7a, 0xa7, 0x08, 0x2a, 0x7e, 0x49, 0x8f, 0xfc, 0xab, 0x9c, 0xb7, 0xa8, + 0x74, 0x72, 0xdb, 0x75, 0x1f, 0x33, 0x1f, 0x9b, 0x0d, 0xb1, 0xd9, 0xd5, 0x10, 0x3b, 0xbf, 0xb7, + 0xcf, 0xb1, 0xfc, 0x99, 0x91, 0xcf, 0xbf, 0xbf, 0x3c, 0x21, 0xc5, 0xc8, 0xdb, 0xdf, 0xec, 0xdd, + 0xf9, 0x8b, 0xd5, 0x36, 0x25, 0xeb, 0x6d, 0x4a, 0x7e, 0x6d, 0x53, 0xb2, 0xdc, 0xa5, 0xd1, 0x7a, + 0x97, 0x46, 0xdf, 0x77, 0x69, 0xf4, 0xf6, 0xac, 0x51, 0x78, 0x33, 0xaf, 0x58, 0x0d, 0x86, 0xa3, + 0xd4, 0x1a, 0xfa, 0x73, 0x05, 0xdc, 0x1f, 0xff, 0xe3, 0xbf, 0xf3, 0xe3, 0xa2, 0x93, 0xb6, 0x3a, + 0x74, 0x63, 0x9f, 0xfd, 0x09, 0x00, 0x00, 0xff, 0xff, 0x21, 0x3e, 0xbc, 0x3f, 0x1d, 0x02, 0x00, + 0x00, } func (m *OracleReporter) Marshal() (dAtA []byte, err error) { @@ -170,7 +161,7 @@ func (m *OracleReporter) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= n1 i = encodeVarintOracleReporter(dAtA, i, uint64(n1)) i-- - dAtA[i] = 0x2a + dAtA[i] = 0x22 if m.Jailed { i-- if m.Jailed { @@ -179,7 +170,7 @@ func (m *OracleReporter) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0 } i-- - dAtA[i] = 0x20 + dAtA[i] = 0x18 } if m.Commission != nil { { @@ -191,7 +182,7 @@ func (m *OracleReporter) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintOracleReporter(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x1a + dAtA[i] = 0x12 } { size := m.TotalTokens.Size() @@ -202,14 +193,7 @@ func (m *OracleReporter) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintOracleReporter(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x12 - if len(m.Reporter) > 0 { - i -= len(m.Reporter) - copy(dAtA[i:], m.Reporter) - i = encodeVarintOracleReporter(dAtA, i, uint64(len(m.Reporter))) - i-- - dAtA[i] = 0xa - } + dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -230,10 +214,6 @@ func (m *OracleReporter) Size() (n int) { } var l int _ = l - l = len(m.Reporter) - if l > 0 { - n += 1 + l + sovOracleReporter(uint64(l)) - } l = m.TotalTokens.Size() n += 1 + l + sovOracleReporter(uint64(l)) if m.Commission != nil { @@ -284,40 +264,6 @@ func (m *OracleReporter) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Reporter", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowOracleReporter - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthOracleReporter - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthOracleReporter - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Reporter = append(m.Reporter[:0], dAtA[iNdEx:postIndex]...) - if m.Reporter == nil { - m.Reporter = []byte{} - } - iNdEx = postIndex - case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field TotalTokens", wireType) } @@ -351,7 +297,7 @@ func (m *OracleReporter) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 3: + case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Commission", wireType) } @@ -387,7 +333,7 @@ func (m *OracleReporter) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 4: + case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Jailed", wireType) } @@ -407,7 +353,7 @@ func (m *OracleReporter) Unmarshal(dAtA []byte) error { } } m.Jailed = bool(v != 0) - case 5: + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field JailedUntil", wireType) } diff --git a/x/reporter/types/query.pb.go b/x/reporter/types/query.pb.go index 5d5c23408..aff94ac91 100644 --- a/x/reporter/types/query.pb.go +++ b/x/reporter/types/query.pb.go @@ -5,11 +5,9 @@ package types import ( context "context" - cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/cosmos-sdk/types/query" _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" @@ -118,97 +116,6 @@ func (m *QueryParamsResponse) GetParams() Params { return Params{} } -// QueryReporterRequest is the request type for the Query/Reporter RPC method. -type QueryReporterRequest struct { - // reporter_address defines the reporter address to query for. - ReporterAddress string `protobuf:"bytes,1,opt,name=reporter_address,json=reporterAddress,proto3" json:"reporter_address,omitempty"` -} - -func (m *QueryReporterRequest) Reset() { *m = QueryReporterRequest{} } -func (m *QueryReporterRequest) String() string { return proto.CompactTextString(m) } -func (*QueryReporterRequest) ProtoMessage() {} -func (*QueryReporterRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a043abc58a7b99a9, []int{2} -} -func (m *QueryReporterRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryReporterRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryReporterRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryReporterRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryReporterRequest.Merge(m, src) -} -func (m *QueryReporterRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryReporterRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryReporterRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryReporterRequest proto.InternalMessageInfo - -func (m *QueryReporterRequest) GetReporterAddress() string { - if m != nil { - return m.ReporterAddress - } - return "" -} - -// QueryReporterResponse is the response type for the Query/Reporter RPC method. -type QueryReporterResponse struct { - Reporter *OracleReporter `protobuf:"bytes,1,opt,name=reporter,proto3" json:"reporter,omitempty"` -} - -func (m *QueryReporterResponse) Reset() { *m = QueryReporterResponse{} } -func (m *QueryReporterResponse) String() string { return proto.CompactTextString(m) } -func (*QueryReporterResponse) ProtoMessage() {} -func (*QueryReporterResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a043abc58a7b99a9, []int{3} -} -func (m *QueryReporterResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryReporterResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryReporterResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryReporterResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryReporterResponse.Merge(m, src) -} -func (m *QueryReporterResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryReporterResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryReporterResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryReporterResponse proto.InternalMessageInfo - -func (m *QueryReporterResponse) GetReporter() *OracleReporter { - if m != nil { - return m.Reporter - } - return nil -} - // QueryReportersRequest is the request type for the Query/Reporters RPC method. type QueryReportersRequest struct { } @@ -217,7 +124,7 @@ func (m *QueryReportersRequest) Reset() { *m = QueryReportersRequest{} } func (m *QueryReportersRequest) String() string { return proto.CompactTextString(m) } func (*QueryReportersRequest) ProtoMessage() {} func (*QueryReportersRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a043abc58a7b99a9, []int{4} + return fileDescriptor_a043abc58a7b99a9, []int{2} } func (m *QueryReportersRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -256,7 +163,7 @@ func (m *QueryReportersResponse) Reset() { *m = QueryReportersResponse{} func (m *QueryReportersResponse) String() string { return proto.CompactTextString(m) } func (*QueryReportersResponse) ProtoMessage() {} func (*QueryReportersResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a043abc58a7b99a9, []int{5} + return fileDescriptor_a043abc58a7b99a9, []int{3} } func (m *QueryReportersResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -303,7 +210,7 @@ func (m *QueryDelegatorReporterRequest) Reset() { *m = QueryDelegatorRep func (m *QueryDelegatorReporterRequest) String() string { return proto.CompactTextString(m) } func (*QueryDelegatorReporterRequest) ProtoMessage() {} func (*QueryDelegatorReporterRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a043abc58a7b99a9, []int{6} + return fileDescriptor_a043abc58a7b99a9, []int{4} } func (m *QueryDelegatorReporterRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -343,7 +250,7 @@ func (m *QueryDelegatorReporterResponse) Reset() { *m = QueryDelegatorRe func (m *QueryDelegatorReporterResponse) String() string { return proto.CompactTextString(m) } func (*QueryDelegatorReporterResponse) ProtoMessage() {} func (*QueryDelegatorReporterResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a043abc58a7b99a9, []int{7} + return fileDescriptor_a043abc58a7b99a9, []int{5} } func (m *QueryDelegatorReporterResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -379,451 +286,54 @@ func (m *QueryDelegatorReporterResponse) GetReporter() string { return "" } -// QueryReporterStakeRequest is the request type for the -// Query/ReporterStake RPC method. -type QueryReporterStakeRequest struct { - // reporter_address defines the reporter address to query for. - ReporterAddress string `protobuf:"bytes,1,opt,name=reporter_address,json=reporterAddress,proto3" json:"reporter_address,omitempty"` -} - -func (m *QueryReporterStakeRequest) Reset() { *m = QueryReporterStakeRequest{} } -func (m *QueryReporterStakeRequest) String() string { return proto.CompactTextString(m) } -func (*QueryReporterStakeRequest) ProtoMessage() {} -func (*QueryReporterStakeRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a043abc58a7b99a9, []int{8} -} -func (m *QueryReporterStakeRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryReporterStakeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryReporterStakeRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryReporterStakeRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryReporterStakeRequest.Merge(m, src) -} -func (m *QueryReporterStakeRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryReporterStakeRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryReporterStakeRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryReporterStakeRequest proto.InternalMessageInfo - -// QueryReporterStakeResponse is the response type for the -// Query/ReporterStake RPC method. -type QueryReporterStakeResponse struct { - // stake defines the total tokens of a reporter. - Stake cosmossdk_io_math.Int `protobuf:"bytes,1,opt,name=stake,proto3,customtype=cosmossdk.io/math.Int" json:"stake"` -} - -func (m *QueryReporterStakeResponse) Reset() { *m = QueryReporterStakeResponse{} } -func (m *QueryReporterStakeResponse) String() string { return proto.CompactTextString(m) } -func (*QueryReporterStakeResponse) ProtoMessage() {} -func (*QueryReporterStakeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a043abc58a7b99a9, []int{9} -} -func (m *QueryReporterStakeResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryReporterStakeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryReporterStakeResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryReporterStakeResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryReporterStakeResponse.Merge(m, src) -} -func (m *QueryReporterStakeResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryReporterStakeResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryReporterStakeResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryReporterStakeResponse proto.InternalMessageInfo - -// QueryDelegationRewardsRequest is the request type for the -// Query/DelegationRewards RPC method. -type QueryDelegationRewardsRequest struct { - // delegator_address defines the delegator address to query for. - DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` - // reporter_address defines the reporter address to query for. - ReporterAddress string `protobuf:"bytes,2,opt,name=reporter_address,json=reporterAddress,proto3" json:"reporter_address,omitempty"` -} - -func (m *QueryDelegationRewardsRequest) Reset() { *m = QueryDelegationRewardsRequest{} } -func (m *QueryDelegationRewardsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryDelegationRewardsRequest) ProtoMessage() {} -func (*QueryDelegationRewardsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a043abc58a7b99a9, []int{10} -} -func (m *QueryDelegationRewardsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryDelegationRewardsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryDelegationRewardsRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryDelegationRewardsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryDelegationRewardsRequest.Merge(m, src) -} -func (m *QueryDelegationRewardsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryDelegationRewardsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryDelegationRewardsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryDelegationRewardsRequest proto.InternalMessageInfo - -// QueryDelegationRewardsResponse is the response type for the -// Query/DelegationRewards RPC method. -type QueryDelegationRewardsResponse struct { - // rewards defines the rewards accrued by a delegation. - Rewards github_com_cosmos_cosmos_sdk_types.DecCoins `protobuf:"bytes,1,rep,name=rewards,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.DecCoins" json:"rewards"` -} - -func (m *QueryDelegationRewardsResponse) Reset() { *m = QueryDelegationRewardsResponse{} } -func (m *QueryDelegationRewardsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryDelegationRewardsResponse) ProtoMessage() {} -func (*QueryDelegationRewardsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a043abc58a7b99a9, []int{11} -} -func (m *QueryDelegationRewardsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryDelegationRewardsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryDelegationRewardsResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryDelegationRewardsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryDelegationRewardsResponse.Merge(m, src) -} -func (m *QueryDelegationRewardsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryDelegationRewardsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryDelegationRewardsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryDelegationRewardsResponse proto.InternalMessageInfo - -func (m *QueryDelegationRewardsResponse) GetRewards() github_com_cosmos_cosmos_sdk_types.DecCoins { - if m != nil { - return m.Rewards - } - return nil -} - -// QueryReporterOutstandingRewardsRequest is the request type for the -// Query/ReporterOutstandingRewards RPC method. -type QueryReporterOutstandingRewardsRequest struct { - // reporter_address defines the reporter address to query for. - ReporterAddress string `protobuf:"bytes,1,opt,name=reporter_address,json=reporterAddress,proto3" json:"reporter_address,omitempty"` -} - -func (m *QueryReporterOutstandingRewardsRequest) Reset() { - *m = QueryReporterOutstandingRewardsRequest{} -} -func (m *QueryReporterOutstandingRewardsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryReporterOutstandingRewardsRequest) ProtoMessage() {} -func (*QueryReporterOutstandingRewardsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a043abc58a7b99a9, []int{12} -} -func (m *QueryReporterOutstandingRewardsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryReporterOutstandingRewardsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryReporterOutstandingRewardsRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryReporterOutstandingRewardsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryReporterOutstandingRewardsRequest.Merge(m, src) -} -func (m *QueryReporterOutstandingRewardsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryReporterOutstandingRewardsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryReporterOutstandingRewardsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryReporterOutstandingRewardsRequest proto.InternalMessageInfo - -func (m *QueryReporterOutstandingRewardsRequest) GetReporterAddress() string { - if m != nil { - return m.ReporterAddress - } - return "" -} - -// QueryReporterOutstandingRewardsResponse is the response type for the -// Query/ReporterOutstandingRewards RPC method. -type QueryReporterOutstandingRewardsResponse struct { - Rewards ReporterOutstandingRewards `protobuf:"bytes,1,opt,name=rewards,proto3" json:"rewards"` -} - -func (m *QueryReporterOutstandingRewardsResponse) Reset() { - *m = QueryReporterOutstandingRewardsResponse{} -} -func (m *QueryReporterOutstandingRewardsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryReporterOutstandingRewardsResponse) ProtoMessage() {} -func (*QueryReporterOutstandingRewardsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a043abc58a7b99a9, []int{13} -} -func (m *QueryReporterOutstandingRewardsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryReporterOutstandingRewardsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryReporterOutstandingRewardsResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryReporterOutstandingRewardsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryReporterOutstandingRewardsResponse.Merge(m, src) -} -func (m *QueryReporterOutstandingRewardsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryReporterOutstandingRewardsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryReporterOutstandingRewardsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryReporterOutstandingRewardsResponse proto.InternalMessageInfo - -func (m *QueryReporterOutstandingRewardsResponse) GetRewards() ReporterOutstandingRewards { - if m != nil { - return m.Rewards - } - return ReporterOutstandingRewards{} -} - -// QueryReporterCommissionRequest is the request type for the -// Query/ReporterCommission RPC method -type QueryReporterCommissionRequest struct { - // reporter_address defines the reporter address to query for. - ReporterAddress string `protobuf:"bytes,1,opt,name=reporter_address,json=reporterAddress,proto3" json:"reporter_address,omitempty"` -} - -func (m *QueryReporterCommissionRequest) Reset() { *m = QueryReporterCommissionRequest{} } -func (m *QueryReporterCommissionRequest) String() string { return proto.CompactTextString(m) } -func (*QueryReporterCommissionRequest) ProtoMessage() {} -func (*QueryReporterCommissionRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a043abc58a7b99a9, []int{14} -} -func (m *QueryReporterCommissionRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryReporterCommissionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryReporterCommissionRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryReporterCommissionRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryReporterCommissionRequest.Merge(m, src) -} -func (m *QueryReporterCommissionRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryReporterCommissionRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryReporterCommissionRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryReporterCommissionRequest proto.InternalMessageInfo - -func (m *QueryReporterCommissionRequest) GetReporterAddress() string { - if m != nil { - return m.ReporterAddress - } - return "" -} - -// QueryReporterCommissionResponse is the response type for the -// Query/ReporterCommission RPC method -type QueryReporterCommissionResponse struct { - // commission defines the commission the reporter received. - Commission ReporterAccumulatedCommission `protobuf:"bytes,1,opt,name=commission,proto3" json:"commission"` -} - -func (m *QueryReporterCommissionResponse) Reset() { *m = QueryReporterCommissionResponse{} } -func (m *QueryReporterCommissionResponse) String() string { return proto.CompactTextString(m) } -func (*QueryReporterCommissionResponse) ProtoMessage() {} -func (*QueryReporterCommissionResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a043abc58a7b99a9, []int{15} -} -func (m *QueryReporterCommissionResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryReporterCommissionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryReporterCommissionResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryReporterCommissionResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryReporterCommissionResponse.Merge(m, src) -} -func (m *QueryReporterCommissionResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryReporterCommissionResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryReporterCommissionResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryReporterCommissionResponse proto.InternalMessageInfo - -func (m *QueryReporterCommissionResponse) GetCommission() ReporterAccumulatedCommission { - if m != nil { - return m.Commission - } - return ReporterAccumulatedCommission{} -} - func init() { proto.RegisterType((*QueryParamsRequest)(nil), "layer.reporter.QueryParamsRequest") proto.RegisterType((*QueryParamsResponse)(nil), "layer.reporter.QueryParamsResponse") - proto.RegisterType((*QueryReporterRequest)(nil), "layer.reporter.QueryReporterRequest") - proto.RegisterType((*QueryReporterResponse)(nil), "layer.reporter.QueryReporterResponse") proto.RegisterType((*QueryReportersRequest)(nil), "layer.reporter.QueryReportersRequest") proto.RegisterType((*QueryReportersResponse)(nil), "layer.reporter.QueryReportersResponse") proto.RegisterType((*QueryDelegatorReporterRequest)(nil), "layer.reporter.QueryDelegatorReporterRequest") proto.RegisterType((*QueryDelegatorReporterResponse)(nil), "layer.reporter.QueryDelegatorReporterResponse") - proto.RegisterType((*QueryReporterStakeRequest)(nil), "layer.reporter.QueryReporterStakeRequest") - proto.RegisterType((*QueryReporterStakeResponse)(nil), "layer.reporter.QueryReporterStakeResponse") - proto.RegisterType((*QueryDelegationRewardsRequest)(nil), "layer.reporter.QueryDelegationRewardsRequest") - proto.RegisterType((*QueryDelegationRewardsResponse)(nil), "layer.reporter.QueryDelegationRewardsResponse") - proto.RegisterType((*QueryReporterOutstandingRewardsRequest)(nil), "layer.reporter.QueryReporterOutstandingRewardsRequest") - proto.RegisterType((*QueryReporterOutstandingRewardsResponse)(nil), "layer.reporter.QueryReporterOutstandingRewardsResponse") - proto.RegisterType((*QueryReporterCommissionRequest)(nil), "layer.reporter.QueryReporterCommissionRequest") - proto.RegisterType((*QueryReporterCommissionResponse)(nil), "layer.reporter.QueryReporterCommissionResponse") } func init() { proto.RegisterFile("layer/reporter/query.proto", fileDescriptor_a043abc58a7b99a9) } var fileDescriptor_a043abc58a7b99a9 = []byte{ - // 985 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x4d, 0x6f, 0xdc, 0x44, - 0x18, 0x5e, 0x17, 0x35, 0x24, 0x2f, 0x02, 0x9a, 0x21, 0x2d, 0xad, 0x29, 0xde, 0xe2, 0x7e, 0x50, - 0x12, 0x6c, 0xab, 0xa5, 0xa2, 0xb4, 0x80, 0x20, 0x9b, 0x56, 0xa2, 0xa7, 0x94, 0x8d, 0xa8, 0x10, - 0x3d, 0x44, 0xb3, 0xeb, 0xd1, 0xd6, 0x64, 0xed, 0x71, 0x3d, 0xb3, 0x40, 0x88, 0x7a, 0xe1, 0x02, - 0x17, 0x24, 0x04, 0x7f, 0xa0, 0x47, 0x04, 0x17, 0x0e, 0x85, 0x13, 0x3f, 0xa0, 0x37, 0xaa, 0x72, - 0x00, 0x71, 0x08, 0x28, 0x41, 0x82, 0x23, 0x3f, 0x01, 0x79, 0xfc, 0xfa, 0x63, 0xbd, 0xf6, 0xee, - 0x82, 0xf6, 0x92, 0xac, 0xdf, 0x79, 0x3f, 0x9e, 0xe7, 0x19, 0xef, 0xf3, 0x2e, 0xe8, 0x7d, 0xba, - 0xcd, 0x22, 0x27, 0x62, 0x21, 0x8f, 0x24, 0x8b, 0x9c, 0xdb, 0x03, 0x16, 0x6d, 0xdb, 0x61, 0xc4, - 0x25, 0x27, 0x4f, 0xa8, 0x33, 0x3b, 0x3d, 0xd3, 0x17, 0xa9, 0xef, 0x05, 0xdc, 0x51, 0x7f, 0x93, - 0x14, 0x7d, 0xb9, 0xcb, 0x85, 0xcf, 0x85, 0xd3, 0xa1, 0x82, 0x25, 0xb5, 0xce, 0x07, 0xe7, 0x3a, - 0x4c, 0xd2, 0x73, 0x4e, 0x48, 0x7b, 0x5e, 0x40, 0xa5, 0xc7, 0x03, 0xcc, 0x35, 0x8a, 0xb9, 0x69, - 0x56, 0x97, 0x7b, 0xe9, 0xf9, 0xb1, 0xe4, 0x7c, 0x53, 0x3d, 0x39, 0xc9, 0x03, 0x1e, 0x2d, 0xf5, - 0x78, 0x8f, 0x27, 0xf1, 0xf8, 0x13, 0x46, 0x8f, 0xf7, 0x38, 0xef, 0xf5, 0x99, 0x43, 0x43, 0xcf, - 0xa1, 0x41, 0xc0, 0xa5, 0x9a, 0x96, 0xd6, 0x3c, 0x57, 0x62, 0xe6, 0x7a, 0x42, 0x46, 0x5e, 0x67, - 0x50, 0x40, 0x74, 0xaa, 0x94, 0xc2, 0x23, 0xda, 0xed, 0xb3, 0xcd, 0xf4, 0x19, 0xb3, 0x9e, 0x29, - 0x65, 0x85, 0x34, 0xa2, 0x3e, 0x4e, 0x31, 0x97, 0x80, 0xbc, 0x1d, 0xd3, 0xbe, 0xae, 0x82, 0x6d, - 0x76, 0x7b, 0xc0, 0x84, 0x34, 0xaf, 0xc3, 0x53, 0x43, 0x51, 0x11, 0xf2, 0x40, 0x30, 0x72, 0x09, - 0xe6, 0x92, 0xe2, 0xa3, 0xda, 0x09, 0xed, 0xec, 0x63, 0xe7, 0x8f, 0xd8, 0xc3, 0x0a, 0xdb, 0x49, - 0x7e, 0x6b, 0xe1, 0xfe, 0x6e, 0xb3, 0xf1, 0xf5, 0x5f, 0xdf, 0x2d, 0x6b, 0x6d, 0x2c, 0x30, 0x6f, - 0xc2, 0x92, 0xea, 0xd8, 0xc6, 0x54, 0x9c, 0x44, 0xd6, 0xe0, 0x50, 0x5a, 0xbd, 0x49, 0x5d, 0x37, - 0x62, 0x22, 0x69, 0xbe, 0xd0, 0x3a, 0xfa, 0xf0, 0x9e, 0xb5, 0x84, 0x2a, 0xae, 0x26, 0x27, 0x1b, - 0x32, 0xf2, 0x82, 0x5e, 0xfb, 0xc9, 0xb4, 0x02, 0xc3, 0xe6, 0x06, 0x1c, 0x2e, 0x35, 0x47, 0xc0, - 0x97, 0x61, 0x3e, 0xcd, 0x45, 0xc8, 0x46, 0x19, 0xf2, 0xba, 0xd2, 0x2c, 0xab, 0xcc, 0xf2, 0xcd, - 0xa7, 0x4b, 0x4d, 0x33, 0x71, 0x6e, 0xc0, 0x91, 0xf2, 0x01, 0x8e, 0x7b, 0x0d, 0x16, 0xd2, 0xf2, - 0x98, 0xc5, 0x23, 0x53, 0xcc, 0xcb, 0x0b, 0xcc, 0x10, 0x9e, 0x55, 0x7d, 0xaf, 0xb0, 0x3e, 0xeb, - 0x51, 0xc9, 0xa3, 0xb2, 0x56, 0x57, 0x61, 0xd1, 0x4d, 0xcf, 0xa6, 0x16, 0xeb, 0x50, 0x56, 0x82, - 0xf1, 0xcb, 0xf3, 0x9f, 0xdd, 0x6d, 0x36, 0xfe, 0xbe, 0xdb, 0x6c, 0x98, 0x37, 0xc0, 0xa8, 0x9b, - 0x88, 0x8c, 0x2e, 0x94, 0x04, 0x1c, 0x37, 0x29, 0x97, 0xee, 0x7d, 0x38, 0x36, 0xa4, 0xd0, 0x86, - 0xa4, 0x5b, 0x6c, 0x96, 0x37, 0x5e, 0xe0, 0xb0, 0x09, 0x7a, 0xd5, 0x2c, 0xc4, 0xbf, 0x0a, 0x07, - 0x45, 0x1c, 0xc0, 0x09, 0x2b, 0xf1, 0x8b, 0xf9, 0xdb, 0x6e, 0xf3, 0x70, 0x32, 0x45, 0xb8, 0x5b, - 0xb6, 0xc7, 0x1d, 0x9f, 0xca, 0x5b, 0xf6, 0xb5, 0x40, 0x3e, 0xbc, 0x67, 0x01, 0x8e, 0xbf, 0x16, - 0xc8, 0x76, 0x52, 0x69, 0x7e, 0xaf, 0x0d, 0xdf, 0x8b, 0xc7, 0x83, 0x36, 0xfb, 0x90, 0x46, 0xae, - 0x98, 0xed, 0xbd, 0x54, 0x0a, 0x73, 0xe0, 0xff, 0x0b, 0xf3, 0xa5, 0x36, 0x7c, 0xbb, 0x45, 0xdc, - 0xa8, 0x4e, 0x08, 0x8f, 0x46, 0x49, 0x08, 0xdf, 0xd6, 0xe3, 0x36, 0x4e, 0x89, 0x3d, 0xce, 0x46, - 0x8f, 0xb3, 0xaf, 0xb0, 0xee, 0x1a, 0xf7, 0x82, 0xd6, 0x2b, 0xb1, 0x7a, 0xdf, 0xfc, 0xde, 0x5c, - 0xe9, 0x79, 0xf2, 0xd6, 0xa0, 0x63, 0x77, 0xb9, 0x8f, 0x36, 0x87, 0xff, 0x2c, 0xe1, 0x6e, 0x39, - 0x72, 0x3b, 0x64, 0x22, 0xad, 0x11, 0x89, 0x0b, 0xa4, 0x63, 0x4c, 0x1f, 0xce, 0x0c, 0xdd, 0xd6, - 0xfa, 0x40, 0x0a, 0x49, 0x03, 0x37, 0xe6, 0x32, 0x2c, 0xea, 0x4c, 0x8c, 0xe1, 0x63, 0x78, 0x7e, - 0xe2, 0x38, 0xd4, 0x62, 0xbd, 0xa8, 0x45, 0xec, 0x14, 0xcb, 0xe5, 0x6f, 0x6e, 0x7d, 0x93, 0xa2, - 0xe1, 0x65, 0x54, 0x19, 0xca, 0x9f, 0x96, 0xad, 0x71, 0xdf, 0xf7, 0x84, 0x50, 0xd7, 0x30, 0x43, - 0x8a, 0x3b, 0xd0, 0xac, 0x1d, 0x83, 0xd4, 0xde, 0x05, 0xe8, 0x66, 0x51, 0x64, 0x67, 0xd5, 0xb1, - 0x5b, 0xed, 0x76, 0x07, 0xfe, 0xa0, 0x4f, 0x25, 0x73, 0xf3, 0x56, 0x45, 0x82, 0x85, 0x5e, 0xe7, - 0xff, 0x01, 0x38, 0xa8, 0xa6, 0x93, 0x1d, 0x98, 0x4b, 0xcc, 0x9f, 0x98, 0xe5, 0xce, 0xa3, 0xfb, - 0x45, 0x3f, 0x39, 0x36, 0x27, 0x81, 0x6d, 0x9e, 0xfd, 0xe4, 0xe7, 0x3f, 0xbf, 0x3a, 0x60, 0x92, - 0x13, 0x8e, 0x64, 0xfd, 0x3e, 0x8f, 0x2c, 0x8f, 0x3b, 0x95, 0xab, 0x8c, 0x7c, 0xae, 0xc1, 0x7c, - 0x8a, 0x9f, 0x9c, 0xaa, 0xec, 0x5d, 0xf2, 0x52, 0xfd, 0xf4, 0x84, 0x2c, 0xc4, 0x70, 0x41, 0x61, - 0xb0, 0xc9, 0x8b, 0xf5, 0x18, 0x76, 0xca, 0x77, 0x78, 0x87, 0x7c, 0xaa, 0xc1, 0x42, 0xb6, 0x1d, - 0xc8, 0xf8, 0x51, 0x99, 0x26, 0x67, 0x26, 0xa5, 0x21, 0xa4, 0x15, 0x05, 0xe9, 0x34, 0x39, 0x59, - 0x0f, 0x29, 0xdb, 0x29, 0xe4, 0x47, 0x0d, 0x16, 0x47, 0xdc, 0x9d, 0x58, 0x95, 0xa3, 0xea, 0xf6, - 0x8e, 0x6e, 0x4f, 0x9b, 0x8e, 0x08, 0xdf, 0x52, 0x08, 0x5b, 0xe4, 0xcd, 0x7a, 0x84, 0x99, 0xf9, - 0x59, 0xb9, 0x8e, 0x23, 0x1e, 0x7a, 0x87, 0x7c, 0xab, 0xc1, 0xe3, 0x43, 0xc6, 0x4e, 0x5e, 0x18, - 0xab, 0x52, 0x71, 0xd1, 0xe8, 0xcb, 0xd3, 0xa4, 0x22, 0xe4, 0x35, 0x05, 0xf9, 0x75, 0xf2, 0xea, - 0x64, 0x51, 0x2d, 0xb5, 0x16, 0xaa, 0xae, 0xfd, 0xa7, 0x5c, 0xec, 0xdc, 0x6c, 0xc7, 0x8b, 0x3d, - 0xb2, 0x4c, 0xc6, 0x8b, 0x3d, 0xea, 0xe1, 0xe6, 0x4d, 0x85, 0xfc, 0x1d, 0xb2, 0x31, 0x51, 0x6c, - 0x8f, 0x07, 0x16, 0x9a, 0x53, 0x95, 0xd8, 0x55, 0x8c, 0x7e, 0xd1, 0x40, 0xaf, 0xb7, 0x3d, 0xf2, - 0xf2, 0x58, 0x85, 0x6b, 0xbd, 0x5d, 0xbf, 0xf8, 0x9f, 0xeb, 0xa6, 0x7f, 0xb3, 0x78, 0x5e, 0x9d, - 0xb3, 0x1d, 0x65, 0xf6, 0x83, 0x06, 0x64, 0xd4, 0x32, 0x89, 0x3d, 0x16, 0xd9, 0x88, 0x85, 0xeb, - 0xce, 0xd4, 0xf9, 0xc8, 0xe0, 0x0d, 0xc5, 0xe0, 0x12, 0xb9, 0x58, 0xcf, 0x20, 0xf7, 0xd7, 0x0a, - 0xe0, 0xad, 0xab, 0xf7, 0xf7, 0x0c, 0xed, 0xc1, 0x9e, 0xa1, 0xfd, 0xb1, 0x67, 0x68, 0x5f, 0xec, - 0x1b, 0x8d, 0x07, 0xfb, 0x46, 0xe3, 0xd7, 0x7d, 0xa3, 0xf1, 0x5e, 0x71, 0x2d, 0x97, 0x9b, 0x7f, - 0x94, 0xb7, 0x57, 0xfb, 0xb9, 0x33, 0xa7, 0x7e, 0xfe, 0xbf, 0xf4, 0x6f, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x74, 0x9f, 0x96, 0x1b, 0x40, 0x0d, 0x00, 0x00, + // 556 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0x41, 0x6b, 0x13, 0x41, + 0x14, 0xde, 0xb5, 0x58, 0x9a, 0x29, 0x88, 0x19, 0x63, 0xad, 0xab, 0x6e, 0xea, 0xd6, 0x4a, 0x68, + 0xc9, 0x0e, 0x8d, 0x5e, 0x14, 0x0f, 0x1a, 0x2c, 0x78, 0xb3, 0x46, 0xe8, 0xc1, 0x4b, 0x98, 0x4d, + 0x86, 0x75, 0x60, 0xb3, 0x6f, 0x3b, 0x3b, 0x11, 0x43, 0xf1, 0xe2, 0x45, 0x8f, 0x82, 0x7f, 0xa0, + 0x47, 0x8f, 0x1e, 0x3c, 0xfa, 0x03, 0x7a, 0x11, 0x8a, 0x5e, 0x3c, 0x89, 0x24, 0x82, 0xfe, 0x0c, + 0xc9, 0xcc, 0xec, 0xb6, 0xdd, 0x24, 0xd6, 0x4b, 0xc8, 0xbc, 0xef, 0xfb, 0xde, 0xf7, 0xbd, 0x79, + 0xb3, 0xc8, 0x89, 0xe8, 0x80, 0x09, 0x22, 0x58, 0x02, 0x42, 0x32, 0x41, 0x76, 0xfb, 0x4c, 0x0c, + 0xfc, 0x44, 0x80, 0x04, 0x7c, 0x4e, 0x61, 0x7e, 0x86, 0x39, 0x65, 0xda, 0xe3, 0x31, 0x10, 0xf5, + 0xab, 0x29, 0xce, 0x7a, 0x07, 0xd2, 0x1e, 0xa4, 0x24, 0xa0, 0x29, 0xd3, 0x5a, 0xf2, 0x62, 0x33, + 0x60, 0x92, 0x6e, 0x92, 0x84, 0x86, 0x3c, 0xa6, 0x92, 0x43, 0x6c, 0xb8, 0xee, 0x71, 0x6e, 0xc6, + 0xea, 0x00, 0xcf, 0xf0, 0xcb, 0x1a, 0x6f, 0xab, 0x13, 0xd1, 0x07, 0x03, 0x55, 0x42, 0x08, 0x41, + 0xd7, 0xc7, 0xff, 0x4c, 0xf5, 0x6a, 0x08, 0x10, 0x46, 0x8c, 0xd0, 0x84, 0x13, 0x1a, 0xc7, 0x20, + 0x95, 0x5b, 0xa6, 0xb9, 0x5e, 0x98, 0xac, 0xcb, 0x53, 0x29, 0x78, 0xd0, 0x3f, 0x96, 0xe8, 0x46, + 0x81, 0x02, 0x82, 0x76, 0x22, 0xd6, 0xce, 0xce, 0x86, 0x75, 0xa5, 0xc0, 0x4a, 0xa8, 0xa0, 0x3d, + 0xe3, 0xe2, 0x55, 0x10, 0x7e, 0x32, 0x1e, 0x7b, 0x5b, 0x15, 0x5b, 0x6c, 0xb7, 0xcf, 0x52, 0xe9, + 0x6d, 0xa3, 0x0b, 0x27, 0xaa, 0x69, 0x02, 0x71, 0xca, 0xf0, 0x1d, 0x34, 0xaf, 0xc5, 0xcb, 0xf6, + 0x8a, 0x5d, 0x5b, 0x6c, 0x2c, 0xf9, 0x27, 0x6f, 0xd8, 0xd7, 0xfc, 0x66, 0xe9, 0xe0, 0x47, 0xd5, + 0xfa, 0xf0, 0xfb, 0xe3, 0xba, 0xdd, 0x32, 0x02, 0xef, 0x12, 0xba, 0xa8, 0x3a, 0xb6, 0x0c, 0x35, + 0xb7, 0xda, 0x41, 0x4b, 0x45, 0xc0, 0xb8, 0xdd, 0x43, 0xa5, 0xac, 0xf1, 0xd8, 0x70, 0xae, 0xb6, + 0xd8, 0x70, 0x8b, 0x86, 0x8f, 0xd5, 0xc4, 0x99, 0xb6, 0x75, 0x24, 0xf0, 0x12, 0x74, 0x4d, 0xf5, + 0x7d, 0xc8, 0x22, 0x16, 0x52, 0x09, 0x22, 0x27, 0x69, 0x63, 0xbc, 0x85, 0xca, 0xdd, 0x0c, 0x6b, + 0xd3, 0x6e, 0x57, 0xb0, 0x54, 0xcf, 0x55, 0x6a, 0x2e, 0x7f, 0xfd, 0x54, 0xaf, 0x98, 0x05, 0x3e, + 0xd0, 0xc8, 0x53, 0x29, 0x78, 0x1c, 0xb6, 0xce, 0xe7, 0x12, 0x53, 0xbf, 0xbb, 0xf0, 0x76, 0xbf, + 0x6a, 0xfd, 0xd9, 0xaf, 0x5a, 0xde, 0x0e, 0x72, 0x67, 0x39, 0x9a, 0x89, 0x6e, 0xa3, 0x85, 0x2c, + 0xe0, 0xa9, 0x4e, 0x39, 0xb3, 0xf1, 0x65, 0x0e, 0x9d, 0x55, 0x8d, 0xf1, 0x1e, 0x9a, 0xd7, 0x37, + 0x8c, 0xbd, 0xe2, 0x45, 0x4c, 0x2e, 0xd1, 0x59, 0xfd, 0x27, 0x47, 0x47, 0xf2, 0x6a, 0xaf, 0xbf, + 0xfd, 0x7a, 0x7f, 0xc6, 0xc3, 0x2b, 0x44, 0xb2, 0x28, 0x02, 0x51, 0xe7, 0x40, 0xa6, 0xbe, 0x17, + 0xfc, 0xc6, 0x46, 0xa5, 0x7c, 0x49, 0x78, 0x6d, 0x6a, 0xf3, 0xe2, 0x76, 0x9d, 0x9b, 0xa7, 0xd1, + 0x4c, 0x8c, 0x0d, 0x15, 0x63, 0x0d, 0xaf, 0xce, 0x8e, 0x91, 0xaf, 0x16, 0x7f, 0xb6, 0x51, 0x79, + 0xe2, 0x92, 0x71, 0x7d, 0xaa, 0xd5, 0xac, 0xf5, 0x3b, 0xfe, 0xff, 0xd2, 0x4d, 0xc2, 0x47, 0x2a, + 0x61, 0x13, 0xdf, 0x9f, 0x9d, 0x30, 0x7f, 0x1b, 0xf5, 0xbc, 0xb4, 0x37, 0xf1, 0xc4, 0x5e, 0x35, + 0xb7, 0x0e, 0x86, 0xae, 0x7d, 0x38, 0x74, 0xed, 0x9f, 0x43, 0xd7, 0x7e, 0x37, 0x72, 0xad, 0xc3, + 0x91, 0x6b, 0x7d, 0x1f, 0xb9, 0xd6, 0xb3, 0x8d, 0x90, 0xcb, 0xe7, 0xfd, 0xc0, 0xef, 0x40, 0x6f, + 0xc2, 0xe5, 0xe5, 0x91, 0x8f, 0x1c, 0x24, 0x2c, 0x0d, 0xe6, 0xd5, 0x07, 0x7c, 0xeb, 0x6f, 0x00, + 0x00, 0x00, 0xff, 0xff, 0x24, 0xac, 0x72, 0x55, 0x02, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -840,20 +350,10 @@ const _ = grpc.SupportPackageIsVersion4 type QueryClient interface { // Parameters queries the parameters of the module. Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) - // Reporter queries the reporter of a reporter address. - Reporter(ctx context.Context, in *QueryReporterRequest, opts ...grpc.CallOption) (*QueryReporterResponse, error) // Reporters queries all the staked reporters. Reporters(ctx context.Context, in *QueryReportersRequest, opts ...grpc.CallOption) (*QueryReportersResponse, error) // DelegatorReporter queries the reporter of a delegator. DelegatorReporter(ctx context.Context, in *QueryDelegatorReporterRequest, opts ...grpc.CallOption) (*QueryDelegatorReporterResponse, error) - // ReporterStake queries the total tokens of a reporter. - ReporterStake(ctx context.Context, in *QueryReporterStakeRequest, opts ...grpc.CallOption) (*QueryReporterStakeResponse, error) - // DelegationRewards queries the total rewards accrued by a delegation. - DelegationRewards(ctx context.Context, in *QueryDelegationRewardsRequest, opts ...grpc.CallOption) (*QueryDelegationRewardsResponse, error) - // ReporterOutstandingRewards queries rewards of a reporter address. - ReporterOutstandingRewards(ctx context.Context, in *QueryReporterOutstandingRewardsRequest, opts ...grpc.CallOption) (*QueryReporterOutstandingRewardsResponse, error) - // ReporterCommission queries accumulated commission for a reporter. - ReporterCommission(ctx context.Context, in *QueryReporterCommissionRequest, opts ...grpc.CallOption) (*QueryReporterCommissionResponse, error) } type queryClient struct { @@ -873,15 +373,6 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts . return out, nil } -func (c *queryClient) Reporter(ctx context.Context, in *QueryReporterRequest, opts ...grpc.CallOption) (*QueryReporterResponse, error) { - out := new(QueryReporterResponse) - err := c.cc.Invoke(ctx, "/layer.reporter.Query/Reporter", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *queryClient) Reporters(ctx context.Context, in *QueryReportersRequest, opts ...grpc.CallOption) (*QueryReportersResponse, error) { out := new(QueryReportersResponse) err := c.cc.Invoke(ctx, "/layer.reporter.Query/Reporters", in, out, opts...) @@ -900,60 +391,14 @@ func (c *queryClient) DelegatorReporter(ctx context.Context, in *QueryDelegatorR return out, nil } -func (c *queryClient) ReporterStake(ctx context.Context, in *QueryReporterStakeRequest, opts ...grpc.CallOption) (*QueryReporterStakeResponse, error) { - out := new(QueryReporterStakeResponse) - err := c.cc.Invoke(ctx, "/layer.reporter.Query/ReporterStake", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) DelegationRewards(ctx context.Context, in *QueryDelegationRewardsRequest, opts ...grpc.CallOption) (*QueryDelegationRewardsResponse, error) { - out := new(QueryDelegationRewardsResponse) - err := c.cc.Invoke(ctx, "/layer.reporter.Query/DelegationRewards", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) ReporterOutstandingRewards(ctx context.Context, in *QueryReporterOutstandingRewardsRequest, opts ...grpc.CallOption) (*QueryReporterOutstandingRewardsResponse, error) { - out := new(QueryReporterOutstandingRewardsResponse) - err := c.cc.Invoke(ctx, "/layer.reporter.Query/ReporterOutstandingRewards", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) ReporterCommission(ctx context.Context, in *QueryReporterCommissionRequest, opts ...grpc.CallOption) (*QueryReporterCommissionResponse, error) { - out := new(QueryReporterCommissionResponse) - err := c.cc.Invoke(ctx, "/layer.reporter.Query/ReporterCommission", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - // QueryServer is the server API for Query service. type QueryServer interface { // Parameters queries the parameters of the module. Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) - // Reporter queries the reporter of a reporter address. - Reporter(context.Context, *QueryReporterRequest) (*QueryReporterResponse, error) // Reporters queries all the staked reporters. Reporters(context.Context, *QueryReportersRequest) (*QueryReportersResponse, error) // DelegatorReporter queries the reporter of a delegator. DelegatorReporter(context.Context, *QueryDelegatorReporterRequest) (*QueryDelegatorReporterResponse, error) - // ReporterStake queries the total tokens of a reporter. - ReporterStake(context.Context, *QueryReporterStakeRequest) (*QueryReporterStakeResponse, error) - // DelegationRewards queries the total rewards accrued by a delegation. - DelegationRewards(context.Context, *QueryDelegationRewardsRequest) (*QueryDelegationRewardsResponse, error) - // ReporterOutstandingRewards queries rewards of a reporter address. - ReporterOutstandingRewards(context.Context, *QueryReporterOutstandingRewardsRequest) (*QueryReporterOutstandingRewardsResponse, error) - // ReporterCommission queries accumulated commission for a reporter. - ReporterCommission(context.Context, *QueryReporterCommissionRequest) (*QueryReporterCommissionResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -963,27 +408,12 @@ type UnimplementedQueryServer struct { func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") } -func (*UnimplementedQueryServer) Reporter(ctx context.Context, req *QueryReporterRequest) (*QueryReporterResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Reporter not implemented") -} func (*UnimplementedQueryServer) Reporters(ctx context.Context, req *QueryReportersRequest) (*QueryReportersResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Reporters not implemented") } func (*UnimplementedQueryServer) DelegatorReporter(ctx context.Context, req *QueryDelegatorReporterRequest) (*QueryDelegatorReporterResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method DelegatorReporter not implemented") } -func (*UnimplementedQueryServer) ReporterStake(ctx context.Context, req *QueryReporterStakeRequest) (*QueryReporterStakeResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ReporterStake not implemented") -} -func (*UnimplementedQueryServer) DelegationRewards(ctx context.Context, req *QueryDelegationRewardsRequest) (*QueryDelegationRewardsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DelegationRewards not implemented") -} -func (*UnimplementedQueryServer) ReporterOutstandingRewards(ctx context.Context, req *QueryReporterOutstandingRewardsRequest) (*QueryReporterOutstandingRewardsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ReporterOutstandingRewards not implemented") -} -func (*UnimplementedQueryServer) ReporterCommission(ctx context.Context, req *QueryReporterCommissionRequest) (*QueryReporterCommissionResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ReporterCommission not implemented") -} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -1007,24 +437,6 @@ func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interf return interceptor(ctx, in, info, handler) } -func _Query_Reporter_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryReporterRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Reporter(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/layer.reporter.Query/Reporter", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Reporter(ctx, req.(*QueryReporterRequest)) - } - return interceptor(ctx, in, info, handler) -} - func _Query_Reporters_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryReportersRequest) if err := dec(in); err != nil { @@ -1061,78 +473,6 @@ func _Query_DelegatorReporter_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } -func _Query_ReporterStake_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryReporterStakeRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).ReporterStake(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/layer.reporter.Query/ReporterStake", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).ReporterStake(ctx, req.(*QueryReporterStakeRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_DelegationRewards_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryDelegationRewardsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).DelegationRewards(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/layer.reporter.Query/DelegationRewards", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).DelegationRewards(ctx, req.(*QueryDelegationRewardsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_ReporterOutstandingRewards_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryReporterOutstandingRewardsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).ReporterOutstandingRewards(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/layer.reporter.Query/ReporterOutstandingRewards", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).ReporterOutstandingRewards(ctx, req.(*QueryReporterOutstandingRewardsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_ReporterCommission_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryReporterCommissionRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).ReporterCommission(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/layer.reporter.Query/ReporterCommission", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).ReporterCommission(ctx, req.(*QueryReporterCommissionRequest)) - } - return interceptor(ctx, in, info, handler) -} - var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "layer.reporter.Query", HandlerType: (*QueryServer)(nil), @@ -1141,10 +481,6 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "Params", Handler: _Query_Params_Handler, }, - { - MethodName: "Reporter", - Handler: _Query_Reporter_Handler, - }, { MethodName: "Reporters", Handler: _Query_Reporters_Handler, @@ -1153,22 +489,6 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "DelegatorReporter", Handler: _Query_DelegatorReporter_Handler, }, - { - MethodName: "ReporterStake", - Handler: _Query_ReporterStake_Handler, - }, - { - MethodName: "DelegationRewards", - Handler: _Query_DelegationRewards_Handler, - }, - { - MethodName: "ReporterOutstandingRewards", - Handler: _Query_ReporterOutstandingRewards_Handler, - }, - { - MethodName: "ReporterCommission", - Handler: _Query_ReporterCommission_Handler, - }, }, Streams: []grpc.StreamDesc{}, Metadata: "layer/reporter/query.proto", @@ -1230,71 +550,6 @@ func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *QueryReporterRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryReporterRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryReporterRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ReporterAddress) > 0 { - i -= len(m.ReporterAddress) - copy(dAtA[i:], m.ReporterAddress) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ReporterAddress))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryReporterResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryReporterResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryReporterResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Reporter != nil { - { - size, err := m.Reporter.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func (m *QueryReportersRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1415,1252 +670,94 @@ func (m *QueryDelegatorReporterResponse) MarshalToSizedBuffer(dAtA []byte) (int, return len(dAtA) - i, nil } -func (m *QueryReporterStakeRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryReporterStakeRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryReporterStakeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ReporterAddress) > 0 { - i -= len(m.ReporterAddress) - copy(dAtA[i:], m.ReporterAddress) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ReporterAddress))) - i-- - dAtA[i] = 0xa +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ } - return len(dAtA) - i, nil + dAtA[offset] = uint8(v) + return base } - -func (m *QueryReporterStakeResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 } - return dAtA[:n], nil -} - -func (m *QueryReporterStakeResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryReporterStakeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i var l int _ = l - { - size := m.Stake.Size() - i -= size - if _, err := m.Stake.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil + return n } -func (m *QueryDelegationRewardsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 } - return dAtA[:n], nil -} - -func (m *QueryDelegationRewardsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryDelegationRewardsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i var l int _ = l - if len(m.ReporterAddress) > 0 { - i -= len(m.ReporterAddress) - copy(dAtA[i:], m.ReporterAddress) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ReporterAddress))) - i-- - dAtA[i] = 0x12 - } - if len(m.DelegatorAddress) > 0 { - i -= len(m.DelegatorAddress) - copy(dAtA[i:], m.DelegatorAddress) - i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddress))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryDelegationRewardsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + return n } -func (m *QueryDelegationRewardsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryDelegationRewardsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Rewards) > 0 { - for iNdEx := len(m.Rewards) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Rewards[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *QueryReporterOutstandingRewardsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryReporterOutstandingRewardsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryReporterOutstandingRewardsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ReporterAddress) > 0 { - i -= len(m.ReporterAddress) - copy(dAtA[i:], m.ReporterAddress) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ReporterAddress))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryReporterOutstandingRewardsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryReporterOutstandingRewardsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryReporterOutstandingRewardsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Rewards.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *QueryReporterCommissionRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryReporterCommissionRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryReporterCommissionRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ReporterAddress) > 0 { - i -= len(m.ReporterAddress) - copy(dAtA[i:], m.ReporterAddress) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ReporterAddress))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryReporterCommissionResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryReporterCommissionResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryReporterCommissionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Commission.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { - offset -= sovQuery(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *QueryParamsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryParamsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Params.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -func (m *QueryReporterRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ReporterAddress) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryReporterResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Reporter != nil { - l = m.Reporter.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryReportersRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryReportersResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Reporters) > 0 { - for _, e := range m.Reporters { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - return n -} - -func (m *QueryDelegatorReporterRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.DelegatorAddress) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryDelegatorReporterResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Reporter) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryReporterStakeRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ReporterAddress) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryReporterStakeResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Stake.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -func (m *QueryDelegationRewardsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.DelegatorAddress) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.ReporterAddress) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryDelegationRewardsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Rewards) > 0 { - for _, e := range m.Rewards { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - return n -} - -func (m *QueryReporterOutstandingRewardsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ReporterAddress) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryReporterOutstandingRewardsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Rewards.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -func (m *QueryReporterCommissionRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ReporterAddress) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryReporterCommissionResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Commission.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -func sovQuery(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozQuery(x uint64) (n int) { - return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryReporterRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryReporterRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryReporterRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ReporterAddress", 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.ReporterAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryReporterResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryReporterResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryReporterResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Reporter", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Reporter == nil { - m.Reporter = &OracleReporter{} - } - if err := m.Reporter.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryReportersRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryReportersRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryReportersRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryReportersResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryReportersResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryReportersResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Reporters", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Reporters = append(m.Reporters, &OracleReporter{}) - if err := m.Reporters[len(m.Reporters)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryDelegatorReporterRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryDelegatorReporterRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDelegatorReporterRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", 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.DelegatorAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryDelegatorReporterResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryDelegatorReporterResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDelegatorReporterResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Reporter", 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.Reporter = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryReporterStakeRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryReporterStakeRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryReporterStakeRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ReporterAddress", 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.ReporterAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF +func (m *QueryReportersRequest) Size() (n int) { + if m == nil { + return 0 } - return nil + var l int + _ = l + return n } -func (m *QueryReporterStakeResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryReporterStakeResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryReporterStakeResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Stake", 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 - } - if err := m.Stake.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy + +func (m *QueryReportersResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Reporters) > 0 { + for _, e := range m.Reporters { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) } } + return n +} - if iNdEx > l { - return io.ErrUnexpectedEOF +func (m *QueryDelegatorReporterRequest) Size() (n int) { + if m == nil { + return 0 } - return nil + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryDelegatorReporterResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Reporter) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *QueryDelegationRewardsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2683,76 +780,12 @@ func (m *QueryDelegationRewardsRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryDelegationRewardsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDelegationRewardsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", 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.DelegatorAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ReporterAddress", 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.ReporterAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -2774,7 +807,7 @@ func (m *QueryDelegationRewardsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryDelegationRewardsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2797,15 +830,15 @@ func (m *QueryDelegationRewardsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryDelegationRewardsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDelegationRewardsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Rewards", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2832,8 +865,7 @@ func (m *QueryDelegationRewardsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Rewards = append(m.Rewards, types.DecCoin{}) - if err := m.Rewards[len(m.Rewards)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -2858,7 +890,7 @@ func (m *QueryDelegationRewardsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryReporterOutstandingRewardsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryReportersRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2881,44 +913,12 @@ func (m *QueryReporterOutstandingRewardsRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryReporterOutstandingRewardsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryReportersRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryReporterOutstandingRewardsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryReportersRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ReporterAddress", 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.ReporterAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -2940,7 +940,7 @@ func (m *QueryReporterOutstandingRewardsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryReporterOutstandingRewardsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryReportersResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2963,15 +963,15 @@ func (m *QueryReporterOutstandingRewardsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryReporterOutstandingRewardsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryReportersResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryReporterOutstandingRewardsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryReportersResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Rewards", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Reporters", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2998,7 +998,8 @@ func (m *QueryReporterOutstandingRewardsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Rewards.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Reporters = append(m.Reporters, &OracleReporter{}) + if err := m.Reporters[len(m.Reporters)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -3023,7 +1024,7 @@ func (m *QueryReporterOutstandingRewardsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryReporterCommissionRequest) Unmarshal(dAtA []byte) error { +func (m *QueryDelegatorReporterRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3046,15 +1047,15 @@ func (m *QueryReporterCommissionRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryReporterCommissionRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryDelegatorReporterRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryReporterCommissionRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryDelegatorReporterRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ReporterAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3082,7 +1083,7 @@ func (m *QueryReporterCommissionRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ReporterAddress = string(dAtA[iNdEx:postIndex]) + m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -3105,7 +1106,7 @@ func (m *QueryReporterCommissionRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryReporterCommissionResponse) Unmarshal(dAtA []byte) error { +func (m *QueryDelegatorReporterResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3128,17 +1129,17 @@ func (m *QueryReporterCommissionResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryReporterCommissionResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryDelegatorReporterResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryReporterCommissionResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryDelegatorReporterResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Commission", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Reporter", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -3148,24 +1149,23 @@ func (m *QueryReporterCommissionResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Commission.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Reporter = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex diff --git a/x/reporter/types/query.pb.gw.go b/x/reporter/types/query.pb.gw.go index 1c12b051a..77139a172 100644 --- a/x/reporter/types/query.pb.gw.go +++ b/x/reporter/types/query.pb.gw.go @@ -51,60 +51,6 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal } -func request_Query_Reporter_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryReporterRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["reporter_address"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "reporter_address") - } - - protoReq.ReporterAddress, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "reporter_address", err) - } - - msg, err := client.Reporter(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_Reporter_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryReporterRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["reporter_address"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "reporter_address") - } - - protoReq.ReporterAddress, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "reporter_address", err) - } - - msg, err := server.Reporter(ctx, &protoReq) - return msg, metadata, err - -} - func request_Query_Reporters_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryReportersRequest var metadata runtime.ServerMetadata @@ -177,244 +123,6 @@ func local_request_Query_DelegatorReporter_0(ctx context.Context, marshaler runt } -func request_Query_ReporterStake_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryReporterStakeRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["reporter_address"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "reporter_address") - } - - protoReq.ReporterAddress, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "reporter_address", err) - } - - msg, err := client.ReporterStake(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_ReporterStake_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryReporterStakeRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["reporter_address"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "reporter_address") - } - - protoReq.ReporterAddress, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "reporter_address", err) - } - - msg, err := server.ReporterStake(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_DelegationRewards_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryDelegationRewardsRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["delegator_address"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "delegator_address") - } - - protoReq.DelegatorAddress, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "delegator_address", err) - } - - val, ok = pathParams["reporter_address"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "reporter_address") - } - - protoReq.ReporterAddress, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "reporter_address", err) - } - - msg, err := client.DelegationRewards(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_DelegationRewards_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryDelegationRewardsRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["delegator_address"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "delegator_address") - } - - protoReq.DelegatorAddress, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "delegator_address", err) - } - - val, ok = pathParams["reporter_address"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "reporter_address") - } - - protoReq.ReporterAddress, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "reporter_address", err) - } - - msg, err := server.DelegationRewards(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_ReporterOutstandingRewards_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryReporterOutstandingRewardsRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["reporter_address"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "reporter_address") - } - - protoReq.ReporterAddress, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "reporter_address", err) - } - - msg, err := client.ReporterOutstandingRewards(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_ReporterOutstandingRewards_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryReporterOutstandingRewardsRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["reporter_address"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "reporter_address") - } - - protoReq.ReporterAddress, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "reporter_address", err) - } - - msg, err := server.ReporterOutstandingRewards(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_ReporterCommission_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryReporterCommissionRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["reporter_address"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "reporter_address") - } - - protoReq.ReporterAddress, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "reporter_address", err) - } - - msg, err := client.ReporterCommission(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_ReporterCommission_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryReporterCommissionRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["reporter_address"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "reporter_address") - } - - protoReq.ReporterAddress, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "reporter_address", err) - } - - msg, err := server.ReporterCommission(ctx, &protoReq) - return msg, metadata, err - -} - // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -444,29 +152,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_Reporter_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_Reporter_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Reporter_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_Query_Reporters_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -513,98 +198,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_ReporterStake_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_ReporterStake_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_ReporterStake_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_DelegationRewards_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_DelegationRewards_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_DelegationRewards_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_ReporterOutstandingRewards_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_ReporterOutstandingRewards_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_ReporterOutstandingRewards_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_ReporterCommission_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_ReporterCommission_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_ReporterCommission_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - return nil } @@ -666,26 +259,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_Reporter_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_Reporter_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Reporter_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_Query_Reporters_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -726,121 +299,21 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_ReporterStake_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_ReporterStake_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_ReporterStake_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_DelegationRewards_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_DelegationRewards_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_DelegationRewards_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_ReporterOutstandingRewards_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_ReporterOutstandingRewards_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_ReporterOutstandingRewards_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_ReporterCommission_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_ReporterCommission_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_ReporterCommission_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - return nil } var ( pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"tellor-io", "layer", "reporter", "params"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_Reporter_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"tellor-io", "layer", "reporter", "reporter_address"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_Reporters_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"tellor-io", "layer", "reporter", "reporters"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_DelegatorReporter_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"tellor-io", "layer", "reporter", "delegator-reporter", "delegator_address"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_ReporterStake_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"tellor-io", "layer", "reporter", "reporter-stake", "reporter_address"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_DelegationRewards_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"tellor-io", "layer", "reporter", "delegation-rewards", "delegator_address", "reporter_address"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_ReporterOutstandingRewards_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"tellor-io", "layer", "reporter", "outstanding-rewards", "reporter_address"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_ReporterCommission_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"tellor-io", "layer", "reporter", "commission", "reporter_address"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( forward_Query_Params_0 = runtime.ForwardResponseMessage - forward_Query_Reporter_0 = runtime.ForwardResponseMessage - forward_Query_Reporters_0 = runtime.ForwardResponseMessage forward_Query_DelegatorReporter_0 = runtime.ForwardResponseMessage - - forward_Query_ReporterStake_0 = runtime.ForwardResponseMessage - - forward_Query_DelegationRewards_0 = runtime.ForwardResponseMessage - - forward_Query_ReporterOutstandingRewards_0 = runtime.ForwardResponseMessage - - forward_Query_ReporterCommission_0 = runtime.ForwardResponseMessage ) diff --git a/x/reporter/types/token_origin.pb.go b/x/reporter/types/token_origin.pb.go index f4128e59a..51eb0e04b 100644 --- a/x/reporter/types/token_origin.pb.go +++ b/x/reporter/types/token_origin.pb.go @@ -26,65 +26,21 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// TokenOrigin is a message to store the origin of a token -type TokenOrigin struct { - // validator_address is the address of the validator that tokens in staking are delegated to - ValidatorAddress []byte `protobuf:"bytes,1,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` - // amount is the amount of tokens to be delegated to a reporter from a delegation in staking - Amount cosmossdk_io_math.Int `protobuf:"bytes,2,opt,name=amount,proto3,customtype=cosmossdk.io/math.Int" json:"amount"` -} - -func (m *TokenOrigin) Reset() { *m = TokenOrigin{} } -func (m *TokenOrigin) String() string { return proto.CompactTextString(m) } -func (*TokenOrigin) ProtoMessage() {} -func (*TokenOrigin) Descriptor() ([]byte, []int) { - return fileDescriptor_bf34edebb26f68f4, []int{0} -} -func (m *TokenOrigin) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *TokenOrigin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_TokenOrigin.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *TokenOrigin) XXX_Merge(src proto.Message) { - xxx_messageInfo_TokenOrigin.Merge(m, src) -} -func (m *TokenOrigin) XXX_Size() int { - return m.Size() -} -func (m *TokenOrigin) XXX_DiscardUnknown() { - xxx_messageInfo_TokenOrigin.DiscardUnknown(m) -} - -var xxx_messageInfo_TokenOrigin proto.InternalMessageInfo - -func (m *TokenOrigin) GetValidatorAddress() []byte { - if m != nil { - return m.ValidatorAddress - } - return nil -} - +// TokenOriginInfo is the struct that holds the data of where tokens are staked type TokenOriginInfo struct { - DelegatorAddress []byte `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` - ValidatorAddress []byte `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` - Amount cosmossdk_io_math.Int `protobuf:"bytes,3,opt,name=amount,proto3,customtype=cosmossdk.io/math.Int" json:"amount"` + // delegator_address is the address of the delegator + DelegatorAddress []byte `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` + // validator_address is the address of the validator + ValidatorAddress []byte `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` + // amount is the amount of tokens staked + Amount cosmossdk_io_math.Int `protobuf:"bytes,3,opt,name=amount,proto3,customtype=cosmossdk.io/math.Int" json:"amount"` } func (m *TokenOriginInfo) Reset() { *m = TokenOriginInfo{} } func (m *TokenOriginInfo) String() string { return proto.CompactTextString(m) } func (*TokenOriginInfo) ProtoMessage() {} func (*TokenOriginInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_bf34edebb26f68f4, []int{1} + return fileDescriptor_bf34edebb26f68f4, []int{0} } func (m *TokenOriginInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -127,24 +83,26 @@ func (m *TokenOriginInfo) GetValidatorAddress() []byte { return nil } -// reporter's snapshot of delegators' sources pre unbonding -type DelegationsPreUpdate struct { - // token_origin is the origin of the tokens that are about to be updated +// DelegationsAmounts is the struct that holds the data of delegations and amounts and the total +type DelegationsAmounts struct { + // token_origins is the list of token origins for and where the amounts are staked TokenOrigins []*TokenOriginInfo `protobuf:"bytes,1,rep,name=token_origins,json=tokenOrigins,proto3" json:"token_origins,omitempty"` + // total amount of tokens in the list + Total cosmossdk_io_math.Int `protobuf:"bytes,2,opt,name=total,proto3,customtype=cosmossdk.io/math.Int" json:"total"` } -func (m *DelegationsPreUpdate) Reset() { *m = DelegationsPreUpdate{} } -func (m *DelegationsPreUpdate) String() string { return proto.CompactTextString(m) } -func (*DelegationsPreUpdate) ProtoMessage() {} -func (*DelegationsPreUpdate) Descriptor() ([]byte, []int) { - return fileDescriptor_bf34edebb26f68f4, []int{2} +func (m *DelegationsAmounts) Reset() { *m = DelegationsAmounts{} } +func (m *DelegationsAmounts) String() string { return proto.CompactTextString(m) } +func (*DelegationsAmounts) ProtoMessage() {} +func (*DelegationsAmounts) Descriptor() ([]byte, []int) { + return fileDescriptor_bf34edebb26f68f4, []int{1} } -func (m *DelegationsPreUpdate) XXX_Unmarshal(b []byte) error { +func (m *DelegationsAmounts) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *DelegationsPreUpdate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *DelegationsAmounts) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_DelegationsPreUpdate.Marshal(b, m, deterministic) + return xxx_messageInfo_DelegationsAmounts.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -154,19 +112,19 @@ func (m *DelegationsPreUpdate) XXX_Marshal(b []byte, deterministic bool) ([]byte return b[:n], nil } } -func (m *DelegationsPreUpdate) XXX_Merge(src proto.Message) { - xxx_messageInfo_DelegationsPreUpdate.Merge(m, src) +func (m *DelegationsAmounts) XXX_Merge(src proto.Message) { + xxx_messageInfo_DelegationsAmounts.Merge(m, src) } -func (m *DelegationsPreUpdate) XXX_Size() int { +func (m *DelegationsAmounts) XXX_Size() int { return m.Size() } -func (m *DelegationsPreUpdate) XXX_DiscardUnknown() { - xxx_messageInfo_DelegationsPreUpdate.DiscardUnknown(m) +func (m *DelegationsAmounts) XXX_DiscardUnknown() { + xxx_messageInfo_DelegationsAmounts.DiscardUnknown(m) } -var xxx_messageInfo_DelegationsPreUpdate proto.InternalMessageInfo +var xxx_messageInfo_DelegationsAmounts proto.InternalMessageInfo -func (m *DelegationsPreUpdate) GetTokenOrigins() []*TokenOriginInfo { +func (m *DelegationsAmounts) GetTokenOrigins() []*TokenOriginInfo { if m != nil { return m.TokenOrigins } @@ -174,77 +132,36 @@ func (m *DelegationsPreUpdate) GetTokenOrigins() []*TokenOriginInfo { } func init() { - proto.RegisterType((*TokenOrigin)(nil), "layer.reporter.TokenOrigin") proto.RegisterType((*TokenOriginInfo)(nil), "layer.reporter.TokenOriginInfo") - proto.RegisterType((*DelegationsPreUpdate)(nil), "layer.reporter.DelegationsPreUpdate") + proto.RegisterType((*DelegationsAmounts)(nil), "layer.reporter.DelegationsAmounts") } func init() { proto.RegisterFile("layer/reporter/token_origin.proto", fileDescriptor_bf34edebb26f68f4) } var fileDescriptor_bf34edebb26f68f4 = []byte{ - // 349 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x92, 0x4f, 0x4b, 0x02, 0x41, - 0x18, 0xc6, 0x77, 0x15, 0x84, 0x46, 0xfb, 0xe3, 0x62, 0x60, 0x1e, 0x56, 0xf3, 0x24, 0x88, 0x33, - 0x50, 0x9f, 0x20, 0xb3, 0x83, 0xa7, 0x42, 0xea, 0x12, 0x81, 0x8c, 0xee, 0xb4, 0x0e, 0xee, 0xce, - 0xbb, 0xcc, 0x8c, 0x91, 0xa7, 0xbe, 0x42, 0x1f, 0xa5, 0x43, 0x1f, 0xc2, 0xa3, 0x74, 0x8a, 0x0e, - 0x12, 0xfa, 0x45, 0x62, 0x77, 0xd4, 0x2c, 0x84, 0xa0, 0xcb, 0x30, 0xef, 0xf3, 0xbe, 0xc3, 0xf3, - 0x1b, 0x9e, 0x17, 0x1d, 0x07, 0x74, 0xcc, 0x24, 0x91, 0x2c, 0x02, 0xa9, 0x99, 0x24, 0x1a, 0x86, - 0x4c, 0x74, 0x41, 0x72, 0x9f, 0x0b, 0x1c, 0x49, 0xd0, 0xe0, 0xec, 0x25, 0x23, 0x78, 0x35, 0x52, - 0xca, 0xd3, 0x90, 0x0b, 0x20, 0xc9, 0x69, 0x46, 0x4a, 0x47, 0x7d, 0x50, 0x21, 0xa8, 0x6e, 0x52, - 0x11, 0x53, 0x2c, 0x5b, 0x05, 0x1f, 0x7c, 0x30, 0x7a, 0x7c, 0x33, 0x6a, 0xf5, 0x09, 0x65, 0xaf, - 0x63, 0xa7, 0xcb, 0xc4, 0xc8, 0xa9, 0xa3, 0xfc, 0x03, 0x0d, 0xb8, 0x47, 0x35, 0xc8, 0x2e, 0xf5, - 0x3c, 0xc9, 0x94, 0x2a, 0xda, 0x15, 0xbb, 0x96, 0xeb, 0x1c, 0xac, 0x1b, 0x67, 0x46, 0x77, 0xce, - 0x51, 0x86, 0x86, 0x30, 0x12, 0xba, 0x98, 0xaa, 0xd8, 0xb5, 0x9d, 0x66, 0x7d, 0x32, 0x2b, 0x5b, - 0x1f, 0xb3, 0xf2, 0xa1, 0xf1, 0x55, 0xde, 0x10, 0x73, 0x20, 0x21, 0xd5, 0x03, 0xdc, 0x16, 0xfa, - 0xed, 0xb5, 0x81, 0x96, 0x40, 0x6d, 0xa1, 0x3b, 0xcb, 0xa7, 0xd5, 0x17, 0x1b, 0xed, 0x6f, 0x10, - 0xb4, 0xc5, 0x3d, 0xc4, 0x14, 0x1e, 0x0b, 0x98, 0xbf, 0x8d, 0x62, 0xdd, 0x58, 0x51, 0x6c, 0x45, - 0x4e, 0xfd, 0x89, 0x9c, 0xfe, 0x3f, 0xf2, 0x1d, 0x2a, 0xb4, 0x0c, 0x05, 0x07, 0xa1, 0xae, 0x24, - 0xbb, 0x89, 0x3c, 0xaa, 0x99, 0xd3, 0x42, 0xbb, 0x9b, 0xa9, 0xc5, 0xc8, 0xe9, 0x5a, 0xf6, 0xa4, - 0x8c, 0x7f, 0xe6, 0x86, 0x7f, 0x7d, 0xb7, 0x93, 0xd3, 0xdf, 0x82, 0x6a, 0x5e, 0x4c, 0xe6, 0xae, - 0x3d, 0x9d, 0xbb, 0xf6, 0xe7, 0xdc, 0xb5, 0x9f, 0x17, 0xae, 0x35, 0x5d, 0xb8, 0xd6, 0xfb, 0xc2, - 0xb5, 0x6e, 0xeb, 0x3e, 0xd7, 0x83, 0x51, 0x0f, 0xf7, 0x21, 0x24, 0x9a, 0x05, 0x01, 0xc8, 0x06, - 0x07, 0x62, 0xf6, 0xe6, 0x71, 0x63, 0x73, 0xc6, 0x11, 0x53, 0xbd, 0x4c, 0x92, 0xef, 0xe9, 0x57, - 0x00, 0x00, 0x00, 0xff, 0xff, 0xd4, 0x45, 0xf3, 0x83, 0x58, 0x02, 0x00, 0x00, -} - -func (m *TokenOrigin) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *TokenOrigin) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *TokenOrigin) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.Amount.Size() - i -= size - if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTokenOrigin(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if len(m.ValidatorAddress) > 0 { - i -= len(m.ValidatorAddress) - copy(dAtA[i:], m.ValidatorAddress) - i = encodeVarintTokenOrigin(dAtA, i, uint64(len(m.ValidatorAddress))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil + // 342 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x91, 0xcf, 0x4e, 0x02, 0x31, + 0x10, 0xc6, 0xb7, 0x12, 0x49, 0xac, 0xf8, 0x87, 0x8d, 0x26, 0xc8, 0x61, 0x41, 0x4e, 0x24, 0x84, + 0x36, 0xd1, 0x27, 0x00, 0xf1, 0xc0, 0xc9, 0x84, 0x78, 0xf2, 0x42, 0x0a, 0x5b, 0x97, 0x86, 0xdd, + 0x0e, 0x69, 0x8b, 0x91, 0xb7, 0xf0, 0x05, 0x7c, 0x07, 0x0f, 0x3e, 0x04, 0x47, 0xe2, 0xc9, 0x78, + 0x20, 0x06, 0x5e, 0xc4, 0x6c, 0x0b, 0x08, 0xde, 0xbc, 0x34, 0x9d, 0x6f, 0x7e, 0x93, 0xf9, 0x66, + 0x06, 0x5f, 0xc6, 0x6c, 0xc2, 0x15, 0x55, 0x7c, 0x04, 0xca, 0x70, 0x45, 0x0d, 0x0c, 0xb9, 0xec, + 0x82, 0x12, 0x91, 0x90, 0x64, 0xa4, 0xc0, 0x80, 0x7f, 0x6c, 0x11, 0xb2, 0x46, 0x8a, 0x79, 0x96, + 0x08, 0x09, 0xd4, 0xbe, 0x0e, 0x29, 0x5e, 0xf4, 0x41, 0x27, 0xa0, 0xbb, 0x36, 0xa2, 0x2e, 0x58, + 0xa5, 0xce, 0x22, 0x88, 0xc0, 0xe9, 0xe9, 0xcf, 0xa9, 0x95, 0x37, 0x84, 0x4f, 0xee, 0xd3, 0x56, + 0x77, 0xb6, 0x53, 0x5b, 0x3e, 0x82, 0x5f, 0xc3, 0xf9, 0x90, 0xc7, 0x3c, 0x62, 0x06, 0x54, 0x97, + 0x85, 0xa1, 0xe2, 0x5a, 0x17, 0x50, 0x19, 0x55, 0x73, 0x9d, 0xd3, 0x4d, 0xa2, 0xe1, 0xf4, 0x14, + 0x7e, 0x62, 0xb1, 0x08, 0x77, 0xe0, 0x3d, 0x07, 0x6f, 0x12, 0x6b, 0xf8, 0x06, 0x67, 0x59, 0x02, + 0x63, 0x69, 0x0a, 0x99, 0x32, 0xaa, 0x1e, 0x34, 0x6b, 0xd3, 0x79, 0xc9, 0xfb, 0x9a, 0x97, 0xce, + 0x9d, 0x53, 0x1d, 0x0e, 0x89, 0x00, 0x9a, 0x30, 0x33, 0x20, 0x6d, 0x69, 0x3e, 0xde, 0xeb, 0x78, + 0x35, 0x42, 0x5b, 0x9a, 0xce, 0xaa, 0xb4, 0xf2, 0x8a, 0xb0, 0xdf, 0x72, 0x36, 0x04, 0x48, 0xdd, + 0xb0, 0xaa, 0xf6, 0x5b, 0xf8, 0x68, 0x7b, 0x67, 0xa9, 0xe3, 0x4c, 0xf5, 0xf0, 0xaa, 0x44, 0x76, + 0xb7, 0x46, 0xfe, 0x4c, 0xdb, 0xc9, 0x99, 0x5f, 0x41, 0xfb, 0x0d, 0xbc, 0x6f, 0xc0, 0xb0, 0xd8, + 0x8e, 0xf0, 0x4f, 0x83, 0xae, 0xb2, 0x79, 0x3b, 0x5d, 0x04, 0x68, 0xb6, 0x08, 0xd0, 0xf7, 0x22, + 0x40, 0x2f, 0xcb, 0xc0, 0x9b, 0x2d, 0x03, 0xef, 0x73, 0x19, 0x78, 0x0f, 0xb5, 0x48, 0x98, 0xc1, + 0xb8, 0x47, 0xfa, 0x90, 0x50, 0xc3, 0xe3, 0x18, 0x54, 0x5d, 0x00, 0x75, 0x87, 0x7f, 0xde, 0x3a, + 0xfd, 0x64, 0xc4, 0x75, 0x2f, 0x6b, 0x0f, 0x74, 0xfd, 0x13, 0x00, 0x00, 0xff, 0xff, 0x41, 0x00, + 0xe6, 0xb5, 0x19, 0x02, 0x00, 0x00, } func (m *TokenOriginInfo) Marshal() (dAtA []byte, err error) { @@ -294,7 +211,7 @@ func (m *TokenOriginInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *DelegationsPreUpdate) Marshal() (dAtA []byte, err error) { +func (m *DelegationsAmounts) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -304,16 +221,26 @@ func (m *DelegationsPreUpdate) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *DelegationsPreUpdate) MarshalTo(dAtA []byte) (int, error) { +func (m *DelegationsAmounts) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *DelegationsPreUpdate) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *DelegationsAmounts) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l + { + size := m.Total.Size() + i -= size + if _, err := m.Total.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTokenOrigin(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 if len(m.TokenOrigins) > 0 { for iNdEx := len(m.TokenOrigins) - 1; iNdEx >= 0; iNdEx-- { { @@ -342,21 +269,6 @@ func encodeVarintTokenOrigin(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *TokenOrigin) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ValidatorAddress) - if l > 0 { - n += 1 + l + sovTokenOrigin(uint64(l)) - } - l = m.Amount.Size() - n += 1 + l + sovTokenOrigin(uint64(l)) - return n -} - func (m *TokenOriginInfo) Size() (n int) { if m == nil { return 0 @@ -376,7 +288,7 @@ func (m *TokenOriginInfo) Size() (n int) { return n } -func (m *DelegationsPreUpdate) Size() (n int) { +func (m *DelegationsAmounts) Size() (n int) { if m == nil { return 0 } @@ -388,6 +300,8 @@ func (m *DelegationsPreUpdate) Size() (n int) { n += 1 + l + sovTokenOrigin(uint64(l)) } } + l = m.Total.Size() + n += 1 + l + sovTokenOrigin(uint64(l)) return n } @@ -397,124 +311,6 @@ func sovTokenOrigin(x uint64) (n int) { func sozTokenOrigin(x uint64) (n int) { return sovTokenOrigin(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *TokenOrigin) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTokenOrigin - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: TokenOrigin: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: TokenOrigin: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTokenOrigin - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTokenOrigin - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTokenOrigin - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ValidatorAddress = append(m.ValidatorAddress[:0], dAtA[iNdEx:postIndex]...) - if m.ValidatorAddress == nil { - m.ValidatorAddress = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTokenOrigin - } - 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 ErrInvalidLengthTokenOrigin - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTokenOrigin - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTokenOrigin(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTokenOrigin - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *TokenOriginInfo) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -667,7 +463,7 @@ func (m *TokenOriginInfo) Unmarshal(dAtA []byte) error { } return nil } -func (m *DelegationsPreUpdate) Unmarshal(dAtA []byte) error { +func (m *DelegationsAmounts) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -690,10 +486,10 @@ func (m *DelegationsPreUpdate) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: DelegationsPreUpdate: wiretype end group for non-group") + return fmt.Errorf("proto: DelegationsAmounts: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: DelegationsPreUpdate: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: DelegationsAmounts: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -730,6 +526,40 @@ func (m *DelegationsPreUpdate) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Total", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTokenOrigin + } + 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 ErrInvalidLengthTokenOrigin + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTokenOrigin + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Total.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTokenOrigin(dAtA[iNdEx:]) diff --git a/x/reporter/types/tx.pb.go b/x/reporter/types/tx.pb.go index d04af9991..5ad5dbcda 100644 --- a/x/reporter/types/tx.pb.go +++ b/x/reporter/types/tx.pb.go @@ -5,11 +5,9 @@ package types import ( context "context" - cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - types1 "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/cosmos-sdk/types/msgservice" _ "github.com/cosmos/cosmos-sdk/types/tx/amino" types "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -129,10 +127,8 @@ func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo type MsgCreateReporter struct { - Reporter string `protobuf:"bytes,1,opt,name=reporter,proto3" json:"reporter,omitempty"` - Amount cosmossdk_io_math.Int `protobuf:"bytes,2,opt,name=amount,proto3,customtype=cosmossdk.io/math.Int" json:"amount"` - TokenOrigins []*TokenOrigin `protobuf:"bytes,3,rep,name=token_origins,json=tokenOrigins,proto3" json:"token_origins,omitempty"` - Commission *types.Commission `protobuf:"bytes,4,opt,name=commission,proto3" json:"commission,omitempty"` + ReporterAddress string `protobuf:"bytes,1,opt,name=reporter_address,json=reporterAddress,proto3" json:"reporter_address,omitempty"` + Commission *types.Commission `protobuf:"bytes,2,opt,name=commission,proto3" json:"commission,omitempty"` } func (m *MsgCreateReporter) Reset() { *m = MsgCreateReporter{} } @@ -168,20 +164,13 @@ func (m *MsgCreateReporter) XXX_DiscardUnknown() { var xxx_messageInfo_MsgCreateReporter proto.InternalMessageInfo -func (m *MsgCreateReporter) GetReporter() string { +func (m *MsgCreateReporter) GetReporterAddress() string { if m != nil { - return m.Reporter + return m.ReporterAddress } return "" } -func (m *MsgCreateReporter) GetTokenOrigins() []*TokenOrigin { - if m != nil { - return m.TokenOrigins - } - return nil -} - func (m *MsgCreateReporter) GetCommission() *types.Commission { if m != nil { return m.Commission @@ -225,25 +214,23 @@ func (m *MsgCreateReporterResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgCreateReporterResponse proto.InternalMessageInfo -type MsgDelegateReporter struct { - Delegator string `protobuf:"bytes,1,opt,name=delegator,proto3" json:"delegator,omitempty"` - Reporter string `protobuf:"bytes,2,opt,name=reporter,proto3" json:"reporter,omitempty"` - Amount cosmossdk_io_math.Int `protobuf:"bytes,3,opt,name=amount,proto3,customtype=cosmossdk.io/math.Int" json:"amount"` - TokenOrigins []*TokenOrigin `protobuf:"bytes,4,rep,name=token_origins,json=tokenOrigins,proto3" json:"token_origins,omitempty"` +type MsgChangeReporter struct { + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` + ReporterAddress string `protobuf:"bytes,2,opt,name=reporter_address,json=reporterAddress,proto3" json:"reporter_address,omitempty"` } -func (m *MsgDelegateReporter) Reset() { *m = MsgDelegateReporter{} } -func (m *MsgDelegateReporter) String() string { return proto.CompactTextString(m) } -func (*MsgDelegateReporter) ProtoMessage() {} -func (*MsgDelegateReporter) Descriptor() ([]byte, []int) { +func (m *MsgChangeReporter) Reset() { *m = MsgChangeReporter{} } +func (m *MsgChangeReporter) String() string { return proto.CompactTextString(m) } +func (*MsgChangeReporter) ProtoMessage() {} +func (*MsgChangeReporter) Descriptor() ([]byte, []int) { return fileDescriptor_67b904a7aa978eb1, []int{4} } -func (m *MsgDelegateReporter) XXX_Unmarshal(b []byte) error { +func (m *MsgChangeReporter) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgDelegateReporter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgChangeReporter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgDelegateReporter.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgChangeReporter.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -253,310 +240,47 @@ func (m *MsgDelegateReporter) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } -func (m *MsgDelegateReporter) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgDelegateReporter.Merge(m, src) +func (m *MsgChangeReporter) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgChangeReporter.Merge(m, src) } -func (m *MsgDelegateReporter) XXX_Size() int { +func (m *MsgChangeReporter) XXX_Size() int { return m.Size() } -func (m *MsgDelegateReporter) XXX_DiscardUnknown() { - xxx_messageInfo_MsgDelegateReporter.DiscardUnknown(m) +func (m *MsgChangeReporter) XXX_DiscardUnknown() { + xxx_messageInfo_MsgChangeReporter.DiscardUnknown(m) } -var xxx_messageInfo_MsgDelegateReporter proto.InternalMessageInfo +var xxx_messageInfo_MsgChangeReporter proto.InternalMessageInfo -func (m *MsgDelegateReporter) GetDelegator() string { +func (m *MsgChangeReporter) GetDelegatorAddress() string { if m != nil { - return m.Delegator + return m.DelegatorAddress } return "" } -func (m *MsgDelegateReporter) GetReporter() string { +func (m *MsgChangeReporter) GetReporterAddress() string { if m != nil { - return m.Reporter + return m.ReporterAddress } return "" } -func (m *MsgDelegateReporter) GetTokenOrigins() []*TokenOrigin { - if m != nil { - return m.TokenOrigins - } - return nil -} - -// MsgDelegateReporterResponse defines the response structure for executing a MsgDelegateReporter message. -type MsgDelegateReporterResponse struct { +type MsgChangeReporterResponse struct { } -func (m *MsgDelegateReporterResponse) Reset() { *m = MsgDelegateReporterResponse{} } -func (m *MsgDelegateReporterResponse) String() string { return proto.CompactTextString(m) } -func (*MsgDelegateReporterResponse) ProtoMessage() {} -func (*MsgDelegateReporterResponse) Descriptor() ([]byte, []int) { +func (m *MsgChangeReporterResponse) Reset() { *m = MsgChangeReporterResponse{} } +func (m *MsgChangeReporterResponse) String() string { return proto.CompactTextString(m) } +func (*MsgChangeReporterResponse) ProtoMessage() {} +func (*MsgChangeReporterResponse) Descriptor() ([]byte, []int) { return fileDescriptor_67b904a7aa978eb1, []int{5} } -func (m *MsgDelegateReporterResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgDelegateReporterResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgDelegateReporterResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgDelegateReporterResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgDelegateReporterResponse.Merge(m, src) -} -func (m *MsgDelegateReporterResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgDelegateReporterResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgDelegateReporterResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgDelegateReporterResponse proto.InternalMessageInfo - -// MsgUndelegateReporter defines the Msg/UndelegateReporter request type. -type MsgUndelegateReporter struct { - DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` - // token_origin is the token origin to undelegate from. If empty, all token origins are undelegated, - // else the amount field will be the amount to undelegate from the specified token origin. - TokenOrigins []*TokenOrigin `protobuf:"bytes,2,rep,name=token_origins,json=tokenOrigins,proto3" json:"token_origins,omitempty"` -} - -func (m *MsgUndelegateReporter) Reset() { *m = MsgUndelegateReporter{} } -func (m *MsgUndelegateReporter) String() string { return proto.CompactTextString(m) } -func (*MsgUndelegateReporter) ProtoMessage() {} -func (*MsgUndelegateReporter) Descriptor() ([]byte, []int) { - return fileDescriptor_67b904a7aa978eb1, []int{6} -} -func (m *MsgUndelegateReporter) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgUndelegateReporter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgUndelegateReporter.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgUndelegateReporter) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUndelegateReporter.Merge(m, src) -} -func (m *MsgUndelegateReporter) XXX_Size() int { - return m.Size() -} -func (m *MsgUndelegateReporter) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUndelegateReporter.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgUndelegateReporter proto.InternalMessageInfo - -func (m *MsgUndelegateReporter) GetDelegatorAddress() string { - if m != nil { - return m.DelegatorAddress - } - return "" -} - -func (m *MsgUndelegateReporter) GetTokenOrigins() []*TokenOrigin { - if m != nil { - return m.TokenOrigins - } - return nil -} - -type MsgUndelegateReporterResponse struct { -} - -func (m *MsgUndelegateReporterResponse) Reset() { *m = MsgUndelegateReporterResponse{} } -func (m *MsgUndelegateReporterResponse) String() string { return proto.CompactTextString(m) } -func (*MsgUndelegateReporterResponse) ProtoMessage() {} -func (*MsgUndelegateReporterResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_67b904a7aa978eb1, []int{7} -} -func (m *MsgUndelegateReporterResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgUndelegateReporterResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgUndelegateReporterResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgUndelegateReporterResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUndelegateReporterResponse.Merge(m, src) -} -func (m *MsgUndelegateReporterResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgUndelegateReporterResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUndelegateReporterResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgUndelegateReporterResponse proto.InternalMessageInfo - -// MsgWithdrawReporterCommission withdraws the full commission to the reporter -// address. -type MsgWithdrawReporterCommission struct { - ReporterAddress string `protobuf:"bytes,1,opt,name=reporter_address,json=reporterAddress,proto3" json:"reporter_address,omitempty"` -} - -func (m *MsgWithdrawReporterCommission) Reset() { *m = MsgWithdrawReporterCommission{} } -func (m *MsgWithdrawReporterCommission) String() string { return proto.CompactTextString(m) } -func (*MsgWithdrawReporterCommission) ProtoMessage() {} -func (*MsgWithdrawReporterCommission) Descriptor() ([]byte, []int) { - return fileDescriptor_67b904a7aa978eb1, []int{8} -} -func (m *MsgWithdrawReporterCommission) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgWithdrawReporterCommission) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgWithdrawReporterCommission.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgWithdrawReporterCommission) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgWithdrawReporterCommission.Merge(m, src) -} -func (m *MsgWithdrawReporterCommission) XXX_Size() int { - return m.Size() -} -func (m *MsgWithdrawReporterCommission) XXX_DiscardUnknown() { - xxx_messageInfo_MsgWithdrawReporterCommission.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgWithdrawReporterCommission proto.InternalMessageInfo - -// MsgWithdrawReporterCommissionResponse defines the -// Msg/WithdrawReporterCommission response type. -type MsgWithdrawReporterCommissionResponse struct { - Amount github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=amount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount"` -} - -func (m *MsgWithdrawReporterCommissionResponse) Reset() { *m = MsgWithdrawReporterCommissionResponse{} } -func (m *MsgWithdrawReporterCommissionResponse) String() string { return proto.CompactTextString(m) } -func (*MsgWithdrawReporterCommissionResponse) ProtoMessage() {} -func (*MsgWithdrawReporterCommissionResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_67b904a7aa978eb1, []int{9} -} -func (m *MsgWithdrawReporterCommissionResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgWithdrawReporterCommissionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgWithdrawReporterCommissionResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgWithdrawReporterCommissionResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgWithdrawReporterCommissionResponse.Merge(m, src) -} -func (m *MsgWithdrawReporterCommissionResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgWithdrawReporterCommissionResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgWithdrawReporterCommissionResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgWithdrawReporterCommissionResponse proto.InternalMessageInfo - -func (m *MsgWithdrawReporterCommissionResponse) GetAmount() github_com_cosmos_cosmos_sdk_types.Coins { - if m != nil { - return m.Amount - } - return nil -} - -// MsgWithdrawDelegatorReward represents delegation withdrawal to a delegator -// from a reporter. -type MsgWithdrawDelegatorReward struct { - DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` - ReporterAddress string `protobuf:"bytes,2,opt,name=reporter_address,json=reporterAddress,proto3" json:"reporter_address,omitempty"` -} - -func (m *MsgWithdrawDelegatorReward) Reset() { *m = MsgWithdrawDelegatorReward{} } -func (m *MsgWithdrawDelegatorReward) String() string { return proto.CompactTextString(m) } -func (*MsgWithdrawDelegatorReward) ProtoMessage() {} -func (*MsgWithdrawDelegatorReward) Descriptor() ([]byte, []int) { - return fileDescriptor_67b904a7aa978eb1, []int{10} -} -func (m *MsgWithdrawDelegatorReward) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgWithdrawDelegatorReward) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgWithdrawDelegatorReward.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgWithdrawDelegatorReward) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgWithdrawDelegatorReward.Merge(m, src) -} -func (m *MsgWithdrawDelegatorReward) XXX_Size() int { - return m.Size() -} -func (m *MsgWithdrawDelegatorReward) XXX_DiscardUnknown() { - xxx_messageInfo_MsgWithdrawDelegatorReward.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgWithdrawDelegatorReward proto.InternalMessageInfo - -// MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward -// response type. -type MsgWithdrawDelegatorRewardResponse struct { - Amount github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=amount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount"` -} - -func (m *MsgWithdrawDelegatorRewardResponse) Reset() { *m = MsgWithdrawDelegatorRewardResponse{} } -func (m *MsgWithdrawDelegatorRewardResponse) String() string { return proto.CompactTextString(m) } -func (*MsgWithdrawDelegatorRewardResponse) ProtoMessage() {} -func (*MsgWithdrawDelegatorRewardResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_67b904a7aa978eb1, []int{11} -} -func (m *MsgWithdrawDelegatorRewardResponse) XXX_Unmarshal(b []byte) error { +func (m *MsgChangeReporterResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgWithdrawDelegatorRewardResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgChangeReporterResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgWithdrawDelegatorRewardResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgChangeReporterResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -566,24 +290,17 @@ func (m *MsgWithdrawDelegatorRewardResponse) XXX_Marshal(b []byte, deterministic return b[:n], nil } } -func (m *MsgWithdrawDelegatorRewardResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgWithdrawDelegatorRewardResponse.Merge(m, src) +func (m *MsgChangeReporterResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgChangeReporterResponse.Merge(m, src) } -func (m *MsgWithdrawDelegatorRewardResponse) XXX_Size() int { +func (m *MsgChangeReporterResponse) XXX_Size() int { return m.Size() } -func (m *MsgWithdrawDelegatorRewardResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgWithdrawDelegatorRewardResponse.DiscardUnknown(m) +func (m *MsgChangeReporterResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgChangeReporterResponse.DiscardUnknown(m) } -var xxx_messageInfo_MsgWithdrawDelegatorRewardResponse proto.InternalMessageInfo - -func (m *MsgWithdrawDelegatorRewardResponse) GetAmount() github_com_cosmos_cosmos_sdk_types.Coins { - if m != nil { - return m.Amount - } - return nil -} +var xxx_messageInfo_MsgChangeReporterResponse proto.InternalMessageInfo // MsgUnjailReporter defines the Msg/UnjailReporter request type. type MsgUnjailReporter struct { @@ -594,7 +311,7 @@ func (m *MsgUnjailReporter) Reset() { *m = MsgUnjailReporter{} } func (m *MsgUnjailReporter) String() string { return proto.CompactTextString(m) } func (*MsgUnjailReporter) ProtoMessage() {} func (*MsgUnjailReporter) Descriptor() ([]byte, []int) { - return fileDescriptor_67b904a7aa978eb1, []int{12} + return fileDescriptor_67b904a7aa978eb1, []int{6} } func (m *MsgUnjailReporter) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -631,7 +348,7 @@ func (m *MsgUnjailReporterResponse) Reset() { *m = MsgUnjailReporterResp func (m *MsgUnjailReporterResponse) String() string { return proto.CompactTextString(m) } func (*MsgUnjailReporterResponse) ProtoMessage() {} func (*MsgUnjailReporterResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_67b904a7aa978eb1, []int{13} + return fileDescriptor_67b904a7aa978eb1, []int{7} } func (m *MsgUnjailReporterResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -670,7 +387,7 @@ func (m *MsgWithdrawTip) Reset() { *m = MsgWithdrawTip{} } func (m *MsgWithdrawTip) String() string { return proto.CompactTextString(m) } func (*MsgWithdrawTip) ProtoMessage() {} func (*MsgWithdrawTip) Descriptor() ([]byte, []int) { - return fileDescriptor_67b904a7aa978eb1, []int{14} + return fileDescriptor_67b904a7aa978eb1, []int{8} } func (m *MsgWithdrawTip) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -721,7 +438,7 @@ func (m *MsgWithdrawTipResponse) Reset() { *m = MsgWithdrawTipResponse{} func (m *MsgWithdrawTipResponse) String() string { return proto.CompactTextString(m) } func (*MsgWithdrawTipResponse) ProtoMessage() {} func (*MsgWithdrawTipResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_67b904a7aa978eb1, []int{15} + return fileDescriptor_67b904a7aa978eb1, []int{9} } func (m *MsgWithdrawTipResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -755,14 +472,8 @@ func init() { proto.RegisterType((*MsgUpdateParamsResponse)(nil), "layer.reporter.MsgUpdateParamsResponse") proto.RegisterType((*MsgCreateReporter)(nil), "layer.reporter.MsgCreateReporter") proto.RegisterType((*MsgCreateReporterResponse)(nil), "layer.reporter.MsgCreateReporterResponse") - proto.RegisterType((*MsgDelegateReporter)(nil), "layer.reporter.MsgDelegateReporter") - proto.RegisterType((*MsgDelegateReporterResponse)(nil), "layer.reporter.MsgDelegateReporterResponse") - proto.RegisterType((*MsgUndelegateReporter)(nil), "layer.reporter.MsgUndelegateReporter") - proto.RegisterType((*MsgUndelegateReporterResponse)(nil), "layer.reporter.MsgUndelegateReporterResponse") - proto.RegisterType((*MsgWithdrawReporterCommission)(nil), "layer.reporter.MsgWithdrawReporterCommission") - proto.RegisterType((*MsgWithdrawReporterCommissionResponse)(nil), "layer.reporter.MsgWithdrawReporterCommissionResponse") - proto.RegisterType((*MsgWithdrawDelegatorReward)(nil), "layer.reporter.MsgWithdrawDelegatorReward") - proto.RegisterType((*MsgWithdrawDelegatorRewardResponse)(nil), "layer.reporter.MsgWithdrawDelegatorRewardResponse") + proto.RegisterType((*MsgChangeReporter)(nil), "layer.reporter.MsgChangeReporter") + proto.RegisterType((*MsgChangeReporterResponse)(nil), "layer.reporter.MsgChangeReporterResponse") proto.RegisterType((*MsgUnjailReporter)(nil), "layer.reporter.MsgUnjailReporter") proto.RegisterType((*MsgUnjailReporterResponse)(nil), "layer.reporter.MsgUnjailReporterResponse") proto.RegisterType((*MsgWithdrawTip)(nil), "layer.reporter.MsgWithdrawTip") @@ -772,68 +483,49 @@ func init() { func init() { proto.RegisterFile("layer/reporter/tx.proto", fileDescriptor_67b904a7aa978eb1) } var fileDescriptor_67b904a7aa978eb1 = []byte{ - // 973 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0x41, 0x4f, 0x24, 0x45, - 0x14, 0x9e, 0x1a, 0x56, 0xe2, 0x3c, 0x76, 0x59, 0x68, 0x77, 0x61, 0x68, 0xa4, 0x07, 0x5a, 0x57, - 0x11, 0x32, 0xdd, 0x81, 0xcd, 0x9a, 0xc8, 0x49, 0x87, 0xdd, 0xc3, 0x1e, 0x50, 0xd3, 0x82, 0x1a, - 0x0f, 0x92, 0x82, 0xae, 0xf4, 0xd4, 0x32, 0xdd, 0x35, 0xe9, 0x2a, 0x60, 0xb9, 0x99, 0xf5, 0xa2, - 0x1e, 0x8c, 0xfe, 0x01, 0xb3, 0x47, 0xe3, 0x89, 0x03, 0x17, 0x4f, 0x5e, 0xb9, 0xb9, 0xe1, 0x64, - 0x3c, 0xac, 0x06, 0x12, 0xf1, 0x67, 0x98, 0xee, 0xae, 0xae, 0xe9, 0xe9, 0xe9, 0x99, 0x85, 0x04, - 0xb3, 0x17, 0x86, 0xaa, 0xf7, 0xbd, 0x57, 0xdf, 0xfb, 0xfa, 0xab, 0xd7, 0x0d, 0x93, 0x2d, 0x7c, - 0x40, 0x42, 0x3b, 0x24, 0x6d, 0x16, 0x0a, 0x12, 0xda, 0xe2, 0xb1, 0xd5, 0x0e, 0x99, 0x60, 0xda, - 0x68, 0x1c, 0xb0, 0xd2, 0x80, 0x3e, 0x8e, 0x7d, 0x1a, 0x30, 0x3b, 0xfe, 0x9b, 0x40, 0x74, 0x63, - 0x9b, 0x71, 0x9f, 0x71, 0x7b, 0x0b, 0x73, 0x62, 0xef, 0x2d, 0x6d, 0x11, 0x81, 0x97, 0xec, 0x6d, - 0x46, 0x03, 0x19, 0x9f, 0x94, 0x71, 0x9f, 0x7b, 0xf6, 0xde, 0x52, 0xf4, 0x23, 0x03, 0x6f, 0xca, - 0x00, 0x17, 0x78, 0x87, 0x06, 0x9e, 0xca, 0x95, 0x6b, 0x89, 0x9a, 0x4a, 0x50, 0x9b, 0xf1, 0xca, - 0x4e, 0x16, 0x32, 0x74, 0xcb, 0x63, 0x1e, 0x4b, 0xf6, 0xa3, 0xff, 0xe4, 0xee, 0x74, 0xae, 0x97, - 0x36, 0x0e, 0xb1, 0x9f, 0xa6, 0xcc, 0xe5, 0x1b, 0x65, 0x3b, 0x24, 0xd8, 0x64, 0x21, 0xf5, 0x52, - 0xbe, 0xe6, 0xaf, 0x08, 0x6e, 0xae, 0x71, 0x6f, 0xa3, 0xed, 0x62, 0x41, 0x3e, 0x8e, 0x93, 0xb5, - 0x77, 0xa1, 0x82, 0x77, 0x45, 0x93, 0x85, 0x54, 0x1c, 0x54, 0xd1, 0x2c, 0x9a, 0xaf, 0x34, 0xaa, - 0x27, 0x47, 0xf5, 0x5b, 0x92, 0xce, 0x07, 0xae, 0x1b, 0x12, 0xce, 0x3f, 0x11, 0x21, 0x0d, 0x3c, - 0xa7, 0x03, 0xd5, 0xde, 0x83, 0xe1, 0xe4, 0xf8, 0x6a, 0x79, 0x16, 0xcd, 0x8f, 0x2c, 0x4f, 0x58, - 0xdd, 0x7a, 0x5a, 0x49, 0xfd, 0x46, 0xe5, 0xf8, 0x79, 0xad, 0xf4, 0xf3, 0xf9, 0xe1, 0x02, 0x72, - 0x64, 0xc2, 0xca, 0xdd, 0x27, 0xe7, 0x87, 0x0b, 0x9d, 0x52, 0xdf, 0x9d, 0x1f, 0x2e, 0xcc, 0x26, - 0xe4, 0x1f, 0x77, 0xe8, 0xe7, 0x78, 0x9a, 0x53, 0x30, 0x99, 0xdb, 0x72, 0x08, 0x6f, 0xb3, 0x80, - 0x13, 0xf3, 0xdb, 0x32, 0x8c, 0xaf, 0x71, 0x6f, 0x35, 0x24, 0x58, 0x10, 0x47, 0x16, 0xd0, 0x74, - 0x78, 0x35, 0x2d, 0x96, 0xf4, 0xe5, 0xa8, 0xb5, 0xb6, 0x0a, 0xc3, 0xd8, 0x67, 0xbb, 0x81, 0x88, - 0xc9, 0x57, 0x1a, 0x8b, 0x11, 0xc9, 0x3f, 0x9f, 0xd7, 0x6e, 0x27, 0x5d, 0x73, 0x77, 0xc7, 0xa2, - 0xcc, 0xf6, 0xb1, 0x68, 0x5a, 0x0f, 0x03, 0x71, 0x72, 0x54, 0x07, 0x29, 0xc7, 0xc3, 0x40, 0x38, - 0x32, 0x55, 0x7b, 0x1f, 0x6e, 0x64, 0x35, 0xe6, 0xd5, 0xa1, 0xd9, 0xa1, 0xf9, 0x91, 0xe5, 0xe9, - 0xbc, 0x10, 0xeb, 0x11, 0xe8, 0xa3, 0x18, 0xe3, 0x5c, 0x17, 0x9d, 0x05, 0xd7, 0x1a, 0x00, 0xdb, - 0xcc, 0xf7, 0x29, 0xe7, 0x94, 0x05, 0xd5, 0x6b, 0xb1, 0x8e, 0xa6, 0x25, 0x8f, 0x4a, 0xbd, 0x22, - 0xbd, 0x63, 0xad, 0x2a, 0xa4, 0x93, 0xc9, 0x5a, 0xb9, 0x11, 0x89, 0xa9, 0x3a, 0x33, 0xa7, 0x61, - 0xaa, 0x47, 0x0a, 0x25, 0xd4, 0x3f, 0x08, 0x5e, 0x5b, 0xe3, 0xde, 0x7d, 0xd2, 0x22, 0x5e, 0x56, - 0xaa, 0xd7, 0xa1, 0xe2, 0x26, 0x7b, 0x2c, 0xd5, 0xaa, 0xb3, 0xd1, 0x25, 0x64, 0xb9, 0xaf, 0x90, - 0x43, 0x57, 0x28, 0xe4, 0xb5, 0x4b, 0x0a, 0xb9, 0x32, 0x1a, 0x3b, 0x4a, 0x51, 0x36, 0x67, 0x60, - 0xba, 0xa0, 0x4f, 0xa5, 0xc3, 0x4f, 0x08, 0x6e, 0x47, 0x66, 0x0a, 0xdc, 0xbc, 0x12, 0x8b, 0x30, - 0xae, 0xaa, 0x6c, 0xe2, 0xc4, 0xfb, 0x52, 0x91, 0x31, 0x15, 0x90, 0x77, 0xa2, 0x97, 0x77, 0xf9, - 0xb2, 0xbc, 0x27, 0x22, 0xde, 0xbd, 0x27, 0x9a, 0x35, 0x98, 0x29, 0xe4, 0xa7, 0x3a, 0xf8, 0x1a, - 0xc5, 0x88, 0xcf, 0xa8, 0x68, 0xba, 0x21, 0xde, 0x4f, 0xe3, 0x1d, 0x8f, 0x68, 0xab, 0x30, 0x96, - 0x12, 0xe8, 0x6e, 0x64, 0xc0, 0xf5, 0xbe, 0x99, 0x66, 0xc8, 0xed, 0x95, 0x99, 0x6f, 0x9e, 0xd6, - 0x4a, 0xff, 0x3e, 0xad, 0x95, 0x22, 0x9e, 0x3d, 0xf5, 0xcc, 0x1f, 0x11, 0xdc, 0x19, 0xc8, 0x22, - 0xe5, 0xab, 0x35, 0x95, 0x4f, 0x50, 0xac, 0xd1, 0x54, 0xea, 0xf2, 0x68, 0xb4, 0x66, 0x2c, 0x4e, - 0x83, 0xc6, 0xbd, 0xc8, 0x42, 0xbf, 0xfc, 0x55, 0x9b, 0xf7, 0xa8, 0x68, 0xee, 0x6e, 0x59, 0xdb, - 0xcc, 0x97, 0xb3, 0x51, 0xfe, 0xd4, 0xb9, 0xbb, 0x63, 0x8b, 0x83, 0x36, 0xe1, 0x71, 0x02, 0x97, - 0xc3, 0x25, 0xa9, 0x6f, 0x1e, 0x23, 0xd0, 0x33, 0x9c, 0xee, 0xa7, 0xda, 0x3a, 0x64, 0x1f, 0x87, - 0xae, 0xf6, 0xa0, 0xef, 0x03, 0x1e, 0xa0, 0x4b, 0xef, 0xa3, 0x2f, 0x52, 0xb7, 0x7c, 0x59, 0x75, - 0x8d, 0xac, 0xba, 0x05, 0x2e, 0xf8, 0x1e, 0x81, 0xd9, 0xbf, 0x95, 0x97, 0xa0, 0xed, 0x7e, 0x3c, - 0x67, 0x37, 0x82, 0x47, 0x98, 0xb6, 0x9c, 0xce, 0x08, 0xf8, 0xff, 0x8d, 0x96, 0x4c, 0xb5, 0xee, - 0x83, 0xd5, 0x5d, 0xf8, 0x0d, 0xc1, 0x68, 0x46, 0xa6, 0x75, 0xda, 0xbe, 0xaa, 0xa7, 0xfc, 0x21, - 0x8c, 0xef, 0xe1, 0x16, 0x75, 0xbb, 0xca, 0x24, 0x8f, 0x79, 0xee, 0xe4, 0xa8, 0x3e, 0x23, 0xcb, - 0x7c, 0x9a, 0x62, 0x72, 0xf5, 0xf6, 0x72, 0xfb, 0x7d, 0xaf, 0x7b, 0x15, 0x26, 0xba, 0x1b, 0x48, - 0x7b, 0x5b, 0xfe, 0x7d, 0x18, 0x86, 0xd6, 0xb8, 0xa7, 0x7d, 0x0e, 0xd7, 0xbb, 0xde, 0xda, 0xb5, - 0xfc, 0x8c, 0xc9, 0xbd, 0x1b, 0xf5, 0xb7, 0x5f, 0x00, 0x50, 0xee, 0xf9, 0x12, 0x46, 0x73, 0x2f, - 0xce, 0xb9, 0x82, 0xd4, 0x6e, 0x88, 0xfe, 0xce, 0x0b, 0x21, 0xaa, 0xbe, 0x0b, 0x63, 0x3d, 0xef, - 0x9b, 0x37, 0x0a, 0xd2, 0xf3, 0x20, 0x7d, 0xf1, 0x02, 0x20, 0x75, 0xca, 0x23, 0xd0, 0x0a, 0xa6, - 0xf9, 0x9d, 0x22, 0x11, 0x7a, 0x60, 0x7a, 0xfd, 0x42, 0x30, 0x75, 0xd6, 0x13, 0x04, 0xfa, 0x80, - 0xc1, 0x5b, 0x54, 0xad, 0x3f, 0x5c, 0xbf, 0x77, 0x29, 0xb8, 0x22, 0x71, 0x00, 0x93, 0xfd, 0x46, - 0xdc, 0xc2, 0x80, 0x8a, 0x39, 0xac, 0xbe, 0x7c, 0x71, 0x6c, 0xd6, 0x31, 0xb9, 0x11, 0x30, 0x57, - 0x28, 0x60, 0x16, 0x52, 0xe8, 0x98, 0xe2, 0xfb, 0xac, 0x6d, 0xc0, 0x48, 0xf6, 0x2e, 0x1b, 0x03, - 0x28, 0xae, 0xd3, 0xb6, 0xfe, 0xd6, 0xe0, 0x78, 0x5a, 0x56, 0x7f, 0xe5, 0xab, 0x68, 0x96, 0x35, - 0x1e, 0x1c, 0x9f, 0x1a, 0xe8, 0xd9, 0xa9, 0x81, 0xfe, 0x3e, 0x35, 0xd0, 0x0f, 0x67, 0x46, 0xe9, - 0xd9, 0x99, 0x51, 0xfa, 0xe3, 0xcc, 0x28, 0x7d, 0xb1, 0x98, 0x19, 0x8a, 0x82, 0xb4, 0x5a, 0x2c, - 0xac, 0x53, 0x66, 0xf7, 0x7c, 0x98, 0xc6, 0xd3, 0x71, 0x6b, 0x38, 0xfe, 0xa2, 0xbe, 0xfb, 0x5f, - 0x00, 0x00, 0x00, 0xff, 0xff, 0x5b, 0xde, 0x80, 0xea, 0x5f, 0x0c, 0x00, 0x00, + // 668 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x41, 0x4f, 0x13, 0x41, + 0x14, 0xee, 0x42, 0x24, 0x61, 0x30, 0x40, 0x37, 0x08, 0xa5, 0x84, 0x2d, 0x34, 0x46, 0x01, 0xc3, + 0x6e, 0x80, 0xc4, 0x44, 0x6e, 0xb6, 0xe1, 0x58, 0x63, 0xaa, 0xa8, 0xf1, 0x20, 0x99, 0x76, 0x27, + 0xd3, 0x91, 0xdd, 0x9d, 0xcd, 0xcc, 0x50, 0xe0, 0x66, 0x3c, 0x19, 0x4f, 0x5e, 0xbd, 0x71, 0xf4, + 0xc8, 0x81, 0xc4, 0x78, 0xf2, 0xca, 0x91, 0x70, 0xf2, 0xa2, 0x31, 0x70, 0xc0, 0x9f, 0x61, 0x76, + 0x77, 0x66, 0xcb, 0x4e, 0x17, 0x88, 0x89, 0x97, 0xb6, 0xf3, 0xde, 0xf7, 0xbe, 0xf9, 0xbe, 0x37, + 0xf3, 0xa6, 0x60, 0xca, 0x83, 0xfb, 0x88, 0x39, 0x0c, 0x85, 0x94, 0x09, 0xc4, 0x1c, 0xb1, 0x67, + 0x87, 0x8c, 0x0a, 0x6a, 0x8e, 0xc6, 0x09, 0x5b, 0x25, 0xca, 0x45, 0xe8, 0x93, 0x80, 0x3a, 0xf1, + 0x67, 0x02, 0x29, 0x5b, 0x6d, 0xca, 0x7d, 0xca, 0x9d, 0x16, 0xe4, 0xc8, 0xe9, 0xae, 0xb4, 0x90, + 0x80, 0x2b, 0x4e, 0x9b, 0x92, 0x40, 0xe6, 0xa7, 0x64, 0xde, 0xe7, 0xd8, 0xe9, 0xae, 0x44, 0x5f, + 0x32, 0x71, 0x57, 0x26, 0xb8, 0x80, 0xdb, 0x24, 0xc0, 0x69, 0xad, 0x5c, 0x4b, 0xd4, 0x74, 0x82, + 0xda, 0x8a, 0x57, 0x4e, 0xb2, 0x90, 0xa9, 0x09, 0x4c, 0x31, 0x4d, 0xe2, 0xd1, 0x2f, 0x19, 0x9d, + 0xd1, 0xbc, 0x84, 0x90, 0x41, 0x5f, 0x95, 0xcc, 0xeb, 0x46, 0xe9, 0x36, 0x0a, 0xb6, 0x28, 0x23, + 0x58, 0xe9, 0xad, 0x7e, 0x33, 0xc0, 0x58, 0x83, 0xe3, 0xcd, 0xd0, 0x85, 0x02, 0x3d, 0x8d, 0x8b, + 0xcd, 0x87, 0x60, 0x18, 0xee, 0x88, 0x0e, 0x65, 0x44, 0xec, 0x97, 0x8c, 0x39, 0x63, 0x61, 0xb8, + 0x56, 0x3a, 0x3d, 0x5a, 0x9e, 0x90, 0x72, 0x1e, 0xbb, 0x2e, 0x43, 0x9c, 0x3f, 0x13, 0x8c, 0x04, + 0xb8, 0xd9, 0x83, 0x9a, 0x8f, 0xc0, 0x50, 0xb2, 0x7d, 0x69, 0x60, 0xce, 0x58, 0x18, 0x59, 0x9d, + 0xb4, 0xb3, 0xfd, 0xb4, 0x13, 0xfe, 0xda, 0xf0, 0xf1, 0xaf, 0x4a, 0xe1, 0xcb, 0xc5, 0xe1, 0x92, + 0xd1, 0x94, 0x05, 0xeb, 0x6b, 0xef, 0x2f, 0x0e, 0x97, 0x7a, 0x54, 0x1f, 0x2f, 0x0e, 0x97, 0xe6, + 0x12, 0xf1, 0x7b, 0x3d, 0xf9, 0x9a, 0xce, 0xea, 0x34, 0x98, 0xd2, 0x42, 0x4d, 0xc4, 0x43, 0x1a, + 0x70, 0x54, 0xfd, 0x6c, 0x80, 0x62, 0x83, 0xe3, 0x3a, 0x43, 0x50, 0xa0, 0xa6, 0x24, 0x30, 0x17, + 0xc1, 0xb8, 0x22, 0xdb, 0x82, 0x89, 0x8b, 0xc4, 0x5f, 0x73, 0x4c, 0xc5, 0xa5, 0x39, 0xb3, 0x06, + 0x40, 0x9b, 0xfa, 0x3e, 0xe1, 0x9c, 0xd0, 0x40, 0xfa, 0xa9, 0xda, 0xb2, 0x03, 0xea, 0xcc, 0xe4, + 0x19, 0xda, 0xf5, 0x14, 0xd9, 0xbc, 0x54, 0xb5, 0x7e, 0x27, 0x32, 0xd5, 0xb7, 0x63, 0x75, 0x06, + 0x4c, 0xf7, 0x49, 0x4b, 0x85, 0x7f, 0x95, 0xc2, 0x3b, 0x30, 0xc0, 0x3d, 0xe1, 0x1b, 0xa0, 0xe8, + 0x22, 0x0f, 0x61, 0x28, 0xa8, 0xa6, 0xfc, 0x9a, 0x93, 0x19, 0x4f, 0x4b, 0x94, 0xa9, 0x7a, 0x8e, + 0xff, 0x81, 0x1b, 0x58, 0xf4, 0xce, 0xac, 0x4f, 0x46, 0xae, 0xfa, 0xe5, 0x28, 0x5b, 0x19, 0xe1, + 0xa9, 0xad, 0xdd, 0xd8, 0xd5, 0x66, 0xf0, 0x16, 0x12, 0x2f, 0x75, 0x55, 0xbf, 0xea, 0x38, 0xfe, + 0x45, 0xce, 0xec, 0x87, 0x83, 0x4a, 0xe1, 0xcf, 0x41, 0xa5, 0x70, 0x5d, 0xb3, 0xb3, 0x1b, 0xa7, + 0xaa, 0xbe, 0x1b, 0x60, 0xb4, 0xc1, 0xf1, 0x4b, 0x22, 0x3a, 0x2e, 0x83, 0xbb, 0xcf, 0x49, 0xf8, + 0xbf, 0x3a, 0xfd, 0x04, 0x14, 0xbb, 0xd0, 0x23, 0x6e, 0x86, 0x26, 0x69, 0xf5, 0xfc, 0xe9, 0xd1, + 0xf2, 0xac, 0xa4, 0x79, 0xa1, 0x30, 0x1a, 0x5f, 0x57, 0x8b, 0x5f, 0xd9, 0xf4, 0x12, 0x98, 0xcc, + 0x1a, 0x50, 0xde, 0x56, 0x7f, 0x0e, 0x82, 0xc1, 0x06, 0xc7, 0xe6, 0x2b, 0x70, 0x3b, 0x33, 0xdc, + 0x15, 0x7d, 0x28, 0xb5, 0x11, 0x2a, 0xdf, 0xbf, 0x01, 0xa0, 0x76, 0x30, 0xdf, 0x80, 0x51, 0x6d, + 0xbe, 0xe6, 0x73, 0x4a, 0xb3, 0x90, 0xf2, 0xe2, 0x8d, 0x90, 0x0c, 0x7f, 0x76, 0x0c, 0x72, 0xf9, + 0x33, 0x90, 0x7c, 0xfe, 0xdc, 0x3b, 0x19, 0xf1, 0x6b, 0x17, 0x32, 0x8f, 0x3f, 0x0b, 0xc9, 0xe5, + 0xcf, 0xbf, 0x5d, 0xe6, 0x26, 0x18, 0xb9, 0x7c, 0xb3, 0xac, 0x9c, 0xca, 0x4b, 0xf9, 0xf2, 0xbd, + 0xeb, 0xf3, 0x8a, 0xb6, 0x7c, 0xeb, 0x5d, 0xf4, 0x72, 0xd6, 0x36, 0x8e, 0xcf, 0x2c, 0xe3, 0xe4, + 0xcc, 0x32, 0x7e, 0x9f, 0x59, 0xc6, 0xa7, 0x73, 0xab, 0x70, 0x72, 0x6e, 0x15, 0x7e, 0x9c, 0x5b, + 0x85, 0xd7, 0x0f, 0x30, 0x11, 0x9d, 0x9d, 0x96, 0xdd, 0xa6, 0xbe, 0x23, 0x90, 0xe7, 0x51, 0xb6, + 0x4c, 0xa8, 0xd3, 0xf7, 0x9a, 0x8a, 0xfd, 0x10, 0xf1, 0xd6, 0x50, 0xfc, 0x37, 0xb0, 0xf6, 0x37, + 0x00, 0x00, 0xff, 0xff, 0x37, 0x8c, 0x21, 0x67, 0x14, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -853,16 +545,7 @@ type MsgClient interface { UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) // CreateReporter defines a (reporter) operation for creating a new reporter. CreateReporter(ctx context.Context, in *MsgCreateReporter, opts ...grpc.CallOption) (*MsgCreateReporterResponse, error) - // DelegateReporter defines a (reporter) operation for delegating to a reporter. - DelegateReporter(ctx context.Context, in *MsgDelegateReporter, opts ...grpc.CallOption) (*MsgDelegateReporterResponse, error) - // UndelegateReporter defines a (reporter) operation for undelegating from a reporter. - UndelegateReporter(ctx context.Context, in *MsgUndelegateReporter, opts ...grpc.CallOption) (*MsgUndelegateReporterResponse, error) - // WithdrawReporterCommission defines a method to withdraw the - // full commission to the reporter address. - WithdrawReporterCommission(ctx context.Context, in *MsgWithdrawReporterCommission, opts ...grpc.CallOption) (*MsgWithdrawReporterCommissionResponse, error) - // WithdrawDelegatorReward defines a method to withdraw rewards of delegator - // from a reporter. - WithdrawDelegatorReward(ctx context.Context, in *MsgWithdrawDelegatorReward, opts ...grpc.CallOption) (*MsgWithdrawDelegatorRewardResponse, error) + ChangeReporter(ctx context.Context, in *MsgChangeReporter, opts ...grpc.CallOption) (*MsgChangeReporterResponse, error) // UnjailReporter defines a method to unjail a jailed reporter. UnjailReporter(ctx context.Context, in *MsgUnjailReporter, opts ...grpc.CallOption) (*MsgUnjailReporterResponse, error) // WithdrawTip defines a method to withdraw tip from a reporter module. @@ -895,36 +578,9 @@ func (c *msgClient) CreateReporter(ctx context.Context, in *MsgCreateReporter, o return out, nil } -func (c *msgClient) DelegateReporter(ctx context.Context, in *MsgDelegateReporter, opts ...grpc.CallOption) (*MsgDelegateReporterResponse, error) { - out := new(MsgDelegateReporterResponse) - err := c.cc.Invoke(ctx, "/layer.reporter.Msg/DelegateReporter", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) UndelegateReporter(ctx context.Context, in *MsgUndelegateReporter, opts ...grpc.CallOption) (*MsgUndelegateReporterResponse, error) { - out := new(MsgUndelegateReporterResponse) - err := c.cc.Invoke(ctx, "/layer.reporter.Msg/UndelegateReporter", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) WithdrawReporterCommission(ctx context.Context, in *MsgWithdrawReporterCommission, opts ...grpc.CallOption) (*MsgWithdrawReporterCommissionResponse, error) { - out := new(MsgWithdrawReporterCommissionResponse) - err := c.cc.Invoke(ctx, "/layer.reporter.Msg/WithdrawReporterCommission", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) WithdrawDelegatorReward(ctx context.Context, in *MsgWithdrawDelegatorReward, opts ...grpc.CallOption) (*MsgWithdrawDelegatorRewardResponse, error) { - out := new(MsgWithdrawDelegatorRewardResponse) - err := c.cc.Invoke(ctx, "/layer.reporter.Msg/WithdrawDelegatorReward", in, out, opts...) +func (c *msgClient) ChangeReporter(ctx context.Context, in *MsgChangeReporter, opts ...grpc.CallOption) (*MsgChangeReporterResponse, error) { + out := new(MsgChangeReporterResponse) + err := c.cc.Invoke(ctx, "/layer.reporter.Msg/ChangeReporter", in, out, opts...) if err != nil { return nil, err } @@ -956,16 +612,7 @@ type MsgServer interface { UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) // CreateReporter defines a (reporter) operation for creating a new reporter. CreateReporter(context.Context, *MsgCreateReporter) (*MsgCreateReporterResponse, error) - // DelegateReporter defines a (reporter) operation for delegating to a reporter. - DelegateReporter(context.Context, *MsgDelegateReporter) (*MsgDelegateReporterResponse, error) - // UndelegateReporter defines a (reporter) operation for undelegating from a reporter. - UndelegateReporter(context.Context, *MsgUndelegateReporter) (*MsgUndelegateReporterResponse, error) - // WithdrawReporterCommission defines a method to withdraw the - // full commission to the reporter address. - WithdrawReporterCommission(context.Context, *MsgWithdrawReporterCommission) (*MsgWithdrawReporterCommissionResponse, error) - // WithdrawDelegatorReward defines a method to withdraw rewards of delegator - // from a reporter. - WithdrawDelegatorReward(context.Context, *MsgWithdrawDelegatorReward) (*MsgWithdrawDelegatorRewardResponse, error) + ChangeReporter(context.Context, *MsgChangeReporter) (*MsgChangeReporterResponse, error) // UnjailReporter defines a method to unjail a jailed reporter. UnjailReporter(context.Context, *MsgUnjailReporter) (*MsgUnjailReporterResponse, error) // WithdrawTip defines a method to withdraw tip from a reporter module. @@ -982,17 +629,8 @@ func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateP func (*UnimplementedMsgServer) CreateReporter(ctx context.Context, req *MsgCreateReporter) (*MsgCreateReporterResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CreateReporter not implemented") } -func (*UnimplementedMsgServer) DelegateReporter(ctx context.Context, req *MsgDelegateReporter) (*MsgDelegateReporterResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DelegateReporter not implemented") -} -func (*UnimplementedMsgServer) UndelegateReporter(ctx context.Context, req *MsgUndelegateReporter) (*MsgUndelegateReporterResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UndelegateReporter not implemented") -} -func (*UnimplementedMsgServer) WithdrawReporterCommission(ctx context.Context, req *MsgWithdrawReporterCommission) (*MsgWithdrawReporterCommissionResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method WithdrawReporterCommission not implemented") -} -func (*UnimplementedMsgServer) WithdrawDelegatorReward(ctx context.Context, req *MsgWithdrawDelegatorReward) (*MsgWithdrawDelegatorRewardResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method WithdrawDelegatorReward not implemented") +func (*UnimplementedMsgServer) ChangeReporter(ctx context.Context, req *MsgChangeReporter) (*MsgChangeReporterResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ChangeReporter not implemented") } func (*UnimplementedMsgServer) UnjailReporter(ctx context.Context, req *MsgUnjailReporter) (*MsgUnjailReporterResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UnjailReporter not implemented") @@ -1041,74 +679,20 @@ func _Msg_CreateReporter_Handler(srv interface{}, ctx context.Context, dec func( return interceptor(ctx, in, info, handler) } -func _Msg_DelegateReporter_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgDelegateReporter) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).DelegateReporter(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/layer.reporter.Msg/DelegateReporter", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).DelegateReporter(ctx, req.(*MsgDelegateReporter)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_UndelegateReporter_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgUndelegateReporter) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).UndelegateReporter(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/layer.reporter.Msg/UndelegateReporter", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).UndelegateReporter(ctx, req.(*MsgUndelegateReporter)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_WithdrawReporterCommission_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgWithdrawReporterCommission) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).WithdrawReporterCommission(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/layer.reporter.Msg/WithdrawReporterCommission", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).WithdrawReporterCommission(ctx, req.(*MsgWithdrawReporterCommission)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_WithdrawDelegatorReward_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgWithdrawDelegatorReward) +func _Msg_ChangeReporter_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgChangeReporter) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).WithdrawDelegatorReward(ctx, in) + return srv.(MsgServer).ChangeReporter(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/layer.reporter.Msg/WithdrawDelegatorReward", + FullMethod: "/layer.reporter.Msg/ChangeReporter", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).WithdrawDelegatorReward(ctx, req.(*MsgWithdrawDelegatorReward)) + return srv.(MsgServer).ChangeReporter(ctx, req.(*MsgChangeReporter)) } return interceptor(ctx, in, info, handler) } @@ -1162,20 +746,8 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ Handler: _Msg_CreateReporter_Handler, }, { - MethodName: "DelegateReporter", - Handler: _Msg_DelegateReporter_Handler, - }, - { - MethodName: "UndelegateReporter", - Handler: _Msg_UndelegateReporter_Handler, - }, - { - MethodName: "WithdrawReporterCommission", - Handler: _Msg_WithdrawReporterCommission_Handler, - }, - { - MethodName: "WithdrawDelegatorReward", - Handler: _Msg_WithdrawDelegatorReward_Handler, + MethodName: "ChangeReporter", + Handler: _Msg_ChangeReporter_Handler, }, { MethodName: "UnjailReporter", @@ -1283,36 +855,12 @@ func (m *MsgCreateReporter) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTx(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x22 - } - if len(m.TokenOrigins) > 0 { - for iNdEx := len(m.TokenOrigins) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.TokenOrigins[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - { - size := m.Amount.Size() - i -= size - if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) + dAtA[i] = 0x12 } - i-- - dAtA[i] = 0x12 - if len(m.Reporter) > 0 { - i -= len(m.Reporter) - copy(dAtA[i:], m.Reporter) - i = encodeVarintTx(dAtA, i, uint64(len(m.Reporter))) + if len(m.ReporterAddress) > 0 { + i -= len(m.ReporterAddress) + copy(dAtA[i:], m.ReporterAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.ReporterAddress))) i-- dAtA[i] = 0xa } @@ -1342,7 +890,7 @@ func (m *MsgCreateReporterResponse) MarshalToSizedBuffer(dAtA []byte) (int, erro return len(dAtA) - i, nil } -func (m *MsgDelegateReporter) Marshal() (dAtA []byte, err error) { +func (m *MsgChangeReporter) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1352,230 +900,12 @@ func (m *MsgDelegateReporter) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgDelegateReporter) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgChangeReporter) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgDelegateReporter) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.TokenOrigins) > 0 { - for iNdEx := len(m.TokenOrigins) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.TokenOrigins[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - } - { - size := m.Amount.Size() - i -= size - if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if len(m.Reporter) > 0 { - i -= len(m.Reporter) - copy(dAtA[i:], m.Reporter) - i = encodeVarintTx(dAtA, i, uint64(len(m.Reporter))) - i-- - dAtA[i] = 0x12 - } - if len(m.Delegator) > 0 { - i -= len(m.Delegator) - copy(dAtA[i:], m.Delegator) - i = encodeVarintTx(dAtA, i, uint64(len(m.Delegator))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgDelegateReporterResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgDelegateReporterResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgDelegateReporterResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgUndelegateReporter) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgUndelegateReporter) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgUndelegateReporter) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.TokenOrigins) > 0 { - for iNdEx := len(m.TokenOrigins) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.TokenOrigins[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if len(m.DelegatorAddress) > 0 { - i -= len(m.DelegatorAddress) - copy(dAtA[i:], m.DelegatorAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.DelegatorAddress))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgUndelegateReporterResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgUndelegateReporterResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgUndelegateReporterResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgWithdrawReporterCommission) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgWithdrawReporterCommission) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgWithdrawReporterCommission) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ReporterAddress) > 0 { - i -= len(m.ReporterAddress) - copy(dAtA[i:], m.ReporterAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.ReporterAddress))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgWithdrawReporterCommissionResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgWithdrawReporterCommissionResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgWithdrawReporterCommissionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Amount) > 0 { - for iNdEx := len(m.Amount) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Amount[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *MsgWithdrawDelegatorReward) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgWithdrawDelegatorReward) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgWithdrawDelegatorReward) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgChangeReporter) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1597,7 +927,7 @@ func (m *MsgWithdrawDelegatorReward) MarshalToSizedBuffer(dAtA []byte) (int, err return len(dAtA) - i, nil } -func (m *MsgWithdrawDelegatorRewardResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgChangeReporterResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1607,30 +937,16 @@ func (m *MsgWithdrawDelegatorRewardResponse) Marshal() (dAtA []byte, err error) return dAtA[:n], nil } -func (m *MsgWithdrawDelegatorRewardResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgChangeReporterResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgWithdrawDelegatorRewardResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgChangeReporterResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Amount) > 0 { - for iNdEx := len(m.Amount) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Amount[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } return len(dAtA) - i, nil } @@ -1788,18 +1104,10 @@ func (m *MsgCreateReporter) Size() (n int) { } var l int _ = l - l = len(m.Reporter) + l = len(m.ReporterAddress) if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = m.Amount.Size() - n += 1 + l + sovTx(uint64(l)) - if len(m.TokenOrigins) > 0 { - for _, e := range m.TokenOrigins { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } if m.Commission != nil { l = m.Commission.Size() n += 1 + l + sovTx(uint64(l)) @@ -1816,97 +1124,7 @@ func (m *MsgCreateReporterResponse) Size() (n int) { return n } -func (m *MsgDelegateReporter) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Delegator) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Reporter) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = m.Amount.Size() - n += 1 + l + sovTx(uint64(l)) - if len(m.TokenOrigins) > 0 { - for _, e := range m.TokenOrigins { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } - return n -} - -func (m *MsgDelegateReporterResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgUndelegateReporter) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.DelegatorAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if len(m.TokenOrigins) > 0 { - for _, e := range m.TokenOrigins { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } - return n -} - -func (m *MsgUndelegateReporterResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgWithdrawReporterCommission) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ReporterAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgWithdrawReporterCommissionResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Amount) > 0 { - for _, e := range m.Amount { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } - return n -} - -func (m *MsgWithdrawDelegatorReward) Size() (n int) { +func (m *MsgChangeReporter) Size() (n int) { if m == nil { return 0 } @@ -1923,18 +1141,12 @@ func (m *MsgWithdrawDelegatorReward) Size() (n int) { return n } -func (m *MsgWithdrawDelegatorRewardResponse) Size() (n int) { +func (m *MsgChangeReporterResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if len(m.Amount) > 0 { - for _, e := range m.Amount { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } return n } @@ -2188,7 +1400,7 @@ func (m *MsgCreateReporter) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Reporter", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ReporterAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2216,13 +1428,13 @@ func (m *MsgCreateReporter) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Reporter = string(dAtA[iNdEx:postIndex]) + m.ReporterAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Commission", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -2232,626 +1444,28 @@ func (m *MsgCreateReporter) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if m.Commission == nil { + m.Commission = &types.Commission{} + } + if err := m.Commission.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TokenOrigins", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TokenOrigins = append(m.TokenOrigins, &TokenOrigin{}) - if err := m.TokenOrigins[len(m.TokenOrigins)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Commission", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Commission == nil { - m.Commission = &types.Commission{} - } - if err := m.Commission.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgCreateReporterResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgCreateReporterResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreateReporterResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgDelegateReporter) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgDelegateReporter: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgDelegateReporter: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Delegator", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - 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 ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Delegator = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Reporter", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - 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 ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Reporter = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - 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 ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TokenOrigins", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TokenOrigins = append(m.TokenOrigins, &TokenOrigin{}) - if err := m.TokenOrigins[len(m.TokenOrigins)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgDelegateReporterResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgDelegateReporterResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgDelegateReporterResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgUndelegateReporter) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgUndelegateReporter: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUndelegateReporter: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - 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 ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TokenOrigins", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TokenOrigins = append(m.TokenOrigins, &TokenOrigin{}) - if err := m.TokenOrigins[len(m.TokenOrigins)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgUndelegateReporterResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgUndelegateReporterResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUndelegateReporterResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgWithdrawReporterCommission) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgWithdrawReporterCommission: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgWithdrawReporterCommission: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ReporterAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - 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 ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ReporterAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -2873,7 +1487,7 @@ func (m *MsgWithdrawReporterCommission) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgWithdrawReporterCommissionResponse) Unmarshal(dAtA []byte) error { +func (m *MsgCreateReporterResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2896,46 +1510,12 @@ func (m *MsgWithdrawReporterCommissionResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgWithdrawReporterCommissionResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgCreateReporterResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgWithdrawReporterCommissionResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgCreateReporterResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Amount = append(m.Amount, types1.Coin{}) - if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -2957,7 +1537,7 @@ func (m *MsgWithdrawReporterCommissionResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgWithdrawDelegatorReward) Unmarshal(dAtA []byte) error { +func (m *MsgChangeReporter) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2980,10 +1560,10 @@ func (m *MsgWithdrawDelegatorReward) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgWithdrawDelegatorReward: wiretype end group for non-group") + return fmt.Errorf("proto: MsgChangeReporter: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgWithdrawDelegatorReward: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgChangeReporter: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -3071,7 +1651,7 @@ func (m *MsgWithdrawDelegatorReward) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgWithdrawDelegatorRewardResponse) Unmarshal(dAtA []byte) error { +func (m *MsgChangeReporterResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3094,46 +1674,12 @@ func (m *MsgWithdrawDelegatorRewardResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgWithdrawDelegatorRewardResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgChangeReporterResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgWithdrawDelegatorRewardResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgChangeReporterResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Amount = append(m.Amount, types1.Coin{}) - if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:])