diff --git a/Makefile b/Makefile index 3372ea32a..0dd79ed99 100644 --- a/Makefile +++ b/Makefile @@ -837,11 +837,15 @@ params_update_proof_all: ## Update the proof module params params_update_proof_min_relay_difficulty_bits: ## Update the proof module params poktrolld tx authz exec ./tools/scripts/params/proof_min_relay_difficulty_bits.json $(PARAM_FLAGS) -### Session Module Params ### -.PHONY: params_update_session_all +### Shared Module Params ### +.PHONY: params_update_shared_all params_update_shared_all: ## Update the session module params poktrolld tx authz exec ./tools/scripts/params/shared_all.json $(PARAM_FLAGS) +.PHONY: params_update_shared_num_blocks_per_session +params_update_shared_num_blocks_per_session: ## Update the shared module params + poktrolld tx authz exec ./tools/scripts/params/shared_num_blocks_per_session.json $(PARAM_FLAGS) + .PHONY: params_query_all params_query_all: check_jq ## Query the params from all available modules @for module in $(MODULES); do \ diff --git a/api/poktroll/shared/tx.pulsar.go b/api/poktroll/shared/tx.pulsar.go index 152712a8d..7c8d19bc5 100644 --- a/api/poktroll/shared/tx.pulsar.go +++ b/api/poktroll/shared/tx.pulsar.go @@ -871,6 +871,1162 @@ func (x *fastReflection_MsgUpdateParamsResponse) ProtoMethods() *protoiface.Meth } } +var ( + md_MsgUpdateParam protoreflect.MessageDescriptor + fd_MsgUpdateParam_authority protoreflect.FieldDescriptor + fd_MsgUpdateParam_name protoreflect.FieldDescriptor + fd_MsgUpdateParam_as_string protoreflect.FieldDescriptor + fd_MsgUpdateParam_as_int64 protoreflect.FieldDescriptor + fd_MsgUpdateParam_as_bytes protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_shared_tx_proto_init() + md_MsgUpdateParam = File_poktroll_shared_tx_proto.Messages().ByName("MsgUpdateParam") + fd_MsgUpdateParam_authority = md_MsgUpdateParam.Fields().ByName("authority") + fd_MsgUpdateParam_name = md_MsgUpdateParam.Fields().ByName("name") + fd_MsgUpdateParam_as_string = md_MsgUpdateParam.Fields().ByName("as_string") + fd_MsgUpdateParam_as_int64 = md_MsgUpdateParam.Fields().ByName("as_int64") + fd_MsgUpdateParam_as_bytes = md_MsgUpdateParam.Fields().ByName("as_bytes") +} + +var _ protoreflect.Message = (*fastReflection_MsgUpdateParam)(nil) + +type fastReflection_MsgUpdateParam MsgUpdateParam + +func (x *MsgUpdateParam) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUpdateParam)(x) +} + +func (x *MsgUpdateParam) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_shared_tx_proto_msgTypes[2] + 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_MsgUpdateParam_messageType fastReflection_MsgUpdateParam_messageType +var _ protoreflect.MessageType = fastReflection_MsgUpdateParam_messageType{} + +type fastReflection_MsgUpdateParam_messageType struct{} + +func (x fastReflection_MsgUpdateParam_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUpdateParam)(nil) +} +func (x fastReflection_MsgUpdateParam_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParam) +} +func (x fastReflection_MsgUpdateParam_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParam +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUpdateParam) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParam +} + +// 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_MsgUpdateParam) Type() protoreflect.MessageType { + return _fastReflection_MsgUpdateParam_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUpdateParam) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParam) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUpdateParam) Interface() protoreflect.ProtoMessage { + return (*MsgUpdateParam)(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_MsgUpdateParam) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Authority != "" { + value := protoreflect.ValueOfString(x.Authority) + if !f(fd_MsgUpdateParam_authority, value) { + return + } + } + if x.Name != "" { + value := protoreflect.ValueOfString(x.Name) + if !f(fd_MsgUpdateParam_name, value) { + return + } + } + if x.AsType != nil { + switch o := x.AsType.(type) { + case *MsgUpdateParam_AsString: + v := o.AsString + value := protoreflect.ValueOfString(v) + if !f(fd_MsgUpdateParam_as_string, value) { + return + } + case *MsgUpdateParam_AsInt64: + v := o.AsInt64 + value := protoreflect.ValueOfInt64(v) + if !f(fd_MsgUpdateParam_as_int64, value) { + return + } + case *MsgUpdateParam_AsBytes: + v := o.AsBytes + value := protoreflect.ValueOfBytes(v) + if !f(fd_MsgUpdateParam_as_bytes, 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_MsgUpdateParam) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.shared.MsgUpdateParam.authority": + return x.Authority != "" + case "poktroll.shared.MsgUpdateParam.name": + return x.Name != "" + case "poktroll.shared.MsgUpdateParam.as_string": + if x.AsType == nil { + return false + } else if _, ok := x.AsType.(*MsgUpdateParam_AsString); ok { + return true + } else { + return false + } + case "poktroll.shared.MsgUpdateParam.as_int64": + if x.AsType == nil { + return false + } else if _, ok := x.AsType.(*MsgUpdateParam_AsInt64); ok { + return true + } else { + return false + } + case "poktroll.shared.MsgUpdateParam.as_bytes": + if x.AsType == nil { + return false + } else if _, ok := x.AsType.(*MsgUpdateParam_AsBytes); ok { + return true + } else { + return false + } + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.MsgUpdateParam")) + } + panic(fmt.Errorf("message poktroll.shared.MsgUpdateParam 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_MsgUpdateParam) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.shared.MsgUpdateParam.authority": + x.Authority = "" + case "poktroll.shared.MsgUpdateParam.name": + x.Name = "" + case "poktroll.shared.MsgUpdateParam.as_string": + x.AsType = nil + case "poktroll.shared.MsgUpdateParam.as_int64": + x.AsType = nil + case "poktroll.shared.MsgUpdateParam.as_bytes": + x.AsType = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.MsgUpdateParam")) + } + panic(fmt.Errorf("message poktroll.shared.MsgUpdateParam 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_MsgUpdateParam) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.shared.MsgUpdateParam.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + case "poktroll.shared.MsgUpdateParam.name": + value := x.Name + return protoreflect.ValueOfString(value) + case "poktroll.shared.MsgUpdateParam.as_string": + if x.AsType == nil { + return protoreflect.ValueOfString("") + } else if v, ok := x.AsType.(*MsgUpdateParam_AsString); ok { + return protoreflect.ValueOfString(v.AsString) + } else { + return protoreflect.ValueOfString("") + } + case "poktroll.shared.MsgUpdateParam.as_int64": + if x.AsType == nil { + return protoreflect.ValueOfInt64(int64(0)) + } else if v, ok := x.AsType.(*MsgUpdateParam_AsInt64); ok { + return protoreflect.ValueOfInt64(v.AsInt64) + } else { + return protoreflect.ValueOfInt64(int64(0)) + } + case "poktroll.shared.MsgUpdateParam.as_bytes": + if x.AsType == nil { + return protoreflect.ValueOfBytes(nil) + } else if v, ok := x.AsType.(*MsgUpdateParam_AsBytes); ok { + return protoreflect.ValueOfBytes(v.AsBytes) + } else { + return protoreflect.ValueOfBytes(nil) + } + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.MsgUpdateParam")) + } + panic(fmt.Errorf("message poktroll.shared.MsgUpdateParam 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_MsgUpdateParam) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.shared.MsgUpdateParam.authority": + x.Authority = value.Interface().(string) + case "poktroll.shared.MsgUpdateParam.name": + x.Name = value.Interface().(string) + case "poktroll.shared.MsgUpdateParam.as_string": + cv := value.Interface().(string) + x.AsType = &MsgUpdateParam_AsString{AsString: cv} + case "poktroll.shared.MsgUpdateParam.as_int64": + cv := value.Int() + x.AsType = &MsgUpdateParam_AsInt64{AsInt64: cv} + case "poktroll.shared.MsgUpdateParam.as_bytes": + cv := value.Bytes() + x.AsType = &MsgUpdateParam_AsBytes{AsBytes: cv} + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.MsgUpdateParam")) + } + panic(fmt.Errorf("message poktroll.shared.MsgUpdateParam 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_MsgUpdateParam) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.shared.MsgUpdateParam.authority": + panic(fmt.Errorf("field authority of message poktroll.shared.MsgUpdateParam is not mutable")) + case "poktroll.shared.MsgUpdateParam.name": + panic(fmt.Errorf("field name of message poktroll.shared.MsgUpdateParam is not mutable")) + case "poktroll.shared.MsgUpdateParam.as_string": + panic(fmt.Errorf("field as_string of message poktroll.shared.MsgUpdateParam is not mutable")) + case "poktroll.shared.MsgUpdateParam.as_int64": + panic(fmt.Errorf("field as_int64 of message poktroll.shared.MsgUpdateParam is not mutable")) + case "poktroll.shared.MsgUpdateParam.as_bytes": + panic(fmt.Errorf("field as_bytes of message poktroll.shared.MsgUpdateParam is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.MsgUpdateParam")) + } + panic(fmt.Errorf("message poktroll.shared.MsgUpdateParam 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_MsgUpdateParam) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.shared.MsgUpdateParam.authority": + return protoreflect.ValueOfString("") + case "poktroll.shared.MsgUpdateParam.name": + return protoreflect.ValueOfString("") + case "poktroll.shared.MsgUpdateParam.as_string": + return protoreflect.ValueOfString("") + case "poktroll.shared.MsgUpdateParam.as_int64": + return protoreflect.ValueOfInt64(int64(0)) + case "poktroll.shared.MsgUpdateParam.as_bytes": + return protoreflect.ValueOfBytes(nil) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.MsgUpdateParam")) + } + panic(fmt.Errorf("message poktroll.shared.MsgUpdateParam 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_MsgUpdateParam) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + case "poktroll.shared.MsgUpdateParam.as_type": + if x.AsType == nil { + return nil + } + switch x.AsType.(type) { + case *MsgUpdateParam_AsString: + return x.Descriptor().Fields().ByName("as_string") + case *MsgUpdateParam_AsInt64: + return x.Descriptor().Fields().ByName("as_int64") + case *MsgUpdateParam_AsBytes: + return x.Descriptor().Fields().ByName("as_bytes") + } + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.shared.MsgUpdateParam", 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_MsgUpdateParam) 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_MsgUpdateParam) 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_MsgUpdateParam) 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_MsgUpdateParam) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgUpdateParam) + 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.Authority) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Name) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + switch x := x.AsType.(type) { + case *MsgUpdateParam_AsString: + if x == nil { + break + } + l = len(x.AsString) + n += 1 + l + runtime.Sov(uint64(l)) + case *MsgUpdateParam_AsInt64: + if x == nil { + break + } + n += 1 + runtime.Sov(uint64(x.AsInt64)) + case *MsgUpdateParam_AsBytes: + if x == nil { + break + } + l = len(x.AsBytes) + 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().(*MsgUpdateParam) + 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) + } + switch x := x.AsType.(type) { + case *MsgUpdateParam_AsString: + i -= len(x.AsString) + copy(dAtA[i:], x.AsString) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.AsString))) + i-- + dAtA[i] = 0x1a + case *MsgUpdateParam_AsInt64: + i = runtime.EncodeVarint(dAtA, i, uint64(x.AsInt64)) + i-- + dAtA[i] = 0x30 + case *MsgUpdateParam_AsBytes: + i -= len(x.AsBytes) + copy(dAtA[i:], x.AsBytes) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.AsBytes))) + i-- + dAtA[i] = 0x3a + } + if len(x.Name) > 0 { + i -= len(x.Name) + copy(dAtA[i:], x.Name) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Name))) + i-- + dAtA[i] = 0x12 + } + if len(x.Authority) > 0 { + i -= len(x.Authority) + copy(dAtA[i:], x.Authority) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority))) + 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().(*MsgUpdateParam) + 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: MsgUpdateParam: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParam: 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 Authority", 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.Authority = 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 Name", 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.Name = 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 AsString", 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.AsType = &MsgUpdateParam_AsString{string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 6: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AsInt64", wireType) + } + var v int64 + 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++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + x.AsType = &MsgUpdateParam_AsInt64{v} + case 7: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AsBytes", 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 + } + v := make([]byte, postIndex-iNdEx) + copy(v, dAtA[iNdEx:postIndex]) + x.AsType = &MsgUpdateParam_AsBytes{v} + 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_MsgUpdateParamResponse protoreflect.MessageDescriptor + fd_MsgUpdateParamResponse_params protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_shared_tx_proto_init() + md_MsgUpdateParamResponse = File_poktroll_shared_tx_proto.Messages().ByName("MsgUpdateParamResponse") + fd_MsgUpdateParamResponse_params = md_MsgUpdateParamResponse.Fields().ByName("params") +} + +var _ protoreflect.Message = (*fastReflection_MsgUpdateParamResponse)(nil) + +type fastReflection_MsgUpdateParamResponse MsgUpdateParamResponse + +func (x *MsgUpdateParamResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUpdateParamResponse)(x) +} + +func (x *MsgUpdateParamResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_shared_tx_proto_msgTypes[3] + 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_MsgUpdateParamResponse_messageType fastReflection_MsgUpdateParamResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgUpdateParamResponse_messageType{} + +type fastReflection_MsgUpdateParamResponse_messageType struct{} + +func (x fastReflection_MsgUpdateParamResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUpdateParamResponse)(nil) +} +func (x fastReflection_MsgUpdateParamResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParamResponse) +} +func (x fastReflection_MsgUpdateParamResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParamResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUpdateParamResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParamResponse +} + +// 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_MsgUpdateParamResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgUpdateParamResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUpdateParamResponse) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParamResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUpdateParamResponse) Interface() protoreflect.ProtoMessage { + return (*MsgUpdateParamResponse)(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_MsgUpdateParamResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Params != nil { + value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + if !f(fd_MsgUpdateParamResponse_params, 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_MsgUpdateParamResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.shared.MsgUpdateParamResponse.params": + return x.Params != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.MsgUpdateParamResponse")) + } + panic(fmt.Errorf("message poktroll.shared.MsgUpdateParamResponse 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_MsgUpdateParamResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.shared.MsgUpdateParamResponse.params": + x.Params = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.MsgUpdateParamResponse")) + } + panic(fmt.Errorf("message poktroll.shared.MsgUpdateParamResponse 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_MsgUpdateParamResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.shared.MsgUpdateParamResponse.params": + value := x.Params + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.MsgUpdateParamResponse")) + } + panic(fmt.Errorf("message poktroll.shared.MsgUpdateParamResponse 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_MsgUpdateParamResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.shared.MsgUpdateParamResponse.params": + x.Params = value.Message().Interface().(*Params) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.MsgUpdateParamResponse")) + } + panic(fmt.Errorf("message poktroll.shared.MsgUpdateParamResponse 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_MsgUpdateParamResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.shared.MsgUpdateParamResponse.params": + if x.Params == nil { + x.Params = new(Params) + } + return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.MsgUpdateParamResponse")) + } + panic(fmt.Errorf("message poktroll.shared.MsgUpdateParamResponse 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_MsgUpdateParamResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.shared.MsgUpdateParamResponse.params": + m := new(Params) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.shared.MsgUpdateParamResponse")) + } + panic(fmt.Errorf("message poktroll.shared.MsgUpdateParamResponse 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_MsgUpdateParamResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.shared.MsgUpdateParamResponse", 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_MsgUpdateParamResponse) 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_MsgUpdateParamResponse) 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_MsgUpdateParamResponse) 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_MsgUpdateParamResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgUpdateParamResponse) + 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.Params != nil { + l = options.Size(x.Params) + 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().(*MsgUpdateParamResponse) + 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.Params != nil { + encoded, err := options.Marshal(x.Params) + 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().(*MsgUpdateParamResponse) + 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: MsgUpdateParamResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParamResponse: 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 Params", 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.Params == nil { + x.Params = &Params{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); 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 @@ -892,8 +2048,6 @@ type MsgUpdateParams struct { // 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"` - // params defines the module parameters to update. - // // NOTE: All parameters must be supplied. Params *Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty"` } @@ -960,6 +2114,144 @@ func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { return file_poktroll_shared_tx_proto_rawDescGZIP(), []int{1} } +// MsgUpdateParam is the Msg/UpdateParam request type to update a single param. +type MsgUpdateParam 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"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // Types that are assignable to AsType: + // + // *MsgUpdateParam_AsString + // *MsgUpdateParam_AsInt64 + // *MsgUpdateParam_AsBytes + AsType isMsgUpdateParam_AsType `protobuf_oneof:"as_type"` +} + +func (x *MsgUpdateParam) Reset() { + *x = MsgUpdateParam{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_shared_tx_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUpdateParam) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUpdateParam) ProtoMessage() {} + +// Deprecated: Use MsgUpdateParam.ProtoReflect.Descriptor instead. +func (*MsgUpdateParam) Descriptor() ([]byte, []int) { + return file_poktroll_shared_tx_proto_rawDescGZIP(), []int{2} +} + +func (x *MsgUpdateParam) GetAuthority() string { + if x != nil { + return x.Authority + } + return "" +} + +func (x *MsgUpdateParam) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *MsgUpdateParam) GetAsType() isMsgUpdateParam_AsType { + if x != nil { + return x.AsType + } + return nil +} + +func (x *MsgUpdateParam) GetAsString() string { + if x, ok := x.GetAsType().(*MsgUpdateParam_AsString); ok { + return x.AsString + } + return "" +} + +func (x *MsgUpdateParam) GetAsInt64() int64 { + if x, ok := x.GetAsType().(*MsgUpdateParam_AsInt64); ok { + return x.AsInt64 + } + return 0 +} + +func (x *MsgUpdateParam) GetAsBytes() []byte { + if x, ok := x.GetAsType().(*MsgUpdateParam_AsBytes); ok { + return x.AsBytes + } + return nil +} + +type isMsgUpdateParam_AsType interface { + isMsgUpdateParam_AsType() +} + +type MsgUpdateParam_AsString struct { + AsString string `protobuf:"bytes,3,opt,name=as_string,json=asString,proto3,oneof"` +} + +type MsgUpdateParam_AsInt64 struct { + AsInt64 int64 `protobuf:"varint,6,opt,name=as_int64,json=asInt64,proto3,oneof"` +} + +type MsgUpdateParam_AsBytes struct { + AsBytes []byte `protobuf:"bytes,7,opt,name=as_bytes,json=asBytes,proto3,oneof"` +} + +func (*MsgUpdateParam_AsString) isMsgUpdateParam_AsType() {} + +func (*MsgUpdateParam_AsInt64) isMsgUpdateParam_AsType() {} + +func (*MsgUpdateParam_AsBytes) isMsgUpdateParam_AsType() {} + +// MsgUpdateParamResponse defines the response structure for executing a +// MsgUpdateParam message after a single param update. +type MsgUpdateParamResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` +} + +func (x *MsgUpdateParamResponse) Reset() { + *x = MsgUpdateParamResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_shared_tx_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUpdateParamResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUpdateParamResponse) ProtoMessage() {} + +// Deprecated: Use MsgUpdateParamResponse.ProtoReflect.Descriptor instead. +func (*MsgUpdateParamResponse) Descriptor() ([]byte, []int) { + return file_poktroll_shared_tx_proto_rawDescGZIP(), []int{3} +} + +func (x *MsgUpdateParamResponse) GetParams() *Params { + if x != nil { + return x.Params + } + return nil +} + var File_poktroll_shared_tx_proto protoreflect.FileDescriptor var file_poktroll_shared_tx_proto_rawDesc = []byte{ @@ -986,25 +2278,51 @@ var file_poktroll_shared_tx_proto_rawDesc = []byte{ 0xb0, 0x2a, 0x21, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x78, 0x2f, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 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, 0x32, - 0x68, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x5a, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x20, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x28, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0x9d, 0x01, 0x0a, 0x13, 0x63, 0x6f, - 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, - 0x64, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x20, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, - 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0xa2, 0x02, - 0x03, 0x50, 0x53, 0x58, 0xaa, 0x02, 0x0f, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, - 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0xca, 0x02, 0x0f, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x5c, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0xe2, 0x02, 0x1b, 0x50, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x3a, 0x3a, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0xfb, 0x01, 0x0a, 0x0e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, + 0x61, 0x6d, 0x12, 0x36, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 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, + 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2c, + 0x0a, 0x09, 0x61, 0x73, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x42, 0x0d, 0xea, 0xde, 0x1f, 0x09, 0x61, 0x73, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, + 0x48, 0x00, 0x52, 0x08, 0x61, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x29, 0x0a, 0x08, + 0x61, 0x73, 0x5f, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x42, 0x0c, + 0xea, 0xde, 0x1f, 0x08, 0x61, 0x73, 0x5f, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x48, 0x00, 0x52, 0x07, + 0x61, 0x73, 0x49, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x29, 0x0a, 0x08, 0x61, 0x73, 0x5f, 0x62, 0x79, + 0x74, 0x65, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x0c, 0xea, 0xde, 0x1f, 0x08, 0x61, + 0x73, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x48, 0x00, 0x52, 0x07, 0x61, 0x73, 0x42, 0x79, 0x74, + 0x65, 0x73, 0x3a, 0x0e, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, + 0x74, 0x79, 0x42, 0x09, 0x0a, 0x07, 0x61, 0x73, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x22, 0x49, 0x0a, + 0x16, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2f, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x32, 0xc1, 0x01, 0x0a, 0x03, 0x4d, 0x73, 0x67, + 0x12, 0x5a, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x12, 0x20, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, + 0x65, 0x64, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x1a, 0x28, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, + 0x61, 0x72, 0x65, 0x64, 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, 0x57, 0x0a, 0x0b, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x1f, 0x2e, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, 0x4d, 0x73, + 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x1a, 0x27, 0x2e, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2e, 0x4d, + 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0x9d, 0x01, 0x0a, + 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x68, + 0x61, 0x72, 0x65, 0x64, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, + 0x20, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, + 0x69, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x73, 0x68, 0x61, 0x72, 0x65, + 0x64, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, 0x02, 0x0f, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0xca, 0x02, 0x0f, 0x50, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0xe2, 0x02, 0x1b, 0x50, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0x5c, 0x47, 0x50, + 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x68, 0x61, 0x72, 0x65, 0x64, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1019,21 +2337,26 @@ func file_poktroll_shared_tx_proto_rawDescGZIP() []byte { return file_poktroll_shared_tx_proto_rawDescData } -var file_poktroll_shared_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_poktroll_shared_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_poktroll_shared_tx_proto_goTypes = []interface{}{ (*MsgUpdateParams)(nil), // 0: poktroll.shared.MsgUpdateParams (*MsgUpdateParamsResponse)(nil), // 1: poktroll.shared.MsgUpdateParamsResponse - (*Params)(nil), // 2: poktroll.shared.Params + (*MsgUpdateParam)(nil), // 2: poktroll.shared.MsgUpdateParam + (*MsgUpdateParamResponse)(nil), // 3: poktroll.shared.MsgUpdateParamResponse + (*Params)(nil), // 4: poktroll.shared.Params } var file_poktroll_shared_tx_proto_depIdxs = []int32{ - 2, // 0: poktroll.shared.MsgUpdateParams.params:type_name -> poktroll.shared.Params - 0, // 1: poktroll.shared.Msg.UpdateParams:input_type -> poktroll.shared.MsgUpdateParams - 1, // 2: poktroll.shared.Msg.UpdateParams:output_type -> poktroll.shared.MsgUpdateParamsResponse - 2, // [2:3] is the sub-list for method output_type - 1, // [1:2] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name + 4, // 0: poktroll.shared.MsgUpdateParams.params:type_name -> poktroll.shared.Params + 4, // 1: poktroll.shared.MsgUpdateParamResponse.params:type_name -> poktroll.shared.Params + 0, // 2: poktroll.shared.Msg.UpdateParams:input_type -> poktroll.shared.MsgUpdateParams + 2, // 3: poktroll.shared.Msg.UpdateParam:input_type -> poktroll.shared.MsgUpdateParam + 1, // 4: poktroll.shared.Msg.UpdateParams:output_type -> poktroll.shared.MsgUpdateParamsResponse + 3, // 5: poktroll.shared.Msg.UpdateParam:output_type -> poktroll.shared.MsgUpdateParamResponse + 4, // [4:6] is the sub-list for method output_type + 2, // [2:4] 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_poktroll_shared_tx_proto_init() } @@ -1067,6 +2390,35 @@ func file_poktroll_shared_tx_proto_init() { return nil } } + file_poktroll_shared_tx_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgUpdateParam); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_shared_tx_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgUpdateParamResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_poktroll_shared_tx_proto_msgTypes[2].OneofWrappers = []interface{}{ + (*MsgUpdateParam_AsString)(nil), + (*MsgUpdateParam_AsInt64)(nil), + (*MsgUpdateParam_AsBytes)(nil), } type x struct{} out := protoimpl.TypeBuilder{ @@ -1074,7 +2426,7 @@ func file_poktroll_shared_tx_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_poktroll_shared_tx_proto_rawDesc, NumEnums: 0, - NumMessages: 2, + NumMessages: 4, NumExtensions: 0, NumServices: 1, }, diff --git a/api/poktroll/shared/tx_grpc.pb.go b/api/poktroll/shared/tx_grpc.pb.go index 6e760cdf7..f9ab841de 100644 --- a/api/poktroll/shared/tx_grpc.pb.go +++ b/api/poktroll/shared/tx_grpc.pb.go @@ -20,6 +20,7 @@ const _ = grpc.SupportPackageIsVersion7 const ( Msg_UpdateParams_FullMethodName = "/poktroll.shared.Msg/UpdateParams" + Msg_UpdateParam_FullMethodName = "/poktroll.shared.Msg/UpdateParam" ) // MsgClient is the client API for Msg service. @@ -29,6 +30,7 @@ type MsgClient interface { // UpdateParams defines a (governance) operation for updating the module // parameters. The authority defaults to the x/gov module account. UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) + UpdateParam(ctx context.Context, in *MsgUpdateParam, opts ...grpc.CallOption) (*MsgUpdateParamResponse, error) } type msgClient struct { @@ -48,6 +50,15 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts return out, nil } +func (c *msgClient) UpdateParam(ctx context.Context, in *MsgUpdateParam, opts ...grpc.CallOption) (*MsgUpdateParamResponse, error) { + out := new(MsgUpdateParamResponse) + err := c.cc.Invoke(ctx, Msg_UpdateParam_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. // All implementations must embed UnimplementedMsgServer // for forward compatibility @@ -55,6 +66,7 @@ type MsgServer interface { // UpdateParams defines a (governance) operation for updating the module // parameters. The authority defaults to the x/gov module account. UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) + UpdateParam(context.Context, *MsgUpdateParam) (*MsgUpdateParamResponse, error) mustEmbedUnimplementedMsgServer() } @@ -65,6 +77,9 @@ type UnimplementedMsgServer struct { func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") } +func (UnimplementedMsgServer) UpdateParam(context.Context, *MsgUpdateParam) (*MsgUpdateParamResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParam not implemented") +} func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {} // UnsafeMsgServer may be embedded to opt out of forward compatibility for this service. @@ -96,6 +111,24 @@ func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(in return interceptor(ctx, in, info, handler) } +func _Msg_UpdateParam_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateParam) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateParam(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Msg_UpdateParam_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateParam(ctx, req.(*MsgUpdateParam)) + } + return interceptor(ctx, in, info, handler) +} + // Msg_ServiceDesc is the grpc.ServiceDesc for Msg service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -107,6 +140,10 @@ var Msg_ServiceDesc = grpc.ServiceDesc{ MethodName: "UpdateParams", Handler: _Msg_UpdateParams_Handler, }, + { + MethodName: "UpdateParam", + Handler: _Msg_UpdateParam_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "poktroll/shared/tx.proto", diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index f09f70e84..11f698dd2 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -15929,403 +15929,6 @@ paths: parameters. tags: - Msg - /pokt-network/poktroll/application/application: - get: - operationId: PoktrollApplicationQuery_AllApplications - responses: - '200': - description: A successful response. - schema: - type: object - properties: - applications: - type: array - items: - type: object - properties: - address: - type: string - title: >- - The Bech32 address of the application using cosmos' - ScalarDescriptor to ensure deterministic encoding - stake: - title: The total amount of uPOKT the application has staked - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the - custom method - - signatures required by gogoproto. - service_configs: - type: array - items: - type: object - properties: - service: - title: >- - The Service for which the application is - configured - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a - session for a certain service but with some - additional configs that identify it? - name: - type: string - description: >- - (Optional) Semantic human readable name for - the service - title: >- - TODO_TECHDEBT: Name is currently unused but - acts as a reminder that an optional onchain - representation of the service is necessary - title: >- - ApplicationServiceConfig holds the service - configuration the application stakes for - title: >- - The list of services this appliccation is configured to - request service for - delegatee_gateway_addresses: - type: array - items: - type: string - description: >- - TODO_TECHDEBT: Rename `delegatee_gateway_addresses` to - `gateway_addresses_delegated_to`. - - Ensure to rename all relevant configs, comments, - variables, function names, etc as well. - - - The Bech32 encoded addresses for all delegatee Gateways, - in a non-nullable slice - pending_undelegations: - type: object - additionalProperties: - type: object - properties: - gateway_addresses: - type: array - items: - type: string - description: >- - UndelegatingGatewayList is used as the Value of - `pending_undelegations`. - - It is required to store a repeated list of strings as - a map value. - description: >- - A map from sessionEndHeights to a list of Gateways. - - The key is the height of the last block of the session - during which the - - respective undelegation was committed. - - The value is a list of gateways being undelegated from. - - TODO_DOCUMENT(@red-0ne): Need to document the flow from - this comment - - so its clear to everyone why this is necessary; - https://github.com/pokt-network/poktroll/issues/476#issuecomment-2052639906. - title: >- - Application defines the type used to store an on-chain - definition and state for an application - pagination: - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: >- - PageResponse is to be embedded in gRPC response messages where - the - - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: pagination.key - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - in: query - required: false - type: string - format: byte - - name: pagination.offset - description: >- - offset is a numeric offset that can be used when key is unavailable. - - It is less efficient than using key. Only one of offset or key - should - - be set. - in: query - required: false - type: string - format: uint64 - - name: pagination.limit - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - in: query - required: false - type: string - format: uint64 - - name: pagination.count_total - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in - UIs. - - count_total is only respected when offset is used. It is ignored - when key - - is set. - in: query - required: false - type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean - tags: - - Query - /pokt-network/poktroll/application/application/{address}: - get: - summary: Queries a list of Application items. - operationId: PoktrollApplicationQuery_Application - responses: - '200': - description: A successful response. - schema: - type: object - properties: - application: - type: object - properties: - address: - type: string - title: >- - The Bech32 address of the application using cosmos' - ScalarDescriptor to ensure deterministic encoding - stake: - title: The total amount of uPOKT the application has staked - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the - custom method - - signatures required by gogoproto. - service_configs: - type: array - items: - type: object - properties: - service: - title: The Service for which the application is configured - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a - session for a certain service but with some - additional configs that identify it? - name: - type: string - description: >- - (Optional) Semantic human readable name for the - service - title: >- - TODO_TECHDEBT: Name is currently unused but acts - as a reminder that an optional onchain - representation of the service is necessary - title: >- - ApplicationServiceConfig holds the service configuration - the application stakes for - title: >- - The list of services this appliccation is configured to - request service for - delegatee_gateway_addresses: - type: array - items: - type: string - description: >- - TODO_TECHDEBT: Rename `delegatee_gateway_addresses` to - `gateway_addresses_delegated_to`. - - Ensure to rename all relevant configs, comments, - variables, function names, etc as well. - - - The Bech32 encoded addresses for all delegatee Gateways, - in a non-nullable slice - pending_undelegations: - type: object - additionalProperties: - type: object - properties: - gateway_addresses: - type: array - items: - type: string - description: >- - UndelegatingGatewayList is used as the Value of - `pending_undelegations`. - - It is required to store a repeated list of strings as a - map value. - description: >- - A map from sessionEndHeights to a list of Gateways. - - The key is the height of the last block of the session - during which the - - respective undelegation was committed. - - The value is a list of gateways being undelegated from. - - TODO_DOCUMENT(@red-0ne): Need to document the flow from - this comment - - so its clear to everyone why this is necessary; - https://github.com/pokt-network/poktroll/issues/476#issuecomment-2052639906. - title: >- - Application defines the type used to store an on-chain - definition and state for an application - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - parameters: - - name: address - in: path - required: true - type: string - tags: - - Query - /pokt-network/poktroll/application/params: - get: - summary: Parameters queries the parameters of the module. - operationId: PoktrollApplicationQuery_Params - responses: - '200': - description: A successful response. - schema: - type: object - properties: - params: - description: params holds all the parameters of this module. - type: object - properties: - max_delegated_gateways: - type: string - format: uint64 - description: >- - QueryParamsResponse is response type for the Query/Params RPC - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - tags: - - Query /poktroll.application.Msg/DelegateToGateway: post: operationId: PoktrollApplicationMsg_DelegateToGateway @@ -17262,18 +16865,73 @@ paths: description: MsgUpdateParams is the Msg/UpdateParams request type. tags: - Msg - /pokt-network/poktroll/session/get_session: - get: - summary: Queries the session given app_address, service and block_height. - operationId: PoktrollSessionQuery_GetSession + /poktroll.session.Msg/UpdateParams: + post: + summary: |- + UpdateParams defines a (governance) operation for updating the module + parameters. The authority defaults to the x/gov module account. + operationId: PoktrollSessionMsg_UpdateParams responses: '200': description: A successful response. schema: type: object - properties: - session: - type: object + description: >- + MsgUpdateParamsResponse defines the response structure for + executing a + + MsgUpdateParams message. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + parameters: + - name: body + description: MsgUpdateParams is the Msg/UpdateParams request type. + in: body + required: true + schema: + type: object + properties: + authority: + type: string + description: >- + authority is the address that controls the module (defaults to + x/gov unless overwritten). + params: + description: |- + params defines the x/session parameters to update. + NOTE: All parameters must be supplied. + type: object + description: MsgUpdateParams is the Msg/UpdateParams request type. + tags: + - Msg + /pokt-network/poktroll/session/get_session: + get: + summary: Queries the session given app_address, service and block_height. + operationId: PoktrollSessionQuery_GetSession + responses: + '200': + description: A successful response. + schema: + type: object + properties: + session: + type: object properties: header: title: The header of the session containing lightweight data @@ -17651,10 +17309,6 @@ paths: params: description: params holds all the parameters of this module. type: object - properties: - num_blocks_per_session: - type: string - format: uint64 description: >- QueryParamsResponse is response type for the Query/Params RPC method. @@ -17678,22 +17332,26 @@ paths: additionalProperties: {} tags: - Query - /poktroll.session.Msg/UpdateParams: - post: - summary: |- - UpdateParams defines a (governance) operation for updating the module - parameters. The authority defaults to the x/gov module account. - operationId: PoktrollSessionMsg_UpdateParams + /pokt-network/poktroll/shared/params: + get: + summary: Parameters queries the parameters of the module. + operationId: PoktrollSharedQuery_Params responses: '200': description: A successful response. schema: type: object + properties: + params: + description: params holds all the parameters of this module. + type: object + properties: + num_blocks_per_session: + type: string + format: uint64 description: >- - MsgUpdateParamsResponse defines the response structure for - executing a - - MsgUpdateParams message. + QueryParamsResponse is response type for the Query/Params RPC + method. default: description: An unexpected error response. schema: @@ -17712,35 +17370,11 @@ paths: '@type': type: string additionalProperties: {} - parameters: - - name: body - description: MsgUpdateParams is the Msg/UpdateParams request type. - in: body - required: true - schema: - type: object - properties: - authority: - type: string - description: >- - authority is the address that controls the module (defaults to - x/gov unless overwritten). - params: - description: |- - params defines the x/session parameters to update. - NOTE: All parameters must be supplied. - type: object - properties: - num_blocks_per_session: - type: string - format: uint64 - description: MsgUpdateParams is the Msg/UpdateParams request type. tags: - - Msg - /pokt-network/poktroll/shared/params: - get: - summary: Parameters queries the parameters of the module. - operationId: PoktrollSharedQuery_Params + - Query + /poktroll.shared.Msg/UpdateParam: + post: + operationId: PoktrollSharedMsg_UpdateParam responses: '200': description: A successful response. @@ -17748,11 +17382,7 @@ paths: type: object properties: params: - description: params holds all the parameters of this module. - type: object - description: >- - QueryParamsResponse is response type for the Query/Params RPC - method. + type: string default: description: An unexpected error response. schema: @@ -17771,8 +17401,21 @@ paths: '@type': type: string additionalProperties: {} + parameters: + - name: body + in: body + required: true + schema: + type: object + properties: + authority: + type: string + name: + type: string + asType: + type: string tags: - - Query + - Msg /poktroll.shared.Msg/UpdateParams: post: summary: |- @@ -17821,11 +17464,12 @@ paths: authority is the address that controls the module (defaults to x/gov unless overwritten). params: - description: |- - params defines the module parameters to update. - - NOTE: All parameters must be supplied. + description: 'NOTE: All parameters must be supplied.' type: object + properties: + num_blocks_per_session: + type: string + format: uint64 description: MsgUpdateParams is the Msg/UpdateParams request type. tags: - Msg @@ -24746,507 +24390,30 @@ definitions: properties: max_expected_time_per_block: type: string - format: uint64 - description: >- - maximum expected time per block (in nanoseconds), used to enforce - block delay. This parameter should reflect the - - largest amount of time that the chain might reasonably take to produce - the next block under normal operating - - conditions. A safe choice is 3-5x the expected time per block. - description: Params defines the set of Connection parameters. - ibc.core.connection.v1.Version: - type: object - properties: - identifier: - type: string - title: unique version identifier - features: - type: array - items: - type: string - title: list of features compatible with the specified identifier - description: |- - Version defines the versioning scheme used to negotiate the IBC verison in - the connection handshake. - cosmos.base.query.v1beta1.PageRequest: - type: object - properties: - key: - type: string - format: byte - description: |- - key is a value returned in PageResponse.next_key to begin - querying the next page most efficiently. Only one of offset or key - should be set. - offset: - type: string - format: uint64 - description: |- - offset is a numeric offset that can be used when key is unavailable. - It is less efficient than using key. Only one of offset or key should - be set. - limit: - type: string - format: uint64 - description: >- - limit is the total number of results to be returned in the result - page. - - If left empty it will default to a value to be set by each app. - count_total: - type: boolean - description: >- - count_total is set to true to indicate that the result set should - include - - a count of the total number of items available for pagination in UIs. - - count_total is only respected when offset is used. It is ignored when - key - - is set. - reverse: - type: boolean - description: >- - reverse is set to true if results are to be returned in the descending - order. - - - Since: cosmos-sdk 0.43 - description: |- - message SomeRequest { - Foo some_parameter = 1; - PageRequest pagination = 2; - } - title: |- - PageRequest is to be embedded in gRPC request messages for efficient - pagination. Ex: - cosmos.base.query.v1beta1.PageResponse: - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: |- - total is total number of results available if PageRequest.count_total - was set, its value is undefined otherwise - description: |- - PageResponse is to be embedded in gRPC response messages where the - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - poktroll.application.Application: - type: object - properties: - address: - type: string - title: >- - The Bech32 address of the application using cosmos' ScalarDescriptor - to ensure deterministic encoding - stake: - title: The total amount of uPOKT the application has staked - type: object - properties: - denom: - type: string - amount: - type: string - description: |- - Coin defines a token with a denomination and an amount. - - NOTE: The amount field is an Int which implements the custom method - signatures required by gogoproto. - service_configs: - type: array - items: - type: object - properties: - service: - title: The Service for which the application is configured - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session for a - certain service but with some additional configs that - identify it? - name: - type: string - description: (Optional) Semantic human readable name for the service - title: >- - TODO_TECHDEBT: Name is currently unused but acts as a - reminder that an optional onchain representation of the - service is necessary - title: >- - ApplicationServiceConfig holds the service configuration the - application stakes for - title: >- - The list of services this appliccation is configured to request - service for - delegatee_gateway_addresses: - type: array - items: - type: string - description: >- - TODO_TECHDEBT: Rename `delegatee_gateway_addresses` to - `gateway_addresses_delegated_to`. - - Ensure to rename all relevant configs, comments, variables, function - names, etc as well. - - - The Bech32 encoded addresses for all delegatee Gateways, in a - non-nullable slice - pending_undelegations: - type: object - additionalProperties: - type: object - properties: - gateway_addresses: - type: array - items: - type: string - description: >- - UndelegatingGatewayList is used as the Value of - `pending_undelegations`. - - It is required to store a repeated list of strings as a map value. - description: >- - A map from sessionEndHeights to a list of Gateways. - - The key is the height of the last block of the session during which - the - - respective undelegation was committed. - - The value is a list of gateways being undelegated from. - - TODO_DOCUMENT(@red-0ne): Need to document the flow from this comment - - so its clear to everyone why this is necessary; - https://github.com/pokt-network/poktroll/issues/476#issuecomment-2052639906. - title: >- - Application defines the type used to store an on-chain definition and - state for an application - poktroll.application.Params: - type: object - properties: - max_delegated_gateways: - type: string - format: uint64 - description: Params defines the parameters for the module. - poktroll.application.QueryAllApplicationsResponse: - type: object - properties: - applications: - type: array - items: - type: object - properties: - address: - type: string - title: >- - The Bech32 address of the application using cosmos' - ScalarDescriptor to ensure deterministic encoding - stake: - title: The total amount of uPOKT the application has staked - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - service_configs: - type: array - items: - type: object - properties: - service: - title: The Service for which the application is configured - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session for - a certain service but with some additional configs - that identify it? - name: - type: string - description: >- - (Optional) Semantic human readable name for the - service - title: >- - TODO_TECHDEBT: Name is currently unused but acts as a - reminder that an optional onchain representation of - the service is necessary - title: >- - ApplicationServiceConfig holds the service configuration the - application stakes for - title: >- - The list of services this appliccation is configured to request - service for - delegatee_gateway_addresses: - type: array - items: - type: string - description: >- - TODO_TECHDEBT: Rename `delegatee_gateway_addresses` to - `gateway_addresses_delegated_to`. - - Ensure to rename all relevant configs, comments, variables, - function names, etc as well. - - - The Bech32 encoded addresses for all delegatee Gateways, in a - non-nullable slice - pending_undelegations: - type: object - additionalProperties: - type: object - properties: - gateway_addresses: - type: array - items: - type: string - description: >- - UndelegatingGatewayList is used as the Value of - `pending_undelegations`. - - It is required to store a repeated list of strings as a map - value. - description: >- - A map from sessionEndHeights to a list of Gateways. - - The key is the height of the last block of the session during - which the - - respective undelegation was committed. - - The value is a list of gateways being undelegated from. - - TODO_DOCUMENT(@red-0ne): Need to document the flow from this - comment - - so its clear to everyone why this is necessary; - https://github.com/pokt-network/poktroll/issues/476#issuecomment-2052639906. - title: >- - Application defines the type used to store an on-chain definition - and state for an application - pagination: - type: object - properties: - next_key: - type: string - format: byte - description: |- - next_key is the key to be passed to PageRequest.key to - query the next page most efficiently. It will be empty if - there are no more results. - total: - type: string - format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total - - was set, its value is undefined otherwise - description: |- - PageResponse is to be embedded in gRPC response messages where the - corresponding request message has used PageRequest. - - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - poktroll.application.QueryGetApplicationResponse: - type: object - properties: - application: - type: object - properties: - address: - type: string - title: >- - The Bech32 address of the application using cosmos' - ScalarDescriptor to ensure deterministic encoding - stake: - title: The total amount of uPOKT the application has staked - type: object - properties: - denom: - type: string - amount: - type: string - description: >- - Coin defines a token with a denomination and an amount. - - - NOTE: The amount field is an Int which implements the custom - method - - signatures required by gogoproto. - service_configs: - type: array - items: - type: object - properties: - service: - title: The Service for which the application is configured - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session for a - certain service but with some additional configs that - identify it? - name: - type: string - description: (Optional) Semantic human readable name for the service - title: >- - TODO_TECHDEBT: Name is currently unused but acts as a - reminder that an optional onchain representation of the - service is necessary - title: >- - ApplicationServiceConfig holds the service configuration the - application stakes for - title: >- - The list of services this appliccation is configured to request - service for - delegatee_gateway_addresses: - type: array - items: - type: string - description: >- - TODO_TECHDEBT: Rename `delegatee_gateway_addresses` to - `gateway_addresses_delegated_to`. - - Ensure to rename all relevant configs, comments, variables, - function names, etc as well. - - - The Bech32 encoded addresses for all delegatee Gateways, in a - non-nullable slice - pending_undelegations: - type: object - additionalProperties: - type: object - properties: - gateway_addresses: - type: array - items: - type: string - description: >- - UndelegatingGatewayList is used as the Value of - `pending_undelegations`. - - It is required to store a repeated list of strings as a map - value. - description: >- - A map from sessionEndHeights to a list of Gateways. - - The key is the height of the last block of the session during - which the - - respective undelegation was committed. - - The value is a list of gateways being undelegated from. - - TODO_DOCUMENT(@red-0ne): Need to document the flow from this - comment - - so its clear to everyone why this is necessary; - https://github.com/pokt-network/poktroll/issues/476#issuecomment-2052639906. - title: >- - Application defines the type used to store an on-chain definition and - state for an application - poktroll.application.QueryParamsResponse: - type: object - properties: - params: - description: params holds all the parameters of this module. - type: object - properties: - max_delegated_gateways: - type: string - format: uint64 - description: QueryParamsResponse is response type for the Query/Params RPC method. - poktroll.application.UndelegatingGatewayList: - type: object - properties: - gateway_addresses: - type: array - items: - type: string - description: |- - UndelegatingGatewayList is used as the Value of `pending_undelegations`. - It is required to store a repeated list of strings as a map value. - poktroll.shared.ApplicationServiceConfig: - type: object - properties: - service: - title: The Service for which the application is configured - type: object - properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session for a certain - service but with some additional configs that identify it? - name: - type: string - description: (Optional) Semantic human readable name for the service - title: >- - TODO_TECHDEBT: Name is currently unused but acts as a reminder - that an optional onchain representation of the service is - necessary - title: >- - ApplicationServiceConfig holds the service configuration the application - stakes for - poktroll.shared.Service: + format: uint64 + description: >- + maximum expected time per block (in nanoseconds), used to enforce + block delay. This parameter should reflect the + + largest amount of time that the chain might reasonably take to produce + the next block under normal operating + + conditions. A safe choice is 3-5x the expected time per block. + description: Params defines the set of Connection parameters. + ibc.core.connection.v1.Version: type: object properties: - id: - type: string - description: Unique identifier for the service - title: >- - For example, what if we want to request a session for a certain - service but with some additional configs that identify it? - name: + identifier: type: string - description: (Optional) Semantic human readable name for the service - title: >- - TODO_TECHDEBT: Name is currently unused but acts as a reminder that an - optional onchain representation of the service is necessary - title: >- - Service message to encapsulate unique and semantic identifiers for a - service on the network + title: unique version identifier + features: + type: array + items: + type: string + title: list of features compatible with the specified identifier + description: |- + Version defines the versioning scheme used to negotiate the IBC verison in + the connection handshake. poktroll.application.MsgDelegateToGateway: type: object properties: @@ -25365,6 +24532,54 @@ definitions: description: |- MsgUpdateParamsResponse defines the response structure for executing a MsgUpdateParams message. + poktroll.application.Params: + type: object + properties: + max_delegated_gateways: + type: string + format: uint64 + description: Params defines the parameters for the module. + poktroll.shared.ApplicationServiceConfig: + type: object + properties: + service: + title: The Service for which the application is configured + type: object + properties: + id: + type: string + description: Unique identifier for the service + title: >- + For example, what if we want to request a session for a certain + service but with some additional configs that identify it? + name: + type: string + description: (Optional) Semantic human readable name for the service + title: >- + TODO_TECHDEBT: Name is currently unused but acts as a reminder + that an optional onchain representation of the service is + necessary + title: >- + ApplicationServiceConfig holds the service configuration the application + stakes for + poktroll.shared.Service: + type: object + properties: + id: + type: string + description: Unique identifier for the service + title: >- + For example, what if we want to request a session for a certain + service but with some additional configs that identify it? + name: + type: string + description: (Optional) Semantic human readable name for the service + title: >- + TODO_TECHDEBT: Name is currently unused but acts as a reminder that an + optional onchain representation of the service is necessary + title: >- + Service message to encapsulate unique and semantic identifiers for a + service on the network poktroll.gateway.MsgStakeGateway: type: object properties: @@ -25771,13 +24986,133 @@ definitions: This will be deducted from the signer's account balance, and transferred to the pocket network foundation. description: Params defines the parameters for the module. - poktroll.session.Params: + poktroll.session.MsgUpdateParams: type: object properties: - num_blocks_per_session: + authority: type: string - format: uint64 + description: >- + authority is the address that controls the module (defaults to x/gov + unless overwritten). + params: + description: |- + params defines the x/session parameters to update. + NOTE: All parameters must be supplied. + type: object + description: MsgUpdateParams is the Msg/UpdateParams request type. + poktroll.session.MsgUpdateParamsResponse: + type: object + description: |- + MsgUpdateParamsResponse defines the response structure for executing a + MsgUpdateParams message. + poktroll.session.Params: + type: object description: Params defines the parameters for the module. + poktroll.application.Application: + type: object + properties: + address: + type: string + title: >- + The Bech32 address of the application using cosmos' ScalarDescriptor + to ensure deterministic encoding + stake: + title: The total amount of uPOKT the application has staked + type: object + properties: + denom: + type: string + amount: + type: string + description: |- + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method + signatures required by gogoproto. + service_configs: + type: array + items: + type: object + properties: + service: + title: The Service for which the application is configured + type: object + properties: + id: + type: string + description: Unique identifier for the service + title: >- + For example, what if we want to request a session for a + certain service but with some additional configs that + identify it? + name: + type: string + description: (Optional) Semantic human readable name for the service + title: >- + TODO_TECHDEBT: Name is currently unused but acts as a + reminder that an optional onchain representation of the + service is necessary + title: >- + ApplicationServiceConfig holds the service configuration the + application stakes for + title: >- + The list of services this appliccation is configured to request + service for + delegatee_gateway_addresses: + type: array + items: + type: string + description: >- + TODO_TECHDEBT: Rename `delegatee_gateway_addresses` to + `gateway_addresses_delegated_to`. + + Ensure to rename all relevant configs, comments, variables, function + names, etc as well. + + + The Bech32 encoded addresses for all delegatee Gateways, in a + non-nullable slice + pending_undelegations: + type: object + additionalProperties: + type: object + properties: + gateway_addresses: + type: array + items: + type: string + description: >- + UndelegatingGatewayList is used as the Value of + `pending_undelegations`. + + It is required to store a repeated list of strings as a map value. + description: >- + A map from sessionEndHeights to a list of Gateways. + + The key is the height of the last block of the session during which + the + + respective undelegation was committed. + + The value is a list of gateways being undelegated from. + + TODO_DOCUMENT(@red-0ne): Need to document the flow from this comment + + so its clear to everyone why this is necessary; + https://github.com/pokt-network/poktroll/issues/476#issuecomment-2052639906. + title: >- + Application defines the type used to store an on-chain definition and + state for an application + poktroll.application.UndelegatingGatewayList: + type: object + properties: + gateway_addresses: + type: array + items: + type: string + description: |- + UndelegatingGatewayList is used as the Value of `pending_undelegations`. + It is required to store a repeated list of strings as a map value. poktroll.session.QueryGetSessionResponse: type: object properties: @@ -26085,10 +25420,6 @@ definitions: params: description: params holds all the parameters of this module. type: object - properties: - num_blocks_per_session: - type: string - format: uint64 description: QueryParamsResponse is response type for the Query/Params RPC method. poktroll.session.Session: type: object @@ -26671,39 +26002,38 @@ definitions: title: >- SupplierServiceConfig holds the service configuration the supplier stakes for - poktroll.session.MsgUpdateParams: + poktroll.shared.Params: type: object properties: - authority: + num_blocks_per_session: type: string - description: >- - authority is the address that controls the module (defaults to x/gov - unless overwritten). + format: uint64 + description: Params defines the parameters for the module. + poktroll.shared.QueryParamsResponse: + type: object + properties: params: - description: |- - params defines the x/session parameters to update. - NOTE: All parameters must be supplied. + description: params holds all the parameters of this module. type: object properties: num_blocks_per_session: type: string format: uint64 - description: MsgUpdateParams is the Msg/UpdateParams request type. - poktroll.session.MsgUpdateParamsResponse: - type: object - description: |- - MsgUpdateParamsResponse defines the response structure for executing a - MsgUpdateParams message. - poktroll.shared.Params: + description: QueryParamsResponse is response type for the Query/Params RPC method. + poktroll.shared.MsgUpdateParam: type: object - description: Params defines the parameters for the module. - poktroll.shared.QueryParamsResponse: + properties: + authority: + type: string + name: + type: string + asType: + type: string + poktroll.shared.MsgUpdateParamResponse: type: object properties: params: - description: params holds all the parameters of this module. - type: object - description: QueryParamsResponse is response type for the Query/Params RPC method. + type: string poktroll.shared.MsgUpdateParams: type: object properties: @@ -26713,11 +26043,12 @@ definitions: authority is the address that controls the module (defaults to x/gov unless overwritten). params: - description: |- - params defines the module parameters to update. - - NOTE: All parameters must be supplied. + description: 'NOTE: All parameters must be supplied.' type: object + properties: + num_blocks_per_session: + type: string + format: uint64 description: MsgUpdateParams is the Msg/UpdateParams request type. poktroll.shared.MsgUpdateParamsResponse: type: object diff --git a/e2e/tests/parse_params_test.go b/e2e/tests/parse_params_test.go index f9e8cd306..e4c497931 100644 --- a/e2e/tests/parse_params_test.go +++ b/e2e/tests/parse_params_test.go @@ -82,7 +82,7 @@ func (s *suite) paramsMapToMsgUpdateParams(moduleName string, paramsMap paramsMa msgUpdateParams = s.newServiceMsgUpdateParams(paramsMap) // NB: gateway & supplier modules currently have no parameters default: - err := fmt.Errorf("unexpected module name %q", moduleName) + err := fmt.Errorf("ERROR: unexpected module name %q", moduleName) s.Fatal(err) panic(err) } @@ -255,8 +255,35 @@ func (s *suite) newMsgUpdateParam( }, }) } + case sharedtypes.ModuleName: + switch param.typeStr { + case "string": + msg = proto.Message(&sharedtypes.MsgUpdateParam{ + Authority: authority, + Name: param.name, + AsType: &sharedtypes.MsgUpdateParam_AsString{ + AsString: param.value.(string), + }, + }) + case "int64": + msg = proto.Message(&sharedtypes.MsgUpdateParam{ + Authority: authority, + Name: param.name, + AsType: &sharedtypes.MsgUpdateParam_AsInt64{ + AsInt64: param.value.(int64), + }, + }) + case "bytes": + msg = proto.Message(&sharedtypes.MsgUpdateParam{ + Authority: authority, + Name: param.name, + AsType: &sharedtypes.MsgUpdateParam_AsBytes{ + AsBytes: param.value.([]byte), + }, + }) + } default: - err := fmt.Errorf("unexpected module name %q", moduleName) + err := fmt.Errorf("ERROR: unexpected module name %q", moduleName) s.Fatal(err) panic(err) } diff --git a/e2e/tests/update_params.feature b/e2e/tests/update_params.feature index 57499f3a2..2d66d03eb 100644 --- a/e2e/tests/update_params.feature +++ b/e2e/tests/update_params.feature @@ -2,7 +2,7 @@ Feature: Params Namespace # TODO_DOCUMENT(@Olshansk): Document all of the on-chain governance parameters. Background: - + Scenario: An unauthorized user cannot update a module params Given the user has the pocketd binary installed And all "tokenomics" module params are set to their default values @@ -52,7 +52,7 @@ Feature: Params Namespace And all "" module params are set to their default values And an authz grant from the "gov" "module" account to the "pnf" "user" account for the "" message exists When the "pnf" account sends an authz exec message to update "" the module param - | name | value | type | + | name | value | type | | | | | Then the "" module param "" should be updated @@ -60,6 +60,7 @@ Feature: Params Namespace | module | message_type | param_name | param_value | param_type | | tokenomics | /poktroll.tokenomics.MsgUpdateParam | compute_units_to_tokens_multiplier | 68 | int64 | | proof | /poktroll.proof.MsgUpdateParam | min_relay_difficulty_bits | 12 | int64 | + | shared | /poktroll.shared.MsgUpdateParam | num_blocks_per_session | 8 | int64 | Scenario: An unauthorized user cannot update individual module params Given the user has the pocketd binary installed diff --git a/proto/poktroll/shared/tx.proto b/proto/poktroll/shared/tx.proto index 37938f942..12f0bd6dd 100644 --- a/proto/poktroll/shared/tx.proto +++ b/proto/poktroll/shared/tx.proto @@ -1,4 +1,5 @@ syntax = "proto3"; + package poktroll.shared; import "amino/amino.proto"; @@ -12,29 +13,48 @@ option go_package = "github.com/pokt-network/poktroll/x/shared/types"; // Msg defines the Msg service. service Msg { option (cosmos.msg.v1.service) = true; - + // UpdateParams defines a (governance) operation for updating the module // parameters. The authority defaults to the x/gov module account. - rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); + rpc UpdateParams (MsgUpdateParams) returns (MsgUpdateParamsResponse); + rpc UpdateParam (MsgUpdateParam ) returns (MsgUpdateParamResponse ); } - // MsgUpdateParams is the Msg/UpdateParams request type. message MsgUpdateParams { - option (cosmos.msg.v1.signer) = "authority"; - option (amino.name) = "poktroll/x/shared/MsgUpdateParams"; - + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "poktroll/x/shared/MsgUpdateParams"; + // authority is the address that controls the module (defaults to x/gov unless overwritten). string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // params defines the module parameters to update. - // + // NOTE: All parameters must be supplied. - Params params = 2 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; + Params params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // MsgUpdateParamsResponse defines the response structure for executing a // MsgUpdateParams message. -message MsgUpdateParamsResponse {} \ No newline at end of file +message MsgUpdateParamsResponse {} + +// MsgUpdateParam is the Msg/UpdateParam request type to update a single param. +message MsgUpdateParam { + option (cosmos.msg.v1.signer) = "authority"; + + // authority is the address that controls the module (defaults to x/gov unless overwritten). + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + string name = 2; + oneof as_type { + string as_string = 3 [(gogoproto.jsontag) = "as_string"]; + int64 as_int64 = 6 [(gogoproto.jsontag) = "as_int64"]; + bytes as_bytes = 7 [(gogoproto.jsontag) = "as_bytes"]; + } +} + +// MsgUpdateParamResponse defines the response structure for executing a +// MsgUpdateParam message after a single param update. +message MsgUpdateParamResponse { + Params params = 1; +} + diff --git a/tools/scripts/authz/dao_genesis_authorizations.json b/tools/scripts/authz/dao_genesis_authorizations.json index 1982c2777..f3c826ce3 100644 --- a/tools/scripts/authz/dao_genesis_authorizations.json +++ b/tools/scripts/authz/dao_genesis_authorizations.json @@ -88,5 +88,14 @@ "msg": "\/poktroll.tokenomics.MsgUpdateParam" }, "expiration": "2500-01-01T00:00:00Z" + }, + { + "granter": "pokt10d07y265gmmuvt4z0w9aw880jnsr700j8yv32t", + "grantee": "pokt1eeeksh2tvkh7wzmfrljnhw4wrhs55lcuvmekkw", + "authorization": { + "@type": "\/cosmos.authz.v1beta1.GenericAuthorization", + "msg": "\/poktroll.shared.MsgUpdateParam" + }, + "expiration": "2500-01-01T00:00:00Z" } ] diff --git a/tools/scripts/params/shared_num_blocks_per_session.json b/tools/scripts/params/shared_num_blocks_per_session.json new file mode 100644 index 000000000..e2d33a017 --- /dev/null +++ b/tools/scripts/params/shared_num_blocks_per_session.json @@ -0,0 +1,12 @@ +{ + "body": { + "messages": [ + { + "@type": "/poktroll.shared.MsgUpdateParam", + "authority": "pokt10d07y265gmmuvt4z0w9aw880jnsr700j8yv32t", + "name": "num_blocks_per_session", + "as_int64": "4" + } + ] + } +} diff --git a/x/proof/keeper/msg_server_update_param.go b/x/proof/keeper/msg_server_update_param.go index 9b8770489..c20e46ca8 100644 --- a/x/proof/keeper/msg_server_update_param.go +++ b/x/proof/keeper/msg_server_update_param.go @@ -2,7 +2,6 @@ package keeper import ( "context" - "fmt" "github.com/pokt-network/poktroll/x/proof/types" ) @@ -27,7 +26,7 @@ func (k msgServer) UpdateParam( case types.ParamMinRelayDifficultyBits: value, ok := msg.AsType.(*types.MsgUpdateParam_AsInt64) if !ok { - return nil, fmt.Errorf("unsupported value type for %s param: %T", msg.Name, msg.AsType) + return nil, types.ErrProofParamInvalid.Wrapf("unsupported value type for %s param: %T", msg.Name, msg.AsType) } minRelayDifficultyBits := uint64(value.AsInt64) @@ -37,7 +36,7 @@ func (k msgServer) UpdateParam( params.MinRelayDifficultyBits = minRelayDifficultyBits default: - return nil, fmt.Errorf("unsupported param %q", msg.Name) + return nil, types.ErrProofParamInvalid.Wrapf("unsupported param %q", msg.Name) } if err := k.SetParams(ctx, params); err != nil { diff --git a/x/proof/types/message_update_param_test.go b/x/proof/types/message_update_param_test.go index 7b5328668..1fd4793a8 100644 --- a/x/proof/types/message_update_param_test.go +++ b/x/proof/types/message_update_param_test.go @@ -42,7 +42,7 @@ func TestMsgUpdateParam_ValidateBasic(t *testing.T) { }, expectedErr: ErrProofParamInvalid, }, { - name: "valid: correct authority and param name", + name: "valid: correct authority, param name, and type", msg: MsgUpdateParam{ Authority: sample.AccAddress(), Name: ParamMinRelayDifficultyBits, diff --git a/x/shared/keeper/msg_server_update_param.go b/x/shared/keeper/msg_server_update_param.go new file mode 100644 index 000000000..4768527cc --- /dev/null +++ b/x/shared/keeper/msg_server_update_param.go @@ -0,0 +1,45 @@ +package keeper + +import ( + "context" + + "github.com/pokt-network/poktroll/x/shared/types" +) + +func (k msgServer) UpdateParam(ctx context.Context, msg *types.MsgUpdateParam) (*types.MsgUpdateParamResponse, error) { + if err := msg.ValidateBasic(); err != nil { + return nil, err + } + + if k.GetAuthority() != msg.Authority { + return nil, types.ErrSharedInvalidSigner.Wrapf("invalid authority; expected %s, got %s", k.GetAuthority(), msg.Authority) + } + + params := k.GetParams(ctx) + + switch msg.Name { + case types.ParamNumBlocksPerSession: + value, ok := msg.AsType.(*types.MsgUpdateParam_AsInt64) + if !ok { + return nil, types.ErrSharedParamInvalid.Wrapf("unsupported value type for %s param: %T", msg.Name, msg.AsType) + } + numBlocksPerSession := uint64(value.AsInt64) + + if err := types.ValidateNumBlocksPerSession(numBlocksPerSession); err != nil { + return nil, err + } + + params.NumBlocksPerSession = numBlocksPerSession + default: + return nil, types.ErrSharedParamInvalid.Wrapf("unsupported param %q", msg.Name) + } + + if err := k.SetParams(ctx, params); err != nil { + return nil, err + } + + updatedParams := k.GetParams(ctx) + return &types.MsgUpdateParamResponse{ + Params: &updatedParams, + }, nil +} diff --git a/x/shared/keeper/msg_server_update_param_test.go b/x/shared/keeper/msg_server_update_param_test.go new file mode 100644 index 000000000..65702fd45 --- /dev/null +++ b/x/shared/keeper/msg_server_update_param_test.go @@ -0,0 +1,42 @@ +package keeper_test + +import ( + "testing" + + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/x/shared/keeper" + + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +func TestMsgUpdateParam_UpdateNumBlocksPerSession(t *testing.T) { + var expectedNumBlocksPerSession int64 = 8 + + k, ctx := keepertest.SharedKeeper(t) + msgSrv := keeper.NewMsgServerImpl(k) + + // Set the parameters to their default values + defaultParams := sharedtypes.DefaultParams() + require.NoError(t, k.SetParams(ctx, defaultParams)) + + // Ensure the default values are different from the new values we want to set + require.NotEqual(t, uint64(expectedNumBlocksPerSession), defaultParams.NumBlocksPerSession) + + // Update the min relay difficulty bits + updateParamMsg := &sharedtypes.MsgUpdateParam{ + Authority: authtypes.NewModuleAddress(govtypes.ModuleName).String(), + Name: sharedtypes.ParamNumBlocksPerSession, + AsType: &sharedtypes.MsgUpdateParam_AsInt64{AsInt64: expectedNumBlocksPerSession}, + } + res, err := msgSrv.UpdateParam(ctx, updateParamMsg) + require.NoError(t, err) + + require.Equal(t, uint64(expectedNumBlocksPerSession), res.Params.NumBlocksPerSession) + + // TODO_BLOCKER: once we have more than one param per module, add assertions + // here which ensure that other params were not changed! +} diff --git a/x/shared/keeper/msg_update_params.go b/x/shared/keeper/msg_update_params.go index 8bdfb89b5..d131f648e 100644 --- a/x/shared/keeper/msg_update_params.go +++ b/x/shared/keeper/msg_update_params.go @@ -15,7 +15,7 @@ func (k msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParam } if k.GetAuthority() != req.Authority { - return nil, errorsmod.Wrapf(types.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.GetAuthority(), req.Authority) + return nil, errorsmod.Wrapf(types.ErrSharedInvalidSigner, "invalid authority; expected %s, got %s", k.GetAuthority(), req.Authority) } ctx := sdk.UnwrapSDKContext(goCtx) diff --git a/x/shared/module/autocli.go b/x/shared/module/autocli.go index 457ff7eff..8d872852a 100644 --- a/x/shared/module/autocli.go +++ b/x/shared/module/autocli.go @@ -23,11 +23,17 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { Tx: &autocliv1.ServiceCommandDescriptor{ Service: modulev1.Msg_ServiceDesc.ServiceName, EnhanceCustomCommand: true, // only required if you want to use the custom command - RpcCommandOptions: []*autocliv1.RpcCommandOptions{ - { - RpcMethod: "UpdateParams", - Skip: true, // skipped because authority gated - }, + RpcCommandOptions: []*autocliv1.RpcCommandOptions{ + // { + // RpcMethod: "UpdateParams", + // Skip: true, // skipped because authority gated + // }, + // { + // RpcMethod: "UpdateParam", + // Use: "update-param [name] [as-type]", + // Short: "Send a update-param tx", + // PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "name"}, {ProtoField: "asType"}}, + // }, // this line is used by ignite scaffolding # autocli/tx }, }, diff --git a/x/shared/module/simulation.go b/x/shared/module/simulation.go index 8d195231d..94808d486 100644 --- a/x/shared/module/simulation.go +++ b/x/shared/module/simulation.go @@ -23,7 +23,11 @@ var ( ) const ( -// this line is used by starport scaffolding # simapp/module/const + opWeightMsgUpdateParam = "op_weight_msg_update_param" + // TODO: Determine the simulation weight value + defaultWeightMsgUpdateParam int = 100 + + // this line is used by starport scaffolding # simapp/module/const ) // GenerateGenesisState creates a randomized GenState of the module. @@ -51,6 +55,17 @@ func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedP func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { operations := make([]simtypes.WeightedOperation, 0) + var weightMsgUpdateParam int + simState.AppParams.GetOrGenerate(opWeightMsgUpdateParam, &weightMsgUpdateParam, nil, + func(_ *rand.Rand) { + weightMsgUpdateParam = defaultWeightMsgUpdateParam + }, + ) + operations = append(operations, simulation.NewWeightedOperation( + weightMsgUpdateParam, + sharedsimulation.SimulateMsgUpdateParam(am.accountKeeper, am.bankKeeper, am.keeper), + )) + // this line is used by starport scaffolding # simapp/module/operation return operations @@ -59,6 +74,14 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp // ProposalMsgs returns msgs used for governance proposals for simulations. func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg { return []simtypes.WeightedProposalMsg{ + simulation.NewWeightedProposalMsg( + opWeightMsgUpdateParam, + defaultWeightMsgUpdateParam, + func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { + sharedsimulation.SimulateMsgUpdateParam(am.accountKeeper, am.bankKeeper, am.keeper) + return nil + }, + ), // this line is used by starport scaffolding # simapp/module/OpMsg } } diff --git a/x/shared/simulation/update_param.go b/x/shared/simulation/update_param.go new file mode 100644 index 000000000..9a2e11016 --- /dev/null +++ b/x/shared/simulation/update_param.go @@ -0,0 +1,29 @@ +package simulation + +import ( + "math/rand" + + "github.com/cosmos/cosmos-sdk/baseapp" + sdk "github.com/cosmos/cosmos-sdk/types" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/pokt-network/poktroll/x/shared/keeper" + "github.com/pokt-network/poktroll/x/shared/types" +) + +func SimulateMsgUpdateParam( + 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.MsgUpdateParam{ + Authority: simAccount.Address.String(), + } + + // TODO: Handling the UpdateParam simulation + + return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(msg), "UpdateParam simulation not implemented"), nil, nil + } +} diff --git a/x/shared/types/codec.go b/x/shared/types/codec.go index ac5526374..17b958d5c 100644 --- a/x/shared/types/codec.go +++ b/x/shared/types/codec.go @@ -8,6 +8,9 @@ import ( ) func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgUpdateParam{}, + ) // this line is used by starport scaffolding # 3 registry.RegisterImplementations((*sdk.Msg)(nil), diff --git a/x/shared/types/errors.go b/x/shared/types/errors.go index 9c60c7fed..5d56db228 100644 --- a/x/shared/types/errors.go +++ b/x/shared/types/errors.go @@ -8,7 +8,8 @@ import ( // x/shared module sentinel errors var ( - ErrInvalidSigner = sdkerrors.Register(ModuleName, 1100, "expected gov account as only signer for proposal message") - ErrSessionParamNameInvalid = sdkerrors.Register(ModuleName, 1101, "the provided param name is invalid") - ErrSessionParamInvalid = sdkerrors.Register(ModuleName, 1102, "the provided param is invalid") + ErrSharedInvalidSigner = sdkerrors.Register(ModuleName, 1100, "expected gov account as only signer for proposal message") + ErrSharedInvalidAddress = sdkerrors.Register(ModuleName, 1101, "invalid address") + ErrSharedParamNameInvalid = sdkerrors.Register(ModuleName, 1102, "the provided param name is invalid") + ErrSharedParamInvalid = sdkerrors.Register(ModuleName, 1103, "the provided param is invalid") ) diff --git a/x/shared/types/genesis.go b/x/shared/types/genesis.go index dee271e3a..82f8c67db 100644 --- a/x/shared/types/genesis.go +++ b/x/shared/types/genesis.go @@ -10,15 +10,15 @@ const DefaultIndex uint64 = 1 // DefaultGenesis returns the default genesis state func DefaultGenesis() *GenesisState { return &GenesisState{ - // this line is used by starport scaffolding # genesis/types/default - Params: DefaultParams(), + // this line is used by starport scaffolding # genesis/types/default + Params: DefaultParams(), } } // Validate performs basic genesis state validation returning an error upon any // failure. func (gs GenesisState) Validate() error { - // this line is used by starport scaffolding # genesis/types/validate + // this line is used by starport scaffolding # genesis/types/validate return gs.Params.ValidateBasic() } diff --git a/x/shared/types/message_update_param.go b/x/shared/types/message_update_param.go new file mode 100644 index 000000000..3cb9b8f2e --- /dev/null +++ b/x/shared/types/message_update_param.go @@ -0,0 +1,67 @@ +package types + +import ( + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +var _ sdk.Msg = (*MsgUpdateParam)(nil) + +// NewMsgUpdateParam creates a new MsgUpdateParam instance for a single +// governance parameter update. +func NewMsgUpdateParam(authority string, name string, value any) (*MsgUpdateParam, error) { + var valueAsType isMsgUpdateParam_AsType + + switch v := value.(type) { + case string: + valueAsType = &MsgUpdateParam_AsString{AsString: v} + case int64: + valueAsType = &MsgUpdateParam_AsInt64{AsInt64: v} + case []byte: + valueAsType = &MsgUpdateParam_AsBytes{AsBytes: v} + default: + return nil, fmt.Errorf("unexpected param value type: %T", value) + } + + return &MsgUpdateParam{ + Authority: authority, + Name: name, + AsType: valueAsType, + }, nil +} + +// ValidateBasic performs a basic validation of the MsgUpdateParam fields. It ensures +// the parameter name is supported and the parameter type matches the expected type for +// a given parameter name. +func (msg *MsgUpdateParam) ValidateBasic() error { + // Validate the address + if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { + return ErrSharedInvalidAddress.Wrapf("invalid authority address %s; (%v)", msg.Authority, err) + } + + // Parameter value cannot be nil. + if msg.AsType == nil { + return ErrSharedParamInvalid.Wrap("missing param AsType") + } + + // Parameter name must be supported by this module. + switch msg.Name { + case ParamNumBlocksPerSession: + return msg.paramTypeIsInt64() + default: + return ErrSharedParamNameInvalid.Wrapf("unsupported name param %q", msg.Name) + } +} + +// paramTypeIsInt64 checks if the parameter type is int64, returning an error if not. +func (msg *MsgUpdateParam) paramTypeIsInt64() error { + if _, ok := msg.AsType.(*MsgUpdateParam_AsInt64); !ok { + return ErrSharedParamInvalid.Wrapf( + "invalid type for param %q expected %T, got %T", + msg.Name, &MsgUpdateParam_AsInt64{}, + msg.AsType, + ) + } + return nil +} diff --git a/x/shared/types/message_update_param_test.go b/x/shared/types/message_update_param_test.go new file mode 100644 index 000000000..09acc022e --- /dev/null +++ b/x/shared/types/message_update_param_test.go @@ -0,0 +1,60 @@ +package types + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/testutil/sample" +) + +func TestMsgUpdateParam_ValidateBasic(t *testing.T) { + tests := []struct { + desc string + msg MsgUpdateParam + expectedErr error + }{ + { + desc: "invalid: authority address invalid", + msg: MsgUpdateParam{ + Authority: "invalid_address", + Name: "", // Doesn't matter for this test + AsType: &MsgUpdateParam_AsInt64{AsInt64: 1}, + }, + expectedErr: ErrSharedInvalidAddress, + }, { + desc: "invalid: param name incorrect (non-existent)", + msg: MsgUpdateParam{ + Authority: sample.AccAddress(), + Name: "WRONG_num_blocks_per_session", + AsType: &MsgUpdateParam_AsInt64{AsInt64: 1}, + }, + expectedErr: ErrSharedParamNameInvalid, + }, { + desc: "invalid: incorrect param type", + msg: MsgUpdateParam{ + Authority: sample.AccAddress(), + Name: ParamNumBlocksPerSession, + AsType: &MsgUpdateParam_AsString{AsString: "invalid"}, + }, + expectedErr: ErrSharedParamInvalid, + }, { + desc: "valid: correct authority, param name, and type", + msg: MsgUpdateParam{ + Authority: sample.AccAddress(), + Name: ParamNumBlocksPerSession, + AsType: &MsgUpdateParam_AsInt64{AsInt64: 1}, + }, + }, + } + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) { + err := tt.msg.ValidateBasic() + if tt.expectedErr != nil { + require.ErrorContains(t, err, tt.expectedErr.Error()) + return + } + require.NoError(t, err) + }) + } +} diff --git a/x/shared/types/params.go b/x/shared/types/params.go index a310639a5..9cfcf5bd5 100644 --- a/x/shared/types/params.go +++ b/x/shared/types/params.go @@ -56,11 +56,11 @@ func (params *Params) ValidateBasic() error { func ValidateNumBlocksPerSession(v interface{}) error { numBlocksPerSession, ok := v.(uint64) if !ok { - return ErrSessionParamInvalid.Wrapf("invalid parameter type: %T", v) + return ErrSharedParamInvalid.Wrapf("invalid parameter type: %T", v) } if numBlocksPerSession < 1 { - return ErrSessionParamInvalid.Wrapf("invalid NumBlocksPerSession: (%v)", numBlocksPerSession) + return ErrSharedParamInvalid.Wrapf("invalid NumBlocksPerSession: (%v)", numBlocksPerSession) } return nil diff --git a/x/shared/types/params_test.go b/x/shared/types/params_test.go index 5c9f2e829..a2611b04a 100644 --- a/x/shared/types/params_test.go +++ b/x/shared/types/params_test.go @@ -15,12 +15,12 @@ func TestParams_ValidateNumBlocksPerSession(t *testing.T) { { desc: "invalid type", numBlocksPerSession: "invalid", - err: ErrSessionParamInvalid.Wrapf("invalid parameter type: %T", "invalid"), + err: ErrSharedParamInvalid.Wrapf("invalid parameter type: %T", "invalid"), }, { desc: "zero NumBlocksPerSession", numBlocksPerSession: uint64(0), - err: ErrSessionParamInvalid.Wrapf("invalid NumBlocksPerSession: (%v)", uint64(0)), + err: ErrSharedParamInvalid.Wrapf("invalid NumBlocksPerSession: (%v)", uint64(0)), }, { desc: "valid NumBlocksPerSession", diff --git a/x/shared/types/tx.pb.go b/x/shared/types/tx.pb.go index 1d34c4e46..a16ed606b 100644 --- a/x/shared/types/tx.pb.go +++ b/x/shared/types/tx.pb.go @@ -35,8 +35,6 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type MsgUpdateParams struct { // 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"` - // params defines the module parameters to update. - // // NOTE: All parameters must be supplied. Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` } @@ -126,37 +124,212 @@ func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo +// MsgUpdateParam is the Msg/UpdateParam request type to update a single param. +type MsgUpdateParam struct { + // 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"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // Types that are valid to be assigned to AsType: + // + // *MsgUpdateParam_AsString + // *MsgUpdateParam_AsInt64 + // *MsgUpdateParam_AsBytes + AsType isMsgUpdateParam_AsType `protobuf_oneof:"as_type"` +} + +func (m *MsgUpdateParam) Reset() { *m = MsgUpdateParam{} } +func (m *MsgUpdateParam) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParam) ProtoMessage() {} +func (*MsgUpdateParam) Descriptor() ([]byte, []int) { + return fileDescriptor_3f2a7564b43f4d89, []int{2} +} +func (m *MsgUpdateParam) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParam) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParam.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 *MsgUpdateParam) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParam.Merge(m, src) +} +func (m *MsgUpdateParam) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParam) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParam.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParam proto.InternalMessageInfo + +type isMsgUpdateParam_AsType interface { + isMsgUpdateParam_AsType() + MarshalTo([]byte) (int, error) + Size() int +} + +type MsgUpdateParam_AsString struct { + AsString string `protobuf:"bytes,3,opt,name=as_string,json=asString,proto3,oneof" json:"as_string"` +} +type MsgUpdateParam_AsInt64 struct { + AsInt64 int64 `protobuf:"varint,6,opt,name=as_int64,json=asInt64,proto3,oneof" json:"as_int64"` +} +type MsgUpdateParam_AsBytes struct { + AsBytes []byte `protobuf:"bytes,7,opt,name=as_bytes,json=asBytes,proto3,oneof" json:"as_bytes"` +} + +func (*MsgUpdateParam_AsString) isMsgUpdateParam_AsType() {} +func (*MsgUpdateParam_AsInt64) isMsgUpdateParam_AsType() {} +func (*MsgUpdateParam_AsBytes) isMsgUpdateParam_AsType() {} + +func (m *MsgUpdateParam) GetAsType() isMsgUpdateParam_AsType { + if m != nil { + return m.AsType + } + return nil +} + +func (m *MsgUpdateParam) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgUpdateParam) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *MsgUpdateParam) GetAsString() string { + if x, ok := m.GetAsType().(*MsgUpdateParam_AsString); ok { + return x.AsString + } + return "" +} + +func (m *MsgUpdateParam) GetAsInt64() int64 { + if x, ok := m.GetAsType().(*MsgUpdateParam_AsInt64); ok { + return x.AsInt64 + } + return 0 +} + +func (m *MsgUpdateParam) GetAsBytes() []byte { + if x, ok := m.GetAsType().(*MsgUpdateParam_AsBytes); ok { + return x.AsBytes + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*MsgUpdateParam) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*MsgUpdateParam_AsString)(nil), + (*MsgUpdateParam_AsInt64)(nil), + (*MsgUpdateParam_AsBytes)(nil), + } +} + +// MsgUpdateParamResponse defines the response structure for executing a +// MsgUpdateParam message after a single param update. +type MsgUpdateParamResponse struct { + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` +} + +func (m *MsgUpdateParamResponse) Reset() { *m = MsgUpdateParamResponse{} } +func (m *MsgUpdateParamResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParamResponse) ProtoMessage() {} +func (*MsgUpdateParamResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_3f2a7564b43f4d89, []int{3} +} +func (m *MsgUpdateParamResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParamResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParamResponse.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 *MsgUpdateParamResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParamResponse.Merge(m, src) +} +func (m *MsgUpdateParamResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParamResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParamResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParamResponse proto.InternalMessageInfo + +func (m *MsgUpdateParamResponse) GetParams() *Params { + if m != nil { + return m.Params + } + return nil +} + func init() { proto.RegisterType((*MsgUpdateParams)(nil), "poktroll.shared.MsgUpdateParams") proto.RegisterType((*MsgUpdateParamsResponse)(nil), "poktroll.shared.MsgUpdateParamsResponse") + proto.RegisterType((*MsgUpdateParam)(nil), "poktroll.shared.MsgUpdateParam") + proto.RegisterType((*MsgUpdateParamResponse)(nil), "poktroll.shared.MsgUpdateParamResponse") } func init() { proto.RegisterFile("poktroll/shared/tx.proto", fileDescriptor_3f2a7564b43f4d89) } var fileDescriptor_3f2a7564b43f4d89 = []byte{ - // 344 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x28, 0xc8, 0xcf, 0x2e, - 0x29, 0xca, 0xcf, 0xc9, 0xd1, 0x2f, 0xce, 0x48, 0x2c, 0x4a, 0x4d, 0xd1, 0x2f, 0xa9, 0xd0, 0x2b, - 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x87, 0xc9, 0xe8, 0x41, 0x64, 0xa4, 0x04, 0x13, 0x73, 0x33, - 0xf3, 0xf2, 0xf5, 0xc1, 0x24, 0x44, 0x8d, 0x94, 0x78, 0x72, 0x7e, 0x71, 0x6e, 0x7e, 0xb1, 0x7e, - 0x6e, 0x71, 0xba, 0x7e, 0x99, 0x21, 0x88, 0x82, 0x4a, 0x48, 0x42, 0x24, 0xe2, 0xc1, 0x3c, 0x7d, - 0x08, 0x07, 0x2a, 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, 0x11, 0x07, 0xb1, 0xa0, 0xa2, 0x32, 0xe8, - 0xee, 0x28, 0x48, 0x2c, 0x4a, 0xcc, 0x85, 0xea, 0x51, 0xda, 0xcd, 0xc8, 0xc5, 0xef, 0x5b, 0x9c, - 0x1e, 0x5a, 0x90, 0x92, 0x58, 0x92, 0x1a, 0x00, 0x96, 0x11, 0x32, 0xe3, 0xe2, 0x4c, 0x2c, 0x2d, - 0xc9, 0xc8, 0x2f, 0xca, 0x2c, 0xa9, 0x94, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x74, 0x92, 0xb8, 0xb4, - 0x45, 0x57, 0x04, 0x6a, 0x99, 0x63, 0x4a, 0x4a, 0x51, 0x6a, 0x71, 0x71, 0x70, 0x49, 0x51, 0x66, - 0x5e, 0x7a, 0x10, 0x42, 0xa9, 0x90, 0x15, 0x17, 0x1b, 0xc4, 0x6c, 0x09, 0x26, 0x05, 0x46, 0x0d, - 0x6e, 0x23, 0x71, 0x3d, 0x34, 0x8f, 0xea, 0x41, 0x2c, 0x70, 0xe2, 0x3c, 0x71, 0x4f, 0x9e, 0x61, - 0xc5, 0xf3, 0x0d, 0x5a, 0x8c, 0x41, 0x50, 0x1d, 0x56, 0x26, 0x4d, 0xcf, 0x37, 0x68, 0x21, 0xcc, - 0xea, 0x7a, 0xbe, 0x41, 0x4b, 0x11, 0xee, 0xf0, 0x0a, 0x98, 0xd3, 0xd1, 0x5c, 0xaa, 0x24, 0xc9, - 0x25, 0x8e, 0x26, 0x14, 0x94, 0x5a, 0x5c, 0x90, 0x9f, 0x57, 0x9c, 0x6a, 0x94, 0xc1, 0xc5, 0xec, - 0x5b, 0x9c, 0x2e, 0x14, 0xc5, 0xc5, 0x83, 0xe2, 0x37, 0x05, 0x0c, 0x37, 0xa1, 0x19, 0x20, 0xa5, - 0x41, 0x48, 0x05, 0xcc, 0x0a, 0x29, 0xd6, 0x06, 0x90, 0x17, 0x9c, 0x3c, 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, 0x3f, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, - 0x3f, 0x57, 0x1f, 0x64, 0xa8, 0x6e, 0x5e, 0x6a, 0x49, 0x79, 0x7e, 0x51, 0xb6, 0x3e, 0xa6, 0xcf, - 0x4a, 0x2a, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0x91, 0x62, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, - 0x86, 0xe5, 0x6f, 0x48, 0x3c, 0x02, 0x00, 0x00, + // 498 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x53, 0xbf, 0x6f, 0xd3, 0x40, + 0x14, 0xf6, 0x11, 0x48, 0xea, 0x6b, 0x68, 0x85, 0x55, 0x11, 0x37, 0x42, 0x8e, 0xc9, 0x82, 0x89, + 0xa8, 0x4f, 0x94, 0xaa, 0x43, 0x36, 0x3c, 0x35, 0x43, 0x25, 0x64, 0x84, 0x90, 0xba, 0x44, 0x97, + 0xe6, 0xe4, 0x58, 0xad, 0x7d, 0x96, 0xdf, 0x15, 0x9a, 0x0d, 0x31, 0x32, 0xf1, 0x67, 0x30, 0x66, + 0x60, 0x63, 0x62, 0xeb, 0x58, 0x31, 0x31, 0x45, 0x28, 0x19, 0x22, 0xf5, 0x5f, 0x60, 0x41, 0x3e, + 0xff, 0x08, 0x71, 0x25, 0x22, 0xb1, 0x24, 0xef, 0xbe, 0xef, 0x7b, 0xdf, 0xbd, 0x77, 0xef, 0x19, + 0xeb, 0x11, 0x3f, 0x13, 0x31, 0x3f, 0x3f, 0x27, 0x30, 0xa2, 0x31, 0x1b, 0x12, 0x71, 0x69, 0x47, + 0x31, 0x17, 0x5c, 0xdb, 0xce, 0x19, 0x3b, 0x65, 0x9a, 0x0f, 0x68, 0xe0, 0x87, 0x9c, 0xc8, 0xdf, + 0x54, 0xd3, 0x6c, 0x9c, 0x72, 0x08, 0x38, 0x90, 0x00, 0x3c, 0xf2, 0xee, 0x79, 0xf2, 0x97, 0x11, + 0xbb, 0x29, 0xd1, 0x97, 0x27, 0x92, 0x1e, 0x32, 0x6a, 0xc7, 0xe3, 0x1e, 0x4f, 0xf1, 0x24, 0xca, + 0xd0, 0x47, 0xe5, 0x3a, 0x22, 0x1a, 0xd3, 0x20, 0xcb, 0x69, 0x7f, 0x43, 0x78, 0xfb, 0x18, 0xbc, + 0x37, 0xd1, 0x90, 0x0a, 0xf6, 0x4a, 0x32, 0xda, 0x21, 0x56, 0xe9, 0x85, 0x18, 0xf1, 0xd8, 0x17, + 0x63, 0x1d, 0x99, 0xc8, 0x52, 0x1d, 0xfd, 0xc7, 0xd7, 0xbd, 0x9d, 0xec, 0xb2, 0x97, 0xc3, 0x61, + 0xcc, 0x00, 0x5e, 0x8b, 0xd8, 0x0f, 0x3d, 0x77, 0x29, 0xd5, 0xba, 0xb8, 0x9a, 0x7a, 0xeb, 0x77, + 0x4c, 0x64, 0x6d, 0xee, 0x37, 0xec, 0x52, 0xa3, 0x76, 0x7a, 0x81, 0xa3, 0x5e, 0x4d, 0x5b, 0xca, + 0x97, 0xc5, 0xa4, 0x83, 0xdc, 0x2c, 0xa3, 0x7b, 0xf0, 0x71, 0x31, 0xe9, 0x2c, 0xbd, 0x3e, 0x2d, + 0x26, 0x9d, 0xc7, 0x45, 0xe1, 0x97, 0x79, 0xe9, 0xa5, 0x4a, 0xdb, 0xbb, 0xb8, 0x51, 0x82, 0x5c, + 0x06, 0x11, 0x0f, 0x81, 0xb5, 0x7f, 0x23, 0xbc, 0xb5, 0xca, 0xfd, 0x77, 0x5f, 0x1a, 0xbe, 0x1b, + 0xd2, 0x80, 0xc9, 0xae, 0x54, 0x57, 0xc6, 0xda, 0x33, 0xac, 0x52, 0xe8, 0x83, 0xd4, 0xea, 0x15, + 0xe9, 0x75, 0xff, 0x66, 0xda, 0x5a, 0x82, 0x47, 0x8a, 0xbb, 0x41, 0x33, 0x33, 0xed, 0x29, 0xde, + 0xa0, 0xd0, 0xf7, 0x43, 0x71, 0x78, 0xa0, 0x57, 0x4d, 0x64, 0x55, 0x9c, 0xfa, 0xcd, 0xb4, 0x55, + 0x60, 0x47, 0x8a, 0x5b, 0xa3, 0xd0, 0x4b, 0xc2, 0x4c, 0x3a, 0x18, 0x0b, 0x06, 0x7a, 0xcd, 0x44, + 0x56, 0xbd, 0x90, 0x4a, 0x2c, 0x95, 0x3a, 0x49, 0xd8, 0xdd, 0x5a, 0x7d, 0x33, 0x47, 0xc5, 0x35, + 0x0a, 0x7d, 0x31, 0x8e, 0x58, 0xbb, 0x87, 0x1f, 0xae, 0x36, 0x9f, 0xbf, 0x8b, 0x46, 0x8a, 0x21, + 0xa1, 0x7f, 0x0e, 0x29, 0x9f, 0xcc, 0xfe, 0x77, 0x84, 0x2b, 0xc7, 0xe0, 0x69, 0x27, 0xb8, 0xbe, + 0xb2, 0x25, 0xe6, 0xad, 0xc4, 0xd2, 0x28, 0x9a, 0xd6, 0x3a, 0x45, 0x51, 0xd4, 0x5b, 0xbc, 0xf9, + 0xf7, 0xa0, 0x5a, 0x6b, 0x12, 0x9b, 0x4f, 0xd6, 0x08, 0x72, 0xe3, 0xe6, 0xbd, 0x0f, 0xc9, 0x96, + 0x39, 0xbd, 0xab, 0x99, 0x81, 0xae, 0x67, 0x06, 0xfa, 0x35, 0x33, 0xd0, 0xe7, 0xb9, 0xa1, 0x5c, + 0xcf, 0x0d, 0xe5, 0xe7, 0xdc, 0x50, 0x4e, 0x88, 0xe7, 0x8b, 0xd1, 0xc5, 0xc0, 0x3e, 0xe5, 0x01, + 0x49, 0x3c, 0xf7, 0x42, 0x26, 0xde, 0xf3, 0xf8, 0x8c, 0xdc, 0x5e, 0xbe, 0xe4, 0x61, 0x61, 0x50, + 0x95, 0xdf, 0xcd, 0x8b, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xf7, 0x42, 0x5a, 0x25, 0xdf, 0x03, + 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -174,6 +347,7 @@ type MsgClient interface { // UpdateParams defines a (governance) operation for updating the module // parameters. The authority defaults to the x/gov module account. UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) + UpdateParam(ctx context.Context, in *MsgUpdateParam, opts ...grpc.CallOption) (*MsgUpdateParamResponse, error) } type msgClient struct { @@ -193,11 +367,21 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts return out, nil } +func (c *msgClient) UpdateParam(ctx context.Context, in *MsgUpdateParam, opts ...grpc.CallOption) (*MsgUpdateParamResponse, error) { + out := new(MsgUpdateParamResponse) + err := c.cc.Invoke(ctx, "/poktroll.shared.Msg/UpdateParam", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { // UpdateParams defines a (governance) operation for updating the module // parameters. The authority defaults to the x/gov module account. UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) + UpdateParam(context.Context, *MsgUpdateParam) (*MsgUpdateParamResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -207,6 +391,9 @@ type UnimplementedMsgServer struct { func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") } +func (*UnimplementedMsgServer) UpdateParam(ctx context.Context, req *MsgUpdateParam) (*MsgUpdateParamResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParam not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -230,6 +417,24 @@ func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(in return interceptor(ctx, in, info, handler) } +func _Msg_UpdateParam_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateParam) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateParam(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/poktroll.shared.Msg/UpdateParam", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateParam(ctx, req.(*MsgUpdateParam)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "poktroll.shared.Msg", HandlerType: (*MsgServer)(nil), @@ -238,6 +443,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "UpdateParams", Handler: _Msg_UpdateParams_Handler, }, + { + MethodName: "UpdateParam", + Handler: _Msg_UpdateParam_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "poktroll/shared/tx.proto", @@ -306,6 +515,129 @@ func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } +func (m *MsgUpdateParam) 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 *MsgUpdateParam) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParam) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.AsType != nil { + { + size := m.AsType.Size() + i -= size + if _, err := m.AsType.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + } + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintTx(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x12 + } + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateParam_AsString) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParam_AsString) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + i -= len(m.AsString) + copy(dAtA[i:], m.AsString) + i = encodeVarintTx(dAtA, i, uint64(len(m.AsString))) + i-- + dAtA[i] = 0x1a + return len(dAtA) - i, nil +} +func (m *MsgUpdateParam_AsInt64) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParam_AsInt64) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + i = encodeVarintTx(dAtA, i, uint64(m.AsInt64)) + i-- + dAtA[i] = 0x30 + return len(dAtA) - i, nil +} +func (m *MsgUpdateParam_AsBytes) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParam_AsBytes) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.AsBytes != nil { + i -= len(m.AsBytes) + copy(dAtA[i:], m.AsBytes) + i = encodeVarintTx(dAtA, i, uint64(len(m.AsBytes))) + i-- + dAtA[i] = 0x3a + } + return len(dAtA) - i, nil +} +func (m *MsgUpdateParamResponse) 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 *MsgUpdateParamResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParamResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Params != nil { + { + size, err := m.Params.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 encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -341,6 +673,70 @@ func (m *MsgUpdateParamsResponse) Size() (n int) { return n } +func (m *MsgUpdateParam) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.AsType != nil { + n += m.AsType.Size() + } + return n +} + +func (m *MsgUpdateParam_AsString) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.AsString) + n += 1 + l + sovTx(uint64(l)) + return n +} +func (m *MsgUpdateParam_AsInt64) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + n += 1 + sovTx(uint64(m.AsInt64)) + return n +} +func (m *MsgUpdateParam_AsBytes) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.AsBytes != nil { + l = len(m.AsBytes) + n += 1 + l + sovTx(uint64(l)) + } + return n +} +func (m *MsgUpdateParamResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Params != nil { + l = m.Params.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -512,6 +908,291 @@ func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgUpdateParam) 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: MsgUpdateParam: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParam: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", 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.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", 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.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AsString", 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.AsType = &MsgUpdateParam_AsString{string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AsInt64", wireType) + } + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.AsType = &MsgUpdateParam_AsInt64{v} + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AsBytes", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := make([]byte, postIndex-iNdEx) + copy(v, dAtA[iNdEx:postIndex]) + m.AsType = &MsgUpdateParam_AsBytes{v} + 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 *MsgUpdateParamResponse) 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: MsgUpdateParamResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParamResponse: 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 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.Params == nil { + m.Params = &Params{} + } + if err := m.Params.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 skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/tokenomics/keeper/msg_server_update_param.go b/x/tokenomics/keeper/msg_server_update_param.go index 0f1415e0f..469848a42 100644 --- a/x/tokenomics/keeper/msg_server_update_param.go +++ b/x/tokenomics/keeper/msg_server_update_param.go @@ -2,7 +2,6 @@ package keeper import ( "context" - "fmt" "github.com/pokt-network/poktroll/x/tokenomics/types" ) @@ -27,7 +26,7 @@ func (k msgServer) UpdateParam( case types.ParamComputeUnitsToTokensMultiplier: value, ok := msg.AsType.(*types.MsgUpdateParam_AsInt64) if !ok { - return nil, fmt.Errorf("unsupported value type for %s param: %T", msg.Name, msg.AsType) + return nil, types.ErrTokenomicsParamsInvalid.Wrapf("unsupported value type for %s param: %T", msg.Name, msg.AsType) } computeUnitsToTokensMultiplier := uint64(value.AsInt64) @@ -37,7 +36,7 @@ func (k msgServer) UpdateParam( params.ComputeUnitsToTokensMultiplier = computeUnitsToTokensMultiplier default: - return nil, fmt.Errorf("unsupported param %q", msg.Name) + return nil, types.ErrTokenomicsParamsInvalid.Wrapf("unsupported param %q", msg.Name) } if err := k.SetParams(ctx, params); err != nil { diff --git a/x/tokenomics/types/message_update_param_test.go b/x/tokenomics/types/message_update_param_test.go index c0898f089..4be202bfb 100644 --- a/x/tokenomics/types/message_update_param_test.go +++ b/x/tokenomics/types/message_update_param_test.go @@ -41,7 +41,7 @@ func TestMsgUpdateParam_ValidateBasic(t *testing.T) { }, expectedErr: ErrTokenomicsParamInvalid, }, { - name: "valid: correct authority and param name", + name: "valid: correct authority, param name, and type", msg: MsgUpdateParam{ Authority: sample.AccAddress(), Name: ParamComputeUnitsToTokensMultiplier,