From c2bb70ae57d702edf72e86d15a97e9aaac2671d2 Mon Sep 17 00:00:00 2001 From: ccamel Date: Tue, 21 Mar 2023 13:02:30 +0100 Subject: [PATCH] feat: generate protobuf code --- x/logic/types/params.pb.go | 600 +++++++++++++++++++++++++++++++++++-- 1 file changed, 568 insertions(+), 32 deletions(-) diff --git a/x/logic/types/params.pb.go b/x/logic/types/params.pb.go index 3db39f52..a0b5479a 100644 --- a/x/logic/types/params.pb.go +++ b/x/logic/types/params.pb.go @@ -32,6 +32,8 @@ type Params struct { // The limits are used to prevent the interpreter from running for too long. // If the interpreter runs for too long, the execution will be aborted. Limits Limits `protobuf:"bytes,2,opt,name=limits,proto3" json:"limits" yaml:"limits"` + // GasPolicy defines the parameters for calculating predicate invocation costs. + GasPolicy *GasPolicy `protobuf:"bytes,3,opt,name=gas_policy,json=gasPolicy,proto3" json:"gas_policy,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -80,6 +82,13 @@ func (m *Params) GetLimits() Limits { return Limits{} } +func (m *Params) GetGasPolicy() *GasPolicy { + if m != nil { + return m.GasPolicy + } + return nil +} + // Limits defines the limits of the logic module. type Limits struct { // max_gas specifies the maximum amount of computing power, measured in "gas," that is allowed to be consumed when @@ -203,47 +212,157 @@ func (m *Interpreter) GetBootstrap() string { return "" } +// PredicateCost defines the unit cost of a predicate during its invocation by the interpreter. +type PredicateCost struct { + // Predicate is the name of the predicate, optionally followed by its arity (e.g. "findall/3"). + // If no arity is specified, the unit cost is applied to all predicates with the same name. + Predicate string `protobuf:"bytes,1,opt,name=predicate,proto3" json:"predicate,omitempty" yaml:"predicate"` + // UnitCost is the unit cost of the predicate. + Cost *github_com_cosmos_cosmos_sdk_types.Uint `protobuf:"bytes,2,opt,name=cost,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Uint" json:"cost,omitempty" yaml:"cost",omitempty` +} + +func (m *PredicateCost) Reset() { *m = PredicateCost{} } +func (m *PredicateCost) String() string { return proto.CompactTextString(m) } +func (*PredicateCost) ProtoMessage() {} +func (*PredicateCost) Descriptor() ([]byte, []int) { + return fileDescriptor_3af0daa241de0fa3, []int{3} +} +func (m *PredicateCost) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PredicateCost) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PredicateCost.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 *PredicateCost) XXX_Merge(src proto.Message) { + xxx_messageInfo_PredicateCost.Merge(m, src) +} +func (m *PredicateCost) XXX_Size() int { + return m.Size() +} +func (m *PredicateCost) XXX_DiscardUnknown() { + xxx_messageInfo_PredicateCost.DiscardUnknown(m) +} + +var xxx_messageInfo_PredicateCost proto.InternalMessageInfo + +func (m *PredicateCost) GetPredicate() string { + if m != nil { + return m.Predicate + } + return "" +} + +// GasPolicy defines the policy for calculating predicate invocation costs and the resulting gas consumption. +type GasPolicy struct { + // WeightingFactor is the factor that is applied to the unit cost of each predicate + // to yield the gas value. + // If not provided or set to 0, the default value of 10000 is used. + WeightingFactor *github_com_cosmos_cosmos_sdk_types.Uint `protobuf:"bytes,1,opt,name=weighting_factor,json=weightingFactor,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Uint" json:"weighting_factor,omitempty" yaml:"weighting_factor"` + // PredicateCosts is the list of predicates and their associated unit costs. + // If not provided, all predicates have a unit cost of 1 by default. + PredicateCosts []*PredicateCost `protobuf:"bytes,2,rep,name=predicate_costs,json=predicateCosts,proto3" json:"predicate_costs,omitempty"` +} + +func (m *GasPolicy) Reset() { *m = GasPolicy{} } +func (m *GasPolicy) String() string { return proto.CompactTextString(m) } +func (*GasPolicy) ProtoMessage() {} +func (*GasPolicy) Descriptor() ([]byte, []int) { + return fileDescriptor_3af0daa241de0fa3, []int{4} +} +func (m *GasPolicy) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GasPolicy) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GasPolicy.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 *GasPolicy) XXX_Merge(src proto.Message) { + xxx_messageInfo_GasPolicy.Merge(m, src) +} +func (m *GasPolicy) XXX_Size() int { + return m.Size() +} +func (m *GasPolicy) XXX_DiscardUnknown() { + xxx_messageInfo_GasPolicy.DiscardUnknown(m) +} + +var xxx_messageInfo_GasPolicy proto.InternalMessageInfo + +func (m *GasPolicy) GetPredicateCosts() []*PredicateCost { + if m != nil { + return m.PredicateCosts + } + return nil +} + func init() { proto.RegisterType((*Params)(nil), "logic.v1beta2.Params") proto.RegisterType((*Limits)(nil), "logic.v1beta2.Limits") proto.RegisterType((*Interpreter)(nil), "logic.v1beta2.Interpreter") + proto.RegisterType((*PredicateCost)(nil), "logic.v1beta2.PredicateCost") + proto.RegisterType((*GasPolicy)(nil), "logic.v1beta2.GasPolicy") } func init() { proto.RegisterFile("logic/v1beta2/params.proto", fileDescriptor_3af0daa241de0fa3) } var fileDescriptor_3af0daa241de0fa3 = []byte{ - // 488 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x93, 0x4f, 0x6b, 0xd4, 0x40, - 0x18, 0xc6, 0x33, 0x5b, 0x89, 0xee, 0x2c, 0xd5, 0x12, 0x5b, 0x0c, 0x2b, 0x24, 0x65, 0x7a, 0xb0, - 0x07, 0x4d, 0xb0, 0x8a, 0x87, 0x82, 0x97, 0x28, 0x88, 0x7f, 0x0e, 0x12, 0xf1, 0x0f, 0x82, 0x2c, - 0x93, 0xec, 0x90, 0x0e, 0x9b, 0xd9, 0x09, 0x99, 0x77, 0x75, 0xb7, 0x9f, 0xc2, 0xa3, 0x47, 0x3f, - 0x81, 0x9f, 0x63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xfa, 0x75, 0x4f, 0x0d, 0x47, 0x3e, 0xcc, 0x32, 0xa6, - 0xbc, 0xb7, 0x7c, 0x0c, 0xab, 0xc2, 0xb5, 0xab, 0xac, 0x9a, 0x43, 0xee, 0x4a, 0xc1, 0x81, 0x89, - 0x0c, 0x66, 0xa1, 0x29, 0xe8, 0xf4, 0x19, 0x55, 0xd6, 0x27, 0x7c, 0xad, 0x54, 0x15, 0x3f, 0x66, - 0xf6, 0x86, 0x8e, 0x09, 0xd6, 0x8f, 0xb9, 0xd1, 0xc4, 0x94, 0x20, 0x12, 0x96, 0x93, 0xbf, 0xe1, - 0xc7, 0xcc, 0x02, 0xbc, 0x55, 0x56, 0x73, 0xa6, 0x26, 0x29, 0x0c, 0x62, 0x39, 0x19, 0x83, 0xde, - 0x52, 0x37, 0x78, 0xb1, 0x7e, 0xcc, 0xad, 0x26, 0xa6, 0x0d, 0x24, 0xe1, 0x75, 0x41, 0xa7, 0xa1, - 0xae, 0x3c, 0x29, 0x0b, 0x7a, 0x97, 0x88, 0xfc, 0x45, 0xb8, 0xd7, 0x3a, 0x50, 0xeb, 0x1d, 0xde, - 0xce, 0x72, 0x36, 0xe4, 0x31, 0x05, 0xa6, 0x06, 0x5f, 0x8e, 0x38, 0xb0, 0x94, 0x2b, 0xb0, 0xd1, - 0xee, 0xc6, 0x7e, 0x37, 0xd8, 0x2b, 0xe7, 0x59, 0x15, 0xee, 0xed, 0x2a, 0xe4, 0x7f, 0x4e, 0x12, - 0xde, 0x6c, 0xca, 0xef, 0x4f, 0xab, 0x17, 0xb8, 0x51, 0x4a, 0xe3, 0x91, 0xe6, 0x76, 0x2e, 0xe1, - 0x9e, 0x39, 0xcf, 0x71, 0x83, 0xd3, 0xaa, 0xf5, 0x08, 0x77, 0x23, 0x29, 0x41, 0x41, 0x4e, 0xb3, - 0xfa, 0x6c, 0xec, 0x1a, 0xb6, 0x55, 0xc1, 0xce, 0x64, 0x12, 0x36, 0xd6, 0xea, 0xef, 0x83, 0xc7, - 0xf3, 0x85, 0x83, 0x4e, 0x16, 0x0e, 0xfa, 0xb3, 0x70, 0xd0, 0xd7, 0xa5, 0x63, 0x9c, 0x2c, 0x1d, - 0xe3, 0xd7, 0xd2, 0x31, 0x3e, 0xee, 0xb5, 0x36, 0x2e, 0x47, 0xd9, 0x43, 0xfd, 0x18, 0xfa, 0x53, - 0xbf, 0xba, 0x6d, 0x7a, 0xe5, 0x91, 0xa9, 0x2f, 0xd0, 0x83, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, - 0x76, 0x62, 0xe7, 0x7f, 0x83, 0x03, 0x00, 0x00, + // 615 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0x3d, 0x6f, 0xd4, 0x30, + 0x1c, 0xc6, 0xcf, 0x6d, 0x75, 0x10, 0x9f, 0xfa, 0x22, 0xd3, 0x8a, 0xe8, 0x40, 0x97, 0xca, 0x1d, + 0xe8, 0x00, 0x89, 0x28, 0x08, 0xa4, 0x4a, 0x2c, 0x29, 0x50, 0xde, 0x86, 0xca, 0x88, 0x17, 0x21, + 0x50, 0xe4, 0xcb, 0x99, 0xd4, 0x6a, 0x72, 0x8e, 0x62, 0x1f, 0xbd, 0xeb, 0xa7, 0x60, 0x64, 0x64, + 0xe1, 0xbb, 0xb4, 0x5b, 0x47, 0xc4, 0x10, 0xa1, 0x76, 0x60, 0xef, 0xca, 0x82, 0xe2, 0xe4, 0x92, + 0x34, 0x42, 0x42, 0x65, 0xb9, 0x4b, 0x9e, 0xe7, 0xef, 0xdf, 0xff, 0xf1, 0x4b, 0x0c, 0xbb, 0xa1, + 0x08, 0xb8, 0xef, 0x7c, 0xba, 0xdd, 0x67, 0x8a, 0x6e, 0x38, 0x31, 0x4d, 0x68, 0x24, 0xed, 0x38, + 0x11, 0x4a, 0xa0, 0x79, 0xed, 0xd9, 0x85, 0xd7, 0x5d, 0x0e, 0x44, 0x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, 0xd3, 0x33, 0x48, 0xfd, 0x08, 0x6a, + 0x2a, 0x3e, 0x02, 0xd0, 0x28, 0x3f, 0x08, 0x34, 0x82, 0x4b, 0xfb, 0x8c, 0x07, 0xbb, 0x8a, 0x0f, + 0x03, 0xef, 0x23, 0xf5, 0x95, 0x48, 0x8a, 0xa8, 0xff, 0x7f, 0x5e, 0x9a, 0x40, 0x4c, 0x16, 0x4b, + 0xe9, 0xb1, 0x56, 0xd0, 0x23, 0xb8, 0x58, 0xce, 0xd7, 0xcb, 0x62, 0x49, 0xbd, 0x7b, 0x9d, 0x8d, + 0xeb, 0x8d, 0x4f, 0xf7, 0xdc, 0x8a, 0x92, 0x85, 0xb8, 0xfe, 0x2a, 0xdd, 0x07, 0x87, 0x27, 0x3d, + 0x70, 0x7c, 0xd2, 0x03, 0x3f, 0x4f, 0x7a, 0xe0, 0xf3, 0x69, 0xaf, 0x75, 0x7c, 0xda, 0x6b, 0x7d, + 0x3f, 0xed, 0xb5, 0xde, 0xad, 0xd5, 0x52, 0x8b, 0xbd, 0xf8, 0xae, 0xfe, 0x19, 0x38, 0x63, 0x27, + 0xbf, 0x1a, 0x75, 0xec, 0x7e, 0x5b, 0xdf, 0x76, 0x77, 0xfe, 0x04, 0x00, 0x00, 0xff, 0xff, 0x01, + 0x09, 0xc0, 0xf9, 0x30, 0x05, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -266,6 +385,18 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.GasPolicy != nil { + { + size, err := m.GasPolicy.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } { size, err := m.Limits.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -396,6 +527,97 @@ func (m *Interpreter) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *PredicateCost) 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 *PredicateCost) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PredicateCost) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Cost != nil { + { + size := m.Cost.Size() + i -= size + if _, err := m.Cost.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Predicate) > 0 { + i -= len(m.Predicate) + copy(dAtA[i:], m.Predicate) + i = encodeVarintParams(dAtA, i, uint64(len(m.Predicate))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GasPolicy) 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 *GasPolicy) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GasPolicy) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.PredicateCosts) > 0 { + for iNdEx := len(m.PredicateCosts) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.PredicateCosts[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.WeightingFactor != nil { + { + size := m.WeightingFactor.Size() + i -= size + if _, err := m.WeightingFactor.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintParams(dAtA []byte, offset int, v uint64) int { offset -= sovParams(v) base := offset @@ -417,6 +639,10 @@ func (m *Params) Size() (n int) { n += 1 + l + sovParams(uint64(l)) l = m.Limits.Size() n += 1 + l + sovParams(uint64(l)) + if m.GasPolicy != nil { + l = m.GasPolicy.Size() + n += 1 + l + sovParams(uint64(l)) + } return n } @@ -466,6 +692,42 @@ func (m *Interpreter) Size() (n int) { return n } +func (m *PredicateCost) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Predicate) + if l > 0 { + n += 1 + l + sovParams(uint64(l)) + } + if m.Cost != nil { + l = m.Cost.Size() + n += 1 + l + sovParams(uint64(l)) + } + return n +} + +func (m *GasPolicy) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.WeightingFactor != nil { + l = m.WeightingFactor.Size() + n += 1 + l + sovParams(uint64(l)) + } + if len(m.PredicateCosts) > 0 { + for _, e := range m.PredicateCosts { + l = e.Size() + n += 1 + l + sovParams(uint64(l)) + } + } + return n +} + func sovParams(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -567,6 +829,42 @@ func (m *Params) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GasPolicy", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.GasPolicy == nil { + m.GasPolicy = &GasPolicy{} + } + if err := m.GasPolicy.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipParams(dAtA[iNdEx:]) @@ -892,6 +1190,244 @@ func (m *Interpreter) Unmarshal(dAtA []byte) error { } return nil } +func (m *PredicateCost) 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 ErrIntOverflowParams + } + 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: PredicateCost: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PredicateCost: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Predicate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + 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 ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Predicate = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Cost", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + 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 ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v github_com_cosmos_cosmos_sdk_types.Uint + m.Cost = &v + if err := m.Cost.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GasPolicy) 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 ErrIntOverflowParams + } + 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: GasPolicy: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GasPolicy: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field WeightingFactor", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + 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 ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v github_com_cosmos_cosmos_sdk_types.Uint + m.WeightingFactor = &v + if err := m.WeightingFactor.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PredicateCosts", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PredicateCosts = append(m.PredicateCosts, &PredicateCost{}) + if err := m.PredicateCosts[len(m.PredicateCosts)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipParams(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0