From d1cd5e69fd97bc5263303ef8bf783c755e54cae0 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Mon, 9 Sep 2024 11:13:25 +0200 Subject: [PATCH 001/139] scaffold: message update-param --module gateway --signer authority name as_type --response params --- api/poktroll/gateway/params.pulsar.go | 3 + api/poktroll/gateway/tx.pulsar.go | 1180 +++++++++++++++++- api/poktroll/gateway/tx_grpc.pb.go | 38 + proto/poktroll/gateway/tx.proto | 28 +- x/gateway/keeper/msg_server_update_param.go | 17 + x/gateway/module/autocli.go | 8 +- x/gateway/module/simulation.go | 23 + x/gateway/simulation/update_param.go | 29 + x/gateway/types/codec.go | 3 + x/gateway/types/message_update_param.go | 25 + x/gateway/types/message_update_param_test.go | 40 + x/gateway/types/params.pb.go | 22 +- x/gateway/types/tx.pb.go | 538 +++++++- 13 files changed, 1862 insertions(+), 92 deletions(-) create mode 100644 x/gateway/keeper/msg_server_update_param.go create mode 100644 x/gateway/simulation/update_param.go create mode 100644 x/gateway/types/message_update_param.go create mode 100644 x/gateway/types/message_update_param_test.go diff --git a/api/poktroll/gateway/params.pulsar.go b/api/poktroll/gateway/params.pulsar.go index 47b892b49..79b8a4dcd 100644 --- a/api/poktroll/gateway/params.pulsar.go +++ b/api/poktroll/gateway/params.pulsar.go @@ -3,6 +3,7 @@ package gateway import ( _ "cosmossdk.io/api/amino" + _ "cosmossdk.io/api/cosmos/base/v1beta1" fmt "fmt" runtime "github.com/cosmos/cosmos-proto/runtime" _ "github.com/cosmos/gogoproto/gogoproto" @@ -417,6 +418,8 @@ var file_poktroll_gateway_params_proto_rawDesc = []byte{ 0x61, 0x79, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, + 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2c, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3a, 0x22, 0xe8, 0xa0, 0x1f, 0x01, 0x8a, 0xe7, 0xb0, 0x2a, 0x19, 0x70, diff --git a/api/poktroll/gateway/tx.pulsar.go b/api/poktroll/gateway/tx.pulsar.go index d4983a136..2cd097506 100644 --- a/api/poktroll/gateway/tx.pulsar.go +++ b/api/poktroll/gateway/tx.pulsar.go @@ -2503,6 +2503,974 @@ func (x *fastReflection_MsgUnstakeGatewayResponse) ProtoMethods() *protoiface.Me } } +var ( + md_MsgUpdateParam protoreflect.MessageDescriptor + fd_MsgUpdateParam_authority protoreflect.FieldDescriptor + fd_MsgUpdateParam_name protoreflect.FieldDescriptor + fd_MsgUpdateParam_asType protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_gateway_tx_proto_init() + md_MsgUpdateParam = File_poktroll_gateway_tx_proto.Messages().ByName("MsgUpdateParam") + fd_MsgUpdateParam_authority = md_MsgUpdateParam.Fields().ByName("authority") + fd_MsgUpdateParam_name = md_MsgUpdateParam.Fields().ByName("name") + fd_MsgUpdateParam_asType = md_MsgUpdateParam.Fields().ByName("asType") +} + +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_gateway_tx_proto_msgTypes[6] + 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 != "" { + value := protoreflect.ValueOfString(x.AsType) + if !f(fd_MsgUpdateParam_asType, 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.gateway.MsgUpdateParam.authority": + return x.Authority != "" + case "poktroll.gateway.MsgUpdateParam.name": + return x.Name != "" + case "poktroll.gateway.MsgUpdateParam.asType": + return x.AsType != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParam")) + } + panic(fmt.Errorf("message poktroll.gateway.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.gateway.MsgUpdateParam.authority": + x.Authority = "" + case "poktroll.gateway.MsgUpdateParam.name": + x.Name = "" + case "poktroll.gateway.MsgUpdateParam.asType": + x.AsType = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParam")) + } + panic(fmt.Errorf("message poktroll.gateway.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.gateway.MsgUpdateParam.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + case "poktroll.gateway.MsgUpdateParam.name": + value := x.Name + return protoreflect.ValueOfString(value) + case "poktroll.gateway.MsgUpdateParam.asType": + value := x.AsType + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParam")) + } + panic(fmt.Errorf("message poktroll.gateway.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.gateway.MsgUpdateParam.authority": + x.Authority = value.Interface().(string) + case "poktroll.gateway.MsgUpdateParam.name": + x.Name = value.Interface().(string) + case "poktroll.gateway.MsgUpdateParam.asType": + x.AsType = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParam")) + } + panic(fmt.Errorf("message poktroll.gateway.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.gateway.MsgUpdateParam.authority": + panic(fmt.Errorf("field authority of message poktroll.gateway.MsgUpdateParam is not mutable")) + case "poktroll.gateway.MsgUpdateParam.name": + panic(fmt.Errorf("field name of message poktroll.gateway.MsgUpdateParam is not mutable")) + case "poktroll.gateway.MsgUpdateParam.asType": + panic(fmt.Errorf("field asType of message poktroll.gateway.MsgUpdateParam is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParam")) + } + panic(fmt.Errorf("message poktroll.gateway.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.gateway.MsgUpdateParam.authority": + return protoreflect.ValueOfString("") + case "poktroll.gateway.MsgUpdateParam.name": + return protoreflect.ValueOfString("") + case "poktroll.gateway.MsgUpdateParam.asType": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParam")) + } + panic(fmt.Errorf("message poktroll.gateway.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() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.gateway.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)) + } + l = len(x.AsType) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*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) + } + if len(x.AsType) > 0 { + i -= len(x.AsType) + copy(dAtA[i:], x.AsType) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.AsType))) + i-- + dAtA[i] = 0x1a + } + 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 AsType", 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 = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgUpdateParamResponse protoreflect.MessageDescriptor + fd_MsgUpdateParamResponse_params protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_gateway_tx_proto_init() + md_MsgUpdateParamResponse = File_poktroll_gateway_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_gateway_tx_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_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 != "" { + value := protoreflect.ValueOfString(x.Params) + 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.gateway.MsgUpdateParamResponse.params": + return x.Params != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParamResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.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.gateway.MsgUpdateParamResponse.params": + x.Params = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParamResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.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.gateway.MsgUpdateParamResponse.params": + value := x.Params + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParamResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.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.gateway.MsgUpdateParamResponse.params": + x.Params = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParamResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.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.gateway.MsgUpdateParamResponse.params": + panic(fmt.Errorf("field params of message poktroll.gateway.MsgUpdateParamResponse is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParamResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.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.gateway.MsgUpdateParamResponse.params": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParamResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.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.gateway.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 + l = len(x.Params) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*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 len(x.Params) > 0 { + i -= len(x.Params) + copy(dAtA[i:], x.Params) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Params))) + 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 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.Params = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 @@ -2721,6 +3689,92 @@ func (*MsgUnstakeGatewayResponse) Descriptor() ([]byte, []int) { return file_poktroll_gateway_tx_proto_rawDescGZIP(), []int{5} } +type MsgUpdateParam struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + AsType string `protobuf:"bytes,3,opt,name=asType,proto3" json:"asType,omitempty"` +} + +func (x *MsgUpdateParam) Reset() { + *x = MsgUpdateParam{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_gateway_tx_proto_msgTypes[6] + 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_gateway_tx_proto_rawDescGZIP(), []int{6} +} + +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() string { + if x != nil { + return x.AsType + } + return "" +} + +type MsgUpdateParamResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Params string `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` +} + +func (x *MsgUpdateParamResponse) Reset() { + *x = MsgUpdateParamResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_gateway_tx_proto_msgTypes[7] + 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_gateway_tx_proto_rawDescGZIP(), []int{7} +} + +func (x *MsgUpdateParamResponse) GetParams() string { + if x != nil { + return x.Params + } + return "" +} + var File_poktroll_gateway_tx_proto protoreflect.FileDescriptor var file_poktroll_gateway_tx_proto_rawDesc = []byte{ @@ -2767,37 +3821,53 @@ var file_poktroll_gateway_tx_proto_rawDesc = []byte{ 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x3a, 0x0c, 0x82, 0xe7, 0xb0, 0x2a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x1b, 0x0a, 0x19, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, - 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xac, 0x02, 0x0a, 0x03, 0x4d, - 0x73, 0x67, 0x12, 0x5c, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x12, 0x21, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, - 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 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, 0x5c, 0x0a, 0x0c, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, + 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x6a, 0x0a, 0x0e, 0x4d, 0x73, + 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x1c, 0x0a, 0x09, + 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 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, 0x16, + 0x0a, 0x06, 0x61, 0x73, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, + 0x61, 0x73, 0x54, 0x79, 0x70, 0x65, 0x3a, 0x0e, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, + 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x22, 0x30, 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, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x32, 0x87, 0x03, 0x0a, 0x03, 0x4d, 0x73, 0x67, + 0x12, 0x5c, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x21, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, - 0x77, 0x61, 0x79, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, - 0x77, 0x61, 0x79, 0x1a, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, - 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x47, - 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x62, - 0x0a, 0x0e, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, - 0x12, 0x23, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, - 0x77, 0x61, 0x79, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, - 0x74, 0x65, 0x77, 0x61, 0x79, 0x1a, 0x2b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, - 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xa7, 0x01, 0xd8, 0xe2, 0x1e, 0x01, - 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, - 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, - 0x01, 0x5a, 0x21, 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, 0x67, 0x61, 0x74, - 0x65, 0x77, 0x61, 0x79, 0xa2, 0x02, 0x03, 0x50, 0x47, 0x58, 0xaa, 0x02, 0x10, 0x50, 0x6f, 0x6b, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0xca, 0x02, 0x10, - 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, - 0xe2, 0x02, 0x1c, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x47, 0x61, 0x74, 0x65, - 0x77, 0x61, 0x79, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, - 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x47, 0x61, 0x74, 0x65, - 0x77, 0x61, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x77, 0x61, 0x79, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, + 0x61, 0x6d, 0x73, 0x1a, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, + 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 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, 0x5c, + 0x0a, 0x0c, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x21, + 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, + 0x79, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, + 0x79, 0x1a, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, + 0x65, 0x77, 0x61, 0x79, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, + 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x62, 0x0a, 0x0e, + 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x23, + 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, + 0x79, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, + 0x77, 0x61, 0x79, 0x1a, 0x2b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, + 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, + 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x59, 0x0a, 0x0b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, + 0x20, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, + 0x61, 0x79, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x1a, 0x28, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, + 0x65, 0x77, 0x61, 0x79, 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, 0xa7, 0x01, 0xd8, 0xe2, 0x1e, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, + 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x21, 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, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0xa2, 0x02, 0x03, + 0x50, 0x47, 0x58, 0xaa, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x47, + 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0xca, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x5c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0xe2, 0x02, 0x1c, 0x50, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x5c, 0x47, 0x50, 0x42, + 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -2812,7 +3882,7 @@ func file_poktroll_gateway_tx_proto_rawDescGZIP() []byte { return file_poktroll_gateway_tx_proto_rawDescData } -var file_poktroll_gateway_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_poktroll_gateway_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_poktroll_gateway_tx_proto_goTypes = []interface{}{ (*MsgUpdateParams)(nil), // 0: poktroll.gateway.MsgUpdateParams (*MsgUpdateParamsResponse)(nil), // 1: poktroll.gateway.MsgUpdateParamsResponse @@ -2820,20 +3890,24 @@ var file_poktroll_gateway_tx_proto_goTypes = []interface{}{ (*MsgStakeGatewayResponse)(nil), // 3: poktroll.gateway.MsgStakeGatewayResponse (*MsgUnstakeGateway)(nil), // 4: poktroll.gateway.MsgUnstakeGateway (*MsgUnstakeGatewayResponse)(nil), // 5: poktroll.gateway.MsgUnstakeGatewayResponse - (*Params)(nil), // 6: poktroll.gateway.Params - (*v1beta1.Coin)(nil), // 7: cosmos.base.v1beta1.Coin + (*MsgUpdateParam)(nil), // 6: poktroll.gateway.MsgUpdateParam + (*MsgUpdateParamResponse)(nil), // 7: poktroll.gateway.MsgUpdateParamResponse + (*Params)(nil), // 8: poktroll.gateway.Params + (*v1beta1.Coin)(nil), // 9: cosmos.base.v1beta1.Coin } var file_poktroll_gateway_tx_proto_depIdxs = []int32{ - 6, // 0: poktroll.gateway.MsgUpdateParams.params:type_name -> poktroll.gateway.Params - 7, // 1: poktroll.gateway.MsgStakeGateway.stake:type_name -> cosmos.base.v1beta1.Coin + 8, // 0: poktroll.gateway.MsgUpdateParams.params:type_name -> poktroll.gateway.Params + 9, // 1: poktroll.gateway.MsgStakeGateway.stake:type_name -> cosmos.base.v1beta1.Coin 0, // 2: poktroll.gateway.Msg.UpdateParams:input_type -> poktroll.gateway.MsgUpdateParams 2, // 3: poktroll.gateway.Msg.StakeGateway:input_type -> poktroll.gateway.MsgStakeGateway 4, // 4: poktroll.gateway.Msg.UnstakeGateway:input_type -> poktroll.gateway.MsgUnstakeGateway - 1, // 5: poktroll.gateway.Msg.UpdateParams:output_type -> poktroll.gateway.MsgUpdateParamsResponse - 3, // 6: poktroll.gateway.Msg.StakeGateway:output_type -> poktroll.gateway.MsgStakeGatewayResponse - 5, // 7: poktroll.gateway.Msg.UnstakeGateway:output_type -> poktroll.gateway.MsgUnstakeGatewayResponse - 5, // [5:8] is the sub-list for method output_type - 2, // [2:5] is the sub-list for method input_type + 6, // 5: poktroll.gateway.Msg.UpdateParam:input_type -> poktroll.gateway.MsgUpdateParam + 1, // 6: poktroll.gateway.Msg.UpdateParams:output_type -> poktroll.gateway.MsgUpdateParamsResponse + 3, // 7: poktroll.gateway.Msg.StakeGateway:output_type -> poktroll.gateway.MsgStakeGatewayResponse + 5, // 8: poktroll.gateway.Msg.UnstakeGateway:output_type -> poktroll.gateway.MsgUnstakeGatewayResponse + 7, // 9: poktroll.gateway.Msg.UpdateParam:output_type -> poktroll.gateway.MsgUpdateParamResponse + 6, // [6:10] is the sub-list for method output_type + 2, // [2:6] 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 @@ -2918,6 +3992,30 @@ func file_poktroll_gateway_tx_proto_init() { return nil } } + file_poktroll_gateway_tx_proto_msgTypes[6].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_gateway_tx_proto_msgTypes[7].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 + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -2925,7 +4023,7 @@ func file_poktroll_gateway_tx_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_poktroll_gateway_tx_proto_rawDesc, NumEnums: 0, - NumMessages: 6, + NumMessages: 8, NumExtensions: 0, NumServices: 1, }, diff --git a/api/poktroll/gateway/tx_grpc.pb.go b/api/poktroll/gateway/tx_grpc.pb.go index 097b42380..e326d0d9f 100644 --- a/api/poktroll/gateway/tx_grpc.pb.go +++ b/api/poktroll/gateway/tx_grpc.pb.go @@ -22,6 +22,7 @@ const ( Msg_UpdateParams_FullMethodName = "/poktroll.gateway.Msg/UpdateParams" Msg_StakeGateway_FullMethodName = "/poktroll.gateway.Msg/StakeGateway" Msg_UnstakeGateway_FullMethodName = "/poktroll.gateway.Msg/UnstakeGateway" + Msg_UpdateParam_FullMethodName = "/poktroll.gateway.Msg/UpdateParam" ) // MsgClient is the client API for Msg service. @@ -35,6 +36,7 @@ type MsgClient interface { UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) StakeGateway(ctx context.Context, in *MsgStakeGateway, opts ...grpc.CallOption) (*MsgStakeGatewayResponse, error) UnstakeGateway(ctx context.Context, in *MsgUnstakeGateway, opts ...grpc.CallOption) (*MsgUnstakeGatewayResponse, error) + UpdateParam(ctx context.Context, in *MsgUpdateParam, opts ...grpc.CallOption) (*MsgUpdateParamResponse, error) } type msgClient struct { @@ -75,6 +77,16 @@ func (c *msgClient) UnstakeGateway(ctx context.Context, in *MsgUnstakeGateway, o return out, nil } +func (c *msgClient) UpdateParam(ctx context.Context, in *MsgUpdateParam, opts ...grpc.CallOption) (*MsgUpdateParamResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(MsgUpdateParamResponse) + err := c.cc.Invoke(ctx, Msg_UpdateParam_FullMethodName, in, out, cOpts...) + 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 @@ -86,6 +98,7 @@ type MsgServer interface { UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) StakeGateway(context.Context, *MsgStakeGateway) (*MsgStakeGatewayResponse, error) UnstakeGateway(context.Context, *MsgUnstakeGateway) (*MsgUnstakeGatewayResponse, error) + UpdateParam(context.Context, *MsgUpdateParam) (*MsgUpdateParamResponse, error) mustEmbedUnimplementedMsgServer() } @@ -102,6 +115,9 @@ func (UnimplementedMsgServer) StakeGateway(context.Context, *MsgStakeGateway) (* func (UnimplementedMsgServer) UnstakeGateway(context.Context, *MsgUnstakeGateway) (*MsgUnstakeGatewayResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UnstakeGateway 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. @@ -169,6 +185,24 @@ func _Msg_UnstakeGateway_Handler(srv interface{}, ctx context.Context, dec func( 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) @@ -188,6 +222,10 @@ var Msg_ServiceDesc = grpc.ServiceDesc{ MethodName: "UnstakeGateway", Handler: _Msg_UnstakeGateway_Handler, }, + { + MethodName: "UpdateParam", + Handler: _Msg_UpdateParam_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "poktroll/gateway/tx.proto", diff --git a/proto/poktroll/gateway/tx.proto b/proto/poktroll/gateway/tx.proto index 922659ee1..171028cb1 100644 --- a/proto/poktroll/gateway/tx.proto +++ b/proto/poktroll/gateway/tx.proto @@ -1,4 +1,5 @@ syntax = "proto3"; + package poktroll.gateway; option go_package = "github.com/pokt-network/poktroll/x/gateway/types"; @@ -9,31 +10,31 @@ import "cosmos/msg/v1/msg.proto"; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; import "cosmos/base/v1beta1/coin.proto"; - import "poktroll/gateway/params.proto"; // 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 StakeGateway (MsgStakeGateway ) returns (MsgStakeGatewayResponse ); rpc UnstakeGateway (MsgUnstakeGateway) returns (MsgUnstakeGatewayResponse); + 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/gateway/MsgUpdateParams"; - + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "poktroll/x/gateway/MsgUpdateParams"; + // authority is the address that controls the module (defaults to x/gov unless overwritten). string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // TODO_IMPROVE(#322): The requirement to provide all params is adopted from the // latest Cosmos SDK version. We should look into either improving this ourselves // or seeing if it is on their roadmap. - + // params defines the x/gateway parameters to update. // NOTE: All parameters must be supplied. Params params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; @@ -45,8 +46,8 @@ message MsgUpdateParamsResponse {} message MsgStakeGateway { option (cosmos.msg.v1.signer) = "address"; // see: https://docs.cosmos.network/main/build/building-modules/protobuf-annotations#signer - string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the gateway - cosmos.base.v1beta1.Coin stake = 2; // The total amount of uPOKT the gateway is staking. Must be ≥ to the current amount that the gateway has staked (if any) + string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the gateway + cosmos.base.v1beta1.Coin stake = 2; // The total amount of uPOKT the gateway is staking. Must be ≥ to the current amount that the gateway has staked (if any) } message MsgStakeGatewayResponse {} @@ -58,3 +59,14 @@ message MsgUnstakeGateway { message MsgUnstakeGatewayResponse {} +message MsgUpdateParam { + option (cosmos.msg.v1.signer) = "authority"; + string authority = 1; + string name = 2; + string asType = 3; +} + +message MsgUpdateParamResponse { + string params = 1; +} + diff --git a/x/gateway/keeper/msg_server_update_param.go b/x/gateway/keeper/msg_server_update_param.go new file mode 100644 index 000000000..b1f5d25ef --- /dev/null +++ b/x/gateway/keeper/msg_server_update_param.go @@ -0,0 +1,17 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/pokt-network/poktroll/x/gateway/types" +) + +func (k msgServer) UpdateParam(goCtx context.Context, msg *types.MsgUpdateParam) (*types.MsgUpdateParamResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + // TODO: Handling the message + _ = ctx + + return &types.MsgUpdateParamResponse{}, nil +} diff --git a/x/gateway/module/autocli.go b/x/gateway/module/autocli.go index f8551e6ab..c39515631 100644 --- a/x/gateway/module/autocli.go +++ b/x/gateway/module/autocli.go @@ -34,7 +34,7 @@ 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{ + RpcCommandOptions: []*autocliv1.RpcCommandOptions{ // { // RpcMethod: "UpdateParams", // Skip: true, // skipped because authority gated @@ -51,6 +51,12 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { // Short: "Send a unstake_gateway tx", // PositionalArgs: []*autocliv1.PositionalArgDescriptor{}, // }, + { + 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/gateway/module/simulation.go b/x/gateway/module/simulation.go index 79e8de69a..9b69e5bd0 100644 --- a/x/gateway/module/simulation.go +++ b/x/gateway/module/simulation.go @@ -31,6 +31,10 @@ const ( // TODO: Determine the simulation weight value defaultWeightMsgUnstakeGateway int = 100 + 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 ) @@ -81,6 +85,17 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp gatewaysimulation.SimulateMsgUnstakeGateway(am.accountKeeper, am.bankKeeper, am.keeper), )) + var weightMsgUpdateParam int + simState.AppParams.GetOrGenerate(opWeightMsgUpdateParam, &weightMsgUpdateParam, nil, + func(_ *rand.Rand) { + weightMsgUpdateParam = defaultWeightMsgUpdateParam + }, + ) + operations = append(operations, simulation.NewWeightedOperation( + weightMsgUpdateParam, + gatewaysimulation.SimulateMsgUpdateParam(am.accountKeeper, am.bankKeeper, am.keeper), + )) + // this line is used by starport scaffolding # simapp/module/operation return operations @@ -105,6 +120,14 @@ func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.Wei return nil }, ), + simulation.NewWeightedProposalMsg( + opWeightMsgUpdateParam, + defaultWeightMsgUpdateParam, + func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { + gatewaysimulation.SimulateMsgUpdateParam(am.accountKeeper, am.bankKeeper, am.keeper) + return nil + }, + ), // this line is used by starport scaffolding # simapp/module/OpMsg } } diff --git a/x/gateway/simulation/update_param.go b/x/gateway/simulation/update_param.go new file mode 100644 index 000000000..57330a01a --- /dev/null +++ b/x/gateway/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/gateway/keeper" + "github.com/pokt-network/poktroll/x/gateway/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/gateway/types/codec.go b/x/gateway/types/codec.go index 4d175c529..06506ba14 100644 --- a/x/gateway/types/codec.go +++ b/x/gateway/types/codec.go @@ -14,6 +14,9 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { registry.RegisterImplementations((*sdk.Msg)(nil), &MsgUnstakeGateway{}, ) + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgUpdateParam{}, + ) // this line is used by starport scaffolding # 3 registry.RegisterImplementations((*sdk.Msg)(nil), diff --git a/x/gateway/types/message_update_param.go b/x/gateway/types/message_update_param.go new file mode 100644 index 000000000..cae2750d8 --- /dev/null +++ b/x/gateway/types/message_update_param.go @@ -0,0 +1,25 @@ +package types + +import ( + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +var _ sdk.Msg = &MsgUpdateParam{} + +func NewMsgUpdateParam(authority string, name string, asType string) *MsgUpdateParam { + return &MsgUpdateParam{ + Authority: authority, + Name: name, + AsType: asType, + } +} + +func (msg *MsgUpdateParam) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.Authority) + if err != nil { + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid authority address (%s)", err) + } + return nil +} diff --git a/x/gateway/types/message_update_param_test.go b/x/gateway/types/message_update_param_test.go new file mode 100644 index 000000000..892ec6878 --- /dev/null +++ b/x/gateway/types/message_update_param_test.go @@ -0,0 +1,40 @@ +package types + +import ( + "testing" + + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/pokt-network/poktroll/testutil/sample" + "github.com/stretchr/testify/require" +) + +func TestMsgUpdateParam_ValidateBasic(t *testing.T) { + tests := []struct { + name string + msg MsgUpdateParam + err error + }{ + { + name: "invalid address", + msg: MsgUpdateParam{ + Authority: "invalid_address", + }, + err: sdkerrors.ErrInvalidAddress, + }, { + name: "valid address", + msg: MsgUpdateParam{ + Authority: sample.AccAddress(), + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := tt.msg.ValidateBasic() + if tt.err != nil { + require.ErrorIs(t, err, tt.err) + return + } + require.NoError(t, err) + }) + } +} diff --git a/x/gateway/types/params.pb.go b/x/gateway/types/params.pb.go index ceb9f5ead..7ac8a04a9 100644 --- a/x/gateway/types/params.pb.go +++ b/x/gateway/types/params.pb.go @@ -5,6 +5,7 @@ package types import ( fmt "fmt" + _ "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" @@ -64,19 +65,20 @@ func init() { func init() { proto.RegisterFile("poktroll/gateway/params.proto", fileDescriptor_23ed52a392489486) } var fileDescriptor_23ed52a392489486 = []byte{ - // 180 bytes of a gzipped FileDescriptorProto + // 207 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2d, 0xc8, 0xcf, 0x2e, 0x29, 0xca, 0xcf, 0xc9, 0xd1, 0x4f, 0x4f, 0x2c, 0x49, 0x2d, 0x4f, 0xac, 0xd4, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x80, 0x49, 0xeb, 0x41, 0xa5, - 0xa5, 0x04, 0x13, 0x73, 0x33, 0xf3, 0xf2, 0xf5, 0xc1, 0x24, 0x44, 0x91, 0x94, 0x48, 0x7a, 0x7e, - 0x7a, 0x3e, 0x98, 0xa9, 0x0f, 0x62, 0x41, 0x44, 0x95, 0x74, 0xb8, 0xd8, 0x02, 0xc0, 0x46, 0x59, - 0x29, 0xbd, 0x58, 0x20, 0xcf, 0xd8, 0xf5, 0x7c, 0x83, 0x96, 0x24, 0xdc, 0xb2, 0x0a, 0xb8, 0x75, - 0x10, 0x35, 0x4e, 0x7e, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0x78, 0xe3, 0x91, 0x1c, - 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, - 0x1c, 0x43, 0x94, 0x41, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x3e, 0xc8, - 0x0c, 0xdd, 0xbc, 0xd4, 0x92, 0xf2, 0xfc, 0xa2, 0x6c, 0x7d, 0x2c, 0x06, 0x96, 0x54, 0x16, 0xa4, - 0x16, 0x27, 0xb1, 0x81, 0x1d, 0x61, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0xb5, 0xe9, 0x34, 0xfe, - 0xe0, 0x00, 0x00, 0x00, + 0xa5, 0x04, 0x13, 0x73, 0x33, 0xf3, 0xf2, 0xf5, 0xc1, 0x24, 0x44, 0x91, 0x94, 0x5c, 0x72, 0x7e, + 0x71, 0x6e, 0x7e, 0xb1, 0x7e, 0x52, 0x62, 0x71, 0xaa, 0x7e, 0x99, 0x61, 0x52, 0x6a, 0x49, 0xa2, + 0xa1, 0x7e, 0x72, 0x7e, 0x66, 0x1e, 0x54, 0x5e, 0x24, 0x3d, 0x3f, 0x3d, 0x1f, 0xcc, 0xd4, 0x07, + 0xb1, 0x20, 0xa2, 0x4a, 0x3a, 0x5c, 0x6c, 0x01, 0x60, 0xab, 0xac, 0x94, 0x5e, 0x2c, 0x90, 0x67, + 0xec, 0x7a, 0xbe, 0x41, 0x4b, 0x12, 0xee, 0x98, 0x0a, 0xb8, 0x73, 0x20, 0x6a, 0x9c, 0xfc, 0x4e, + 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc6, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, + 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0x83, 0xf4, + 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0x7d, 0x90, 0x19, 0xba, 0x79, 0xa9, 0x25, + 0xe5, 0xf9, 0x45, 0xd9, 0xfa, 0x58, 0x0c, 0x2c, 0xa9, 0x2c, 0x48, 0x2d, 0x4e, 0x62, 0x03, 0x3b, + 0xc2, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x89, 0x77, 0x0d, 0x96, 0x00, 0x01, 0x00, 0x00, } func (this *Params) Equal(that interface{}) bool { diff --git a/x/gateway/types/tx.pb.go b/x/gateway/types/tx.pb.go index 1ed9ad63d..89edda5d6 100644 --- a/x/gateway/types/tx.pb.go +++ b/x/gateway/types/tx.pb.go @@ -270,6 +270,102 @@ func (m *MsgUnstakeGatewayResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUnstakeGatewayResponse proto.InternalMessageInfo +type MsgUpdateParam struct { + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + AsType string `protobuf:"bytes,3,opt,name=asType,proto3" json:"asType,omitempty"` +} + +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_7ad4b0c5e3b59f23, []int{6} +} +func (m *MsgUpdateParam) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParam) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + 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 + +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) GetAsType() string { + if m != nil { + return m.AsType + } + return "" +} + +type MsgUpdateParamResponse struct { + Params string `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_7ad4b0c5e3b59f23, []int{7} +} +func (m *MsgUpdateParamResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParamResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + 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() string { + if m != nil { + return m.Params + } + return "" +} + func init() { proto.RegisterType((*MsgUpdateParams)(nil), "poktroll.gateway.MsgUpdateParams") proto.RegisterType((*MsgUpdateParamsResponse)(nil), "poktroll.gateway.MsgUpdateParamsResponse") @@ -277,43 +373,49 @@ func init() { proto.RegisterType((*MsgStakeGatewayResponse)(nil), "poktroll.gateway.MsgStakeGatewayResponse") proto.RegisterType((*MsgUnstakeGateway)(nil), "poktroll.gateway.MsgUnstakeGateway") proto.RegisterType((*MsgUnstakeGatewayResponse)(nil), "poktroll.gateway.MsgUnstakeGatewayResponse") + proto.RegisterType((*MsgUpdateParam)(nil), "poktroll.gateway.MsgUpdateParam") + proto.RegisterType((*MsgUpdateParamResponse)(nil), "poktroll.gateway.MsgUpdateParamResponse") } func init() { proto.RegisterFile("poktroll/gateway/tx.proto", fileDescriptor_7ad4b0c5e3b59f23) } var fileDescriptor_7ad4b0c5e3b59f23 = []byte{ - // 489 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x53, 0xbf, 0x6f, 0xd3, 0x40, - 0x18, 0xcd, 0x15, 0xb5, 0x28, 0x47, 0x05, 0xd4, 0xaa, 0xd4, 0xd8, 0x88, 0xa3, 0x84, 0xa5, 0x04, - 0xf5, 0x8e, 0x04, 0xc1, 0x50, 0x26, 0xc2, 0xc0, 0x54, 0x84, 0x5c, 0x75, 0x41, 0x48, 0xe8, 0x9c, - 0x9c, 0xae, 0x56, 0x6a, 0x9f, 0xe5, 0xbb, 0xfe, 0xc8, 0x86, 0x10, 0x13, 0x13, 0x7f, 0x06, 0x03, - 0x43, 0x06, 0x56, 0xf6, 0x8e, 0x15, 0x53, 0x27, 0x84, 0x9c, 0x21, 0xff, 0x06, 0x3a, 0xdf, 0x39, - 0x6d, 0x1c, 0xa3, 0x20, 0xb1, 0xd8, 0xbe, 0x7b, 0xef, 0x7b, 0xdf, 0xfb, 0xde, 0x9d, 0xa1, 0x9b, - 0x88, 0x81, 0x4a, 0xc5, 0xe1, 0x21, 0xe1, 0x54, 0xb1, 0x13, 0x3a, 0x24, 0xea, 0x14, 0x27, 0xa9, - 0x50, 0xc2, 0xb9, 0x5d, 0x40, 0xd8, 0x42, 0xde, 0x1a, 0x8d, 0xc2, 0x58, 0x90, 0xfc, 0x69, 0x48, - 0xde, 0x46, 0x4f, 0xc8, 0x48, 0x48, 0x12, 0x49, 0x4e, 0x8e, 0xdb, 0xfa, 0x65, 0x01, 0xd7, 0x00, - 0xef, 0xf3, 0x15, 0x31, 0x0b, 0x0b, 0xad, 0x73, 0xc1, 0x85, 0xd9, 0xd7, 0x5f, 0x76, 0x17, 0x59, - 0xa5, 0x80, 0x4a, 0x46, 0x8e, 0xdb, 0x01, 0x53, 0xb4, 0x4d, 0x7a, 0x22, 0x8c, 0x2d, 0x7e, 0x77, - 0xce, 0x69, 0x42, 0x53, 0x1a, 0x59, 0xd1, 0xe6, 0x0f, 0x00, 0x6f, 0xed, 0x4a, 0xbe, 0x9f, 0xf4, - 0xa9, 0x62, 0x6f, 0x72, 0xc4, 0x79, 0x06, 0xeb, 0xf4, 0x48, 0x1d, 0x88, 0x34, 0x54, 0xc3, 0x06, - 0xd8, 0x04, 0x5b, 0xf5, 0x6e, 0xe3, 0xe7, 0xf7, 0xed, 0x75, 0xeb, 0xe6, 0x45, 0xbf, 0x9f, 0x32, - 0x29, 0xf7, 0x54, 0x1a, 0xc6, 0xdc, 0xbf, 0xa4, 0x3a, 0xcf, 0xe1, 0x8a, 0xd1, 0x6e, 0x2c, 0x6d, - 0x82, 0xad, 0x1b, 0x9d, 0x06, 0x2e, 0x47, 0x81, 0x4d, 0x87, 0x6e, 0xfd, 0xec, 0xd7, 0xbd, 0xda, - 0xd7, 0xc9, 0xa8, 0x05, 0x7c, 0x5b, 0xb2, 0xf3, 0xf4, 0xe3, 0x64, 0xd4, 0xba, 0x14, 0xfb, 0x3c, - 0x19, 0xb5, 0x9a, 0x53, 0xeb, 0xa7, 0x53, 0xf3, 0x25, 0xaf, 0x4d, 0x17, 0x6e, 0x94, 0xb6, 0x7c, - 0x26, 0x13, 0x11, 0x4b, 0xd6, 0xfc, 0x64, 0x46, 0xdb, 0x53, 0x74, 0xc0, 0x5e, 0x99, 0x72, 0xa7, - 0x03, 0xaf, 0x53, 0x63, 0x7f, 0xe1, 0x60, 0x05, 0xd1, 0x21, 0x70, 0x59, 0x6a, 0x0d, 0x3b, 0x95, - 0x8b, 0x2d, 0x5d, 0x27, 0x8e, 0x6d, 0xe2, 0xf8, 0xa5, 0x08, 0x63, 0xdf, 0xf0, 0x76, 0x56, 0xf5, - 0x28, 0x45, 0xb9, 0x75, 0x78, 0xd5, 0xc5, 0xd4, 0xe1, 0x3e, 0x5c, 0xd3, 0xe6, 0x63, 0xf9, 0x9f, - 0x16, 0x4b, 0x1d, 0xef, 0x40, 0x77, 0x4e, 0xb6, 0xe8, 0xd9, 0xf9, 0xb6, 0x04, 0xaf, 0xed, 0x4a, - 0xee, 0xbc, 0x83, 0xab, 0x33, 0x87, 0x7e, 0x7f, 0xfe, 0xb0, 0x4a, 0xc1, 0x7a, 0x0f, 0x17, 0x52, - 0x8a, 0x2e, 0x5a, 0x7d, 0x26, 0xf7, 0x6a, 0xf5, 0xab, 0x94, 0xbf, 0xa8, 0x57, 0xe5, 0xe6, 0x04, - 0xf0, 0x66, 0x29, 0xb4, 0x07, 0xd5, 0xd6, 0x66, 0x48, 0xde, 0xa3, 0x7f, 0x20, 0x15, 0x3d, 0xbc, - 0xe5, 0x0f, 0xfa, 0x7a, 0x76, 0x5f, 0x9f, 0x65, 0x08, 0x9c, 0x67, 0x08, 0x5c, 0x64, 0x08, 0xfc, - 0xce, 0x10, 0xf8, 0x32, 0x46, 0xb5, 0xf3, 0x31, 0xaa, 0x5d, 0x8c, 0x51, 0xed, 0xed, 0x63, 0x1e, - 0xaa, 0x83, 0xa3, 0x00, 0xf7, 0x44, 0x44, 0xb4, 0xf6, 0x76, 0xcc, 0xd4, 0x89, 0x48, 0x07, 0xa4, - 0xe2, 0xe6, 0xaa, 0x61, 0xc2, 0x64, 0xb0, 0x92, 0xff, 0x76, 0x4f, 0xfe, 0x04, 0x00, 0x00, 0xff, - 0xff, 0xe9, 0x90, 0xe7, 0x8f, 0x41, 0x04, 0x00, 0x00, + // 559 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0xbf, 0x6f, 0xd3, 0x40, + 0x14, 0x8e, 0x09, 0x0d, 0xca, 0x35, 0x0a, 0xf4, 0x54, 0xb5, 0xb1, 0x01, 0x13, 0xcc, 0x12, 0x82, + 0xea, 0x6b, 0x82, 0x60, 0x08, 0x13, 0x61, 0x60, 0x2a, 0x42, 0x2e, 0x1d, 0x40, 0x95, 0xd0, 0x39, + 0x39, 0xb9, 0x26, 0xb5, 0xcf, 0xf2, 0x5d, 0x7f, 0x64, 0x43, 0x08, 0x09, 0x89, 0x89, 0x3f, 0x83, + 0x31, 0x03, 0x2b, 0x7b, 0xc7, 0x8a, 0xa9, 0x13, 0x42, 0xc9, 0x90, 0x7f, 0x03, 0xd9, 0x77, 0x76, + 0x63, 0x27, 0x28, 0x48, 0x5d, 0x92, 0x7b, 0xef, 0x7d, 0xf7, 0xbd, 0xef, 0xfd, 0x38, 0x03, 0x35, + 0xa0, 0x03, 0x1e, 0xd2, 0xc3, 0x43, 0xe4, 0x60, 0x4e, 0x4e, 0xf0, 0x10, 0xf1, 0x53, 0x33, 0x08, + 0x29, 0xa7, 0xf0, 0x56, 0x12, 0x32, 0x65, 0x48, 0x5b, 0xc3, 0x9e, 0xeb, 0x53, 0x14, 0xff, 0x0a, + 0x90, 0xb6, 0xd9, 0xa3, 0xcc, 0xa3, 0x0c, 0x79, 0xcc, 0x41, 0xc7, 0xad, 0xe8, 0x4f, 0x06, 0x54, + 0x11, 0x78, 0x1f, 0x5b, 0x48, 0x18, 0x32, 0xb4, 0xee, 0x50, 0x87, 0x0a, 0x7f, 0x74, 0x92, 0x5e, + 0x5d, 0x32, 0xd9, 0x98, 0x11, 0x74, 0xdc, 0xb2, 0x09, 0xc7, 0x2d, 0xd4, 0xa3, 0xae, 0x2f, 0xe3, + 0x77, 0xe7, 0x94, 0x06, 0x38, 0xc4, 0x9e, 0x24, 0x35, 0x7e, 0x2a, 0xe0, 0xe6, 0x0e, 0x73, 0xf6, + 0x82, 0x3e, 0xe6, 0xe4, 0x75, 0x1c, 0x81, 0x4f, 0x41, 0x19, 0x1f, 0xf1, 0x03, 0x1a, 0xba, 0x7c, + 0x58, 0x53, 0xea, 0x4a, 0xa3, 0xdc, 0xad, 0xfd, 0xfa, 0xb1, 0xb5, 0x2e, 0xd5, 0x3c, 0xef, 0xf7, + 0x43, 0xc2, 0xd8, 0x2e, 0x0f, 0x5d, 0xdf, 0xb1, 0x2e, 0xa1, 0xf0, 0x19, 0x28, 0x09, 0xee, 0xda, + 0xb5, 0xba, 0xd2, 0x58, 0x6d, 0xd7, 0xcc, 0x7c, 0x2b, 0x4c, 0x91, 0xa1, 0x5b, 0x3e, 0xfb, 0x7d, + 0xaf, 0xf0, 0x7d, 0x3a, 0x6a, 0x2a, 0x96, 0xbc, 0xd2, 0x79, 0xf2, 0x69, 0x3a, 0x6a, 0x5e, 0x92, + 0x7d, 0x9d, 0x8e, 0x9a, 0x46, 0x2a, 0xfd, 0x34, 0x15, 0x9f, 0xd3, 0x6a, 0xa8, 0x60, 0x33, 0xe7, + 0xb2, 0x08, 0x0b, 0xa8, 0xcf, 0x88, 0xf1, 0x59, 0x94, 0xb6, 0xcb, 0xf1, 0x80, 0xbc, 0x14, 0xd7, + 0x61, 0x1b, 0xdc, 0xc0, 0x42, 0xfe, 0xd2, 0xc2, 0x12, 0x20, 0x44, 0x60, 0x85, 0x45, 0x1c, 0xb2, + 0x2a, 0xd5, 0x94, 0xf0, 0xa8, 0xe3, 0xa6, 0xec, 0xb8, 0xf9, 0x82, 0xba, 0xbe, 0x25, 0x70, 0x9d, + 0x4a, 0x54, 0x4a, 0x72, 0x5d, 0x2a, 0x9c, 0x55, 0x91, 0x2a, 0xdc, 0x03, 0x6b, 0x91, 0x78, 0x9f, + 0x5d, 0x51, 0x62, 0x2e, 0xe3, 0x6d, 0xa0, 0xce, 0xd1, 0xa6, 0x39, 0x3f, 0x80, 0x6a, 0xb6, 0x61, + 0xf0, 0xce, 0xdc, 0xb8, 0x67, 0x87, 0x0a, 0xc1, 0x75, 0x1f, 0x7b, 0xa2, 0xf8, 0xb2, 0x15, 0x9f, + 0xe1, 0x06, 0x28, 0x61, 0xf6, 0x66, 0x18, 0x90, 0x5a, 0x31, 0xf6, 0x4a, 0xab, 0x53, 0xcd, 0xce, + 0xd0, 0xd8, 0x06, 0x1b, 0xd9, 0x5c, 0x89, 0x8a, 0x88, 0x41, 0xae, 0x8a, 0x48, 0x28, 0xad, 0xf6, + 0x97, 0x22, 0x28, 0xee, 0x30, 0x07, 0xee, 0x83, 0x4a, 0x66, 0x25, 0xef, 0xcf, 0xaf, 0x52, 0x6e, + 0xec, 0xda, 0xc3, 0xa5, 0x90, 0x34, 0xfb, 0x3e, 0xa8, 0x64, 0xb6, 0x62, 0x31, 0xfb, 0x2c, 0xe4, + 0x1f, 0xec, 0x8b, 0xa6, 0x0a, 0x6d, 0x50, 0xcd, 0x8d, 0xf4, 0xc1, 0x62, 0x69, 0x19, 0x90, 0xf6, + 0xe8, 0x3f, 0x40, 0x69, 0x8e, 0xb7, 0x60, 0x75, 0x76, 0x84, 0xf5, 0x65, 0xb5, 0x6b, 0x8d, 0x65, + 0x88, 0x84, 0x5a, 0x5b, 0xf9, 0x18, 0xbd, 0xcb, 0xee, 0xab, 0xb3, 0xb1, 0xae, 0x9c, 0x8f, 0x75, + 0xe5, 0x62, 0xac, 0x2b, 0x7f, 0xc6, 0xba, 0xf2, 0x6d, 0xa2, 0x17, 0xce, 0x27, 0x7a, 0xe1, 0x62, + 0xa2, 0x17, 0xde, 0x6d, 0x3b, 0x2e, 0x3f, 0x38, 0xb2, 0xcd, 0x1e, 0xf5, 0x50, 0x44, 0xbc, 0xe5, + 0x13, 0x7e, 0x42, 0xc3, 0x01, 0x5a, 0xf0, 0x64, 0xf9, 0x30, 0x20, 0xcc, 0x2e, 0xc5, 0xdf, 0x9b, + 0xc7, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xe4, 0xd8, 0x4b, 0xf5, 0x3a, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -333,6 +435,7 @@ type MsgClient interface { UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) StakeGateway(ctx context.Context, in *MsgStakeGateway, opts ...grpc.CallOption) (*MsgStakeGatewayResponse, error) UnstakeGateway(ctx context.Context, in *MsgUnstakeGateway, opts ...grpc.CallOption) (*MsgUnstakeGatewayResponse, error) + UpdateParam(ctx context.Context, in *MsgUpdateParam, opts ...grpc.CallOption) (*MsgUpdateParamResponse, error) } type msgClient struct { @@ -370,6 +473,15 @@ func (c *msgClient) UnstakeGateway(ctx context.Context, in *MsgUnstakeGateway, o 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.gateway.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 @@ -377,6 +489,7 @@ type MsgServer interface { UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) StakeGateway(context.Context, *MsgStakeGateway) (*MsgStakeGatewayResponse, error) UnstakeGateway(context.Context, *MsgUnstakeGateway) (*MsgUnstakeGatewayResponse, error) + UpdateParam(context.Context, *MsgUpdateParam) (*MsgUpdateParamResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -392,6 +505,9 @@ func (*UnimplementedMsgServer) StakeGateway(ctx context.Context, req *MsgStakeGa func (*UnimplementedMsgServer) UnstakeGateway(ctx context.Context, req *MsgUnstakeGateway) (*MsgUnstakeGatewayResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UnstakeGateway 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) @@ -451,6 +567,24 @@ func _Msg_UnstakeGateway_Handler(srv interface{}, ctx context.Context, dec func( 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.gateway.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.gateway.Msg", HandlerType: (*MsgServer)(nil), @@ -467,6 +601,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "UnstakeGateway", Handler: _Msg_UnstakeGateway_Handler, }, + { + MethodName: "UpdateParam", + Handler: _Msg_UpdateParam_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "poktroll/gateway/tx.proto", @@ -653,6 +791,80 @@ func (m *MsgUnstakeGatewayResponse) MarshalToSizedBuffer(dAtA []byte) (int, erro 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 len(m.AsType) > 0 { + i -= len(m.AsType) + copy(dAtA[i:], m.AsType) + i = encodeVarintTx(dAtA, i, uint64(len(m.AsType))) + i-- + dAtA[i] = 0x1a + } + 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 *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 len(m.Params) > 0 { + i -= len(m.Params) + copy(dAtA[i:], m.Params) + i = encodeVarintTx(dAtA, i, uint64(len(m.Params))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -736,6 +948,40 @@ func (m *MsgUnstakeGatewayResponse) 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)) + } + l = len(m.AsType) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgUpdateParamResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Params) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1207,6 +1453,234 @@ func (m *MsgUnstakeGatewayResponse) 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 AsType", 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 = string(dAtA[iNdEx:postIndex]) + 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 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.Params = string(dAtA[iNdEx:postIndex]) + 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 From 91eecfc7c5057e5e8e54c1ff9438eab71fb495ab Mon Sep 17 00:00:00 2001 From: Bryan White Date: Mon, 9 Sep 2024 11:26:43 +0200 Subject: [PATCH 002/139] chore: update gateway MsgUpdateParam fields --- api/poktroll/gateway/tx.pulsar.go | 273 ++++++++++++++++++++---------- proto/poktroll/gateway/tx.proto | 10 +- x/gateway/types/tx.pb.go | 182 ++++++++++++++------ 3 files changed, 313 insertions(+), 152 deletions(-) diff --git a/api/poktroll/gateway/tx.pulsar.go b/api/poktroll/gateway/tx.pulsar.go index 2cd097506..178fbb097 100644 --- a/api/poktroll/gateway/tx.pulsar.go +++ b/api/poktroll/gateway/tx.pulsar.go @@ -2507,7 +2507,7 @@ var ( md_MsgUpdateParam protoreflect.MessageDescriptor fd_MsgUpdateParam_authority protoreflect.FieldDescriptor fd_MsgUpdateParam_name protoreflect.FieldDescriptor - fd_MsgUpdateParam_asType protoreflect.FieldDescriptor + fd_MsgUpdateParam_as_coin protoreflect.FieldDescriptor ) func init() { @@ -2515,7 +2515,7 @@ func init() { md_MsgUpdateParam = File_poktroll_gateway_tx_proto.Messages().ByName("MsgUpdateParam") fd_MsgUpdateParam_authority = md_MsgUpdateParam.Fields().ByName("authority") fd_MsgUpdateParam_name = md_MsgUpdateParam.Fields().ByName("name") - fd_MsgUpdateParam_asType = md_MsgUpdateParam.Fields().ByName("asType") + fd_MsgUpdateParam_as_coin = md_MsgUpdateParam.Fields().ByName("as_coin") } var _ protoreflect.Message = (*fastReflection_MsgUpdateParam)(nil) @@ -2595,10 +2595,14 @@ func (x *fastReflection_MsgUpdateParam) Range(f func(protoreflect.FieldDescripto return } } - if x.AsType != "" { - value := protoreflect.ValueOfString(x.AsType) - if !f(fd_MsgUpdateParam_asType, value) { - return + if x.AsType != nil { + switch o := x.AsType.(type) { + case *MsgUpdateParam_AsCoin: + v := o.AsCoin + value := protoreflect.ValueOfMessage(v.ProtoReflect()) + if !f(fd_MsgUpdateParam_as_coin, value) { + return + } } } } @@ -2620,8 +2624,14 @@ func (x *fastReflection_MsgUpdateParam) Has(fd protoreflect.FieldDescriptor) boo return x.Authority != "" case "poktroll.gateway.MsgUpdateParam.name": return x.Name != "" - case "poktroll.gateway.MsgUpdateParam.asType": - return x.AsType != "" + case "poktroll.gateway.MsgUpdateParam.as_coin": + if x.AsType == nil { + return false + } else if _, ok := x.AsType.(*MsgUpdateParam_AsCoin); ok { + return true + } else { + return false + } default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParam")) @@ -2642,8 +2652,8 @@ func (x *fastReflection_MsgUpdateParam) Clear(fd protoreflect.FieldDescriptor) { x.Authority = "" case "poktroll.gateway.MsgUpdateParam.name": x.Name = "" - case "poktroll.gateway.MsgUpdateParam.asType": - x.AsType = "" + case "poktroll.gateway.MsgUpdateParam.as_coin": + x.AsType = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParam")) @@ -2666,9 +2676,14 @@ func (x *fastReflection_MsgUpdateParam) Get(descriptor protoreflect.FieldDescrip case "poktroll.gateway.MsgUpdateParam.name": value := x.Name return protoreflect.ValueOfString(value) - case "poktroll.gateway.MsgUpdateParam.asType": - value := x.AsType - return protoreflect.ValueOfString(value) + case "poktroll.gateway.MsgUpdateParam.as_coin": + if x.AsType == nil { + return protoreflect.ValueOfMessage((*v1beta1.Coin)(nil).ProtoReflect()) + } else if v, ok := x.AsType.(*MsgUpdateParam_AsCoin); ok { + return protoreflect.ValueOfMessage(v.AsCoin.ProtoReflect()) + } else { + return protoreflect.ValueOfMessage((*v1beta1.Coin)(nil).ProtoReflect()) + } default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParam")) @@ -2693,8 +2708,9 @@ func (x *fastReflection_MsgUpdateParam) Set(fd protoreflect.FieldDescriptor, val x.Authority = value.Interface().(string) case "poktroll.gateway.MsgUpdateParam.name": x.Name = value.Interface().(string) - case "poktroll.gateway.MsgUpdateParam.asType": - x.AsType = value.Interface().(string) + case "poktroll.gateway.MsgUpdateParam.as_coin": + cv := value.Message().Interface().(*v1beta1.Coin) + x.AsType = &MsgUpdateParam_AsCoin{AsCoin: cv} default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParam")) @@ -2715,12 +2731,26 @@ func (x *fastReflection_MsgUpdateParam) Set(fd protoreflect.FieldDescriptor, val // 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.gateway.MsgUpdateParam.as_coin": + if x.AsType == nil { + value := &v1beta1.Coin{} + oneofValue := &MsgUpdateParam_AsCoin{AsCoin: value} + x.AsType = oneofValue + return protoreflect.ValueOfMessage(value.ProtoReflect()) + } + switch m := x.AsType.(type) { + case *MsgUpdateParam_AsCoin: + return protoreflect.ValueOfMessage(m.AsCoin.ProtoReflect()) + default: + value := &v1beta1.Coin{} + oneofValue := &MsgUpdateParam_AsCoin{AsCoin: value} + x.AsType = oneofValue + return protoreflect.ValueOfMessage(value.ProtoReflect()) + } case "poktroll.gateway.MsgUpdateParam.authority": panic(fmt.Errorf("field authority of message poktroll.gateway.MsgUpdateParam is not mutable")) case "poktroll.gateway.MsgUpdateParam.name": panic(fmt.Errorf("field name of message poktroll.gateway.MsgUpdateParam is not mutable")) - case "poktroll.gateway.MsgUpdateParam.asType": - panic(fmt.Errorf("field asType of message poktroll.gateway.MsgUpdateParam is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParam")) @@ -2738,8 +2768,9 @@ func (x *fastReflection_MsgUpdateParam) NewField(fd protoreflect.FieldDescriptor return protoreflect.ValueOfString("") case "poktroll.gateway.MsgUpdateParam.name": return protoreflect.ValueOfString("") - case "poktroll.gateway.MsgUpdateParam.asType": - return protoreflect.ValueOfString("") + case "poktroll.gateway.MsgUpdateParam.as_coin": + value := &v1beta1.Coin{} + return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParam")) @@ -2753,6 +2784,14 @@ func (x *fastReflection_MsgUpdateParam) NewField(fd protoreflect.FieldDescriptor // 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.gateway.MsgUpdateParam.as_type": + if x.AsType == nil { + return nil + } + switch x.AsType.(type) { + case *MsgUpdateParam_AsCoin: + return x.Descriptor().Fields().ByName("as_coin") + } default: panic(fmt.Errorf("%s is not a oneof field in poktroll.gateway.MsgUpdateParam", d.FullName())) } @@ -2817,8 +2856,12 @@ func (x *fastReflection_MsgUpdateParam) ProtoMethods() *protoiface.Methods { if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } - l = len(x.AsType) - if l > 0 { + switch x := x.AsType.(type) { + case *MsgUpdateParam_AsCoin: + if x == nil { + break + } + l = options.Size(x.AsCoin) n += 1 + l + runtime.Sov(uint64(l)) } if x.unknownFields != nil { @@ -2850,10 +2893,18 @@ func (x *fastReflection_MsgUpdateParam) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if len(x.AsType) > 0 { - i -= len(x.AsType) - copy(dAtA[i:], x.AsType) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.AsType))) + switch x := x.AsType.(type) { + case *MsgUpdateParam_AsCoin: + encoded, err := options.Marshal(x.AsCoin) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) i-- dAtA[i] = 0x1a } @@ -2986,9 +3037,9 @@ func (x *fastReflection_MsgUpdateParam) ProtoMethods() *protoiface.Methods { iNdEx = postIndex case 3: if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AsType", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AsCoin", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -2998,23 +3049,26 @@ func (x *fastReflection_MsgUpdateParam) ProtoMethods() *protoiface.Methods { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.AsType = string(dAtA[iNdEx:postIndex]) + v := &v1beta1.Coin{} + if err := options.Unmarshal(dAtA[iNdEx:postIndex], v); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + x.AsType = &MsgUpdateParam_AsCoin{v} iNdEx = postIndex default: iNdEx = preIndex @@ -3689,14 +3743,19 @@ func (*MsgUnstakeGatewayResponse) Descriptor() ([]byte, []int) { return file_poktroll_gateway_tx_proto_rawDescGZIP(), []int{5} } +// 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"` - AsType string `protobuf:"bytes,3,opt,name=asType,proto3" json:"asType,omitempty"` + // Types that are assignable to AsType: + // + // *MsgUpdateParam_AsCoin + AsType isMsgUpdateParam_AsType `protobuf_oneof:"as_type"` } func (x *MsgUpdateParam) Reset() { @@ -3733,13 +3792,30 @@ func (x *MsgUpdateParam) GetName() string { return "" } -func (x *MsgUpdateParam) GetAsType() string { +func (x *MsgUpdateParam) GetAsType() isMsgUpdateParam_AsType { if x != nil { return x.AsType } - return "" + return nil +} + +func (x *MsgUpdateParam) GetAsCoin() *v1beta1.Coin { + if x, ok := x.GetAsType().(*MsgUpdateParam_AsCoin); ok { + return x.AsCoin + } + return nil +} + +type isMsgUpdateParam_AsType interface { + isMsgUpdateParam_AsType() } +type MsgUpdateParam_AsCoin struct { + AsCoin *v1beta1.Coin `protobuf:"bytes,3,opt,name=as_coin,json=asCoin,proto3,oneof"` +} + +func (*MsgUpdateParam_AsCoin) isMsgUpdateParam_AsType() {} + type MsgUpdateParamResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -3821,53 +3897,58 @@ var file_poktroll_gateway_tx_proto_rawDesc = []byte{ 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x3a, 0x0c, 0x82, 0xe7, 0xb0, 0x2a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x1b, 0x0a, 0x19, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, - 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x6a, 0x0a, 0x0e, 0x4d, 0x73, - 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x1c, 0x0a, 0x09, - 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 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, 0x16, - 0x0a, 0x06, 0x61, 0x73, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, - 0x61, 0x73, 0x54, 0x79, 0x70, 0x65, 0x3a, 0x0e, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, - 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x22, 0x30, 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, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x32, 0x87, 0x03, 0x0a, 0x03, 0x4d, 0x73, 0x67, - 0x12, 0x5c, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, - 0x12, 0x21, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, - 0x77, 0x61, 0x79, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x1a, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, - 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 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, 0x5c, - 0x0a, 0x0c, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x21, - 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, - 0x79, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, - 0x79, 0x1a, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, - 0x65, 0x77, 0x61, 0x79, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, - 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x62, 0x0a, 0x0e, - 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x23, - 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, - 0x79, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, - 0x77, 0x61, 0x79, 0x1a, 0x2b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, - 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, - 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x59, 0x0a, 0x0b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, - 0x20, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, - 0x61, 0x79, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x1a, 0x28, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, + 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xba, 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, 0x41, 0x0a, 0x07, 0x61, 0x73, 0x5f, + 0x63, 0x6f, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x0b, 0xea, 0xde, 0x1f, 0x07, 0x61, 0x73, 0x5f, 0x63, 0x6f, + 0x69, 0x6e, 0x48, 0x00, 0x52, 0x06, 0x61, 0x73, 0x43, 0x6f, 0x69, 0x6e, 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, 0x30, 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, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x32, 0x87, 0x03, 0x0a, 0x03, 0x4d, 0x73, + 0x67, 0x12, 0x5c, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x12, 0x21, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 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, 0xa7, 0x01, 0xd8, 0xe2, 0x1e, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x70, - 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, - 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x21, 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, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0xa2, 0x02, 0x03, - 0x50, 0x47, 0x58, 0xaa, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x47, - 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0xca, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x5c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0xe2, 0x02, 0x1c, 0x50, 0x6f, 0x6b, 0x74, - 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x5c, 0x47, 0x50, 0x42, - 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, + 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 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, + 0x5c, 0x0a, 0x0c, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, + 0x21, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, + 0x61, 0x79, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, + 0x61, 0x79, 0x1a, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, + 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, + 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x62, 0x0a, + 0x0e, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, + 0x23, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, + 0x61, 0x79, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, + 0x65, 0x77, 0x61, 0x79, 0x1a, 0x2b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, + 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, + 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x59, 0x0a, 0x0b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x12, 0x20, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, + 0x77, 0x61, 0x79, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, + 0x61, 0x6d, 0x1a, 0x28, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, + 0x74, 0x65, 0x77, 0x61, 0x79, 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, 0xa7, 0x01, 0xd8, 0xe2, 0x1e, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, + 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x21, 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, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0xa2, 0x02, + 0x03, 0x50, 0x47, 0x58, 0xaa, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, + 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0xca, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x5c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0xe2, 0x02, 0x1c, 0x50, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x5c, 0x47, 0x50, + 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -3898,19 +3979,20 @@ var file_poktroll_gateway_tx_proto_goTypes = []interface{}{ var file_poktroll_gateway_tx_proto_depIdxs = []int32{ 8, // 0: poktroll.gateway.MsgUpdateParams.params:type_name -> poktroll.gateway.Params 9, // 1: poktroll.gateway.MsgStakeGateway.stake:type_name -> cosmos.base.v1beta1.Coin - 0, // 2: poktroll.gateway.Msg.UpdateParams:input_type -> poktroll.gateway.MsgUpdateParams - 2, // 3: poktroll.gateway.Msg.StakeGateway:input_type -> poktroll.gateway.MsgStakeGateway - 4, // 4: poktroll.gateway.Msg.UnstakeGateway:input_type -> poktroll.gateway.MsgUnstakeGateway - 6, // 5: poktroll.gateway.Msg.UpdateParam:input_type -> poktroll.gateway.MsgUpdateParam - 1, // 6: poktroll.gateway.Msg.UpdateParams:output_type -> poktroll.gateway.MsgUpdateParamsResponse - 3, // 7: poktroll.gateway.Msg.StakeGateway:output_type -> poktroll.gateway.MsgStakeGatewayResponse - 5, // 8: poktroll.gateway.Msg.UnstakeGateway:output_type -> poktroll.gateway.MsgUnstakeGatewayResponse - 7, // 9: poktroll.gateway.Msg.UpdateParam:output_type -> poktroll.gateway.MsgUpdateParamResponse - 6, // [6:10] is the sub-list for method output_type - 2, // [2:6] 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 + 9, // 2: poktroll.gateway.MsgUpdateParam.as_coin:type_name -> cosmos.base.v1beta1.Coin + 0, // 3: poktroll.gateway.Msg.UpdateParams:input_type -> poktroll.gateway.MsgUpdateParams + 2, // 4: poktroll.gateway.Msg.StakeGateway:input_type -> poktroll.gateway.MsgStakeGateway + 4, // 5: poktroll.gateway.Msg.UnstakeGateway:input_type -> poktroll.gateway.MsgUnstakeGateway + 6, // 6: poktroll.gateway.Msg.UpdateParam:input_type -> poktroll.gateway.MsgUpdateParam + 1, // 7: poktroll.gateway.Msg.UpdateParams:output_type -> poktroll.gateway.MsgUpdateParamsResponse + 3, // 8: poktroll.gateway.Msg.StakeGateway:output_type -> poktroll.gateway.MsgStakeGatewayResponse + 5, // 9: poktroll.gateway.Msg.UnstakeGateway:output_type -> poktroll.gateway.MsgUnstakeGatewayResponse + 7, // 10: poktroll.gateway.Msg.UpdateParam:output_type -> poktroll.gateway.MsgUpdateParamResponse + 7, // [7:11] is the sub-list for method output_type + 3, // [3:7] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name } func init() { file_poktroll_gateway_tx_proto_init() } @@ -4017,6 +4099,9 @@ func file_poktroll_gateway_tx_proto_init() { } } } + file_poktroll_gateway_tx_proto_msgTypes[6].OneofWrappers = []interface{}{ + (*MsgUpdateParam_AsCoin)(nil), + } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/proto/poktroll/gateway/tx.proto b/proto/poktroll/gateway/tx.proto index 171028cb1..9285ad61c 100644 --- a/proto/poktroll/gateway/tx.proto +++ b/proto/poktroll/gateway/tx.proto @@ -59,11 +59,17 @@ message MsgUnstakeGateway { message MsgUnstakeGatewayResponse {} +// MsgUpdateParam is the Msg/UpdateParam request type to update a single param. message MsgUpdateParam { option (cosmos.msg.v1.signer) = "authority"; - string authority = 1; + + // 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; - string asType = 3; + oneof as_type { + cosmos.base.v1beta1.Coin as_coin = 3 [(gogoproto.jsontag) = "as_coin"]; + } } message MsgUpdateParamResponse { diff --git a/x/gateway/types/tx.pb.go b/x/gateway/types/tx.pb.go index 89edda5d6..5d1ed3f5f 100644 --- a/x/gateway/types/tx.pb.go +++ b/x/gateway/types/tx.pb.go @@ -270,10 +270,15 @@ func (m *MsgUnstakeGatewayResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUnstakeGatewayResponse 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"` - AsType string `protobuf:"bytes,3,opt,name=asType,proto3" json:"asType,omitempty"` + // Types that are valid to be assigned to AsType: + // + // *MsgUpdateParam_AsCoin + AsType isMsgUpdateParam_AsType `protobuf_oneof:"as_type"` } func (m *MsgUpdateParam) Reset() { *m = MsgUpdateParam{} } @@ -305,6 +310,25 @@ func (m *MsgUpdateParam) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateParam proto.InternalMessageInfo +type isMsgUpdateParam_AsType interface { + isMsgUpdateParam_AsType() + MarshalTo([]byte) (int, error) + Size() int +} + +type MsgUpdateParam_AsCoin struct { + AsCoin *types.Coin `protobuf:"bytes,3,opt,name=as_coin,json=asCoin,proto3,oneof" json:"as_coin"` +} + +func (*MsgUpdateParam_AsCoin) 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 @@ -319,11 +343,18 @@ func (m *MsgUpdateParam) GetName() string { return "" } -func (m *MsgUpdateParam) GetAsType() string { - if m != nil { - return m.AsType +func (m *MsgUpdateParam) GetAsCoin() *types.Coin { + if x, ok := m.GetAsType().(*MsgUpdateParam_AsCoin); ok { + return x.AsCoin + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*MsgUpdateParam) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*MsgUpdateParam_AsCoin)(nil), } - return "" } type MsgUpdateParamResponse struct { @@ -380,42 +411,44 @@ func init() { func init() { proto.RegisterFile("poktroll/gateway/tx.proto", fileDescriptor_7ad4b0c5e3b59f23) } var fileDescriptor_7ad4b0c5e3b59f23 = []byte{ - // 559 bytes of a gzipped FileDescriptorProto + // 579 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0xbf, 0x6f, 0xd3, 0x40, - 0x14, 0x8e, 0x09, 0x0d, 0xca, 0x35, 0x0a, 0xf4, 0x54, 0xb5, 0xb1, 0x01, 0x13, 0xcc, 0x12, 0x82, - 0xea, 0x6b, 0x82, 0x60, 0x08, 0x13, 0x61, 0x60, 0x2a, 0x42, 0x2e, 0x1d, 0x40, 0x95, 0xd0, 0x39, - 0x39, 0xb9, 0x26, 0xb5, 0xcf, 0xf2, 0x5d, 0x7f, 0x64, 0x43, 0x08, 0x09, 0x89, 0x89, 0x3f, 0x83, - 0x31, 0x03, 0x2b, 0x7b, 0xc7, 0x8a, 0xa9, 0x13, 0x42, 0xc9, 0x90, 0x7f, 0x03, 0xd9, 0x77, 0x76, - 0x63, 0x27, 0x28, 0x48, 0x5d, 0x92, 0x7b, 0xef, 0x7d, 0xf7, 0xbd, 0xef, 0xfd, 0x38, 0x03, 0x35, - 0xa0, 0x03, 0x1e, 0xd2, 0xc3, 0x43, 0xe4, 0x60, 0x4e, 0x4e, 0xf0, 0x10, 0xf1, 0x53, 0x33, 0x08, - 0x29, 0xa7, 0xf0, 0x56, 0x12, 0x32, 0x65, 0x48, 0x5b, 0xc3, 0x9e, 0xeb, 0x53, 0x14, 0xff, 0x0a, - 0x90, 0xb6, 0xd9, 0xa3, 0xcc, 0xa3, 0x0c, 0x79, 0xcc, 0x41, 0xc7, 0xad, 0xe8, 0x4f, 0x06, 0x54, - 0x11, 0x78, 0x1f, 0x5b, 0x48, 0x18, 0x32, 0xb4, 0xee, 0x50, 0x87, 0x0a, 0x7f, 0x74, 0x92, 0x5e, - 0x5d, 0x32, 0xd9, 0x98, 0x11, 0x74, 0xdc, 0xb2, 0x09, 0xc7, 0x2d, 0xd4, 0xa3, 0xae, 0x2f, 0xe3, - 0x77, 0xe7, 0x94, 0x06, 0x38, 0xc4, 0x9e, 0x24, 0x35, 0x7e, 0x2a, 0xe0, 0xe6, 0x0e, 0x73, 0xf6, - 0x82, 0x3e, 0xe6, 0xe4, 0x75, 0x1c, 0x81, 0x4f, 0x41, 0x19, 0x1f, 0xf1, 0x03, 0x1a, 0xba, 0x7c, - 0x58, 0x53, 0xea, 0x4a, 0xa3, 0xdc, 0xad, 0xfd, 0xfa, 0xb1, 0xb5, 0x2e, 0xd5, 0x3c, 0xef, 0xf7, - 0x43, 0xc2, 0xd8, 0x2e, 0x0f, 0x5d, 0xdf, 0xb1, 0x2e, 0xa1, 0xf0, 0x19, 0x28, 0x09, 0xee, 0xda, - 0xb5, 0xba, 0xd2, 0x58, 0x6d, 0xd7, 0xcc, 0x7c, 0x2b, 0x4c, 0x91, 0xa1, 0x5b, 0x3e, 0xfb, 0x7d, - 0xaf, 0xf0, 0x7d, 0x3a, 0x6a, 0x2a, 0x96, 0xbc, 0xd2, 0x79, 0xf2, 0x69, 0x3a, 0x6a, 0x5e, 0x92, - 0x7d, 0x9d, 0x8e, 0x9a, 0x46, 0x2a, 0xfd, 0x34, 0x15, 0x9f, 0xd3, 0x6a, 0xa8, 0x60, 0x33, 0xe7, - 0xb2, 0x08, 0x0b, 0xa8, 0xcf, 0x88, 0xf1, 0x59, 0x94, 0xb6, 0xcb, 0xf1, 0x80, 0xbc, 0x14, 0xd7, - 0x61, 0x1b, 0xdc, 0xc0, 0x42, 0xfe, 0xd2, 0xc2, 0x12, 0x20, 0x44, 0x60, 0x85, 0x45, 0x1c, 0xb2, - 0x2a, 0xd5, 0x94, 0xf0, 0xa8, 0xe3, 0xa6, 0xec, 0xb8, 0xf9, 0x82, 0xba, 0xbe, 0x25, 0x70, 0x9d, - 0x4a, 0x54, 0x4a, 0x72, 0x5d, 0x2a, 0x9c, 0x55, 0x91, 0x2a, 0xdc, 0x03, 0x6b, 0x91, 0x78, 0x9f, - 0x5d, 0x51, 0x62, 0x2e, 0xe3, 0x6d, 0xa0, 0xce, 0xd1, 0xa6, 0x39, 0x3f, 0x80, 0x6a, 0xb6, 0x61, - 0xf0, 0xce, 0xdc, 0xb8, 0x67, 0x87, 0x0a, 0xc1, 0x75, 0x1f, 0x7b, 0xa2, 0xf8, 0xb2, 0x15, 0x9f, - 0xe1, 0x06, 0x28, 0x61, 0xf6, 0x66, 0x18, 0x90, 0x5a, 0x31, 0xf6, 0x4a, 0xab, 0x53, 0xcd, 0xce, - 0xd0, 0xd8, 0x06, 0x1b, 0xd9, 0x5c, 0x89, 0x8a, 0x88, 0x41, 0xae, 0x8a, 0x48, 0x28, 0xad, 0xf6, - 0x97, 0x22, 0x28, 0xee, 0x30, 0x07, 0xee, 0x83, 0x4a, 0x66, 0x25, 0xef, 0xcf, 0xaf, 0x52, 0x6e, - 0xec, 0xda, 0xc3, 0xa5, 0x90, 0x34, 0xfb, 0x3e, 0xa8, 0x64, 0xb6, 0x62, 0x31, 0xfb, 0x2c, 0xe4, - 0x1f, 0xec, 0x8b, 0xa6, 0x0a, 0x6d, 0x50, 0xcd, 0x8d, 0xf4, 0xc1, 0x62, 0x69, 0x19, 0x90, 0xf6, - 0xe8, 0x3f, 0x40, 0x69, 0x8e, 0xb7, 0x60, 0x75, 0x76, 0x84, 0xf5, 0x65, 0xb5, 0x6b, 0x8d, 0x65, - 0x88, 0x84, 0x5a, 0x5b, 0xf9, 0x18, 0xbd, 0xcb, 0xee, 0xab, 0xb3, 0xb1, 0xae, 0x9c, 0x8f, 0x75, - 0xe5, 0x62, 0xac, 0x2b, 0x7f, 0xc6, 0xba, 0xf2, 0x6d, 0xa2, 0x17, 0xce, 0x27, 0x7a, 0xe1, 0x62, - 0xa2, 0x17, 0xde, 0x6d, 0x3b, 0x2e, 0x3f, 0x38, 0xb2, 0xcd, 0x1e, 0xf5, 0x50, 0x44, 0xbc, 0xe5, - 0x13, 0x7e, 0x42, 0xc3, 0x01, 0x5a, 0xf0, 0x64, 0xf9, 0x30, 0x20, 0xcc, 0x2e, 0xc5, 0xdf, 0x9b, - 0xc7, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xe4, 0xd8, 0x4b, 0xf5, 0x3a, 0x05, 0x00, 0x00, + 0x14, 0x8e, 0x09, 0x4d, 0x95, 0x4b, 0x14, 0xa8, 0x55, 0xb5, 0x89, 0x11, 0x6e, 0x08, 0x4b, 0x08, + 0xaa, 0xaf, 0x09, 0x82, 0x21, 0x4c, 0x0d, 0x03, 0x2c, 0x45, 0xc8, 0x55, 0x07, 0x50, 0xa5, 0xea, + 0x92, 0x9c, 0x5c, 0x2b, 0xb5, 0xcf, 0xf2, 0x5d, 0x7f, 0x64, 0x43, 0x08, 0x09, 0x89, 0x89, 0x3f, + 0x83, 0x31, 0x03, 0x13, 0x12, 0x7b, 0xc7, 0x8a, 0xa9, 0x53, 0x85, 0x92, 0x21, 0x12, 0x7f, 0x05, + 0x3a, 0xdf, 0xd9, 0x8d, 0x9d, 0x20, 0x23, 0xba, 0xd8, 0x77, 0xef, 0x7d, 0xf7, 0xbd, 0xef, 0x3d, + 0x7f, 0x3e, 0x50, 0xf1, 0xc8, 0x80, 0xf9, 0xe4, 0xe8, 0x08, 0x5a, 0x88, 0xe1, 0x53, 0x34, 0x84, + 0xec, 0xcc, 0xf0, 0x7c, 0xc2, 0x88, 0x7a, 0x37, 0x4c, 0x19, 0x32, 0xa5, 0xad, 0x20, 0xc7, 0x76, + 0x09, 0x0c, 0x9e, 0x02, 0xa4, 0xad, 0xf7, 0x08, 0x75, 0x08, 0x85, 0x0e, 0xb5, 0xe0, 0x49, 0x93, + 0xbf, 0x64, 0xa2, 0x22, 0x12, 0x07, 0xc1, 0x0e, 0x8a, 0x8d, 0x4c, 0xad, 0x5a, 0xc4, 0x22, 0x22, + 0xce, 0x57, 0x32, 0xaa, 0x4b, 0xa6, 0x2e, 0xa2, 0x18, 0x9e, 0x34, 0xbb, 0x98, 0xa1, 0x26, 0xec, + 0x11, 0xdb, 0x95, 0xf9, 0xfb, 0x73, 0x4a, 0x3d, 0xe4, 0x23, 0x47, 0x92, 0xd6, 0x7e, 0x28, 0xe0, + 0xce, 0x0e, 0xb5, 0xf6, 0xbc, 0x3e, 0x62, 0xf8, 0x4d, 0x90, 0x51, 0x9f, 0x81, 0x3c, 0x3a, 0x66, + 0x87, 0xc4, 0xb7, 0xd9, 0xb0, 0xac, 0x54, 0x95, 0x7a, 0xbe, 0x53, 0xfe, 0xf9, 0x6d, 0x73, 0x55, + 0xaa, 0xd9, 0xee, 0xf7, 0x7d, 0x4c, 0xe9, 0x2e, 0xf3, 0x6d, 0xd7, 0x32, 0xaf, 0xa1, 0xea, 0x73, + 0x90, 0x13, 0xdc, 0xe5, 0x5b, 0x55, 0xa5, 0x5e, 0x68, 0x95, 0x8d, 0xe4, 0x28, 0x0c, 0x51, 0xa1, + 0x93, 0x3f, 0xbf, 0xda, 0xc8, 0x7c, 0x9d, 0x8e, 0x1a, 0x8a, 0x29, 0x8f, 0xb4, 0x9f, 0x7e, 0x98, + 0x8e, 0x1a, 0xd7, 0x64, 0x9f, 0xa7, 0xa3, 0x46, 0x2d, 0x92, 0x7e, 0x16, 0x89, 0x4f, 0x68, 0xad, + 0x55, 0xc0, 0x7a, 0x22, 0x64, 0x62, 0xea, 0x11, 0x97, 0xe2, 0xda, 0x47, 0xd1, 0xda, 0x2e, 0x43, + 0x03, 0xfc, 0x52, 0x1c, 0x57, 0x5b, 0x60, 0x19, 0x09, 0xf9, 0xa9, 0x8d, 0x85, 0x40, 0x15, 0x82, + 0x25, 0xca, 0x39, 0x64, 0x57, 0x15, 0x43, 0xc2, 0xf9, 0xc4, 0x0d, 0x39, 0x71, 0xe3, 0x05, 0xb1, + 0x5d, 0x53, 0xe0, 0xda, 0x45, 0xde, 0x4a, 0x78, 0x5c, 0x2a, 0x9c, 0x55, 0x11, 0x29, 0xdc, 0x03, + 0x2b, 0x5c, 0xbc, 0x4b, 0x6f, 0x28, 0x31, 0x51, 0xf1, 0x1e, 0xa8, 0xcc, 0xd1, 0x46, 0x35, 0xbf, + 0x2b, 0xa0, 0x14, 0x9f, 0xd8, 0x7f, 0x7f, 0x6f, 0x15, 0xdc, 0x76, 0x91, 0x23, 0xe6, 0x92, 0x37, + 0x83, 0xb5, 0xba, 0x0d, 0x96, 0x11, 0x3d, 0xe0, 0xfe, 0x2b, 0x67, 0x53, 0xc6, 0xd5, 0x29, 0xfc, + 0xbe, 0xda, 0x08, 0xd1, 0xaf, 0x32, 0x66, 0x0e, 0x51, 0x1e, 0x6e, 0x97, 0xe2, 0x4e, 0xe8, 0xe4, + 0x03, 0x4a, 0x36, 0xf4, 0x70, 0x6d, 0x0b, 0xac, 0xc5, 0xb5, 0x87, 0x6d, 0xa9, 0x6b, 0x91, 0xf7, + 0x82, 0x06, 0x42, 0x5b, 0xb5, 0x3e, 0x65, 0x41, 0x76, 0x87, 0x5a, 0xea, 0x3e, 0x28, 0xc6, 0x3c, + 0xfe, 0x60, 0xde, 0x9b, 0x09, 0x1f, 0x69, 0x8f, 0x52, 0x21, 0x51, 0xf5, 0x7d, 0x50, 0x8c, 0xd9, + 0x6c, 0x31, 0xfb, 0x2c, 0xe4, 0x2f, 0xec, 0x8b, 0x6c, 0xa2, 0x76, 0x41, 0x29, 0xe1, 0x91, 0x87, + 0x8b, 0xa5, 0xc5, 0x40, 0xda, 0xe3, 0x7f, 0x00, 0x45, 0x35, 0xde, 0x82, 0xc2, 0xac, 0x25, 0xaa, + 0x69, 0xbd, 0x6b, 0xf5, 0x34, 0x44, 0x48, 0xad, 0x2d, 0xbd, 0xe7, 0x3f, 0x7a, 0xe7, 0xf5, 0xf9, + 0x58, 0x57, 0x2e, 0xc6, 0xba, 0x72, 0x39, 0xd6, 0x95, 0x5f, 0x63, 0x5d, 0xf9, 0x32, 0xd1, 0x33, + 0x17, 0x13, 0x3d, 0x73, 0x39, 0xd1, 0x33, 0xef, 0xb6, 0x2c, 0x9b, 0x1d, 0x1e, 0x77, 0x8d, 0x1e, + 0x71, 0x20, 0x27, 0xde, 0x74, 0x31, 0x3b, 0x25, 0xfe, 0x00, 0x2e, 0xb8, 0x03, 0xb8, 0x15, 0x68, + 0x37, 0x17, 0x5c, 0x60, 0x4f, 0xfe, 0x04, 0x00, 0x00, 0xff, 0xff, 0xe2, 0xe8, 0x50, 0xa3, 0x8b, + 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -811,12 +844,14 @@ func (m *MsgUpdateParam) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.AsType) > 0 { - i -= len(m.AsType) - copy(dAtA[i:], m.AsType) - i = encodeVarintTx(dAtA, i, uint64(len(m.AsType))) - i-- - dAtA[i] = 0x1a + 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) @@ -835,6 +870,27 @@ func (m *MsgUpdateParam) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *MsgUpdateParam_AsCoin) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParam_AsCoin) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.AsCoin != nil { + { + size, err := m.AsCoin.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + return len(dAtA) - i, nil +} func (m *MsgUpdateParamResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -962,13 +1018,24 @@ func (m *MsgUpdateParam) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.AsType) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) + if m.AsType != nil { + n += m.AsType.Size() } return n } +func (m *MsgUpdateParam_AsCoin) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.AsCoin != nil { + l = m.AsCoin.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n +} func (m *MsgUpdateParamResponse) Size() (n int) { if m == nil { return 0 @@ -1548,9 +1615,9 @@ func (m *MsgUpdateParam) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AsType", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field AsCoin", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1560,23 +1627,26 @@ func (m *MsgUpdateParam) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.AsType = string(dAtA[iNdEx:postIndex]) + v := &types.Coin{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.AsType = &MsgUpdateParam_AsCoin{v} iNdEx = postIndex default: iNdEx = preIndex From ef62280882274dfa3288b515fe2598b9e6a070ac Mon Sep 17 00:00:00 2001 From: Bryan White Date: Mon, 23 Sep 2024 21:30:25 +0200 Subject: [PATCH 003/139] chore: update MsgUpdateParamResponse fields --- api/poktroll/gateway/tx.pulsar.go | 167 ++++++++++++++++-------------- proto/poktroll/gateway/tx.proto | 2 +- x/gateway/types/tx.pb.go | 115 ++++++++++---------- 3 files changed, 155 insertions(+), 129 deletions(-) diff --git a/api/poktroll/gateway/tx.pulsar.go b/api/poktroll/gateway/tx.pulsar.go index 178fbb097..046dba6a6 100644 --- a/api/poktroll/gateway/tx.pulsar.go +++ b/api/poktroll/gateway/tx.pulsar.go @@ -3181,8 +3181,8 @@ func (x *fastReflection_MsgUpdateParamResponse) Interface() protoreflect.ProtoMe // 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 != "" { - value := protoreflect.ValueOfString(x.Params) + if x.Params != nil { + value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) if !f(fd_MsgUpdateParamResponse_params, value) { return } @@ -3203,7 +3203,7 @@ func (x *fastReflection_MsgUpdateParamResponse) Range(f func(protoreflect.FieldD func (x *fastReflection_MsgUpdateParamResponse) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { case "poktroll.gateway.MsgUpdateParamResponse.params": - return x.Params != "" + return x.Params != nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParamResponse")) @@ -3221,7 +3221,7 @@ func (x *fastReflection_MsgUpdateParamResponse) Has(fd protoreflect.FieldDescrip func (x *fastReflection_MsgUpdateParamResponse) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { case "poktroll.gateway.MsgUpdateParamResponse.params": - x.Params = "" + x.Params = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParamResponse")) @@ -3240,7 +3240,7 @@ func (x *fastReflection_MsgUpdateParamResponse) Get(descriptor protoreflect.Fiel switch descriptor.FullName() { case "poktroll.gateway.MsgUpdateParamResponse.params": value := x.Params - return protoreflect.ValueOfString(value) + return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParamResponse")) @@ -3262,7 +3262,7 @@ func (x *fastReflection_MsgUpdateParamResponse) Get(descriptor protoreflect.Fiel func (x *fastReflection_MsgUpdateParamResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { case "poktroll.gateway.MsgUpdateParamResponse.params": - x.Params = value.Interface().(string) + x.Params = value.Message().Interface().(*Params) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParamResponse")) @@ -3284,7 +3284,10 @@ func (x *fastReflection_MsgUpdateParamResponse) Set(fd protoreflect.FieldDescrip func (x *fastReflection_MsgUpdateParamResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { case "poktroll.gateway.MsgUpdateParamResponse.params": - panic(fmt.Errorf("field params of message poktroll.gateway.MsgUpdateParamResponse is not mutable")) + 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.gateway.MsgUpdateParamResponse")) @@ -3299,7 +3302,8 @@ func (x *fastReflection_MsgUpdateParamResponse) Mutable(fd protoreflect.FieldDes func (x *fastReflection_MsgUpdateParamResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { case "poktroll.gateway.MsgUpdateParamResponse.params": - return protoreflect.ValueOfString("") + m := new(Params) + return protoreflect.ValueOfMessage(m.ProtoReflect()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParamResponse")) @@ -3369,8 +3373,8 @@ func (x *fastReflection_MsgUpdateParamResponse) ProtoMethods() *protoiface.Metho var n int var l int _ = l - l = len(x.Params) - if l > 0 { + if x.Params != nil { + l = options.Size(x.Params) n += 1 + l + runtime.Sov(uint64(l)) } if x.unknownFields != nil { @@ -3402,10 +3406,17 @@ func (x *fastReflection_MsgUpdateParamResponse) ProtoMethods() *protoiface.Metho i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if len(x.Params) > 0 { - i -= len(x.Params) - copy(dAtA[i:], x.Params) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Params))) + 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 } @@ -3462,7 +3473,7 @@ func (x *fastReflection_MsgUpdateParamResponse) ProtoMethods() *protoiface.Metho if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -3472,23 +3483,27 @@ func (x *fastReflection_MsgUpdateParamResponse) ProtoMethods() *protoiface.Metho } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.Params = string(dAtA[iNdEx:postIndex]) + 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 @@ -3821,7 +3836,7 @@ type MsgUpdateParamResponse struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Params string `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` } func (x *MsgUpdateParamResponse) Reset() { @@ -3844,11 +3859,11 @@ func (*MsgUpdateParamResponse) Descriptor() ([]byte, []int) { return file_poktroll_gateway_tx_proto_rawDescGZIP(), []int{7} } -func (x *MsgUpdateParamResponse) GetParams() string { +func (x *MsgUpdateParamResponse) GetParams() *Params { if x != nil { return x.Params } - return "" + return nil } var File_poktroll_gateway_tx_proto protoreflect.FileDescriptor @@ -3909,46 +3924,47 @@ var file_poktroll_gateway_tx_proto_rawDesc = []byte{ 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x0b, 0xea, 0xde, 0x1f, 0x07, 0x61, 0x73, 0x5f, 0x63, 0x6f, 0x69, 0x6e, 0x48, 0x00, 0x52, 0x06, 0x61, 0x73, 0x43, 0x6f, 0x69, 0x6e, 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, 0x30, 0x0a, 0x16, 0x4d, 0x73, 0x67, 0x55, 0x70, + 0x61, 0x73, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x22, 0x4a, 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, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x32, 0x87, 0x03, 0x0a, 0x03, 0x4d, 0x73, - 0x67, 0x12, 0x5c, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x73, 0x12, 0x21, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, - 0x65, 0x77, 0x61, 0x79, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, - 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, - 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 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, - 0x5c, 0x0a, 0x0c, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, - 0x21, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, - 0x61, 0x79, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, - 0x61, 0x79, 0x1a, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, - 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, - 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x62, 0x0a, - 0x0e, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, - 0x23, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, - 0x61, 0x79, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, - 0x65, 0x77, 0x61, 0x79, 0x1a, 0x2b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, - 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, - 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x59, 0x0a, 0x0b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x12, 0x20, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, - 0x77, 0x61, 0x79, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, - 0x61, 0x6d, 0x1a, 0x28, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, - 0x74, 0x65, 0x77, 0x61, 0x79, 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, 0xa7, 0x01, 0xd8, 0xe2, 0x1e, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, - 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, - 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x21, 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, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0xa2, 0x02, - 0x03, 0x50, 0x47, 0x58, 0xaa, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, - 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0xca, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, - 0x6c, 0x6c, 0x5c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0xe2, 0x02, 0x1c, 0x50, 0x6f, 0x6b, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x5c, 0x47, 0x50, - 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, - 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x12, 0x30, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, + 0x65, 0x77, 0x61, 0x79, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x06, 0x70, 0x61, 0x72, + 0x61, 0x6d, 0x73, 0x32, 0x87, 0x03, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x5c, 0x0a, 0x0c, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x21, 0x2e, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x4d, + 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x29, + 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, + 0x79, 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, 0x5c, 0x0a, 0x0c, 0x53, 0x74, 0x61, + 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x21, 0x2e, 0x70, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x4d, 0x73, 0x67, + 0x53, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x1a, 0x29, 0x2e, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, + 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x62, 0x0a, 0x0e, 0x55, 0x6e, 0x73, 0x74, 0x61, + 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x23, 0x2e, 0x70, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x4d, 0x73, 0x67, + 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x1a, 0x2b, + 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, + 0x79, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, + 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x59, 0x0a, 0x0b, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x20, 0x2e, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x4d, 0x73, + 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x1a, 0x28, 0x2e, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 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, 0xa7, 0x01, + 0xd8, 0xe2, 0x1e, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x21, 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, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0xa2, 0x02, 0x03, 0x50, 0x47, 0x58, 0xaa, 0x02, + 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, + 0x79, 0xca, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x47, 0x61, 0x74, + 0x65, 0x77, 0x61, 0x79, 0xe2, 0x02, 0x1c, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, + 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0xea, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, + 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -3980,19 +3996,20 @@ var file_poktroll_gateway_tx_proto_depIdxs = []int32{ 8, // 0: poktroll.gateway.MsgUpdateParams.params:type_name -> poktroll.gateway.Params 9, // 1: poktroll.gateway.MsgStakeGateway.stake:type_name -> cosmos.base.v1beta1.Coin 9, // 2: poktroll.gateway.MsgUpdateParam.as_coin:type_name -> cosmos.base.v1beta1.Coin - 0, // 3: poktroll.gateway.Msg.UpdateParams:input_type -> poktroll.gateway.MsgUpdateParams - 2, // 4: poktroll.gateway.Msg.StakeGateway:input_type -> poktroll.gateway.MsgStakeGateway - 4, // 5: poktroll.gateway.Msg.UnstakeGateway:input_type -> poktroll.gateway.MsgUnstakeGateway - 6, // 6: poktroll.gateway.Msg.UpdateParam:input_type -> poktroll.gateway.MsgUpdateParam - 1, // 7: poktroll.gateway.Msg.UpdateParams:output_type -> poktroll.gateway.MsgUpdateParamsResponse - 3, // 8: poktroll.gateway.Msg.StakeGateway:output_type -> poktroll.gateway.MsgStakeGatewayResponse - 5, // 9: poktroll.gateway.Msg.UnstakeGateway:output_type -> poktroll.gateway.MsgUnstakeGatewayResponse - 7, // 10: poktroll.gateway.Msg.UpdateParam:output_type -> poktroll.gateway.MsgUpdateParamResponse - 7, // [7:11] is the sub-list for method output_type - 3, // [3:7] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name + 8, // 3: poktroll.gateway.MsgUpdateParamResponse.params:type_name -> poktroll.gateway.Params + 0, // 4: poktroll.gateway.Msg.UpdateParams:input_type -> poktroll.gateway.MsgUpdateParams + 2, // 5: poktroll.gateway.Msg.StakeGateway:input_type -> poktroll.gateway.MsgStakeGateway + 4, // 6: poktroll.gateway.Msg.UnstakeGateway:input_type -> poktroll.gateway.MsgUnstakeGateway + 6, // 7: poktroll.gateway.Msg.UpdateParam:input_type -> poktroll.gateway.MsgUpdateParam + 1, // 8: poktroll.gateway.Msg.UpdateParams:output_type -> poktroll.gateway.MsgUpdateParamsResponse + 3, // 9: poktroll.gateway.Msg.StakeGateway:output_type -> poktroll.gateway.MsgStakeGatewayResponse + 5, // 10: poktroll.gateway.Msg.UnstakeGateway:output_type -> poktroll.gateway.MsgUnstakeGatewayResponse + 7, // 11: poktroll.gateway.Msg.UpdateParam:output_type -> poktroll.gateway.MsgUpdateParamResponse + 8, // [8:12] is the sub-list for method output_type + 4, // [4:8] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name } func init() { file_poktroll_gateway_tx_proto_init() } diff --git a/proto/poktroll/gateway/tx.proto b/proto/poktroll/gateway/tx.proto index 9285ad61c..3b5458517 100644 --- a/proto/poktroll/gateway/tx.proto +++ b/proto/poktroll/gateway/tx.proto @@ -73,6 +73,6 @@ message MsgUpdateParam { } message MsgUpdateParamResponse { - string params = 1; + Params params = 1; } diff --git a/x/gateway/types/tx.pb.go b/x/gateway/types/tx.pb.go index 5d1ed3f5f..6db15bbbb 100644 --- a/x/gateway/types/tx.pb.go +++ b/x/gateway/types/tx.pb.go @@ -358,7 +358,7 @@ func (*MsgUpdateParam) XXX_OneofWrappers() []interface{} { } type MsgUpdateParamResponse struct { - Params string `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` } func (m *MsgUpdateParamResponse) Reset() { *m = MsgUpdateParamResponse{} } @@ -390,11 +390,11 @@ func (m *MsgUpdateParamResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateParamResponse proto.InternalMessageInfo -func (m *MsgUpdateParamResponse) GetParams() string { +func (m *MsgUpdateParamResponse) GetParams() *Params { if m != nil { return m.Params } - return "" + return nil } func init() { @@ -411,44 +411,44 @@ func init() { func init() { proto.RegisterFile("poktroll/gateway/tx.proto", fileDescriptor_7ad4b0c5e3b59f23) } var fileDescriptor_7ad4b0c5e3b59f23 = []byte{ - // 579 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0xbf, 0x6f, 0xd3, 0x40, - 0x14, 0x8e, 0x09, 0x4d, 0x95, 0x4b, 0x14, 0xa8, 0x55, 0xb5, 0x89, 0x11, 0x6e, 0x08, 0x4b, 0x08, - 0xaa, 0xaf, 0x09, 0x82, 0x21, 0x4c, 0x0d, 0x03, 0x2c, 0x45, 0xc8, 0x55, 0x07, 0x50, 0xa5, 0xea, - 0x92, 0x9c, 0x5c, 0x2b, 0xb5, 0xcf, 0xf2, 0x5d, 0x7f, 0x64, 0x43, 0x08, 0x09, 0x89, 0x89, 0x3f, - 0x83, 0x31, 0x03, 0x13, 0x12, 0x7b, 0xc7, 0x8a, 0xa9, 0x53, 0x85, 0x92, 0x21, 0x12, 0x7f, 0x05, - 0x3a, 0xdf, 0xd9, 0x8d, 0x9d, 0x20, 0x23, 0xba, 0xd8, 0x77, 0xef, 0x7d, 0xf7, 0xbd, 0xef, 0x3d, - 0x7f, 0x3e, 0x50, 0xf1, 0xc8, 0x80, 0xf9, 0xe4, 0xe8, 0x08, 0x5a, 0x88, 0xe1, 0x53, 0x34, 0x84, - 0xec, 0xcc, 0xf0, 0x7c, 0xc2, 0x88, 0x7a, 0x37, 0x4c, 0x19, 0x32, 0xa5, 0xad, 0x20, 0xc7, 0x76, - 0x09, 0x0c, 0x9e, 0x02, 0xa4, 0xad, 0xf7, 0x08, 0x75, 0x08, 0x85, 0x0e, 0xb5, 0xe0, 0x49, 0x93, - 0xbf, 0x64, 0xa2, 0x22, 0x12, 0x07, 0xc1, 0x0e, 0x8a, 0x8d, 0x4c, 0xad, 0x5a, 0xc4, 0x22, 0x22, - 0xce, 0x57, 0x32, 0xaa, 0x4b, 0xa6, 0x2e, 0xa2, 0x18, 0x9e, 0x34, 0xbb, 0x98, 0xa1, 0x26, 0xec, - 0x11, 0xdb, 0x95, 0xf9, 0xfb, 0x73, 0x4a, 0x3d, 0xe4, 0x23, 0x47, 0x92, 0xd6, 0x7e, 0x28, 0xe0, - 0xce, 0x0e, 0xb5, 0xf6, 0xbc, 0x3e, 0x62, 0xf8, 0x4d, 0x90, 0x51, 0x9f, 0x81, 0x3c, 0x3a, 0x66, - 0x87, 0xc4, 0xb7, 0xd9, 0xb0, 0xac, 0x54, 0x95, 0x7a, 0xbe, 0x53, 0xfe, 0xf9, 0x6d, 0x73, 0x55, - 0xaa, 0xd9, 0xee, 0xf7, 0x7d, 0x4c, 0xe9, 0x2e, 0xf3, 0x6d, 0xd7, 0x32, 0xaf, 0xa1, 0xea, 0x73, - 0x90, 0x13, 0xdc, 0xe5, 0x5b, 0x55, 0xa5, 0x5e, 0x68, 0x95, 0x8d, 0xe4, 0x28, 0x0c, 0x51, 0xa1, - 0x93, 0x3f, 0xbf, 0xda, 0xc8, 0x7c, 0x9d, 0x8e, 0x1a, 0x8a, 0x29, 0x8f, 0xb4, 0x9f, 0x7e, 0x98, - 0x8e, 0x1a, 0xd7, 0x64, 0x9f, 0xa7, 0xa3, 0x46, 0x2d, 0x92, 0x7e, 0x16, 0x89, 0x4f, 0x68, 0xad, - 0x55, 0xc0, 0x7a, 0x22, 0x64, 0x62, 0xea, 0x11, 0x97, 0xe2, 0xda, 0x47, 0xd1, 0xda, 0x2e, 0x43, - 0x03, 0xfc, 0x52, 0x1c, 0x57, 0x5b, 0x60, 0x19, 0x09, 0xf9, 0xa9, 0x8d, 0x85, 0x40, 0x15, 0x82, - 0x25, 0xca, 0x39, 0x64, 0x57, 0x15, 0x43, 0xc2, 0xf9, 0xc4, 0x0d, 0x39, 0x71, 0xe3, 0x05, 0xb1, - 0x5d, 0x53, 0xe0, 0xda, 0x45, 0xde, 0x4a, 0x78, 0x5c, 0x2a, 0x9c, 0x55, 0x11, 0x29, 0xdc, 0x03, - 0x2b, 0x5c, 0xbc, 0x4b, 0x6f, 0x28, 0x31, 0x51, 0xf1, 0x1e, 0xa8, 0xcc, 0xd1, 0x46, 0x35, 0xbf, - 0x2b, 0xa0, 0x14, 0x9f, 0xd8, 0x7f, 0x7f, 0x6f, 0x15, 0xdc, 0x76, 0x91, 0x23, 0xe6, 0x92, 0x37, - 0x83, 0xb5, 0xba, 0x0d, 0x96, 0x11, 0x3d, 0xe0, 0xfe, 0x2b, 0x67, 0x53, 0xc6, 0xd5, 0x29, 0xfc, - 0xbe, 0xda, 0x08, 0xd1, 0xaf, 0x32, 0x66, 0x0e, 0x51, 0x1e, 0x6e, 0x97, 0xe2, 0x4e, 0xe8, 0xe4, - 0x03, 0x4a, 0x36, 0xf4, 0x70, 0x6d, 0x0b, 0xac, 0xc5, 0xb5, 0x87, 0x6d, 0xa9, 0x6b, 0x91, 0xf7, - 0x82, 0x06, 0x42, 0x5b, 0xb5, 0x3e, 0x65, 0x41, 0x76, 0x87, 0x5a, 0xea, 0x3e, 0x28, 0xc6, 0x3c, - 0xfe, 0x60, 0xde, 0x9b, 0x09, 0x1f, 0x69, 0x8f, 0x52, 0x21, 0x51, 0xf5, 0x7d, 0x50, 0x8c, 0xd9, - 0x6c, 0x31, 0xfb, 0x2c, 0xe4, 0x2f, 0xec, 0x8b, 0x6c, 0xa2, 0x76, 0x41, 0x29, 0xe1, 0x91, 0x87, - 0x8b, 0xa5, 0xc5, 0x40, 0xda, 0xe3, 0x7f, 0x00, 0x45, 0x35, 0xde, 0x82, 0xc2, 0xac, 0x25, 0xaa, - 0x69, 0xbd, 0x6b, 0xf5, 0x34, 0x44, 0x48, 0xad, 0x2d, 0xbd, 0xe7, 0x3f, 0x7a, 0xe7, 0xf5, 0xf9, - 0x58, 0x57, 0x2e, 0xc6, 0xba, 0x72, 0x39, 0xd6, 0x95, 0x5f, 0x63, 0x5d, 0xf9, 0x32, 0xd1, 0x33, - 0x17, 0x13, 0x3d, 0x73, 0x39, 0xd1, 0x33, 0xef, 0xb6, 0x2c, 0x9b, 0x1d, 0x1e, 0x77, 0x8d, 0x1e, - 0x71, 0x20, 0x27, 0xde, 0x74, 0x31, 0x3b, 0x25, 0xfe, 0x00, 0x2e, 0xb8, 0x03, 0xb8, 0x15, 0x68, - 0x37, 0x17, 0x5c, 0x60, 0x4f, 0xfe, 0x04, 0x00, 0x00, 0xff, 0xff, 0xe2, 0xe8, 0x50, 0xa3, 0x8b, - 0x05, 0x00, 0x00, + // 581 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0xcf, 0x6b, 0x13, 0x41, + 0x14, 0xce, 0x18, 0x9b, 0x92, 0x49, 0x88, 0x76, 0x29, 0x36, 0x59, 0x71, 0x1b, 0xe3, 0x25, 0x46, + 0xba, 0xd3, 0x44, 0xf4, 0x10, 0x4f, 0x8d, 0x07, 0x45, 0xa8, 0xc8, 0x96, 0x1e, 0x94, 0x42, 0x99, + 0x24, 0xcb, 0x76, 0x49, 0x77, 0x67, 0xd9, 0x99, 0xfe, 0xc8, 0x4d, 0x44, 0x10, 0x3c, 0xf9, 0x67, + 0x78, 0xcc, 0xc1, 0x93, 0xe0, 0xbd, 0xc7, 0xe2, 0xa9, 0xa7, 0x22, 0xc9, 0x21, 0xe0, 0x5f, 0x21, + 0xb3, 0x33, 0xbb, 0xcd, 0x6e, 0xa2, 0x2b, 0x7a, 0x49, 0x66, 0xde, 0xfb, 0xde, 0xf7, 0xbe, 0xf7, + 0xf6, 0x63, 0x60, 0xc5, 0x23, 0x03, 0xe6, 0x93, 0xc3, 0x43, 0x64, 0x61, 0x66, 0x9e, 0xe0, 0x21, + 0x62, 0xa7, 0xba, 0xe7, 0x13, 0x46, 0x94, 0x9b, 0x61, 0x4a, 0x97, 0x29, 0x75, 0x05, 0x3b, 0xb6, + 0x4b, 0x50, 0xf0, 0x2b, 0x40, 0xea, 0x5a, 0x8f, 0x50, 0x87, 0x50, 0xe4, 0x50, 0x0b, 0x1d, 0x37, + 0xf9, 0x9f, 0x4c, 0x54, 0x44, 0x62, 0x3f, 0xb8, 0x21, 0x71, 0x91, 0xa9, 0x55, 0x8b, 0x58, 0x44, + 0xc4, 0xf9, 0x49, 0x46, 0x35, 0xc9, 0xd4, 0xc5, 0xd4, 0x44, 0xc7, 0xcd, 0xae, 0xc9, 0x70, 0x13, + 0xf5, 0x88, 0xed, 0xca, 0xfc, 0x9d, 0x39, 0xa5, 0x1e, 0xf6, 0xb1, 0x23, 0x49, 0x6b, 0xdf, 0x00, + 0xbc, 0xb1, 0x4d, 0xad, 0x5d, 0xaf, 0x8f, 0x99, 0xf9, 0x2a, 0xc8, 0x28, 0x8f, 0x61, 0x1e, 0x1f, + 0xb1, 0x03, 0xe2, 0xdb, 0x6c, 0x58, 0x06, 0x55, 0x50, 0xcf, 0x77, 0xca, 0xdf, 0xbf, 0x6c, 0xac, + 0x4a, 0x35, 0x5b, 0xfd, 0xbe, 0x6f, 0x52, 0xba, 0xc3, 0x7c, 0xdb, 0xb5, 0x8c, 0x2b, 0xa8, 0xf2, + 0x04, 0xe6, 0x04, 0x77, 0xf9, 0x5a, 0x15, 0xd4, 0x0b, 0xad, 0xb2, 0x9e, 0x5c, 0x85, 0x2e, 0x3a, + 0x74, 0xf2, 0x67, 0x97, 0xeb, 0x99, 0xcf, 0xd3, 0x51, 0x03, 0x18, 0xb2, 0xa4, 0xfd, 0xe8, 0xdd, + 0x74, 0xd4, 0xb8, 0x22, 0xfb, 0x38, 0x1d, 0x35, 0x6a, 0x91, 0xf4, 0xd3, 0x48, 0x7c, 0x42, 0x6b, + 0xad, 0x02, 0xd7, 0x12, 0x21, 0xc3, 0xa4, 0x1e, 0x71, 0xa9, 0x59, 0x7b, 0x2f, 0x46, 0xdb, 0x61, + 0x78, 0x60, 0x3e, 0x13, 0xe5, 0x4a, 0x0b, 0x2e, 0x63, 0x21, 0x3f, 0x75, 0xb0, 0x10, 0xa8, 0x20, + 0xb8, 0x44, 0x39, 0x87, 0x9c, 0xaa, 0xa2, 0x4b, 0x38, 0xdf, 0xb8, 0x2e, 0x37, 0xae, 0x3f, 0x25, + 0xb6, 0x6b, 0x08, 0x5c, 0xbb, 0xc8, 0x47, 0x09, 0xcb, 0xa5, 0xc2, 0x59, 0x15, 0x91, 0xc2, 0x5d, + 0xb8, 0xc2, 0xc5, 0xbb, 0xf4, 0x3f, 0x25, 0x26, 0x3a, 0xde, 0x86, 0x95, 0x39, 0xda, 0xa8, 0xe7, + 0x57, 0x00, 0x4b, 0xf1, 0x8d, 0xfd, 0xf3, 0xf7, 0x56, 0xe0, 0x75, 0x17, 0x3b, 0x62, 0x2f, 0x79, + 0x23, 0x38, 0x2b, 0x5b, 0x70, 0x19, 0xd3, 0x7d, 0xee, 0xbf, 0x72, 0x36, 0x65, 0x5d, 0x9d, 0xc2, + 0xcf, 0xcb, 0xf5, 0x10, 0xfd, 0x3c, 0x63, 0xe4, 0x30, 0xe5, 0xe1, 0x76, 0x29, 0xee, 0x84, 0x4e, + 0x3e, 0xa0, 0x64, 0x43, 0xcf, 0xac, 0xbd, 0x80, 0xb7, 0xe2, 0xda, 0xc3, 0xb1, 0x94, 0xcd, 0xc8, + 0x7b, 0xe0, 0xcf, 0xde, 0x0b, 0x0d, 0xd7, 0xfa, 0x90, 0x85, 0xd9, 0x6d, 0x6a, 0x29, 0x7b, 0xb0, + 0x18, 0x73, 0xff, 0xdd, 0xf9, 0xca, 0x84, 0xc3, 0xd4, 0xfb, 0xa9, 0x90, 0x48, 0xd7, 0x1e, 0x2c, + 0xc6, 0x0c, 0xb8, 0x98, 0x7d, 0x16, 0xf2, 0x1b, 0xf6, 0x45, 0x06, 0x52, 0xba, 0xb0, 0x94, 0x70, + 0xcf, 0xbd, 0xc5, 0xd2, 0x62, 0x20, 0xf5, 0xc1, 0x5f, 0x80, 0xa2, 0x1e, 0xaf, 0x61, 0x61, 0xd6, + 0x2c, 0xd5, 0xb4, 0xd9, 0xd5, 0x7a, 0x1a, 0x22, 0xa4, 0x56, 0x97, 0xde, 0xf2, 0x27, 0xa0, 0xf3, + 0xf2, 0x6c, 0xac, 0x81, 0xf3, 0xb1, 0x06, 0x2e, 0xc6, 0x1a, 0xf8, 0x31, 0xd6, 0xc0, 0xa7, 0x89, + 0x96, 0x39, 0x9f, 0x68, 0x99, 0x8b, 0x89, 0x96, 0x79, 0xb3, 0x69, 0xd9, 0xec, 0xe0, 0xa8, 0xab, + 0xf7, 0x88, 0x83, 0x38, 0xf1, 0x86, 0x6b, 0xb2, 0x13, 0xe2, 0x0f, 0xd0, 0x82, 0xd7, 0x81, 0x9b, + 0x84, 0x76, 0x73, 0xc1, 0xd3, 0xf6, 0xf0, 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, 0x2f, 0x45, 0x6f, + 0x88, 0xa5, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -911,10 +911,15 @@ func (m *MsgUpdateParamResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) _ = i var l int _ = l - if len(m.Params) > 0 { - i -= len(m.Params) - copy(dAtA[i:], m.Params) - i = encodeVarintTx(dAtA, i, uint64(len(m.Params))) + 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 } @@ -1042,8 +1047,8 @@ func (m *MsgUpdateParamResponse) Size() (n int) { } var l int _ = l - l = len(m.Params) - if l > 0 { + if m.Params != nil { + l = m.Params.Size() n += 1 + l + sovTx(uint64(l)) } return n @@ -1702,7 +1707,7 @@ func (m *MsgUpdateParamResponse) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1712,23 +1717,27 @@ func (m *MsgUpdateParamResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.Params = string(dAtA[iNdEx:postIndex]) + if m.Params == nil { + m.Params = &Params{} + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex From f7a6e5bc55e41f59442f0fe1c2ba6a5815fdd15e Mon Sep 17 00:00:00 2001 From: Bryan White Date: Tue, 10 Sep 2024 13:44:21 +0200 Subject: [PATCH 004/139] chore: comment out autocli for gateway module param updates --- x/gateway/module/autocli.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/x/gateway/module/autocli.go b/x/gateway/module/autocli.go index c39515631..cc9175bcf 100644 --- a/x/gateway/module/autocli.go +++ b/x/gateway/module/autocli.go @@ -34,7 +34,7 @@ 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{ + RpcCommandOptions: []*autocliv1.RpcCommandOptions{ // { // RpcMethod: "UpdateParams", // Skip: true, // skipped because authority gated @@ -51,12 +51,12 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { // Short: "Send a unstake_gateway tx", // PositionalArgs: []*autocliv1.PositionalArgDescriptor{}, // }, - { - RpcMethod: "UpdateParam", - Use: "update-param [name] [as-type]", - Short: "Send a update-param tx", - PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "name"}, {ProtoField: "asType"}}, - }, + // { + // 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 }, }, From 8957f1c21c94e320f932cede20e1861ff66dee51 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Thu, 26 Sep 2024 10:43:22 +0200 Subject: [PATCH 005/139] fix: linter error --- x/gateway/types/message_update_param.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/x/gateway/types/message_update_param.go b/x/gateway/types/message_update_param.go index cae2750d8..d5e798ef8 100644 --- a/x/gateway/types/message_update_param.go +++ b/x/gateway/types/message_update_param.go @@ -2,11 +2,11 @@ package types import ( errorsmod "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" + cosmostypes "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) -var _ sdk.Msg = &MsgUpdateParam{} +var _ cosmostypes.Msg = (*MsgUpdateParam)(nil) func NewMsgUpdateParam(authority string, name string, asType string) *MsgUpdateParam { return &MsgUpdateParam{ @@ -17,7 +17,7 @@ func NewMsgUpdateParam(authority string, name string, asType string) *MsgUpdateP } func (msg *MsgUpdateParam) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(msg.Authority) + _, err := cosmostypes.AccAddressFromBech32(msg.Authority) if err != nil { return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid authority address (%s)", err) } From 3016ca38d2895ea887502e89df6bb83d58b9f567 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Thu, 26 Sep 2024 10:43:41 +0200 Subject: [PATCH 006/139] revert: premature changes --- api/poktroll/gateway/params.pulsar.go | 3 - api/poktroll/gateway/tx.pulsar.go | 265 +++++++++----------------- proto/poktroll/gateway/tx.proto | 10 +- x/gateway/types/params.pb.go | 22 +-- x/gateway/types/tx.pb.go | 183 ++++++------------ 5 files changed, 164 insertions(+), 319 deletions(-) diff --git a/api/poktroll/gateway/params.pulsar.go b/api/poktroll/gateway/params.pulsar.go index 79b8a4dcd..47b892b49 100644 --- a/api/poktroll/gateway/params.pulsar.go +++ b/api/poktroll/gateway/params.pulsar.go @@ -3,7 +3,6 @@ package gateway import ( _ "cosmossdk.io/api/amino" - _ "cosmossdk.io/api/cosmos/base/v1beta1" fmt "fmt" runtime "github.com/cosmos/cosmos-proto/runtime" _ "github.com/cosmos/gogoproto/gogoproto" @@ -418,8 +417,6 @@ var file_poktroll_gateway_params_proto_rawDesc = []byte{ 0x61, 0x79, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, - 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2c, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3a, 0x22, 0xe8, 0xa0, 0x1f, 0x01, 0x8a, 0xe7, 0xb0, 0x2a, 0x19, 0x70, diff --git a/api/poktroll/gateway/tx.pulsar.go b/api/poktroll/gateway/tx.pulsar.go index 046dba6a6..4625908b1 100644 --- a/api/poktroll/gateway/tx.pulsar.go +++ b/api/poktroll/gateway/tx.pulsar.go @@ -2507,7 +2507,7 @@ var ( md_MsgUpdateParam protoreflect.MessageDescriptor fd_MsgUpdateParam_authority protoreflect.FieldDescriptor fd_MsgUpdateParam_name protoreflect.FieldDescriptor - fd_MsgUpdateParam_as_coin protoreflect.FieldDescriptor + fd_MsgUpdateParam_as_type protoreflect.FieldDescriptor ) func init() { @@ -2515,7 +2515,7 @@ func init() { md_MsgUpdateParam = File_poktroll_gateway_tx_proto.Messages().ByName("MsgUpdateParam") fd_MsgUpdateParam_authority = md_MsgUpdateParam.Fields().ByName("authority") fd_MsgUpdateParam_name = md_MsgUpdateParam.Fields().ByName("name") - fd_MsgUpdateParam_as_coin = md_MsgUpdateParam.Fields().ByName("as_coin") + fd_MsgUpdateParam_as_type = md_MsgUpdateParam.Fields().ByName("as_type") } var _ protoreflect.Message = (*fastReflection_MsgUpdateParam)(nil) @@ -2595,14 +2595,10 @@ func (x *fastReflection_MsgUpdateParam) Range(f func(protoreflect.FieldDescripto return } } - if x.AsType != nil { - switch o := x.AsType.(type) { - case *MsgUpdateParam_AsCoin: - v := o.AsCoin - value := protoreflect.ValueOfMessage(v.ProtoReflect()) - if !f(fd_MsgUpdateParam_as_coin, value) { - return - } + if x.AsType != "" { + value := protoreflect.ValueOfString(x.AsType) + if !f(fd_MsgUpdateParam_as_type, value) { + return } } } @@ -2624,14 +2620,8 @@ func (x *fastReflection_MsgUpdateParam) Has(fd protoreflect.FieldDescriptor) boo return x.Authority != "" case "poktroll.gateway.MsgUpdateParam.name": return x.Name != "" - case "poktroll.gateway.MsgUpdateParam.as_coin": - if x.AsType == nil { - return false - } else if _, ok := x.AsType.(*MsgUpdateParam_AsCoin); ok { - return true - } else { - return false - } + case "poktroll.gateway.MsgUpdateParam.as_type": + return x.AsType != "" default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParam")) @@ -2652,8 +2642,8 @@ func (x *fastReflection_MsgUpdateParam) Clear(fd protoreflect.FieldDescriptor) { x.Authority = "" case "poktroll.gateway.MsgUpdateParam.name": x.Name = "" - case "poktroll.gateway.MsgUpdateParam.as_coin": - x.AsType = nil + case "poktroll.gateway.MsgUpdateParam.as_type": + x.AsType = "" default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParam")) @@ -2676,14 +2666,9 @@ func (x *fastReflection_MsgUpdateParam) Get(descriptor protoreflect.FieldDescrip case "poktroll.gateway.MsgUpdateParam.name": value := x.Name return protoreflect.ValueOfString(value) - case "poktroll.gateway.MsgUpdateParam.as_coin": - if x.AsType == nil { - return protoreflect.ValueOfMessage((*v1beta1.Coin)(nil).ProtoReflect()) - } else if v, ok := x.AsType.(*MsgUpdateParam_AsCoin); ok { - return protoreflect.ValueOfMessage(v.AsCoin.ProtoReflect()) - } else { - return protoreflect.ValueOfMessage((*v1beta1.Coin)(nil).ProtoReflect()) - } + case "poktroll.gateway.MsgUpdateParam.as_type": + value := x.AsType + return protoreflect.ValueOfString(value) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParam")) @@ -2708,9 +2693,8 @@ func (x *fastReflection_MsgUpdateParam) Set(fd protoreflect.FieldDescriptor, val x.Authority = value.Interface().(string) case "poktroll.gateway.MsgUpdateParam.name": x.Name = value.Interface().(string) - case "poktroll.gateway.MsgUpdateParam.as_coin": - cv := value.Message().Interface().(*v1beta1.Coin) - x.AsType = &MsgUpdateParam_AsCoin{AsCoin: cv} + case "poktroll.gateway.MsgUpdateParam.as_type": + x.AsType = value.Interface().(string) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParam")) @@ -2731,26 +2715,12 @@ func (x *fastReflection_MsgUpdateParam) Set(fd protoreflect.FieldDescriptor, val // 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.gateway.MsgUpdateParam.as_coin": - if x.AsType == nil { - value := &v1beta1.Coin{} - oneofValue := &MsgUpdateParam_AsCoin{AsCoin: value} - x.AsType = oneofValue - return protoreflect.ValueOfMessage(value.ProtoReflect()) - } - switch m := x.AsType.(type) { - case *MsgUpdateParam_AsCoin: - return protoreflect.ValueOfMessage(m.AsCoin.ProtoReflect()) - default: - value := &v1beta1.Coin{} - oneofValue := &MsgUpdateParam_AsCoin{AsCoin: value} - x.AsType = oneofValue - return protoreflect.ValueOfMessage(value.ProtoReflect()) - } case "poktroll.gateway.MsgUpdateParam.authority": panic(fmt.Errorf("field authority of message poktroll.gateway.MsgUpdateParam is not mutable")) case "poktroll.gateway.MsgUpdateParam.name": panic(fmt.Errorf("field name of message poktroll.gateway.MsgUpdateParam is not mutable")) + case "poktroll.gateway.MsgUpdateParam.as_type": + panic(fmt.Errorf("field as_type of message poktroll.gateway.MsgUpdateParam is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParam")) @@ -2768,9 +2738,8 @@ func (x *fastReflection_MsgUpdateParam) NewField(fd protoreflect.FieldDescriptor return protoreflect.ValueOfString("") case "poktroll.gateway.MsgUpdateParam.name": return protoreflect.ValueOfString("") - case "poktroll.gateway.MsgUpdateParam.as_coin": - value := &v1beta1.Coin{} - return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "poktroll.gateway.MsgUpdateParam.as_type": + return protoreflect.ValueOfString("") default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParam")) @@ -2784,14 +2753,6 @@ func (x *fastReflection_MsgUpdateParam) NewField(fd protoreflect.FieldDescriptor // 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.gateway.MsgUpdateParam.as_type": - if x.AsType == nil { - return nil - } - switch x.AsType.(type) { - case *MsgUpdateParam_AsCoin: - return x.Descriptor().Fields().ByName("as_coin") - } default: panic(fmt.Errorf("%s is not a oneof field in poktroll.gateway.MsgUpdateParam", d.FullName())) } @@ -2856,12 +2817,8 @@ func (x *fastReflection_MsgUpdateParam) ProtoMethods() *protoiface.Methods { if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } - switch x := x.AsType.(type) { - case *MsgUpdateParam_AsCoin: - if x == nil { - break - } - l = options.Size(x.AsCoin) + l = len(x.AsType) + if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } if x.unknownFields != nil { @@ -2893,18 +2850,10 @@ func (x *fastReflection_MsgUpdateParam) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - switch x := x.AsType.(type) { - case *MsgUpdateParam_AsCoin: - encoded, err := options.Marshal(x.AsCoin) - 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))) + if len(x.AsType) > 0 { + i -= len(x.AsType) + copy(dAtA[i:], x.AsType) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.AsType))) i-- dAtA[i] = 0x1a } @@ -3037,9 +2986,9 @@ func (x *fastReflection_MsgUpdateParam) ProtoMethods() *protoiface.Methods { iNdEx = postIndex case 3: if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AsCoin", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AsType", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -3049,26 +2998,23 @@ func (x *fastReflection_MsgUpdateParam) ProtoMethods() *protoiface.Methods { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - v := &v1beta1.Coin{} - if err := options.Unmarshal(dAtA[iNdEx:postIndex], v); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - x.AsType = &MsgUpdateParam_AsCoin{v} + x.AsType = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -3767,10 +3713,7 @@ 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 assignable to AsType: - // - // *MsgUpdateParam_AsCoin - AsType isMsgUpdateParam_AsType `protobuf_oneof:"as_type"` + AsType string `protobuf:"bytes,3,opt,name=as_type,json=asType,proto3" json:"as_type,omitempty"` } func (x *MsgUpdateParam) Reset() { @@ -3807,30 +3750,13 @@ func (x *MsgUpdateParam) GetName() string { return "" } -func (x *MsgUpdateParam) GetAsType() isMsgUpdateParam_AsType { +func (x *MsgUpdateParam) GetAsType() string { if x != nil { return x.AsType } - return nil -} - -func (x *MsgUpdateParam) GetAsCoin() *v1beta1.Coin { - if x, ok := x.GetAsType().(*MsgUpdateParam_AsCoin); ok { - return x.AsCoin - } - return nil -} - -type isMsgUpdateParam_AsType interface { - isMsgUpdateParam_AsType() -} - -type MsgUpdateParam_AsCoin struct { - AsCoin *v1beta1.Coin `protobuf:"bytes,3,opt,name=as_coin,json=asCoin,proto3,oneof"` + return "" } -func (*MsgUpdateParam_AsCoin) isMsgUpdateParam_AsType() {} - type MsgUpdateParamResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -3912,59 +3838,56 @@ var file_poktroll_gateway_tx_proto_rawDesc = []byte{ 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x3a, 0x0c, 0x82, 0xe7, 0xb0, 0x2a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x1b, 0x0a, 0x19, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, - 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xba, 0x01, 0x0a, 0x0e, 0x4d, + 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x85, 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, 0x41, 0x0a, 0x07, 0x61, 0x73, 0x5f, - 0x63, 0x6f, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, - 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x0b, 0xea, 0xde, 0x1f, 0x07, 0x61, 0x73, 0x5f, 0x63, 0x6f, - 0x69, 0x6e, 0x48, 0x00, 0x52, 0x06, 0x61, 0x73, 0x43, 0x6f, 0x69, 0x6e, 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, 0x4a, 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, 0x30, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, - 0x65, 0x77, 0x61, 0x79, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x06, 0x70, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x32, 0x87, 0x03, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x5c, 0x0a, 0x0c, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x21, 0x2e, 0x70, 0x6f, - 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x4d, - 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x29, - 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, - 0x79, 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, 0x5c, 0x0a, 0x0c, 0x53, 0x74, 0x61, - 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x21, 0x2e, 0x70, 0x6f, 0x6b, 0x74, - 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x4d, 0x73, 0x67, - 0x53, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x1a, 0x29, 0x2e, 0x70, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x61, 0x73, 0x5f, + 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x73, 0x54, 0x79, + 0x70, 0x65, 0x3a, 0x0e, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, + 0x74, 0x79, 0x22, 0x4a, 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, 0x30, 0x0a, 0x06, + 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, - 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x62, 0x0a, 0x0e, 0x55, 0x6e, 0x73, 0x74, 0x61, - 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x23, 0x2e, 0x70, 0x6f, 0x6b, 0x74, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x32, 0x87, + 0x03, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x5c, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x21, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x4d, 0x73, 0x67, - 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x1a, 0x2b, - 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, - 0x79, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, - 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x59, 0x0a, 0x0b, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x20, 0x2e, 0x70, 0x6f, 0x6b, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x4d, 0x73, - 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x1a, 0x28, 0x2e, 0x70, - 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 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, 0xa7, 0x01, - 0xd8, 0xe2, 0x1e, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, - 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x21, 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, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0xa2, 0x02, 0x03, 0x50, 0x47, 0x58, 0xaa, 0x02, - 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, - 0x79, 0xca, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x47, 0x61, 0x74, - 0x65, 0x77, 0x61, 0x79, 0xe2, 0x02, 0x1c, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, - 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0xea, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, - 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5c, 0x0a, 0x0c, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, + 0x65, 0x77, 0x61, 0x79, 0x12, 0x21, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, + 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, + 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x1a, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x74, + 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x62, 0x0a, 0x0e, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, + 0x65, 0x77, 0x61, 0x79, 0x12, 0x23, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, + 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, + 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x1a, 0x2b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x4d, 0x73, 0x67, + 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x59, 0x0a, 0x0b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x20, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x1a, 0x28, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 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, 0xa7, 0x01, 0xd8, 0xe2, 0x1e, 0x01, 0x0a, + 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, + 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, + 0x5a, 0x21, 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, 0x67, 0x61, 0x74, 0x65, + 0x77, 0x61, 0x79, 0xa2, 0x02, 0x03, 0x50, 0x47, 0x58, 0xaa, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0xca, 0x02, 0x10, 0x50, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0xe2, + 0x02, 0x1c, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x47, 0x61, 0x74, 0x65, 0x77, + 0x61, 0x79, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, + 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x47, 0x61, 0x74, 0x65, 0x77, + 0x61, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -3995,21 +3918,20 @@ var file_poktroll_gateway_tx_proto_goTypes = []interface{}{ var file_poktroll_gateway_tx_proto_depIdxs = []int32{ 8, // 0: poktroll.gateway.MsgUpdateParams.params:type_name -> poktroll.gateway.Params 9, // 1: poktroll.gateway.MsgStakeGateway.stake:type_name -> cosmos.base.v1beta1.Coin - 9, // 2: poktroll.gateway.MsgUpdateParam.as_coin:type_name -> cosmos.base.v1beta1.Coin - 8, // 3: poktroll.gateway.MsgUpdateParamResponse.params:type_name -> poktroll.gateway.Params - 0, // 4: poktroll.gateway.Msg.UpdateParams:input_type -> poktroll.gateway.MsgUpdateParams - 2, // 5: poktroll.gateway.Msg.StakeGateway:input_type -> poktroll.gateway.MsgStakeGateway - 4, // 6: poktroll.gateway.Msg.UnstakeGateway:input_type -> poktroll.gateway.MsgUnstakeGateway - 6, // 7: poktroll.gateway.Msg.UpdateParam:input_type -> poktroll.gateway.MsgUpdateParam - 1, // 8: poktroll.gateway.Msg.UpdateParams:output_type -> poktroll.gateway.MsgUpdateParamsResponse - 3, // 9: poktroll.gateway.Msg.StakeGateway:output_type -> poktroll.gateway.MsgStakeGatewayResponse - 5, // 10: poktroll.gateway.Msg.UnstakeGateway:output_type -> poktroll.gateway.MsgUnstakeGatewayResponse - 7, // 11: poktroll.gateway.Msg.UpdateParam:output_type -> poktroll.gateway.MsgUpdateParamResponse - 8, // [8:12] is the sub-list for method output_type - 4, // [4:8] is the sub-list for method input_type - 4, // [4:4] is the sub-list for extension type_name - 4, // [4:4] is the sub-list for extension extendee - 0, // [0:4] is the sub-list for field type_name + 8, // 2: poktroll.gateway.MsgUpdateParamResponse.params:type_name -> poktroll.gateway.Params + 0, // 3: poktroll.gateway.Msg.UpdateParams:input_type -> poktroll.gateway.MsgUpdateParams + 2, // 4: poktroll.gateway.Msg.StakeGateway:input_type -> poktroll.gateway.MsgStakeGateway + 4, // 5: poktroll.gateway.Msg.UnstakeGateway:input_type -> poktroll.gateway.MsgUnstakeGateway + 6, // 6: poktroll.gateway.Msg.UpdateParam:input_type -> poktroll.gateway.MsgUpdateParam + 1, // 7: poktroll.gateway.Msg.UpdateParams:output_type -> poktroll.gateway.MsgUpdateParamsResponse + 3, // 8: poktroll.gateway.Msg.StakeGateway:output_type -> poktroll.gateway.MsgStakeGatewayResponse + 5, // 9: poktroll.gateway.Msg.UnstakeGateway:output_type -> poktroll.gateway.MsgUnstakeGatewayResponse + 7, // 10: poktroll.gateway.Msg.UpdateParam:output_type -> poktroll.gateway.MsgUpdateParamResponse + 7, // [7:11] is the sub-list for method output_type + 3, // [3:7] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name } func init() { file_poktroll_gateway_tx_proto_init() } @@ -4116,9 +4038,6 @@ func file_poktroll_gateway_tx_proto_init() { } } } - file_poktroll_gateway_tx_proto_msgTypes[6].OneofWrappers = []interface{}{ - (*MsgUpdateParam_AsCoin)(nil), - } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/proto/poktroll/gateway/tx.proto b/proto/poktroll/gateway/tx.proto index 3b5458517..caf37f199 100644 --- a/proto/poktroll/gateway/tx.proto +++ b/proto/poktroll/gateway/tx.proto @@ -15,7 +15,7 @@ import "poktroll/gateway/params.proto"; // 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 ); @@ -27,14 +27,14 @@ service Msg { message MsgUpdateParams { option (cosmos.msg.v1.signer) = "authority"; option (amino.name) = "poktroll/x/gateway/MsgUpdateParams"; - + // authority is the address that controls the module (defaults to x/gov unless overwritten). string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // TODO_IMPROVE(#322): The requirement to provide all params is adopted from the // latest Cosmos SDK version. We should look into either improving this ourselves // or seeing if it is on their roadmap. - + // params defines the x/gateway parameters to update. // NOTE: All parameters must be supplied. Params params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; @@ -67,9 +67,7 @@ message MsgUpdateParam { string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; string name = 2; - oneof as_type { - cosmos.base.v1beta1.Coin as_coin = 3 [(gogoproto.jsontag) = "as_coin"]; - } + string as_type = 3; } message MsgUpdateParamResponse { diff --git a/x/gateway/types/params.pb.go b/x/gateway/types/params.pb.go index 7ac8a04a9..ceb9f5ead 100644 --- a/x/gateway/types/params.pb.go +++ b/x/gateway/types/params.pb.go @@ -5,7 +5,6 @@ package types import ( fmt "fmt" - _ "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" @@ -65,20 +64,19 @@ func init() { func init() { proto.RegisterFile("poktroll/gateway/params.proto", fileDescriptor_23ed52a392489486) } var fileDescriptor_23ed52a392489486 = []byte{ - // 207 bytes of a gzipped FileDescriptorProto + // 180 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2d, 0xc8, 0xcf, 0x2e, 0x29, 0xca, 0xcf, 0xc9, 0xd1, 0x4f, 0x4f, 0x2c, 0x49, 0x2d, 0x4f, 0xac, 0xd4, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x80, 0x49, 0xeb, 0x41, 0xa5, - 0xa5, 0x04, 0x13, 0x73, 0x33, 0xf3, 0xf2, 0xf5, 0xc1, 0x24, 0x44, 0x91, 0x94, 0x5c, 0x72, 0x7e, - 0x71, 0x6e, 0x7e, 0xb1, 0x7e, 0x52, 0x62, 0x71, 0xaa, 0x7e, 0x99, 0x61, 0x52, 0x6a, 0x49, 0xa2, - 0xa1, 0x7e, 0x72, 0x7e, 0x66, 0x1e, 0x54, 0x5e, 0x24, 0x3d, 0x3f, 0x3d, 0x1f, 0xcc, 0xd4, 0x07, - 0xb1, 0x20, 0xa2, 0x4a, 0x3a, 0x5c, 0x6c, 0x01, 0x60, 0xab, 0xac, 0x94, 0x5e, 0x2c, 0x90, 0x67, - 0xec, 0x7a, 0xbe, 0x41, 0x4b, 0x12, 0xee, 0x98, 0x0a, 0xb8, 0x73, 0x20, 0x6a, 0x9c, 0xfc, 0x4e, - 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc6, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, - 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0x83, 0xf4, - 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0x7d, 0x90, 0x19, 0xba, 0x79, 0xa9, 0x25, - 0xe5, 0xf9, 0x45, 0xd9, 0xfa, 0x58, 0x0c, 0x2c, 0xa9, 0x2c, 0x48, 0x2d, 0x4e, 0x62, 0x03, 0x3b, - 0xc2, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x89, 0x77, 0x0d, 0x96, 0x00, 0x01, 0x00, 0x00, + 0xa5, 0x04, 0x13, 0x73, 0x33, 0xf3, 0xf2, 0xf5, 0xc1, 0x24, 0x44, 0x91, 0x94, 0x48, 0x7a, 0x7e, + 0x7a, 0x3e, 0x98, 0xa9, 0x0f, 0x62, 0x41, 0x44, 0x95, 0x74, 0xb8, 0xd8, 0x02, 0xc0, 0x46, 0x59, + 0x29, 0xbd, 0x58, 0x20, 0xcf, 0xd8, 0xf5, 0x7c, 0x83, 0x96, 0x24, 0xdc, 0xb2, 0x0a, 0xb8, 0x75, + 0x10, 0x35, 0x4e, 0x7e, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0x78, 0xe3, 0x91, 0x1c, + 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, + 0x1c, 0x43, 0x94, 0x41, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x3e, 0xc8, + 0x0c, 0xdd, 0xbc, 0xd4, 0x92, 0xf2, 0xfc, 0xa2, 0x6c, 0x7d, 0x2c, 0x06, 0x96, 0x54, 0x16, 0xa4, + 0x16, 0x27, 0xb1, 0x81, 0x1d, 0x61, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0xb5, 0xe9, 0x34, 0xfe, + 0xe0, 0x00, 0x00, 0x00, } func (this *Params) Equal(that interface{}) bool { diff --git a/x/gateway/types/tx.pb.go b/x/gateway/types/tx.pb.go index 6db15bbbb..425361733 100644 --- a/x/gateway/types/tx.pb.go +++ b/x/gateway/types/tx.pb.go @@ -275,10 +275,7 @@ 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_AsCoin - AsType isMsgUpdateParam_AsType `protobuf_oneof:"as_type"` + AsType string `protobuf:"bytes,3,opt,name=as_type,json=asType,proto3" json:"as_type,omitempty"` } func (m *MsgUpdateParam) Reset() { *m = MsgUpdateParam{} } @@ -310,25 +307,6 @@ func (m *MsgUpdateParam) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateParam proto.InternalMessageInfo -type isMsgUpdateParam_AsType interface { - isMsgUpdateParam_AsType() - MarshalTo([]byte) (int, error) - Size() int -} - -type MsgUpdateParam_AsCoin struct { - AsCoin *types.Coin `protobuf:"bytes,3,opt,name=as_coin,json=asCoin,proto3,oneof" json:"as_coin"` -} - -func (*MsgUpdateParam_AsCoin) 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 @@ -343,18 +321,11 @@ func (m *MsgUpdateParam) GetName() string { return "" } -func (m *MsgUpdateParam) GetAsCoin() *types.Coin { - if x, ok := m.GetAsType().(*MsgUpdateParam_AsCoin); ok { - return x.AsCoin - } - return nil -} - -// XXX_OneofWrappers is for the internal use of the proto package. -func (*MsgUpdateParam) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*MsgUpdateParam_AsCoin)(nil), +func (m *MsgUpdateParam) GetAsType() string { + if m != nil { + return m.AsType } + return "" } type MsgUpdateParamResponse struct { @@ -411,44 +382,43 @@ func init() { func init() { proto.RegisterFile("poktroll/gateway/tx.proto", fileDescriptor_7ad4b0c5e3b59f23) } var fileDescriptor_7ad4b0c5e3b59f23 = []byte{ - // 581 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0xcf, 0x6b, 0x13, 0x41, - 0x14, 0xce, 0x18, 0x9b, 0x92, 0x49, 0x88, 0x76, 0x29, 0x36, 0x59, 0x71, 0x1b, 0xe3, 0x25, 0x46, - 0xba, 0xd3, 0x44, 0xf4, 0x10, 0x4f, 0x8d, 0x07, 0x45, 0xa8, 0xc8, 0x96, 0x1e, 0x94, 0x42, 0x99, - 0x24, 0xcb, 0x76, 0x49, 0x77, 0x67, 0xd9, 0x99, 0xfe, 0xc8, 0x4d, 0x44, 0x10, 0x3c, 0xf9, 0x67, - 0x78, 0xcc, 0xc1, 0x93, 0xe0, 0xbd, 0xc7, 0xe2, 0xa9, 0xa7, 0x22, 0xc9, 0x21, 0xe0, 0x5f, 0x21, - 0xb3, 0x33, 0xbb, 0xcd, 0x6e, 0xa2, 0x2b, 0x7a, 0x49, 0x66, 0xde, 0xfb, 0xde, 0xf7, 0xbe, 0xf7, - 0xf6, 0x63, 0x60, 0xc5, 0x23, 0x03, 0xe6, 0x93, 0xc3, 0x43, 0x64, 0x61, 0x66, 0x9e, 0xe0, 0x21, - 0x62, 0xa7, 0xba, 0xe7, 0x13, 0x46, 0x94, 0x9b, 0x61, 0x4a, 0x97, 0x29, 0x75, 0x05, 0x3b, 0xb6, - 0x4b, 0x50, 0xf0, 0x2b, 0x40, 0xea, 0x5a, 0x8f, 0x50, 0x87, 0x50, 0xe4, 0x50, 0x0b, 0x1d, 0x37, - 0xf9, 0x9f, 0x4c, 0x54, 0x44, 0x62, 0x3f, 0xb8, 0x21, 0x71, 0x91, 0xa9, 0x55, 0x8b, 0x58, 0x44, - 0xc4, 0xf9, 0x49, 0x46, 0x35, 0xc9, 0xd4, 0xc5, 0xd4, 0x44, 0xc7, 0xcd, 0xae, 0xc9, 0x70, 0x13, - 0xf5, 0x88, 0xed, 0xca, 0xfc, 0x9d, 0x39, 0xa5, 0x1e, 0xf6, 0xb1, 0x23, 0x49, 0x6b, 0xdf, 0x00, - 0xbc, 0xb1, 0x4d, 0xad, 0x5d, 0xaf, 0x8f, 0x99, 0xf9, 0x2a, 0xc8, 0x28, 0x8f, 0x61, 0x1e, 0x1f, - 0xb1, 0x03, 0xe2, 0xdb, 0x6c, 0x58, 0x06, 0x55, 0x50, 0xcf, 0x77, 0xca, 0xdf, 0xbf, 0x6c, 0xac, - 0x4a, 0x35, 0x5b, 0xfd, 0xbe, 0x6f, 0x52, 0xba, 0xc3, 0x7c, 0xdb, 0xb5, 0x8c, 0x2b, 0xa8, 0xf2, - 0x04, 0xe6, 0x04, 0x77, 0xf9, 0x5a, 0x15, 0xd4, 0x0b, 0xad, 0xb2, 0x9e, 0x5c, 0x85, 0x2e, 0x3a, - 0x74, 0xf2, 0x67, 0x97, 0xeb, 0x99, 0xcf, 0xd3, 0x51, 0x03, 0x18, 0xb2, 0xa4, 0xfd, 0xe8, 0xdd, - 0x74, 0xd4, 0xb8, 0x22, 0xfb, 0x38, 0x1d, 0x35, 0x6a, 0x91, 0xf4, 0xd3, 0x48, 0x7c, 0x42, 0x6b, - 0xad, 0x02, 0xd7, 0x12, 0x21, 0xc3, 0xa4, 0x1e, 0x71, 0xa9, 0x59, 0x7b, 0x2f, 0x46, 0xdb, 0x61, - 0x78, 0x60, 0x3e, 0x13, 0xe5, 0x4a, 0x0b, 0x2e, 0x63, 0x21, 0x3f, 0x75, 0xb0, 0x10, 0xa8, 0x20, - 0xb8, 0x44, 0x39, 0x87, 0x9c, 0xaa, 0xa2, 0x4b, 0x38, 0xdf, 0xb8, 0x2e, 0x37, 0xae, 0x3f, 0x25, - 0xb6, 0x6b, 0x08, 0x5c, 0xbb, 0xc8, 0x47, 0x09, 0xcb, 0xa5, 0xc2, 0x59, 0x15, 0x91, 0xc2, 0x5d, - 0xb8, 0xc2, 0xc5, 0xbb, 0xf4, 0x3f, 0x25, 0x26, 0x3a, 0xde, 0x86, 0x95, 0x39, 0xda, 0xa8, 0xe7, - 0x57, 0x00, 0x4b, 0xf1, 0x8d, 0xfd, 0xf3, 0xf7, 0x56, 0xe0, 0x75, 0x17, 0x3b, 0x62, 0x2f, 0x79, - 0x23, 0x38, 0x2b, 0x5b, 0x70, 0x19, 0xd3, 0x7d, 0xee, 0xbf, 0x72, 0x36, 0x65, 0x5d, 0x9d, 0xc2, - 0xcf, 0xcb, 0xf5, 0x10, 0xfd, 0x3c, 0x63, 0xe4, 0x30, 0xe5, 0xe1, 0x76, 0x29, 0xee, 0x84, 0x4e, - 0x3e, 0xa0, 0x64, 0x43, 0xcf, 0xac, 0xbd, 0x80, 0xb7, 0xe2, 0xda, 0xc3, 0xb1, 0x94, 0xcd, 0xc8, - 0x7b, 0xe0, 0xcf, 0xde, 0x0b, 0x0d, 0xd7, 0xfa, 0x90, 0x85, 0xd9, 0x6d, 0x6a, 0x29, 0x7b, 0xb0, - 0x18, 0x73, 0xff, 0xdd, 0xf9, 0xca, 0x84, 0xc3, 0xd4, 0xfb, 0xa9, 0x90, 0x48, 0xd7, 0x1e, 0x2c, - 0xc6, 0x0c, 0xb8, 0x98, 0x7d, 0x16, 0xf2, 0x1b, 0xf6, 0x45, 0x06, 0x52, 0xba, 0xb0, 0x94, 0x70, - 0xcf, 0xbd, 0xc5, 0xd2, 0x62, 0x20, 0xf5, 0xc1, 0x5f, 0x80, 0xa2, 0x1e, 0xaf, 0x61, 0x61, 0xd6, - 0x2c, 0xd5, 0xb4, 0xd9, 0xd5, 0x7a, 0x1a, 0x22, 0xa4, 0x56, 0x97, 0xde, 0xf2, 0x27, 0xa0, 0xf3, - 0xf2, 0x6c, 0xac, 0x81, 0xf3, 0xb1, 0x06, 0x2e, 0xc6, 0x1a, 0xf8, 0x31, 0xd6, 0xc0, 0xa7, 0x89, - 0x96, 0x39, 0x9f, 0x68, 0x99, 0x8b, 0x89, 0x96, 0x79, 0xb3, 0x69, 0xd9, 0xec, 0xe0, 0xa8, 0xab, - 0xf7, 0x88, 0x83, 0x38, 0xf1, 0x86, 0x6b, 0xb2, 0x13, 0xe2, 0x0f, 0xd0, 0x82, 0xd7, 0x81, 0x9b, - 0x84, 0x76, 0x73, 0xc1, 0xd3, 0xf6, 0xf0, 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, 0x2f, 0x45, 0x6f, - 0x88, 0xa5, 0x05, 0x00, 0x00, + // 564 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0xbf, 0x6f, 0xd3, 0x40, + 0x14, 0xce, 0x11, 0x9a, 0x2a, 0xd7, 0x28, 0xd0, 0x53, 0x45, 0x12, 0x23, 0x4c, 0x08, 0x4b, 0x08, + 0xaa, 0xaf, 0x09, 0x82, 0x21, 0x4c, 0x84, 0x01, 0x09, 0xa9, 0x08, 0xa5, 0x74, 0x00, 0x55, 0xaa, + 0xce, 0xc9, 0xc9, 0xb5, 0x52, 0xfb, 0x2c, 0xdf, 0xf5, 0x47, 0x36, 0x84, 0x40, 0x48, 0x4c, 0xfc, + 0x19, 0x8c, 0x19, 0x58, 0xd9, 0x3b, 0x56, 0x4c, 0x9d, 0x10, 0x4a, 0x86, 0xfc, 0x1b, 0xc8, 0xbe, + 0xb3, 0x1b, 0x3b, 0x81, 0x20, 0x58, 0x12, 0xfb, 0xbd, 0xef, 0x7d, 0xef, 0x7b, 0xef, 0xbe, 0x33, + 0xac, 0x78, 0x6c, 0x20, 0x7c, 0x76, 0x78, 0x88, 0x2d, 0x22, 0xe8, 0x09, 0x19, 0x62, 0x71, 0x6a, + 0x78, 0x3e, 0x13, 0x0c, 0x5d, 0x8f, 0x52, 0x86, 0x4a, 0x69, 0xeb, 0xc4, 0xb1, 0x5d, 0x86, 0xc3, + 0x5f, 0x09, 0xd2, 0x4a, 0x3d, 0xc6, 0x1d, 0xc6, 0xb1, 0xc3, 0x2d, 0x7c, 0xdc, 0x0c, 0xfe, 0x54, + 0xa2, 0x22, 0x13, 0xfb, 0xe1, 0x1b, 0x96, 0x2f, 0x2a, 0xb5, 0x61, 0x31, 0x8b, 0xc9, 0x78, 0xf0, + 0xa4, 0xa2, 0xba, 0x62, 0x32, 0x09, 0xa7, 0xf8, 0xb8, 0x69, 0x52, 0x41, 0x9a, 0xb8, 0xc7, 0x6c, + 0x57, 0xe5, 0x6f, 0xcd, 0x29, 0xf5, 0x88, 0x4f, 0x1c, 0x45, 0x5a, 0xfb, 0x06, 0xe0, 0xb5, 0x6d, + 0x6e, 0xed, 0x7a, 0x7d, 0x22, 0xe8, 0xcb, 0x30, 0x83, 0x1e, 0xc1, 0x3c, 0x39, 0x12, 0x07, 0xcc, + 0xb7, 0xc5, 0xb0, 0x0c, 0xaa, 0xa0, 0x9e, 0xef, 0x94, 0xbf, 0x7f, 0xdd, 0xdc, 0x50, 0x6a, 0x9e, + 0xf4, 0xfb, 0x3e, 0xe5, 0x7c, 0x47, 0xf8, 0xb6, 0x6b, 0x75, 0x2f, 0xa1, 0xe8, 0x31, 0xcc, 0x49, + 0xee, 0xf2, 0x95, 0x2a, 0xa8, 0xaf, 0xb5, 0xca, 0x46, 0x7a, 0x15, 0x86, 0xec, 0xd0, 0xc9, 0x9f, + 0xfd, 0xb8, 0x9d, 0xf9, 0x32, 0x1d, 0x35, 0x40, 0x57, 0x95, 0xb4, 0x1f, 0xbe, 0x9b, 0x8e, 0x1a, + 0x97, 0x64, 0x9f, 0xa6, 0xa3, 0x46, 0x2d, 0x96, 0x7e, 0x1a, 0x8b, 0x4f, 0x69, 0xad, 0x55, 0x60, + 0x29, 0x15, 0xea, 0x52, 0xee, 0x31, 0x97, 0xd3, 0xda, 0x7b, 0x39, 0xda, 0x8e, 0x20, 0x03, 0xfa, + 0x4c, 0x96, 0xa3, 0x16, 0x5c, 0x25, 0x52, 0xfe, 0xd2, 0xc1, 0x22, 0x20, 0xc2, 0x70, 0x85, 0x07, + 0x1c, 0x6a, 0xaa, 0x8a, 0xa1, 0xe0, 0xc1, 0xc6, 0x0d, 0xb5, 0x71, 0xe3, 0x29, 0xb3, 0xdd, 0xae, + 0xc4, 0xb5, 0x0b, 0xc1, 0x28, 0x51, 0xb9, 0x52, 0x38, 0xab, 0x22, 0x56, 0xb8, 0x0b, 0xd7, 0x03, + 0xf1, 0x2e, 0xff, 0x4f, 0x89, 0xa9, 0x8e, 0x37, 0x61, 0x65, 0x8e, 0x36, 0xee, 0xf9, 0x01, 0xc0, + 0x62, 0x72, 0x63, 0xff, 0x7c, 0xde, 0x08, 0x5e, 0x75, 0x89, 0x23, 0xf7, 0x92, 0xef, 0x86, 0xcf, + 0xa8, 0x04, 0x57, 0x09, 0xdf, 0x17, 0x43, 0x8f, 0x96, 0xb3, 0x61, 0x38, 0x47, 0xf8, 0xab, 0xa1, + 0x47, 0xdb, 0xc5, 0xe4, 0xf9, 0xd6, 0x9e, 0xc3, 0x1b, 0x49, 0x19, 0x91, 0x42, 0xb4, 0x15, 0xdb, + 0x08, 0xfc, 0xd9, 0x46, 0x91, 0x77, 0x5a, 0x1f, 0xb3, 0x30, 0xbb, 0xcd, 0x2d, 0xb4, 0x07, 0x0b, + 0x09, 0x23, 0xdf, 0x99, 0xaf, 0x4c, 0x99, 0x45, 0xbb, 0xb7, 0x14, 0x12, 0xeb, 0xda, 0x83, 0x85, + 0x84, 0x97, 0x16, 0xb3, 0xcf, 0x42, 0x7e, 0xc3, 0xbe, 0xc8, 0x0b, 0xc8, 0x84, 0xc5, 0x94, 0x11, + 0xee, 0x2e, 0x96, 0x96, 0x00, 0x69, 0xf7, 0xff, 0x02, 0x14, 0xf7, 0x78, 0x0d, 0xd7, 0x66, 0xcf, + 0xbd, 0xba, 0x6c, 0x76, 0xad, 0xbe, 0x0c, 0x11, 0x51, 0x6b, 0x2b, 0x6f, 0x83, 0xdb, 0xdc, 0x79, + 0x71, 0x36, 0xd6, 0xc1, 0xf9, 0x58, 0x07, 0x17, 0x63, 0x1d, 0xfc, 0x1c, 0xeb, 0xe0, 0xf3, 0x44, + 0xcf, 0x9c, 0x4f, 0xf4, 0xcc, 0xc5, 0x44, 0xcf, 0xbc, 0xd9, 0xb2, 0x6c, 0x71, 0x70, 0x64, 0x1a, + 0x3d, 0xe6, 0xe0, 0x80, 0x78, 0xd3, 0xa5, 0xe2, 0x84, 0xf9, 0x03, 0xbc, 0xe0, 0xa2, 0x07, 0x16, + 0xe2, 0x66, 0x2e, 0xfc, 0x4a, 0x3d, 0xf8, 0x15, 0x00, 0x00, 0xff, 0xff, 0x6c, 0xf2, 0xee, 0xa1, + 0x70, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -844,14 +814,12 @@ func (m *MsgUpdateParam) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = 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.AsType) > 0 { + i -= len(m.AsType) + copy(dAtA[i:], m.AsType) + i = encodeVarintTx(dAtA, i, uint64(len(m.AsType))) + i-- + dAtA[i] = 0x1a } if len(m.Name) > 0 { i -= len(m.Name) @@ -870,27 +838,6 @@ func (m *MsgUpdateParam) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgUpdateParam_AsCoin) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgUpdateParam_AsCoin) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.AsCoin != nil { - { - size, err := m.AsCoin.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - return len(dAtA) - i, nil -} func (m *MsgUpdateParamResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1023,24 +970,13 @@ func (m *MsgUpdateParam) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - if m.AsType != nil { - n += m.AsType.Size() - } - return n -} - -func (m *MsgUpdateParam_AsCoin) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.AsCoin != nil { - l = m.AsCoin.Size() + l = len(m.AsType) + if l > 0 { n += 1 + l + sovTx(uint64(l)) } return n } + func (m *MsgUpdateParamResponse) Size() (n int) { if m == nil { return 0 @@ -1620,9 +1556,9 @@ func (m *MsgUpdateParam) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AsCoin", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field AsType", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1632,26 +1568,23 @@ func (m *MsgUpdateParam) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - v := &types.Coin{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.AsType = &MsgUpdateParam_AsCoin{v} + m.AsType = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex From 899effb2dec8fd207f58c5c70162915db4654156 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Thu, 26 Sep 2024 08:57:40 +0200 Subject: [PATCH 007/139] feat: add min_stake gateway module param --- api/poktroll/gateway/params.pulsar.go | 142 +++++++++++++++++--- config.yml | 3 + e2e/tests/parse_params_test.go | 22 ++- proto/poktroll/gateway/params.proto | 3 + x/gateway/keeper/msg_server_update_param.go | 42 +++++- x/gateway/types/errors.go | 1 + x/gateway/types/message_update_param.go | 39 +++++- x/gateway/types/params.go | 66 ++++++++- x/gateway/types/params.pb.go | 89 ++++++++++-- 9 files changed, 360 insertions(+), 47 deletions(-) diff --git a/api/poktroll/gateway/params.pulsar.go b/api/poktroll/gateway/params.pulsar.go index 47b892b49..2c7aea466 100644 --- a/api/poktroll/gateway/params.pulsar.go +++ b/api/poktroll/gateway/params.pulsar.go @@ -3,6 +3,7 @@ package gateway import ( _ "cosmossdk.io/api/amino" + v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" fmt "fmt" runtime "github.com/cosmos/cosmos-proto/runtime" _ "github.com/cosmos/gogoproto/gogoproto" @@ -15,12 +16,14 @@ import ( ) var ( - md_Params protoreflect.MessageDescriptor + md_Params protoreflect.MessageDescriptor + fd_Params_min_stake protoreflect.FieldDescriptor ) func init() { file_poktroll_gateway_params_proto_init() md_Params = File_poktroll_gateway_params_proto.Messages().ByName("Params") + fd_Params_min_stake = md_Params.Fields().ByName("min_stake") } var _ protoreflect.Message = (*fastReflection_Params)(nil) @@ -88,6 +91,12 @@ func (x *fastReflection_Params) Interface() protoreflect.ProtoMessage { // While iterating, mutating operations may only be performed // on the current field descriptor. func (x *fastReflection_Params) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.MinStake != nil { + value := protoreflect.ValueOfMessage(x.MinStake.ProtoReflect()) + if !f(fd_Params_min_stake, value) { + return + } + } } // Has reports whether a field is populated. @@ -103,6 +112,8 @@ func (x *fastReflection_Params) Range(f func(protoreflect.FieldDescriptor, proto // a repeated field is populated if it is non-empty. func (x *fastReflection_Params) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { + case "poktroll.gateway.Params.min_stake": + return x.MinStake != nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.Params")) @@ -119,6 +130,8 @@ func (x *fastReflection_Params) Has(fd protoreflect.FieldDescriptor) bool { // Clear is a mutating operation and unsafe for concurrent use. func (x *fastReflection_Params) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { + case "poktroll.gateway.Params.min_stake": + x.MinStake = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.Params")) @@ -135,6 +148,9 @@ func (x *fastReflection_Params) Clear(fd protoreflect.FieldDescriptor) { // of the value; to obtain a mutable reference, use Mutable. func (x *fastReflection_Params) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { + case "poktroll.gateway.Params.min_stake": + value := x.MinStake + return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.Params")) @@ -155,6 +171,8 @@ func (x *fastReflection_Params) Get(descriptor protoreflect.FieldDescriptor) pro // Set is a mutating operation and unsafe for concurrent use. func (x *fastReflection_Params) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { + case "poktroll.gateway.Params.min_stake": + x.MinStake = value.Message().Interface().(*v1beta1.Coin) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.Params")) @@ -175,6 +193,11 @@ func (x *fastReflection_Params) Set(fd protoreflect.FieldDescriptor, value proto // Mutable is a mutating operation and unsafe for concurrent use. func (x *fastReflection_Params) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { + case "poktroll.gateway.Params.min_stake": + if x.MinStake == nil { + x.MinStake = new(v1beta1.Coin) + } + return protoreflect.ValueOfMessage(x.MinStake.ProtoReflect()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.Params")) @@ -188,6 +211,9 @@ func (x *fastReflection_Params) Mutable(fd protoreflect.FieldDescriptor) protore // For lists, maps, and messages, this returns a new, empty, mutable value. func (x *fastReflection_Params) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { + case "poktroll.gateway.Params.min_stake": + m := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(m.ProtoReflect()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.Params")) @@ -257,6 +283,10 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { var n int var l int _ = l + if x.MinStake != nil { + l = options.Size(x.MinStake) + n += 1 + l + runtime.Sov(uint64(l)) + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -286,6 +316,20 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if x.MinStake != nil { + encoded, err := options.Marshal(x.MinStake) + 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 { @@ -335,6 +379,42 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Params: 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 MinStake", 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.MinStake == nil { + x.MinStake = &v1beta1.Coin{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.MinStake); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -388,6 +468,8 @@ type Params struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + MinStake *v1beta1.Coin `protobuf:"bytes,1,opt,name=min_stake,json=minStake,proto3" json:"min_stake,omitempty"` } func (x *Params) Reset() { @@ -410,6 +492,13 @@ func (*Params) Descriptor() ([]byte, []int) { return file_poktroll_gateway_params_proto_rawDescGZIP(), []int{0} } +func (x *Params) GetMinStake() *v1beta1.Coin { + if x != nil { + return x.MinStake + } + return nil +} + var File_poktroll_gateway_params_proto protoreflect.FileDescriptor var file_poktroll_gateway_params_proto_rawDesc = []byte{ @@ -417,22 +506,29 @@ var file_poktroll_gateway_params_proto_rawDesc = []byte{ 0x61, 0x79, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, + 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, - 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2c, 0x0a, 0x06, 0x50, 0x61, - 0x72, 0x61, 0x6d, 0x73, 0x3a, 0x22, 0xe8, 0xa0, 0x1f, 0x01, 0x8a, 0xe7, 0xb0, 0x2a, 0x19, 0x70, - 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x78, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, - 0x79, 0x2f, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0xab, 0x01, 0xd8, 0xe2, 0x1e, 0x01, 0x0a, - 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, - 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, 0x0b, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x21, 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, - 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0xa2, 0x02, 0x03, 0x50, 0x47, 0x58, 0xaa, 0x02, 0x10, - 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, - 0xca, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x47, 0x61, 0x74, 0x65, - 0x77, 0x61, 0x79, 0xe2, 0x02, 0x1c, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x47, - 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0xea, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x47, - 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x73, 0x0a, 0x06, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x12, 0x45, 0x0a, 0x09, 0x6d, 0x69, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x6b, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, + 0x69, 0x6e, 0x42, 0x0d, 0xea, 0xde, 0x1f, 0x09, 0x6d, 0x69, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x6b, + 0x65, 0x52, 0x08, 0x6d, 0x69, 0x6e, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x3a, 0x22, 0xe8, 0xa0, 0x1f, + 0x01, 0x8a, 0xe7, 0xb0, 0x2a, 0x19, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x78, + 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, + 0xab, 0x01, 0xd8, 0xe2, 0x1e, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, 0x0b, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x21, 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, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0xa2, 0x02, + 0x03, 0x50, 0x47, 0x58, 0xaa, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, + 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0xca, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x5c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0xe2, 0x02, 0x1c, 0x50, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x5c, 0x47, 0x50, + 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -449,14 +545,16 @@ func file_poktroll_gateway_params_proto_rawDescGZIP() []byte { var file_poktroll_gateway_params_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_poktroll_gateway_params_proto_goTypes = []interface{}{ - (*Params)(nil), // 0: poktroll.gateway.Params + (*Params)(nil), // 0: poktroll.gateway.Params + (*v1beta1.Coin)(nil), // 1: cosmos.base.v1beta1.Coin } var file_poktroll_gateway_params_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name + 1, // 0: poktroll.gateway.Params.min_stake:type_name -> cosmos.base.v1beta1.Coin + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name } func init() { file_poktroll_gateway_params_proto_init() } diff --git a/config.yml b/config.yml index 4c5215779..087e86b2c 100644 --- a/config.yml +++ b/config.yml @@ -223,6 +223,9 @@ genesis: amount: "1000068" denom: upokt gateway: + params: + # TODO_MAINNER: Determine realistic amount for minimum gateway stake amount. + min_stake: 100 gatewayList: - address: pokt15vzxjqklzjtlz7lahe8z2dfe9nm5vxwwmscne4 stake: diff --git a/e2e/tests/parse_params_test.go b/e2e/tests/parse_params_test.go index 43e9fef2b..345fb4949 100644 --- a/e2e/tests/parse_params_test.go +++ b/e2e/tests/parse_params_test.go @@ -16,6 +16,7 @@ import ( "github.com/pokt-network/poktroll/app/volatile" apptypes "github.com/pokt-network/poktroll/x/application/types" + gatewaytypes "github.com/pokt-network/poktroll/x/gateway/types" prooftypes "github.com/pokt-network/poktroll/x/proof/types" servicetypes "github.com/pokt-network/poktroll/x/service/types" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" @@ -94,7 +95,9 @@ func (s *suite) paramsMapToMsgUpdateParams(moduleName string, paramsMap paramsAn msgUpdateParams = s.newAppMsgUpdateParams(paramsMap) case servicetypes.ModuleName: msgUpdateParams = s.newServiceMsgUpdateParams(paramsMap) - // NB: gateway & supplier modules currently have no parameters + case gatewaytypes.ModuleName: + msgUpdateParams = s.newGatewayMsgUpdateParams(paramsMap) + // NB: supplier module currently has no parameters default: err := fmt.Errorf("ERROR: unexpected module name %q", moduleName) s.Fatal(err) @@ -388,3 +391,20 @@ func (s *suite) newServiceMsgUpdateParam(authority string, param paramAny) (msg return msg } + +func (s *suite) newGatewayMsgUpdateParam(authority string, param paramAny) (msg proto.Message) { + switch param.typeStr { + case "coin": + msg = proto.Message(&gatewaytypes.MsgUpdateParam{ + Authority: authority, + Name: param.name, + AsType: &gatewaytypes.MsgUpdateParam_AsCoin{ + AsCoin: param.value.(*cosmostypes.Coin), + }, + }) + default: + s.Fatalf("unexpected param type %q for %s module", param.typeStr, tokenomicstypes.ModuleName) + } + + return msg +} diff --git a/proto/poktroll/gateway/params.proto b/proto/poktroll/gateway/params.proto index 4b1671aad..49ece5ac3 100644 --- a/proto/poktroll/gateway/params.proto +++ b/proto/poktroll/gateway/params.proto @@ -5,10 +5,13 @@ option go_package = "github.com/pokt-network/poktroll/x/gateway/types"; option (gogoproto.stable_marshaler_all) = true; import "amino/amino.proto"; +import "cosmos/base/v1beta1/coin.proto"; import "gogoproto/gogo.proto"; // Params defines the parameters for the module. message Params { option (amino.name) = "poktroll/x/gateway/Params"; option (gogoproto.equal) = true; + + cosmos.base.v1beta1.Coin min_stake = 1 [(gogoproto.jsontag) = "min_stake"]; } diff --git a/x/gateway/keeper/msg_server_update_param.go b/x/gateway/keeper/msg_server_update_param.go index b1f5d25ef..835d0701d 100644 --- a/x/gateway/keeper/msg_server_update_param.go +++ b/x/gateway/keeper/msg_server_update_param.go @@ -3,15 +3,45 @@ package keeper import ( "context" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/pokt-network/poktroll/x/gateway/types" ) -func (k msgServer) UpdateParam(goCtx context.Context, msg *types.MsgUpdateParam) (*types.MsgUpdateParamResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) +func (k msgServer) UpdateParam(ctx context.Context, msg *types.MsgUpdateParam) (*types.MsgUpdateParamResponse, error) { + if err := msg.ValidateBasic(); err != nil { + return nil, err + } - // TODO: Handling the message - _ = ctx + if k.GetAuthority() != msg.Authority { + return nil, types.ErrGatewayInvalidSigner.Wrapf("invalid authority; expected %s, got %s", k.GetAuthority(), msg.Authority) + } - return &types.MsgUpdateParamResponse{}, nil + params := k.GetParams(ctx) + + switch msg.Name { + case types.ParamMinStake: + value, ok := msg.AsType.(*types.MsgUpdateParam_AsCoin) + if !ok { + return nil, types.ErrGatewayParamInvalid.Wrapf("unsupported value type for %s param: %T", msg.Name, msg.AsType) + } + + params.MinStake = value.AsCoin + default: + return nil, types.ErrGatewayParamInvalid.Wrapf("unsupported param %q", msg.Name) + } + + // Perform a global validation on all params, which includes the updated param. + // This is needed to ensure that the updated param is valid in the context of all other params. + if err := params.Validate(); err != nil { + return nil, err + } + + 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/gateway/types/errors.go b/x/gateway/types/errors.go index 54bf3f388..6dc182445 100644 --- a/x/gateway/types/errors.go +++ b/x/gateway/types/errors.go @@ -11,4 +11,5 @@ var ( ErrGatewayInvalidStake = sdkerrors.Register(ModuleName, 1102, "invalid gateway stake") ErrGatewayUnauthorized = sdkerrors.Register(ModuleName, 1103, "unauthorized signer") ErrGatewayNotFound = sdkerrors.Register(ModuleName, 1104, "gateway not found") + ErrGatewayParamInvalid = sdkerrors.Register(ModuleName, 1105, "the provided param is invalid") ) diff --git a/x/gateway/types/message_update_param.go b/x/gateway/types/message_update_param.go index d5e798ef8..6ce071438 100644 --- a/x/gateway/types/message_update_param.go +++ b/x/gateway/types/message_update_param.go @@ -1,6 +1,8 @@ package types import ( + "fmt" + errorsmod "cosmossdk.io/errors" cosmostypes "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -8,11 +10,20 @@ import ( var _ cosmostypes.Msg = (*MsgUpdateParam)(nil) -func NewMsgUpdateParam(authority string, name string, asType string) *MsgUpdateParam { +func NewMsgUpdateParam(authority string, name string, value any) *MsgUpdateParam { + var valueAsType isMsgUpdateParam_AsType + + switch v := value.(type) { + case *cosmostypes.Coin: + valueAsType = &MsgUpdateParam_AsCoin{AsCoin: v} + default: + panic(fmt.Sprintf("unexpected param value type: %T", value)) + } + return &MsgUpdateParam{ Authority: authority, Name: name, - AsType: asType, + AsType: valueAsType, } } @@ -21,5 +32,29 @@ func (msg *MsgUpdateParam) ValidateBasic() error { if err != nil { return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid authority address (%s)", err) } + + // Parameter value cannot be nil. + if msg.AsType == nil { + return ErrGatewayParamInvalid.Wrap("missing param AsType") + } + + // Parameter name must be supported by this module. + switch msg.Name { + case ParamMinStake: + return msg.paramTypeIsCoin() + default: + return ErrGatewayParamInvalid.Wrapf("unsupported param %q", msg.Name) + } +} + +func (msg *MsgUpdateParam) paramTypeIsCoin() error { + _, ok := msg.AsType.(*MsgUpdateParam_AsCoin) + if !ok { + return ErrGatewayParamInvalid.Wrapf( + "invalid type for param %q expected %T type: %T", + msg.Name, &MsgUpdateParam_AsCoin{}, msg.AsType, + ) + } + return nil } diff --git a/x/gateway/types/params.go b/x/gateway/types/params.go index 95b0cf8a2..e995e4717 100644 --- a/x/gateway/types/params.go +++ b/x/gateway/types/params.go @@ -1,8 +1,20 @@ package types -import paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" +import ( + cosmostypes "github.com/cosmos/cosmos-sdk/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" -var _ paramtypes.ParamSet = (*Params)(nil) + "github.com/pokt-network/poktroll/app/volatile" +) + +var ( + _ paramtypes.ParamSet = (*Params)(nil) + + // TODO_MAINNET: Determine a sensible default value for the min stake amount. + KeyMinStake = []byte("MinStake") + ParamMinStake = "min_stake" + DefaultMinStake = cosmostypes.NewInt64Coin(volatile.DenomuPOKT, 100) +) // ParamKeyTable the param key table for launch module func ParamKeyTable() paramtypes.KeyTable { @@ -10,21 +22,63 @@ func ParamKeyTable() paramtypes.KeyTable { } // NewParams creates a new Params instance -func NewParams() Params { - return Params{} +func NewParams(minStake *cosmostypes.Coin) Params { + return Params{ + MinStake: minStake, + } } // DefaultParams returns a default set of parameters func DefaultParams() Params { - return NewParams() + return NewParams(&DefaultMinStake) } // ParamSetPairs get the params.ParamSet func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { - return paramtypes.ParamSetPairs{} + return paramtypes.ParamSetPairs{ + paramtypes.NewParamSetPair( + KeyMinStake, + &p.MinStake, + ValidateMinStake, + ), + } } // Validate validates the set of params func (p Params) Validate() error { + if err := ValidateMinStake(p.MinStake); err != nil { + return err + } + return nil +} + +func ValidateMinStake(minStakeAny any) error { + minStakeCoin, ok := minStakeAny.(*cosmostypes.Coin) + if !ok { + return ErrGatewayParamInvalid.Wrapf("invalid type for %s: %T; expected *cosmostypes.Coin", ParamMinStake, minStakeAny) + } + + if err := ValidateMinStakeDenom(minStakeCoin); err != nil { + return err + } + + if err := ValidateMinStakeAboveZero(minStakeCoin); err != nil { + return err + } + + return nil +} + +func ValidateMinStakeDenom(minStakeCoin *cosmostypes.Coin) error { + if minStakeCoin.Denom != volatile.DenomuPOKT { + return ErrGatewayParamInvalid.Wrapf("min stake denom must be %s: %s", volatile.DenomuPOKT, minStakeCoin) + } + return nil +} + +func ValidateMinStakeAboveZero(minStakeCoin *cosmostypes.Coin) error { + if minStakeCoin.Amount.Int64() <= 0 { + return ErrGatewayParamInvalid.Wrapf("min stake amount must be greater than zero: %s", minStakeCoin) + } return nil } diff --git a/x/gateway/types/params.pb.go b/x/gateway/types/params.pb.go index ceb9f5ead..d89d0ba7a 100644 --- a/x/gateway/types/params.pb.go +++ b/x/gateway/types/params.pb.go @@ -5,6 +5,7 @@ package types import ( fmt "fmt" + types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" @@ -26,6 +27,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Params defines the parameters for the module. type Params struct { + MinStake *types.Coin `protobuf:"bytes,1,opt,name=min_stake,json=minStake,proto3" json:"min_stake"` } func (m *Params) Reset() { *m = Params{} } @@ -57,6 +59,13 @@ func (m *Params) XXX_DiscardUnknown() { var xxx_messageInfo_Params proto.InternalMessageInfo +func (m *Params) GetMinStake() *types.Coin { + if m != nil { + return m.MinStake + } + return nil +} + func init() { proto.RegisterType((*Params)(nil), "poktroll.gateway.Params") } @@ -64,19 +73,24 @@ func init() { func init() { proto.RegisterFile("poktroll/gateway/params.proto", fileDescriptor_23ed52a392489486) } var fileDescriptor_23ed52a392489486 = []byte{ - // 180 bytes of a gzipped FileDescriptorProto + // 258 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2d, 0xc8, 0xcf, 0x2e, 0x29, 0xca, 0xcf, 0xc9, 0xd1, 0x4f, 0x4f, 0x2c, 0x49, 0x2d, 0x4f, 0xac, 0xd4, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x80, 0x49, 0xeb, 0x41, 0xa5, - 0xa5, 0x04, 0x13, 0x73, 0x33, 0xf3, 0xf2, 0xf5, 0xc1, 0x24, 0x44, 0x91, 0x94, 0x48, 0x7a, 0x7e, - 0x7a, 0x3e, 0x98, 0xa9, 0x0f, 0x62, 0x41, 0x44, 0x95, 0x74, 0xb8, 0xd8, 0x02, 0xc0, 0x46, 0x59, - 0x29, 0xbd, 0x58, 0x20, 0xcf, 0xd8, 0xf5, 0x7c, 0x83, 0x96, 0x24, 0xdc, 0xb2, 0x0a, 0xb8, 0x75, - 0x10, 0x35, 0x4e, 0x7e, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0x78, 0xe3, 0x91, 0x1c, - 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, - 0x1c, 0x43, 0x94, 0x41, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x3e, 0xc8, - 0x0c, 0xdd, 0xbc, 0xd4, 0x92, 0xf2, 0xfc, 0xa2, 0x6c, 0x7d, 0x2c, 0x06, 0x96, 0x54, 0x16, 0xa4, - 0x16, 0x27, 0xb1, 0x81, 0x1d, 0x61, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0xb5, 0xe9, 0x34, 0xfe, - 0xe0, 0x00, 0x00, 0x00, + 0xa5, 0x04, 0x13, 0x73, 0x33, 0xf3, 0xf2, 0xf5, 0xc1, 0x24, 0x44, 0x91, 0x94, 0x5c, 0x72, 0x7e, + 0x71, 0x6e, 0x7e, 0xb1, 0x7e, 0x52, 0x62, 0x71, 0xaa, 0x7e, 0x99, 0x61, 0x52, 0x6a, 0x49, 0xa2, + 0xa1, 0x7e, 0x72, 0x7e, 0x66, 0x1e, 0x54, 0x5e, 0x24, 0x3d, 0x3f, 0x3d, 0x1f, 0xcc, 0xd4, 0x07, + 0xb1, 0x20, 0xa2, 0x4a, 0xc5, 0x5c, 0x6c, 0x01, 0x60, 0xab, 0x84, 0x5c, 0xb9, 0x38, 0x73, 0x33, + 0xf3, 0xe2, 0x8b, 0x4b, 0x12, 0xb3, 0x53, 0x25, 0x18, 0x15, 0x18, 0x35, 0xb8, 0x8d, 0x24, 0xf5, + 0x20, 0x66, 0xea, 0x81, 0xcc, 0xd4, 0x83, 0x9a, 0xa9, 0xe7, 0x9c, 0x9f, 0x99, 0xe7, 0xc4, 0xfb, + 0xea, 0x9e, 0x3c, 0x42, 0x7d, 0x10, 0x47, 0x6e, 0x66, 0x5e, 0x30, 0x88, 0x65, 0xa5, 0xf4, 0x62, + 0x81, 0x3c, 0x63, 0xd7, 0xf3, 0x0d, 0x5a, 0x92, 0x70, 0x3f, 0x55, 0xc0, 0x7d, 0x05, 0xb1, 0xca, + 0xc9, 0xef, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x6f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, + 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, + 0x32, 0x48, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x07, 0x99, 0xa1, 0x9b, + 0x97, 0x5a, 0x52, 0x9e, 0x5f, 0x94, 0xad, 0x8f, 0xc5, 0xc0, 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, + 0x36, 0xb0, 0x5f, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xbc, 0xcb, 0xc3, 0x2b, 0x47, 0x01, + 0x00, 0x00, } func (this *Params) Equal(that interface{}) bool { @@ -98,6 +112,9 @@ func (this *Params) Equal(that interface{}) bool { } else if this == nil { return false } + if !this.MinStake.Equal(that1.MinStake) { + return false + } return true } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -120,6 +137,18 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.MinStake != nil { + { + size, err := m.MinStake.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } return len(dAtA) - i, nil } @@ -140,6 +169,10 @@ func (m *Params) Size() (n int) { } var l int _ = l + if m.MinStake != nil { + l = m.MinStake.Size() + n += 1 + l + sovParams(uint64(l)) + } return n } @@ -178,6 +211,42 @@ func (m *Params) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinStake", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MinStake == nil { + m.MinStake = &types.Coin{} + } + if err := m.MinStake.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipParams(dAtA[iNdEx:]) From 83c1d7477243785066627f4352a29edcc915958f Mon Sep 17 00:00:00 2001 From: Bryan White Date: Mon, 23 Sep 2024 21:48:11 +0200 Subject: [PATCH 008/139] chore: cleanup makefiles and param update JSON files --- makefiles/params.mk | 12 ++++++++++++ tools/scripts/params/tokenomics_all.json | 13 ------------- ...kenomics_compute_units_to_tokens_multiplier.json | 12 ------------ 3 files changed, 12 insertions(+), 25 deletions(-) delete mode 100644 tools/scripts/params/tokenomics_all.json delete mode 100644 tools/scripts/params/tokenomics_compute_units_to_tokens_multiplier.json diff --git a/makefiles/params.mk b/makefiles/params.mk index 58aeeba8f..dbf8a92d7 100644 --- a/makefiles/params.mk +++ b/makefiles/params.mk @@ -97,6 +97,18 @@ params_update_shared_proof_window_close_offset_blocks: ## Update the shared modu params_update_shared_compute_units_to_tokens_multiplier: ## Update the shared module compute_units_to_tokens_multiplier param poktrolld tx authz exec ./tools/scripts/params/shared_compute_units_to_tokens_multiplier.json $(PARAM_FLAGS) +### Service Module Params ### +.PHONY: params_get_service +params_get_service: ## Get the service module params + poktrolld query service params --node $(POCKET_NODE) + +.PHONY: params_update_service_all +params_update_service_all: ## Update the session module params + poktrolld tx authz exec ./tools/scripts/params/service_all.json $(PARAM_FLAGS) + +.PHONY: params_get_service +params_get_service: ## Get the service module params + poktrolld query service params --node $(POCKET_NODE) .PHONY: params_query_all params_query_all: check_jq ## Query the params from all available modules diff --git a/tools/scripts/params/tokenomics_all.json b/tools/scripts/params/tokenomics_all.json deleted file mode 100644 index 4194f89d0..000000000 --- a/tools/scripts/params/tokenomics_all.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "body": { - "messages": [ - { - "@type": "/poktroll.tokenomics.MsgUpdateParams", - "authority": "pokt10d07y265gmmuvt4z0w9aw880jnsr700j8yv32t", - "params": { - "compute_units_to_tokens_multiplier": "42" - } - } - ] - } -} \ No newline at end of file diff --git a/tools/scripts/params/tokenomics_compute_units_to_tokens_multiplier.json b/tools/scripts/params/tokenomics_compute_units_to_tokens_multiplier.json deleted file mode 100644 index 363bb1350..000000000 --- a/tools/scripts/params/tokenomics_compute_units_to_tokens_multiplier.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "body": { - "messages": [ - { - "@type": "/poktroll.tokenomics.MsgUpdateParam", - "authority": "pokt10d07y265gmmuvt4z0w9aw880jnsr700j8yv32t", - "name": "compute_units_to_tokens_multiplier", - "as_int64": "42" - } - ] - } -} From 55e6a3146f2afee955c8810c68343daaea59bc84 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Mon, 23 Sep 2024 21:48:38 +0200 Subject: [PATCH 009/139] chore: add gateway module param make targets --- makefiles/params.mk | 13 +++++++++++++ tools/scripts/params/gateway_min_stake.json | 12 ++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 tools/scripts/params/gateway_min_stake.json diff --git a/makefiles/params.mk b/makefiles/params.mk index dbf8a92d7..8ccdf9f36 100644 --- a/makefiles/params.mk +++ b/makefiles/params.mk @@ -110,6 +110,19 @@ params_update_service_all: ## Update the session module params params_get_service: ## Get the service module params poktrolld query service params --node $(POCKET_NODE) +### Gateway Module Params ### +.PHONY: params_get_gateway +params_get_gateway: ## Get the gateway module params + poktrolld query gateway params --node $(POCKET_NODE) + +.PHONY: params_update_gateway_all +params_update_gateway_all: ## Update the session module params + poktrolld tx authz exec ./tools/scripts/params/gateway_all.json $(PARAM_FLAGS) + +.PHONY: params_update_gateway_min_stake +params_update_gateway_min_stake: ## Update the gateway module min_stake param + poktrolld tx authz exec ./tools/scripts/params/gateway_min_stake.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/tools/scripts/params/gateway_min_stake.json b/tools/scripts/params/gateway_min_stake.json new file mode 100644 index 000000000..fb30d5351 --- /dev/null +++ b/tools/scripts/params/gateway_min_stake.json @@ -0,0 +1,12 @@ +{ + "body": { + "messages": [ + { + "@type": "/poktroll.gateway.MsgUpdateParam", + "authority": "pokt10d07y265gmmuvt4z0w9aw880jnsr700j8yv32t", + "name": "min_stake", + "as_int64": "42" + } + ] + } +} From ddd68bbb05abcaad420e666e995a111b1b715c45 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Thu, 26 Sep 2024 09:28:57 +0200 Subject: [PATCH 010/139] refctor: consolidate param config types --- testutil/integration/suites/param_configs.go | 47 ++++++++++++++++++++ testutil/integration/suites/update_params.go | 47 -------------------- 2 files changed, 47 insertions(+), 47 deletions(-) diff --git a/testutil/integration/suites/param_configs.go b/testutil/integration/suites/param_configs.go index 2e95a7c41..ccc57583d 100644 --- a/testutil/integration/suites/param_configs.go +++ b/testutil/integration/suites/param_configs.go @@ -16,6 +16,53 @@ import ( tokenomicstypes "github.com/pokt-network/poktroll/x/tokenomics/types" ) +// ParamType is a type alias for a module parameter type. It is the string that +// is returned when calling reflect.Value#Type()#Name() on a module parameter. +type ParamType = string + +const ( + ParamTypeInt64 ParamType = "int64" + ParamTypeUint64 ParamType = "uint64" + ParamTypeFloat32 ParamType = "float32" + ParamTypeString ParamType = "string" + ParamTypeBytes ParamType = "uint8" + ParamTypeCoin ParamType = "Coin" +) + +// ModuleParamConfig holds type information about a module's parameters update +// message(s) along with default and valid non-default values and a query constructor +// function for the module. It is used by ParamsSuite to construct and send +// parameter update messages and assert on their results. +type ModuleParamConfig struct { + ParamsMsgs ModuleParamsMessages + // ParamTypes is a map of parameter types to their respective MsgUpdateParam_As* + // types which satisfy the oneof for the MsgUpdateParam#AsType field. Each AsType + // type which the module supports should be included in this map. + ParamTypes map[ParamType]any + // ValidParams is a set of parameters which are expected to be valid when used + // together AND when used individually, where the reamining parameters are set + // to their default values. + ValidParams any + DefaultParams any + NewParamClientFn any +} + +// ModuleParamsMessages holds a reference to each of the params-related message +// types for a given module. The values are only used for their type information +// which is obtained via reflection. The values are not used for their actual +// message contents and MAY be the zero value. +// If MsgUpdateParam is omitted (i.e. nil), ParamsSuite will assume that +// this module does not support individual parameter updates (i.e. MsgUpdateParam). +// In this case, MsgUpdateParamResponse SHOULD also be omitted. +type ModuleParamsMessages struct { + MsgUpdateParams any + MsgUpdateParamsResponse any + MsgUpdateParam any + MsgUpdateParamResponse any + QueryParamsRequest any + QueryParamsResponse any +} + var ( ValidAddServiceFeeCoin = cosmostypes.NewInt64Coin(volatile.DenomuPOKT, 1000000001) ValidProofMissingPenaltyCoin = cosmostypes.NewInt64Coin(volatile.DenomuPOKT, 500) diff --git a/testutil/integration/suites/update_params.go b/testutil/integration/suites/update_params.go index 243c3f3a2..dbb859397 100644 --- a/testutil/integration/suites/update_params.go +++ b/testutil/integration/suites/update_params.go @@ -19,58 +19,11 @@ import ( tokenomicstypes "github.com/pokt-network/poktroll/x/tokenomics/types" ) -// ParamType is a type alias for a module parameter type. It is the string that -// is returned when calling reflect.Value#Type()#Name() on a module parameter. -type ParamType = string - -const ( - ParamTypeInt64 ParamType = "int64" - ParamTypeUint64 ParamType = "uint64" - ParamTypeFloat32 ParamType = "float32" - ParamTypeString ParamType = "string" - ParamTypeBytes ParamType = "uint8" - ParamTypeCoin ParamType = "Coin" -) - const ( MsgUpdateParamsName = "MsgUpdateParams" MsgUpdateParamName = "MsgUpdateParam" ) -// ModuleParamConfig holds type information about a module's parameters update -// message(s) along with default and valid non-default values and a query constructor -// function for the module. It is used by ParamsSuite to construct and send -// parameter update messages and assert on their results. -type ModuleParamConfig struct { - ParamsMsgs ModuleParamsMessages - // ParamTypes is a map of parameter types to their respective MsgUpdateParam_As* - // types which satisfy the oneof for the MsgUpdateParam#AsType field. Each AsType - // type which the module supports should be included in this map. - ParamTypes map[ParamType]any - // ValidParams is a set of parameters which are expected to be valid when used - // together AND when used individually, where the reamining parameters are set - // to their default values. - ValidParams any - DefaultParams any - NewParamClientFn any -} - -// ModuleParamsMessages holds a reference to each of the params-related message -// types for a given module. The values are only used for their type information -// which is obtained via reflection. The values are not used for their actual -// message contents and MAY be the zero value. -// If MsgUpdateParam is omitted (i.e. nil), ParamsSuite will assume that -// this module does not support individual parameter updates (i.e. MsgUpdateParam). -// In this case, MsgUpdateParamResponse SHOULD also be omitted. -type ModuleParamsMessages struct { - MsgUpdateParams any - MsgUpdateParamsResponse any - MsgUpdateParam any - MsgUpdateParamResponse any - QueryParamsRequest any - QueryParamsResponse any -} - var ( // MsgUpdateParamEnabledModuleNames is a list of module names which support // individual parameter updates (i.e. MsgUpdateParam). It is initialized in From fa8caf6a1232abfe40a1d15eb2f9a4c6fc5be303 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Thu, 26 Sep 2024 09:52:53 +0200 Subject: [PATCH 011/139] tests: improve error messaging --- testutil/integration/suites/update_params.go | 24 ++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/testutil/integration/suites/update_params.go b/testutil/integration/suites/update_params.go index dbb859397..bc1342c0d 100644 --- a/testutil/integration/suites/update_params.go +++ b/testutil/integration/suites/update_params.go @@ -1,7 +1,10 @@ package suites import ( + "os" + "path/filepath" "reflect" + "strings" "testing" cosmostypes "github.com/cosmos/cosmos-sdk/types" @@ -44,15 +47,28 @@ var ( tokenomicstypes.ModuleName: TokenomicsModuleParamConfig, } - _ IntegrationSuite = (*ParamsSuite)(nil) + // paramConfigsPath is the path, relative to the project root, to the go file + // containing the ModuleParamConfig declaration. It is set in init() and is + // interpolated into error messages when a module's ModuleParamConfig seems + // misconfigured (e.g. missing expected values). + paramConfigsPath string ) +var _ IntegrationSuite = (*ParamsSuite)(nil) + func init() { for moduleName, moduleParamCfg := range ModuleParamConfigMap { if moduleParamCfg.ParamsMsgs.MsgUpdateParam != nil { MsgUpdateParamEnabledModuleNames = append(MsgUpdateParamEnabledModuleNames, moduleName) } } + + // Take the package path of the ModuleParamConfig type and drop the github.com// prefix. + paramConfigsPkgPath := reflect.TypeOf(ModuleParamConfig{}).PkgPath() + paramConfigsPathParts := strings.Split(paramConfigsPkgPath, string(os.PathSeparator)) + paramConfigsDir := filepath.Join(paramConfigsPathParts[3:]...) + // NB: The file name is not included in the package path and must be updated here if it changes. + paramConfigsPath = filepath.Join(paramConfigsDir, "param_configs.go") } // ParamsSuite is an integration test suite that provides helper functions for @@ -215,7 +231,11 @@ func (s *ParamsSuite) RunUpdateParamAsSigner( msgUpdateParamValue.Elem().FieldByName("Name").SetString(cases.ToSnakeCase(paramName)) - msgAsTypeStruct := moduleCfg.ParamTypes[paramType] + msgAsTypeStruct, hasParamType := moduleCfg.ParamTypes[paramType] + require.Truef(t, hasParamType, + "module %q does not include param type %q in its ModuleParamConfig#ParamTypes; consider updating %s", + moduleName, paramType, paramConfigsPath, + ) msgAsTypeType := reflect.TypeOf(msgAsTypeStruct) msgAsTypeValue := reflect.New(msgAsTypeType) switch paramType { From ae006e2fb34f90701e71dad0be9af4bcc9d48a72 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Thu, 26 Sep 2024 09:53:24 +0200 Subject: [PATCH 012/139] tests: add coverage over gateway min stake param updates --- testutil/integration/suites/param_configs.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/testutil/integration/suites/param_configs.go b/testutil/integration/suites/param_configs.go index ccc57583d..13c8b8330 100644 --- a/testutil/integration/suites/param_configs.go +++ b/testutil/integration/suites/param_configs.go @@ -69,6 +69,7 @@ var ( ValidProofSubmissionFeeCoin = cosmostypes.NewInt64Coin(volatile.DenomuPOKT, 5000000) ValidProofRequirementThresholdCoin = cosmostypes.NewInt64Coin(volatile.DenomuPOKT, 100) ValidRelayDifficultyTargetHash, _ = hex.DecodeString("00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff") + ValidActorMinStake = cosmostypes.NewInt64Coin(volatile.DenomuPOKT, 100) SharedModuleParamConfig = ModuleParamConfig{ ParamsMsgs: ModuleParamsMessages{ @@ -149,10 +150,17 @@ var ( ParamsMsgs: ModuleParamsMessages{ MsgUpdateParams: gatewaytypes.MsgUpdateParams{}, MsgUpdateParamsResponse: gatewaytypes.MsgUpdateParamsResponse{}, + MsgUpdateParam: gatewaytypes.MsgUpdateParam{}, + MsgUpdateParamResponse: gatewaytypes.MsgUpdateParamResponse{}, QueryParamsRequest: gatewaytypes.QueryParamsRequest{}, QueryParamsResponse: gatewaytypes.QueryParamsResponse{}, }, - ValidParams: gatewaytypes.Params{}, + ValidParams: gatewaytypes.Params{ + MinStake: &ValidActorMinStake, + }, + ParamTypes: map[ParamType]any{ + ParamTypeCoin: gatewaytypes.MsgUpdateParam_AsCoin{}, + }, DefaultParams: gatewaytypes.DefaultParams(), NewParamClientFn: gatewaytypes.NewQueryClient, } From e92e3b1d91052b1a3b57cab96226c922fb9e3ffc Mon Sep 17 00:00:00 2001 From: Bryan White Date: Thu, 26 Sep 2024 11:05:07 +0200 Subject: [PATCH 013/139] =?UTF-8?q?chore:=20add=20as=5Fcoin=20as=5Ftype=20?= =?UTF-8?q?type=20=F0=9F=98=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/poktroll/gateway/tx.pulsar.go | 265 +++++++++++++++++++----------- proto/poktroll/gateway/tx.proto | 4 +- x/gateway/types/tx.pb.go | 183 ++++++++++++++------- 3 files changed, 301 insertions(+), 151 deletions(-) diff --git a/api/poktroll/gateway/tx.pulsar.go b/api/poktroll/gateway/tx.pulsar.go index 4625908b1..046dba6a6 100644 --- a/api/poktroll/gateway/tx.pulsar.go +++ b/api/poktroll/gateway/tx.pulsar.go @@ -2507,7 +2507,7 @@ var ( md_MsgUpdateParam protoreflect.MessageDescriptor fd_MsgUpdateParam_authority protoreflect.FieldDescriptor fd_MsgUpdateParam_name protoreflect.FieldDescriptor - fd_MsgUpdateParam_as_type protoreflect.FieldDescriptor + fd_MsgUpdateParam_as_coin protoreflect.FieldDescriptor ) func init() { @@ -2515,7 +2515,7 @@ func init() { md_MsgUpdateParam = File_poktroll_gateway_tx_proto.Messages().ByName("MsgUpdateParam") fd_MsgUpdateParam_authority = md_MsgUpdateParam.Fields().ByName("authority") fd_MsgUpdateParam_name = md_MsgUpdateParam.Fields().ByName("name") - fd_MsgUpdateParam_as_type = md_MsgUpdateParam.Fields().ByName("as_type") + fd_MsgUpdateParam_as_coin = md_MsgUpdateParam.Fields().ByName("as_coin") } var _ protoreflect.Message = (*fastReflection_MsgUpdateParam)(nil) @@ -2595,10 +2595,14 @@ func (x *fastReflection_MsgUpdateParam) Range(f func(protoreflect.FieldDescripto return } } - if x.AsType != "" { - value := protoreflect.ValueOfString(x.AsType) - if !f(fd_MsgUpdateParam_as_type, value) { - return + if x.AsType != nil { + switch o := x.AsType.(type) { + case *MsgUpdateParam_AsCoin: + v := o.AsCoin + value := protoreflect.ValueOfMessage(v.ProtoReflect()) + if !f(fd_MsgUpdateParam_as_coin, value) { + return + } } } } @@ -2620,8 +2624,14 @@ func (x *fastReflection_MsgUpdateParam) Has(fd protoreflect.FieldDescriptor) boo return x.Authority != "" case "poktroll.gateway.MsgUpdateParam.name": return x.Name != "" - case "poktroll.gateway.MsgUpdateParam.as_type": - return x.AsType != "" + case "poktroll.gateway.MsgUpdateParam.as_coin": + if x.AsType == nil { + return false + } else if _, ok := x.AsType.(*MsgUpdateParam_AsCoin); ok { + return true + } else { + return false + } default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParam")) @@ -2642,8 +2652,8 @@ func (x *fastReflection_MsgUpdateParam) Clear(fd protoreflect.FieldDescriptor) { x.Authority = "" case "poktroll.gateway.MsgUpdateParam.name": x.Name = "" - case "poktroll.gateway.MsgUpdateParam.as_type": - x.AsType = "" + case "poktroll.gateway.MsgUpdateParam.as_coin": + x.AsType = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParam")) @@ -2666,9 +2676,14 @@ func (x *fastReflection_MsgUpdateParam) Get(descriptor protoreflect.FieldDescrip case "poktroll.gateway.MsgUpdateParam.name": value := x.Name return protoreflect.ValueOfString(value) - case "poktroll.gateway.MsgUpdateParam.as_type": - value := x.AsType - return protoreflect.ValueOfString(value) + case "poktroll.gateway.MsgUpdateParam.as_coin": + if x.AsType == nil { + return protoreflect.ValueOfMessage((*v1beta1.Coin)(nil).ProtoReflect()) + } else if v, ok := x.AsType.(*MsgUpdateParam_AsCoin); ok { + return protoreflect.ValueOfMessage(v.AsCoin.ProtoReflect()) + } else { + return protoreflect.ValueOfMessage((*v1beta1.Coin)(nil).ProtoReflect()) + } default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParam")) @@ -2693,8 +2708,9 @@ func (x *fastReflection_MsgUpdateParam) Set(fd protoreflect.FieldDescriptor, val x.Authority = value.Interface().(string) case "poktroll.gateway.MsgUpdateParam.name": x.Name = value.Interface().(string) - case "poktroll.gateway.MsgUpdateParam.as_type": - x.AsType = value.Interface().(string) + case "poktroll.gateway.MsgUpdateParam.as_coin": + cv := value.Message().Interface().(*v1beta1.Coin) + x.AsType = &MsgUpdateParam_AsCoin{AsCoin: cv} default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParam")) @@ -2715,12 +2731,26 @@ func (x *fastReflection_MsgUpdateParam) Set(fd protoreflect.FieldDescriptor, val // 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.gateway.MsgUpdateParam.as_coin": + if x.AsType == nil { + value := &v1beta1.Coin{} + oneofValue := &MsgUpdateParam_AsCoin{AsCoin: value} + x.AsType = oneofValue + return protoreflect.ValueOfMessage(value.ProtoReflect()) + } + switch m := x.AsType.(type) { + case *MsgUpdateParam_AsCoin: + return protoreflect.ValueOfMessage(m.AsCoin.ProtoReflect()) + default: + value := &v1beta1.Coin{} + oneofValue := &MsgUpdateParam_AsCoin{AsCoin: value} + x.AsType = oneofValue + return protoreflect.ValueOfMessage(value.ProtoReflect()) + } case "poktroll.gateway.MsgUpdateParam.authority": panic(fmt.Errorf("field authority of message poktroll.gateway.MsgUpdateParam is not mutable")) case "poktroll.gateway.MsgUpdateParam.name": panic(fmt.Errorf("field name of message poktroll.gateway.MsgUpdateParam is not mutable")) - case "poktroll.gateway.MsgUpdateParam.as_type": - panic(fmt.Errorf("field as_type of message poktroll.gateway.MsgUpdateParam is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParam")) @@ -2738,8 +2768,9 @@ func (x *fastReflection_MsgUpdateParam) NewField(fd protoreflect.FieldDescriptor return protoreflect.ValueOfString("") case "poktroll.gateway.MsgUpdateParam.name": return protoreflect.ValueOfString("") - case "poktroll.gateway.MsgUpdateParam.as_type": - return protoreflect.ValueOfString("") + case "poktroll.gateway.MsgUpdateParam.as_coin": + value := &v1beta1.Coin{} + return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParam")) @@ -2753,6 +2784,14 @@ func (x *fastReflection_MsgUpdateParam) NewField(fd protoreflect.FieldDescriptor // 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.gateway.MsgUpdateParam.as_type": + if x.AsType == nil { + return nil + } + switch x.AsType.(type) { + case *MsgUpdateParam_AsCoin: + return x.Descriptor().Fields().ByName("as_coin") + } default: panic(fmt.Errorf("%s is not a oneof field in poktroll.gateway.MsgUpdateParam", d.FullName())) } @@ -2817,8 +2856,12 @@ func (x *fastReflection_MsgUpdateParam) ProtoMethods() *protoiface.Methods { if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } - l = len(x.AsType) - if l > 0 { + switch x := x.AsType.(type) { + case *MsgUpdateParam_AsCoin: + if x == nil { + break + } + l = options.Size(x.AsCoin) n += 1 + l + runtime.Sov(uint64(l)) } if x.unknownFields != nil { @@ -2850,10 +2893,18 @@ func (x *fastReflection_MsgUpdateParam) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if len(x.AsType) > 0 { - i -= len(x.AsType) - copy(dAtA[i:], x.AsType) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.AsType))) + switch x := x.AsType.(type) { + case *MsgUpdateParam_AsCoin: + encoded, err := options.Marshal(x.AsCoin) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) i-- dAtA[i] = 0x1a } @@ -2986,9 +3037,9 @@ func (x *fastReflection_MsgUpdateParam) ProtoMethods() *protoiface.Methods { iNdEx = postIndex case 3: if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AsType", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AsCoin", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -2998,23 +3049,26 @@ func (x *fastReflection_MsgUpdateParam) ProtoMethods() *protoiface.Methods { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.AsType = string(dAtA[iNdEx:postIndex]) + v := &v1beta1.Coin{} + if err := options.Unmarshal(dAtA[iNdEx:postIndex], v); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + x.AsType = &MsgUpdateParam_AsCoin{v} iNdEx = postIndex default: iNdEx = preIndex @@ -3713,7 +3767,10 @@ 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"` - AsType string `protobuf:"bytes,3,opt,name=as_type,json=asType,proto3" json:"as_type,omitempty"` + // Types that are assignable to AsType: + // + // *MsgUpdateParam_AsCoin + AsType isMsgUpdateParam_AsType `protobuf_oneof:"as_type"` } func (x *MsgUpdateParam) Reset() { @@ -3750,13 +3807,30 @@ func (x *MsgUpdateParam) GetName() string { return "" } -func (x *MsgUpdateParam) GetAsType() string { +func (x *MsgUpdateParam) GetAsType() isMsgUpdateParam_AsType { if x != nil { return x.AsType } - return "" + return nil } +func (x *MsgUpdateParam) GetAsCoin() *v1beta1.Coin { + if x, ok := x.GetAsType().(*MsgUpdateParam_AsCoin); ok { + return x.AsCoin + } + return nil +} + +type isMsgUpdateParam_AsType interface { + isMsgUpdateParam_AsType() +} + +type MsgUpdateParam_AsCoin struct { + AsCoin *v1beta1.Coin `protobuf:"bytes,3,opt,name=as_coin,json=asCoin,proto3,oneof"` +} + +func (*MsgUpdateParam_AsCoin) isMsgUpdateParam_AsType() {} + type MsgUpdateParamResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -3838,56 +3912,59 @@ var file_poktroll_gateway_tx_proto_rawDesc = []byte{ 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x3a, 0x0c, 0x82, 0xe7, 0xb0, 0x2a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x1b, 0x0a, 0x19, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, - 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x85, 0x01, 0x0a, 0x0e, 0x4d, + 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xba, 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, 0x17, 0x0a, 0x07, 0x61, 0x73, 0x5f, - 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x73, 0x54, 0x79, - 0x70, 0x65, 0x3a, 0x0e, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, - 0x74, 0x79, 0x22, 0x4a, 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, 0x30, 0x0a, 0x06, - 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, - 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x32, 0x87, - 0x03, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x5c, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x21, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x41, 0x0a, 0x07, 0x61, 0x73, 0x5f, + 0x63, 0x6f, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x0b, 0xea, 0xde, 0x1f, 0x07, 0x61, 0x73, 0x5f, 0x63, 0x6f, + 0x69, 0x6e, 0x48, 0x00, 0x52, 0x06, 0x61, 0x73, 0x43, 0x6f, 0x69, 0x6e, 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, 0x4a, 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, 0x30, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, + 0x65, 0x77, 0x61, 0x79, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x06, 0x70, 0x61, 0x72, + 0x61, 0x6d, 0x73, 0x32, 0x87, 0x03, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x5c, 0x0a, 0x0c, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x21, 0x2e, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x4d, + 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x29, + 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, + 0x79, 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, 0x5c, 0x0a, 0x0c, 0x53, 0x74, 0x61, + 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x21, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 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, 0x5c, 0x0a, 0x0c, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, - 0x65, 0x77, 0x61, 0x79, 0x12, 0x21, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, - 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, - 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x1a, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, - 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x74, - 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x62, 0x0a, 0x0e, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, - 0x65, 0x77, 0x61, 0x79, 0x12, 0x23, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, - 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, - 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x1a, 0x2b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, + 0x53, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x1a, 0x29, 0x2e, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, + 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x62, 0x0a, 0x0e, 0x55, 0x6e, 0x73, 0x74, 0x61, + 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x23, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x4d, 0x73, 0x67, - 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x59, 0x0a, 0x0b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x20, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x1a, 0x28, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, - 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 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, 0xa7, 0x01, 0xd8, 0xe2, 0x1e, 0x01, 0x0a, - 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, - 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, - 0x5a, 0x21, 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, 0x67, 0x61, 0x74, 0x65, - 0x77, 0x61, 0x79, 0xa2, 0x02, 0x03, 0x50, 0x47, 0x58, 0xaa, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, - 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0xca, 0x02, 0x10, 0x50, - 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0xe2, - 0x02, 0x1c, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x47, 0x61, 0x74, 0x65, 0x77, - 0x61, 0x79, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, - 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x47, 0x61, 0x74, 0x65, 0x77, - 0x61, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x1a, 0x2b, + 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, + 0x79, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, + 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x59, 0x0a, 0x0b, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x20, 0x2e, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x4d, 0x73, + 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x1a, 0x28, 0x2e, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 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, 0xa7, 0x01, + 0xd8, 0xe2, 0x1e, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x21, 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, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0xa2, 0x02, 0x03, 0x50, 0x47, 0x58, 0xaa, 0x02, + 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, + 0x79, 0xca, 0x02, 0x10, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x47, 0x61, 0x74, + 0x65, 0x77, 0x61, 0x79, 0xe2, 0x02, 0x1c, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, + 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0xea, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, + 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -3918,20 +3995,21 @@ var file_poktroll_gateway_tx_proto_goTypes = []interface{}{ var file_poktroll_gateway_tx_proto_depIdxs = []int32{ 8, // 0: poktroll.gateway.MsgUpdateParams.params:type_name -> poktroll.gateway.Params 9, // 1: poktroll.gateway.MsgStakeGateway.stake:type_name -> cosmos.base.v1beta1.Coin - 8, // 2: poktroll.gateway.MsgUpdateParamResponse.params:type_name -> poktroll.gateway.Params - 0, // 3: poktroll.gateway.Msg.UpdateParams:input_type -> poktroll.gateway.MsgUpdateParams - 2, // 4: poktroll.gateway.Msg.StakeGateway:input_type -> poktroll.gateway.MsgStakeGateway - 4, // 5: poktroll.gateway.Msg.UnstakeGateway:input_type -> poktroll.gateway.MsgUnstakeGateway - 6, // 6: poktroll.gateway.Msg.UpdateParam:input_type -> poktroll.gateway.MsgUpdateParam - 1, // 7: poktroll.gateway.Msg.UpdateParams:output_type -> poktroll.gateway.MsgUpdateParamsResponse - 3, // 8: poktroll.gateway.Msg.StakeGateway:output_type -> poktroll.gateway.MsgStakeGatewayResponse - 5, // 9: poktroll.gateway.Msg.UnstakeGateway:output_type -> poktroll.gateway.MsgUnstakeGatewayResponse - 7, // 10: poktroll.gateway.Msg.UpdateParam:output_type -> poktroll.gateway.MsgUpdateParamResponse - 7, // [7:11] is the sub-list for method output_type - 3, // [3:7] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name + 9, // 2: poktroll.gateway.MsgUpdateParam.as_coin:type_name -> cosmos.base.v1beta1.Coin + 8, // 3: poktroll.gateway.MsgUpdateParamResponse.params:type_name -> poktroll.gateway.Params + 0, // 4: poktroll.gateway.Msg.UpdateParams:input_type -> poktroll.gateway.MsgUpdateParams + 2, // 5: poktroll.gateway.Msg.StakeGateway:input_type -> poktroll.gateway.MsgStakeGateway + 4, // 6: poktroll.gateway.Msg.UnstakeGateway:input_type -> poktroll.gateway.MsgUnstakeGateway + 6, // 7: poktroll.gateway.Msg.UpdateParam:input_type -> poktroll.gateway.MsgUpdateParam + 1, // 8: poktroll.gateway.Msg.UpdateParams:output_type -> poktroll.gateway.MsgUpdateParamsResponse + 3, // 9: poktroll.gateway.Msg.StakeGateway:output_type -> poktroll.gateway.MsgStakeGatewayResponse + 5, // 10: poktroll.gateway.Msg.UnstakeGateway:output_type -> poktroll.gateway.MsgUnstakeGatewayResponse + 7, // 11: poktroll.gateway.Msg.UpdateParam:output_type -> poktroll.gateway.MsgUpdateParamResponse + 8, // [8:12] is the sub-list for method output_type + 4, // [4:8] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name } func init() { file_poktroll_gateway_tx_proto_init() } @@ -4038,6 +4116,9 @@ func file_poktroll_gateway_tx_proto_init() { } } } + file_poktroll_gateway_tx_proto_msgTypes[6].OneofWrappers = []interface{}{ + (*MsgUpdateParam_AsCoin)(nil), + } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/proto/poktroll/gateway/tx.proto b/proto/poktroll/gateway/tx.proto index caf37f199..2f4082f4a 100644 --- a/proto/poktroll/gateway/tx.proto +++ b/proto/poktroll/gateway/tx.proto @@ -67,7 +67,9 @@ message MsgUpdateParam { string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; string name = 2; - string as_type = 3; + oneof as_type { + cosmos.base.v1beta1.Coin as_coin = 3 [(gogoproto.jsontag) = "as_coin"]; + } } message MsgUpdateParamResponse { diff --git a/x/gateway/types/tx.pb.go b/x/gateway/types/tx.pb.go index 425361733..6db15bbbb 100644 --- a/x/gateway/types/tx.pb.go +++ b/x/gateway/types/tx.pb.go @@ -275,7 +275,10 @@ 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"` - AsType string `protobuf:"bytes,3,opt,name=as_type,json=asType,proto3" json:"as_type,omitempty"` + // Types that are valid to be assigned to AsType: + // + // *MsgUpdateParam_AsCoin + AsType isMsgUpdateParam_AsType `protobuf_oneof:"as_type"` } func (m *MsgUpdateParam) Reset() { *m = MsgUpdateParam{} } @@ -307,6 +310,25 @@ func (m *MsgUpdateParam) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateParam proto.InternalMessageInfo +type isMsgUpdateParam_AsType interface { + isMsgUpdateParam_AsType() + MarshalTo([]byte) (int, error) + Size() int +} + +type MsgUpdateParam_AsCoin struct { + AsCoin *types.Coin `protobuf:"bytes,3,opt,name=as_coin,json=asCoin,proto3,oneof" json:"as_coin"` +} + +func (*MsgUpdateParam_AsCoin) 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 @@ -321,11 +343,18 @@ func (m *MsgUpdateParam) GetName() string { return "" } -func (m *MsgUpdateParam) GetAsType() string { - if m != nil { - return m.AsType +func (m *MsgUpdateParam) GetAsCoin() *types.Coin { + if x, ok := m.GetAsType().(*MsgUpdateParam_AsCoin); ok { + return x.AsCoin + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*MsgUpdateParam) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*MsgUpdateParam_AsCoin)(nil), } - return "" } type MsgUpdateParamResponse struct { @@ -382,43 +411,44 @@ func init() { func init() { proto.RegisterFile("poktroll/gateway/tx.proto", fileDescriptor_7ad4b0c5e3b59f23) } var fileDescriptor_7ad4b0c5e3b59f23 = []byte{ - // 564 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0xbf, 0x6f, 0xd3, 0x40, - 0x14, 0xce, 0x11, 0x9a, 0x2a, 0xd7, 0x28, 0xd0, 0x53, 0x45, 0x12, 0x23, 0x4c, 0x08, 0x4b, 0x08, - 0xaa, 0xaf, 0x09, 0x82, 0x21, 0x4c, 0x84, 0x01, 0x09, 0xa9, 0x08, 0xa5, 0x74, 0x00, 0x55, 0xaa, - 0xce, 0xc9, 0xc9, 0xb5, 0x52, 0xfb, 0x2c, 0xdf, 0xf5, 0x47, 0x36, 0x84, 0x40, 0x48, 0x4c, 0xfc, - 0x19, 0x8c, 0x19, 0x58, 0xd9, 0x3b, 0x56, 0x4c, 0x9d, 0x10, 0x4a, 0x86, 0xfc, 0x1b, 0xc8, 0xbe, - 0xb3, 0x1b, 0x3b, 0x81, 0x20, 0x58, 0x12, 0xfb, 0xbd, 0xef, 0x7d, 0xef, 0x7b, 0xef, 0xbe, 0x33, - 0xac, 0x78, 0x6c, 0x20, 0x7c, 0x76, 0x78, 0x88, 0x2d, 0x22, 0xe8, 0x09, 0x19, 0x62, 0x71, 0x6a, - 0x78, 0x3e, 0x13, 0x0c, 0x5d, 0x8f, 0x52, 0x86, 0x4a, 0x69, 0xeb, 0xc4, 0xb1, 0x5d, 0x86, 0xc3, - 0x5f, 0x09, 0xd2, 0x4a, 0x3d, 0xc6, 0x1d, 0xc6, 0xb1, 0xc3, 0x2d, 0x7c, 0xdc, 0x0c, 0xfe, 0x54, - 0xa2, 0x22, 0x13, 0xfb, 0xe1, 0x1b, 0x96, 0x2f, 0x2a, 0xb5, 0x61, 0x31, 0x8b, 0xc9, 0x78, 0xf0, - 0xa4, 0xa2, 0xba, 0x62, 0x32, 0x09, 0xa7, 0xf8, 0xb8, 0x69, 0x52, 0x41, 0x9a, 0xb8, 0xc7, 0x6c, - 0x57, 0xe5, 0x6f, 0xcd, 0x29, 0xf5, 0x88, 0x4f, 0x1c, 0x45, 0x5a, 0xfb, 0x06, 0xe0, 0xb5, 0x6d, - 0x6e, 0xed, 0x7a, 0x7d, 0x22, 0xe8, 0xcb, 0x30, 0x83, 0x1e, 0xc1, 0x3c, 0x39, 0x12, 0x07, 0xcc, - 0xb7, 0xc5, 0xb0, 0x0c, 0xaa, 0xa0, 0x9e, 0xef, 0x94, 0xbf, 0x7f, 0xdd, 0xdc, 0x50, 0x6a, 0x9e, - 0xf4, 0xfb, 0x3e, 0xe5, 0x7c, 0x47, 0xf8, 0xb6, 0x6b, 0x75, 0x2f, 0xa1, 0xe8, 0x31, 0xcc, 0x49, - 0xee, 0xf2, 0x95, 0x2a, 0xa8, 0xaf, 0xb5, 0xca, 0x46, 0x7a, 0x15, 0x86, 0xec, 0xd0, 0xc9, 0x9f, - 0xfd, 0xb8, 0x9d, 0xf9, 0x32, 0x1d, 0x35, 0x40, 0x57, 0x95, 0xb4, 0x1f, 0xbe, 0x9b, 0x8e, 0x1a, - 0x97, 0x64, 0x9f, 0xa6, 0xa3, 0x46, 0x2d, 0x96, 0x7e, 0x1a, 0x8b, 0x4f, 0x69, 0xad, 0x55, 0x60, - 0x29, 0x15, 0xea, 0x52, 0xee, 0x31, 0x97, 0xd3, 0xda, 0x7b, 0x39, 0xda, 0x8e, 0x20, 0x03, 0xfa, - 0x4c, 0x96, 0xa3, 0x16, 0x5c, 0x25, 0x52, 0xfe, 0xd2, 0xc1, 0x22, 0x20, 0xc2, 0x70, 0x85, 0x07, - 0x1c, 0x6a, 0xaa, 0x8a, 0xa1, 0xe0, 0xc1, 0xc6, 0x0d, 0xb5, 0x71, 0xe3, 0x29, 0xb3, 0xdd, 0xae, - 0xc4, 0xb5, 0x0b, 0xc1, 0x28, 0x51, 0xb9, 0x52, 0x38, 0xab, 0x22, 0x56, 0xb8, 0x0b, 0xd7, 0x03, - 0xf1, 0x2e, 0xff, 0x4f, 0x89, 0xa9, 0x8e, 0x37, 0x61, 0x65, 0x8e, 0x36, 0xee, 0xf9, 0x01, 0xc0, - 0x62, 0x72, 0x63, 0xff, 0x7c, 0xde, 0x08, 0x5e, 0x75, 0x89, 0x23, 0xf7, 0x92, 0xef, 0x86, 0xcf, - 0xa8, 0x04, 0x57, 0x09, 0xdf, 0x17, 0x43, 0x8f, 0x96, 0xb3, 0x61, 0x38, 0x47, 0xf8, 0xab, 0xa1, - 0x47, 0xdb, 0xc5, 0xe4, 0xf9, 0xd6, 0x9e, 0xc3, 0x1b, 0x49, 0x19, 0x91, 0x42, 0xb4, 0x15, 0xdb, - 0x08, 0xfc, 0xd9, 0x46, 0x91, 0x77, 0x5a, 0x1f, 0xb3, 0x30, 0xbb, 0xcd, 0x2d, 0xb4, 0x07, 0x0b, - 0x09, 0x23, 0xdf, 0x99, 0xaf, 0x4c, 0x99, 0x45, 0xbb, 0xb7, 0x14, 0x12, 0xeb, 0xda, 0x83, 0x85, - 0x84, 0x97, 0x16, 0xb3, 0xcf, 0x42, 0x7e, 0xc3, 0xbe, 0xc8, 0x0b, 0xc8, 0x84, 0xc5, 0x94, 0x11, - 0xee, 0x2e, 0x96, 0x96, 0x00, 0x69, 0xf7, 0xff, 0x02, 0x14, 0xf7, 0x78, 0x0d, 0xd7, 0x66, 0xcf, - 0xbd, 0xba, 0x6c, 0x76, 0xad, 0xbe, 0x0c, 0x11, 0x51, 0x6b, 0x2b, 0x6f, 0x83, 0xdb, 0xdc, 0x79, - 0x71, 0x36, 0xd6, 0xc1, 0xf9, 0x58, 0x07, 0x17, 0x63, 0x1d, 0xfc, 0x1c, 0xeb, 0xe0, 0xf3, 0x44, - 0xcf, 0x9c, 0x4f, 0xf4, 0xcc, 0xc5, 0x44, 0xcf, 0xbc, 0xd9, 0xb2, 0x6c, 0x71, 0x70, 0x64, 0x1a, - 0x3d, 0xe6, 0xe0, 0x80, 0x78, 0xd3, 0xa5, 0xe2, 0x84, 0xf9, 0x03, 0xbc, 0xe0, 0xa2, 0x07, 0x16, - 0xe2, 0x66, 0x2e, 0xfc, 0x4a, 0x3d, 0xf8, 0x15, 0x00, 0x00, 0xff, 0xff, 0x6c, 0xf2, 0xee, 0xa1, - 0x70, 0x05, 0x00, 0x00, + // 581 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0xcf, 0x6b, 0x13, 0x41, + 0x14, 0xce, 0x18, 0x9b, 0x92, 0x49, 0x88, 0x76, 0x29, 0x36, 0x59, 0x71, 0x1b, 0xe3, 0x25, 0x46, + 0xba, 0xd3, 0x44, 0xf4, 0x10, 0x4f, 0x8d, 0x07, 0x45, 0xa8, 0xc8, 0x96, 0x1e, 0x94, 0x42, 0x99, + 0x24, 0xcb, 0x76, 0x49, 0x77, 0x67, 0xd9, 0x99, 0xfe, 0xc8, 0x4d, 0x44, 0x10, 0x3c, 0xf9, 0x67, + 0x78, 0xcc, 0xc1, 0x93, 0xe0, 0xbd, 0xc7, 0xe2, 0xa9, 0xa7, 0x22, 0xc9, 0x21, 0xe0, 0x5f, 0x21, + 0xb3, 0x33, 0xbb, 0xcd, 0x6e, 0xa2, 0x2b, 0x7a, 0x49, 0x66, 0xde, 0xfb, 0xde, 0xf7, 0xbe, 0xf7, + 0xf6, 0x63, 0x60, 0xc5, 0x23, 0x03, 0xe6, 0x93, 0xc3, 0x43, 0x64, 0x61, 0x66, 0x9e, 0xe0, 0x21, + 0x62, 0xa7, 0xba, 0xe7, 0x13, 0x46, 0x94, 0x9b, 0x61, 0x4a, 0x97, 0x29, 0x75, 0x05, 0x3b, 0xb6, + 0x4b, 0x50, 0xf0, 0x2b, 0x40, 0xea, 0x5a, 0x8f, 0x50, 0x87, 0x50, 0xe4, 0x50, 0x0b, 0x1d, 0x37, + 0xf9, 0x9f, 0x4c, 0x54, 0x44, 0x62, 0x3f, 0xb8, 0x21, 0x71, 0x91, 0xa9, 0x55, 0x8b, 0x58, 0x44, + 0xc4, 0xf9, 0x49, 0x46, 0x35, 0xc9, 0xd4, 0xc5, 0xd4, 0x44, 0xc7, 0xcd, 0xae, 0xc9, 0x70, 0x13, + 0xf5, 0x88, 0xed, 0xca, 0xfc, 0x9d, 0x39, 0xa5, 0x1e, 0xf6, 0xb1, 0x23, 0x49, 0x6b, 0xdf, 0x00, + 0xbc, 0xb1, 0x4d, 0xad, 0x5d, 0xaf, 0x8f, 0x99, 0xf9, 0x2a, 0xc8, 0x28, 0x8f, 0x61, 0x1e, 0x1f, + 0xb1, 0x03, 0xe2, 0xdb, 0x6c, 0x58, 0x06, 0x55, 0x50, 0xcf, 0x77, 0xca, 0xdf, 0xbf, 0x6c, 0xac, + 0x4a, 0x35, 0x5b, 0xfd, 0xbe, 0x6f, 0x52, 0xba, 0xc3, 0x7c, 0xdb, 0xb5, 0x8c, 0x2b, 0xa8, 0xf2, + 0x04, 0xe6, 0x04, 0x77, 0xf9, 0x5a, 0x15, 0xd4, 0x0b, 0xad, 0xb2, 0x9e, 0x5c, 0x85, 0x2e, 0x3a, + 0x74, 0xf2, 0x67, 0x97, 0xeb, 0x99, 0xcf, 0xd3, 0x51, 0x03, 0x18, 0xb2, 0xa4, 0xfd, 0xe8, 0xdd, + 0x74, 0xd4, 0xb8, 0x22, 0xfb, 0x38, 0x1d, 0x35, 0x6a, 0x91, 0xf4, 0xd3, 0x48, 0x7c, 0x42, 0x6b, + 0xad, 0x02, 0xd7, 0x12, 0x21, 0xc3, 0xa4, 0x1e, 0x71, 0xa9, 0x59, 0x7b, 0x2f, 0x46, 0xdb, 0x61, + 0x78, 0x60, 0x3e, 0x13, 0xe5, 0x4a, 0x0b, 0x2e, 0x63, 0x21, 0x3f, 0x75, 0xb0, 0x10, 0xa8, 0x20, + 0xb8, 0x44, 0x39, 0x87, 0x9c, 0xaa, 0xa2, 0x4b, 0x38, 0xdf, 0xb8, 0x2e, 0x37, 0xae, 0x3f, 0x25, + 0xb6, 0x6b, 0x08, 0x5c, 0xbb, 0xc8, 0x47, 0x09, 0xcb, 0xa5, 0xc2, 0x59, 0x15, 0x91, 0xc2, 0x5d, + 0xb8, 0xc2, 0xc5, 0xbb, 0xf4, 0x3f, 0x25, 0x26, 0x3a, 0xde, 0x86, 0x95, 0x39, 0xda, 0xa8, 0xe7, + 0x57, 0x00, 0x4b, 0xf1, 0x8d, 0xfd, 0xf3, 0xf7, 0x56, 0xe0, 0x75, 0x17, 0x3b, 0x62, 0x2f, 0x79, + 0x23, 0x38, 0x2b, 0x5b, 0x70, 0x19, 0xd3, 0x7d, 0xee, 0xbf, 0x72, 0x36, 0x65, 0x5d, 0x9d, 0xc2, + 0xcf, 0xcb, 0xf5, 0x10, 0xfd, 0x3c, 0x63, 0xe4, 0x30, 0xe5, 0xe1, 0x76, 0x29, 0xee, 0x84, 0x4e, + 0x3e, 0xa0, 0x64, 0x43, 0xcf, 0xac, 0xbd, 0x80, 0xb7, 0xe2, 0xda, 0xc3, 0xb1, 0x94, 0xcd, 0xc8, + 0x7b, 0xe0, 0xcf, 0xde, 0x0b, 0x0d, 0xd7, 0xfa, 0x90, 0x85, 0xd9, 0x6d, 0x6a, 0x29, 0x7b, 0xb0, + 0x18, 0x73, 0xff, 0xdd, 0xf9, 0xca, 0x84, 0xc3, 0xd4, 0xfb, 0xa9, 0x90, 0x48, 0xd7, 0x1e, 0x2c, + 0xc6, 0x0c, 0xb8, 0x98, 0x7d, 0x16, 0xf2, 0x1b, 0xf6, 0x45, 0x06, 0x52, 0xba, 0xb0, 0x94, 0x70, + 0xcf, 0xbd, 0xc5, 0xd2, 0x62, 0x20, 0xf5, 0xc1, 0x5f, 0x80, 0xa2, 0x1e, 0xaf, 0x61, 0x61, 0xd6, + 0x2c, 0xd5, 0xb4, 0xd9, 0xd5, 0x7a, 0x1a, 0x22, 0xa4, 0x56, 0x97, 0xde, 0xf2, 0x27, 0xa0, 0xf3, + 0xf2, 0x6c, 0xac, 0x81, 0xf3, 0xb1, 0x06, 0x2e, 0xc6, 0x1a, 0xf8, 0x31, 0xd6, 0xc0, 0xa7, 0x89, + 0x96, 0x39, 0x9f, 0x68, 0x99, 0x8b, 0x89, 0x96, 0x79, 0xb3, 0x69, 0xd9, 0xec, 0xe0, 0xa8, 0xab, + 0xf7, 0x88, 0x83, 0x38, 0xf1, 0x86, 0x6b, 0xb2, 0x13, 0xe2, 0x0f, 0xd0, 0x82, 0xd7, 0x81, 0x9b, + 0x84, 0x76, 0x73, 0xc1, 0xd3, 0xf6, 0xf0, 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, 0x2f, 0x45, 0x6f, + 0x88, 0xa5, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -814,12 +844,14 @@ func (m *MsgUpdateParam) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.AsType) > 0 { - i -= len(m.AsType) - copy(dAtA[i:], m.AsType) - i = encodeVarintTx(dAtA, i, uint64(len(m.AsType))) - i-- - dAtA[i] = 0x1a + 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) @@ -838,6 +870,27 @@ func (m *MsgUpdateParam) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *MsgUpdateParam_AsCoin) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParam_AsCoin) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.AsCoin != nil { + { + size, err := m.AsCoin.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + return len(dAtA) - i, nil +} func (m *MsgUpdateParamResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -970,13 +1023,24 @@ func (m *MsgUpdateParam) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.AsType) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) + if m.AsType != nil { + n += m.AsType.Size() } return n } +func (m *MsgUpdateParam_AsCoin) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.AsCoin != nil { + l = m.AsCoin.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n +} func (m *MsgUpdateParamResponse) Size() (n int) { if m == nil { return 0 @@ -1556,9 +1620,9 @@ func (m *MsgUpdateParam) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AsType", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field AsCoin", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1568,23 +1632,26 @@ func (m *MsgUpdateParam) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.AsType = string(dAtA[iNdEx:postIndex]) + v := &types.Coin{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.AsType = &MsgUpdateParam_AsCoin{v} iNdEx = postIndex default: iNdEx = preIndex From b2e12677a23334dc35df9232c4a00f4497c4e3bb Mon Sep 17 00:00:00 2001 From: Bryan White Date: Thu, 26 Sep 2024 11:22:15 +0200 Subject: [PATCH 014/139] chore: add app MsgUpdateParam to genesis authorizations --- tools/scripts/authz/dao_genesis_authorizations.json | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tools/scripts/authz/dao_genesis_authorizations.json b/tools/scripts/authz/dao_genesis_authorizations.json index 9bc539937..3eead39e5 100644 --- a/tools/scripts/authz/dao_genesis_authorizations.json +++ b/tools/scripts/authz/dao_genesis_authorizations.json @@ -143,6 +143,15 @@ }, "expiration": "2500-01-01T00:00:00Z" }, + { + "granter": "pokt10d07y265gmmuvt4z0w9aw880jnsr700j8yv32t", + "grantee": "pokt1eeeksh2tvkh7wzmfrljnhw4wrhs55lcuvmekkw", + "authorization": { + "@type": "\/cosmos.authz.v1beta1.GenericAuthorization", + "msg": "\/poktroll.gateway.MsgUpdateParam" + }, + "expiration": "2500-01-01T00:00:00Z" + }, { "granter": "pokt10d07y265gmmuvt4z0w9aw880jnsr700j8yv32t", "grantee": "pokt1eeeksh2tvkh7wzmfrljnhw4wrhs55lcuvmekkw", From 0373fa29d455098221f33e6b54a8f3a60a1e6f0f Mon Sep 17 00:00:00 2001 From: Bryan White Date: Thu, 26 Sep 2024 11:23:42 +0200 Subject: [PATCH 015/139] fix: typo --- config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.yml b/config.yml index 087e86b2c..8691475a8 100644 --- a/config.yml +++ b/config.yml @@ -224,7 +224,7 @@ genesis: denom: upokt gateway: params: - # TODO_MAINNER: Determine realistic amount for minimum gateway stake amount. + # TODO_MAINNET: Determine realistic amount for minimum gateway stake amount. min_stake: 100 gatewayList: - address: pokt15vzxjqklzjtlz7lahe8z2dfe9nm5vxwwmscne4 From da7894af4be17e87ff7ad07da9bea1790dfebbc6 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Thu, 26 Sep 2024 13:08:38 +0200 Subject: [PATCH 016/139] chore: cleanup makefiles --- makefiles/params.mk | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/makefiles/params.mk b/makefiles/params.mk index 8ccdf9f36..8594b1e19 100644 --- a/makefiles/params.mk +++ b/makefiles/params.mk @@ -97,19 +97,6 @@ params_update_shared_proof_window_close_offset_blocks: ## Update the shared modu params_update_shared_compute_units_to_tokens_multiplier: ## Update the shared module compute_units_to_tokens_multiplier param poktrolld tx authz exec ./tools/scripts/params/shared_compute_units_to_tokens_multiplier.json $(PARAM_FLAGS) -### Service Module Params ### -.PHONY: params_get_service -params_get_service: ## Get the service module params - poktrolld query service params --node $(POCKET_NODE) - -.PHONY: params_update_service_all -params_update_service_all: ## Update the session module params - poktrolld tx authz exec ./tools/scripts/params/service_all.json $(PARAM_FLAGS) - -.PHONY: params_get_service -params_get_service: ## Get the service module params - poktrolld query service params --node $(POCKET_NODE) - ### Gateway Module Params ### .PHONY: params_get_gateway params_get_gateway: ## Get the gateway module params From 015c53725a95840145ac242d517486559c9f271f Mon Sep 17 00:00:00 2001 From: Bryan White Date: Thu, 26 Sep 2024 14:28:03 +0200 Subject: [PATCH 017/139] wip: fixing tests --- x/gateway/keeper/msg_update_params_test.go | 26 ++++++++---- x/gateway/keeper/params_test.go | 42 +++++++++++++++++++ x/gateway/types/genesis_test.go | 43 ++++++++++---------- x/gateway/types/message_update_param_test.go | 40 ++++++++++++++---- x/gateway/types/params.go | 4 ++ x/proof/keeper/msg_server_update_param.go | 39 ++++-------------- 6 files changed, 126 insertions(+), 68 deletions(-) diff --git a/x/gateway/keeper/msg_update_params_test.go b/x/gateway/keeper/msg_update_params_test.go index 7fb8ab31e..400aeb7c0 100644 --- a/x/gateway/keeper/msg_update_params_test.go +++ b/x/gateway/keeper/msg_update_params_test.go @@ -5,24 +5,24 @@ import ( "github.com/stretchr/testify/require" - "github.com/pokt-network/poktroll/x/gateway/types" + gatewaytypes "github.com/pokt-network/poktroll/x/gateway/types" ) func TestMsgUpdateParams(t *testing.T) { k, ms, ctx := setupMsgServer(t) - params := types.DefaultParams() + params := gatewaytypes.DefaultParams() require.NoError(t, k.SetParams(ctx, params)) // default params tests := []struct { desc string - input *types.MsgUpdateParams + input *gatewaytypes.MsgUpdateParams shouldError bool expectedErrMsg string }{ { desc: "invalid: authority address invalid", - input: &types.MsgUpdateParams{ + input: &gatewaytypes.MsgUpdateParams{ Authority: "invalid", Params: params, }, @@ -30,16 +30,26 @@ func TestMsgUpdateParams(t *testing.T) { expectedErrMsg: "invalid authority", }, { - desc: "send empty params", - input: &types.MsgUpdateParams{ + desc: "invalid: send empty params", + input: &gatewaytypes.MsgUpdateParams{ Authority: k.GetAuthority(), - Params: types.Params{}, + Params: gatewaytypes.Params{}, + }, + shouldError: true, + }, + { + desc: "valid: send minimal params", + input: &gatewaytypes.MsgUpdateParams{ + Authority: k.GetAuthority(), + Params: gatewaytypes.Params{ + MinStake: &gatewaytypes.DefaultMinStake, + }, }, shouldError: false, }, { desc: "valid: send default params", - input: &types.MsgUpdateParams{ + input: &gatewaytypes.MsgUpdateParams{ Authority: k.GetAuthority(), Params: params, }, diff --git a/x/gateway/keeper/params_test.go b/x/gateway/keeper/params_test.go index 27bf9d53d..93f0a73f0 100644 --- a/x/gateway/keeper/params_test.go +++ b/x/gateway/keeper/params_test.go @@ -3,10 +3,14 @@ package keeper_test import ( "testing" + "cosmossdk.io/math" + cosmostypes "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" + "github.com/pokt-network/poktroll/app/volatile" testkeeper "github.com/pokt-network/poktroll/testutil/keeper" "github.com/pokt-network/poktroll/x/gateway/types" + gatewaytypes "github.com/pokt-network/poktroll/x/gateway/types" ) func TestGetParams(t *testing.T) { @@ -16,3 +20,41 @@ func TestGetParams(t *testing.T) { require.NoError(t, k.SetParams(ctx, params)) require.EqualValues(t, params, k.GetParams(ctx)) } + +func TestParams_ValidateMinRelayDifficulty(t *testing.T) { + tests := []struct { + desc string + minStake any + expectedErr error + }{ + { + desc: "invalid type", + minStake: int64(-1), + expectedErr: gatewaytypes.ErrGatewayParamInvalid.Wrapf("invalid type for %s: int64; expected *cosmostypes.Coin", gatewaytypes.ParamMinStake), + }, + { + desc: "MinStake less than zero", + minStake: &cosmostypes.Coin{ + Denom: volatile.DenomuPOKT, + Amount: math.NewInt(-1), + }, + expectedErr: gatewaytypes.ErrGatewayParamInvalid.Wrapf("min stake amount must be greater than zero: -1%s", volatile.DenomuPOKT), + }, + { + desc: "valid MinStake", + minStake: &gatewaytypes.DefaultMinStake, + }, + } + + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) { + err := gatewaytypes.ValidateMinStake(tt.minStake) + if tt.expectedErr != nil { + require.Error(t, err) + require.Contains(t, err.Error(), tt.expectedErr.Error()) + } else { + require.NoError(t, err) + } + }) + } +} diff --git a/x/gateway/types/genesis_test.go b/x/gateway/types/genesis_test.go index 357176de1..d7dbf5b60 100644 --- a/x/gateway/types/genesis_test.go +++ b/x/gateway/types/genesis_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/require" "github.com/pokt-network/poktroll/testutil/sample" - "github.com/pokt-network/poktroll/x/gateway/types" + gatewaytypes "github.com/pokt-network/poktroll/x/gateway/types" ) func TestGenesisState_Validate(t *testing.T) { @@ -20,18 +20,19 @@ func TestGenesisState_Validate(t *testing.T) { tests := []struct { desc string - genState *types.GenesisState + genState *gatewaytypes.GenesisState valid bool }{ { desc: "default is valid", - genState: types.DefaultGenesis(), + genState: gatewaytypes.DefaultGenesis(), valid: true, }, { desc: "valid genesis state", - genState: &types.GenesisState{ - GatewayList: []types.Gateway{ + genState: &gatewaytypes.GenesisState{ + Params: gatewaytypes.DefaultParams(), + GatewayList: []gatewaytypes.Gateway{ { Address: addr1, Stake: &stake1, @@ -41,14 +42,14 @@ func TestGenesisState_Validate(t *testing.T) { Stake: &stake2, }, }, - // this line is used by starport scaffolding # types/genesis/validField + // this line is used by starport scaffolding # gatewaytypes/genesis/validField }, valid: true, }, { desc: "invalid - duplicated gateway address", - genState: &types.GenesisState{ - GatewayList: []types.Gateway{ + genState: &gatewaytypes.GenesisState{ + GatewayList: []gatewaytypes.Gateway{ { Address: addr1, Stake: &stake1, @@ -63,8 +64,8 @@ func TestGenesisState_Validate(t *testing.T) { }, { desc: "invalid - nil gateway stake", - genState: &types.GenesisState{ - GatewayList: []types.Gateway{ + genState: &gatewaytypes.GenesisState{ + GatewayList: []gatewaytypes.Gateway{ { Address: addr1, Stake: &stake1, @@ -79,8 +80,8 @@ func TestGenesisState_Validate(t *testing.T) { }, { desc: "invalid - missing gateway stake", - genState: &types.GenesisState{ - GatewayList: []types.Gateway{ + genState: &gatewaytypes.GenesisState{ + GatewayList: []gatewaytypes.Gateway{ { Address: addr1, Stake: &stake1, @@ -95,8 +96,8 @@ func TestGenesisState_Validate(t *testing.T) { }, { desc: "invalid - zero gateway stake", - genState: &types.GenesisState{ - GatewayList: []types.Gateway{ + genState: &gatewaytypes.GenesisState{ + GatewayList: []gatewaytypes.Gateway{ { Address: addr1, Stake: &stake1, @@ -111,8 +112,8 @@ func TestGenesisState_Validate(t *testing.T) { }, { desc: "invalid - negative gateway stake", - genState: &types.GenesisState{ - GatewayList: []types.Gateway{ + genState: &gatewaytypes.GenesisState{ + GatewayList: []gatewaytypes.Gateway{ { Address: addr1, Stake: &stake1, @@ -127,8 +128,8 @@ func TestGenesisState_Validate(t *testing.T) { }, { desc: "invalid - wrong stake denom", - genState: &types.GenesisState{ - GatewayList: []types.Gateway{ + genState: &gatewaytypes.GenesisState{ + GatewayList: []gatewaytypes.Gateway{ { Address: addr1, Stake: &stake1, @@ -143,8 +144,8 @@ func TestGenesisState_Validate(t *testing.T) { }, { desc: "invalid - missing denom", - genState: &types.GenesisState{ - GatewayList: []types.Gateway{ + genState: &gatewaytypes.GenesisState{ + GatewayList: []gatewaytypes.Gateway{ { Address: addr1, Stake: &stake1, @@ -157,7 +158,7 @@ func TestGenesisState_Validate(t *testing.T) { }, valid: false, }, - // this line is used by starport scaffolding # types/genesis/testcase + // this line is used by starport scaffolding # gatewaytypes/genesis/testcase } for _, test := range tests { t.Run(test.desc, func(t *testing.T) { diff --git a/x/gateway/types/message_update_param_test.go b/x/gateway/types/message_update_param_test.go index 892ec6878..ef089f8ec 100644 --- a/x/gateway/types/message_update_param_test.go +++ b/x/gateway/types/message_update_param_test.go @@ -4,34 +4,56 @@ import ( "testing" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/pokt-network/poktroll/testutil/sample" "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/testutil/sample" ) func TestMsgUpdateParam_ValidateBasic(t *testing.T) { tests := []struct { - name string - msg MsgUpdateParam - err error + name string + msg MsgUpdateParam + expectedErr error }{ { - name: "invalid address", + name: "invalid: authority address invalid", msg: MsgUpdateParam{ Authority: "invalid_address", + Name: "", // Doesn't matter for this test + AsType: &MsgUpdateParam_AsCoin{AsCoin: &DefaultMinStake}, + }, + expectedErr: sdkerrors.ErrInvalidAddress, + }, { + name: "invalid: param name incorrect (non-existent)", + msg: MsgUpdateParam{ + Authority: sample.AccAddress(), + Name: "WRONG_relay_difficulty_target_hash", + AsType: &MsgUpdateParam_AsCoin{AsCoin: nil}, + }, + + expectedErr: ErrGatewayParamInvalid, + }, { + name: "invalid: value cannot be nil", + msg: MsgUpdateParam{ + Authority: sample.AccAddress(), + Name: ParamMinStake, + AsType: &MsgUpdateParam_AsCoin{AsCoin: nil}, }, - err: sdkerrors.ErrInvalidAddress, + expectedErr: ErrGatewayParamInvalid, }, { - name: "valid address", + name: "valid: correct authority, param name, and type", msg: MsgUpdateParam{ Authority: sample.AccAddress(), + Name: ParamMinStake, + AsType: &MsgUpdateParam_AsCoin{AsCoin: &DefaultMinStake}, }, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { err := tt.msg.ValidateBasic() - if tt.err != nil { - require.ErrorIs(t, err, tt.err) + if tt.expectedErr != nil { + require.ErrorIs(t, err, tt.expectedErr) return } require.NoError(t, err) diff --git a/x/gateway/types/params.go b/x/gateway/types/params.go index e995e4717..320e0a97d 100644 --- a/x/gateway/types/params.go +++ b/x/gateway/types/params.go @@ -58,6 +58,10 @@ func ValidateMinStake(minStakeAny any) error { return ErrGatewayParamInvalid.Wrapf("invalid type for %s: %T; expected *cosmostypes.Coin", ParamMinStake, minStakeAny) } + if minStakeCoin == nil { + return ErrGatewayParamInvalid.Wrap("missing min_stake") + } + if err := ValidateMinStakeDenom(minStakeCoin); err != nil { return err } diff --git a/x/proof/keeper/msg_server_update_param.go b/x/proof/keeper/msg_server_update_param.go index 03828492a..df698a38b 100644 --- a/x/proof/keeper/msg_server_update_param.go +++ b/x/proof/keeper/msg_server_update_param.go @@ -28,65 +28,44 @@ func (k msgServer) UpdateParam( if !ok { return nil, types.ErrProofParamInvalid.Wrapf("unsupported value type for %s param: %T", msg.Name, msg.AsType) } - relayDifficultyTargetHash := value.AsBytes - if err := types.ValidateRelayDifficultyTargetHash(relayDifficultyTargetHash); err != nil { - return nil, err - } - - params.RelayDifficultyTargetHash = relayDifficultyTargetHash + params.RelayDifficultyTargetHash = value.AsBytes case types.ParamProofRequestProbability: value, ok := msg.AsType.(*types.MsgUpdateParam_AsFloat) if !ok { return nil, types.ErrProofParamInvalid.Wrapf("unsupported value type for %s param: %T", msg.Name, msg.AsType) } - proofRequestProbability := value.AsFloat - - if err := types.ValidateProofRequestProbability(proofRequestProbability); err != nil { - return nil, err - } - params.ProofRequestProbability = proofRequestProbability + params.ProofRequestProbability = value.AsFloat case types.ParamProofRequirementThreshold: value, ok := msg.AsType.(*types.MsgUpdateParam_AsCoin) if !ok { return nil, types.ErrProofParamInvalid.Wrapf("unsupported value type for %s param: %T", msg.Name, msg.AsType) } - proofRequirementThreshold := value.AsCoin - if err := types.ValidateProofRequirementThreshold(proofRequirementThreshold); err != nil { - return nil, err - } - - params.ProofRequirementThreshold = proofRequirementThreshold + params.ProofRequirementThreshold = value.AsCoin case types.ParamProofMissingPenalty: value, ok := msg.AsType.(*types.MsgUpdateParam_AsCoin) if !ok { return nil, types.ErrProofParamInvalid.Wrapf("unsupported value type for %s param: %T", msg.Name, msg.AsType) } - proofMissingPenalty := value.AsCoin - if err := types.ValidateProofMissingPenalty(proofMissingPenalty); err != nil { - return nil, err - } - - params.ProofMissingPenalty = proofMissingPenalty + params.ProofMissingPenalty = value.AsCoin case types.ParamProofSubmissionFee: value, ok := msg.AsType.(*types.MsgUpdateParam_AsCoin) if !ok { return nil, types.ErrProofParamInvalid.Wrapf("unsupported value type for %s param: %T", msg.Name, msg.AsType) } - proofSubmissionFee := value.AsCoin - - if err := types.ValidateProofSubmissionFee(proofSubmissionFee); err != nil { - return nil, err - } - params.ProofSubmissionFee = proofSubmissionFee + params.ProofSubmissionFee = value.AsCoin default: return nil, types.ErrProofParamInvalid.Wrapf("unsupported param %q", msg.Name) } + if err := params.ValidateBasic(); err != nil { + return nil, err + } + if err := k.SetParams(ctx, params); err != nil { return nil, err } From 1ac6c48fffa58b90c5926a581ac4531df7d7c645 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Thu, 26 Sep 2024 15:49:31 +0200 Subject: [PATCH 018/139] tests: add tests --- .../keeper/msg_server_update_param_test.go | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 x/gateway/keeper/msg_server_update_param_test.go diff --git a/x/gateway/keeper/msg_server_update_param_test.go b/x/gateway/keeper/msg_server_update_param_test.go new file mode 100644 index 000000000..001d80cb6 --- /dev/null +++ b/x/gateway/keeper/msg_server_update_param_test.go @@ -0,0 +1,41 @@ +package keeper_test + +import ( + "testing" + + cosmostypes "github.com/cosmos/cosmos-sdk/types" + 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/app/volatile" + testkeeper "github.com/pokt-network/poktroll/testutil/keeper" + gatewaytypes "github.com/pokt-network/poktroll/x/gateway/types" +) + +func TestMsgUpdateParam_UpdateMinStakeOnly(t *testing.T) { + expectedMinStake := cosmostypes.NewInt64Coin(volatile.DenomuPOKT, 420) + + // Set the parameters to their default values + k, msgSrv, ctx := setupMsgServer(t) + defaultParams := gatewaytypes.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, expectedMinStake, defaultParams.MinStake) + + // Update the min relay difficulty bits + updateParamMsg := &gatewaytypes.MsgUpdateParam{ + Authority: authtypes.NewModuleAddress(govtypes.ModuleName).String(), + Name: gatewaytypes.ParamMinStake, + AsType: &gatewaytypes.MsgUpdateParam_AsCoin{AsCoin: &expectedMinStake}, + } + res, err := msgSrv.UpdateParam(ctx, updateParamMsg) + require.NoError(t, err) + + require.NotEqual(t, defaultParams.MinStake, res.Params.MinStake) + require.Equal(t, expectedMinStake.Amount, res.Params.MinStake.Amount) + + // Ensure the other parameters are unchanged + testkeeper.AssertDefaultParamsEqualExceptFields(t, &defaultParams, res.Params, "MinStake") +} From db366f6b31c66313f4f325cddacc3b27d0d55ff9 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Thu, 26 Sep 2024 19:35:43 +0200 Subject: [PATCH 019/139] tests: remove erroneous case --- x/gateway/types/message_update_param_test.go | 8 -------- 1 file changed, 8 deletions(-) diff --git a/x/gateway/types/message_update_param_test.go b/x/gateway/types/message_update_param_test.go index ef089f8ec..84530f9e8 100644 --- a/x/gateway/types/message_update_param_test.go +++ b/x/gateway/types/message_update_param_test.go @@ -31,14 +31,6 @@ func TestMsgUpdateParam_ValidateBasic(t *testing.T) { AsType: &MsgUpdateParam_AsCoin{AsCoin: nil}, }, - expectedErr: ErrGatewayParamInvalid, - }, { - name: "invalid: value cannot be nil", - msg: MsgUpdateParam{ - Authority: sample.AccAddress(), - Name: ParamMinStake, - AsType: &MsgUpdateParam_AsCoin{AsCoin: nil}, - }, expectedErr: ErrGatewayParamInvalid, }, { name: "valid: correct authority, param name, and type", From 60bef17fa8986435a4cbf1568b1b76d5fa1f1d0d Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 27 Sep 2024 10:09:42 +0200 Subject: [PATCH 020/139] test: gateway staking below minimum fails --- .../keeper/msg_server_stake_gateway_test.go | 49 +++++++++++++++---- 1 file changed, 39 insertions(+), 10 deletions(-) diff --git a/x/gateway/keeper/msg_server_stake_gateway_test.go b/x/gateway/keeper/msg_server_stake_gateway_test.go index 9645c1a0a..ff0b52440 100644 --- a/x/gateway/keeper/msg_server_stake_gateway_test.go +++ b/x/gateway/keeper/msg_server_stake_gateway_test.go @@ -4,13 +4,14 @@ import ( "testing" "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" + cosmostypes "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" + "github.com/pokt-network/poktroll/app/volatile" keepertest "github.com/pokt-network/poktroll/testutil/keeper" "github.com/pokt-network/poktroll/testutil/sample" "github.com/pokt-network/poktroll/x/gateway/keeper" - "github.com/pokt-network/poktroll/x/gateway/types" + gatewaytypes "github.com/pokt-network/poktroll/x/gateway/types" ) func TestMsgServer_StakeGateway_SuccessfulCreateAndUpdate(t *testing.T) { @@ -25,8 +26,8 @@ func TestMsgServer_StakeGateway_SuccessfulCreateAndUpdate(t *testing.T) { require.False(t, isGatewayFound) // Prepare the gateway - initialStake := sdk.NewCoin("upokt", math.NewInt(100)) - stakeMsg := &types.MsgStakeGateway{ + initialStake := cosmostypes.NewCoin("upokt", math.NewInt(100)) + stakeMsg := &gatewaytypes.MsgStakeGateway{ Address: addr, Stake: &initialStake, } @@ -42,8 +43,8 @@ func TestMsgServer_StakeGateway_SuccessfulCreateAndUpdate(t *testing.T) { require.Equal(t, initialStake.Amount, foundGateway.Stake.Amount) // Prepare an updated gateway with a higher stake - updatedStake := sdk.NewCoin("upokt", math.NewInt(200)) - updateMsg := &types.MsgStakeGateway{ + updatedStake := cosmostypes.NewCoin("upokt", math.NewInt(200)) + updateMsg := &gatewaytypes.MsgStakeGateway{ Address: addr, Stake: &updatedStake, } @@ -62,8 +63,8 @@ func TestMsgServer_StakeGateway_FailLoweringStake(t *testing.T) { // Prepare the gateway addr := sample.AccAddress() - initialStake := sdk.NewCoin("upokt", math.NewInt(100)) - stakeMsg := &types.MsgStakeGateway{ + initialStake := cosmostypes.NewCoin("upokt", math.NewInt(100)) + stakeMsg := &gatewaytypes.MsgStakeGateway{ Address: addr, Stake: &initialStake, } @@ -75,8 +76,8 @@ func TestMsgServer_StakeGateway_FailLoweringStake(t *testing.T) { require.True(t, isGatewayFound) // Prepare an updated gateway with a lower stake - updatedStake := sdk.NewCoin("upokt", math.NewInt(50)) - updateMsg := &types.MsgStakeGateway{ + updatedStake := cosmostypes.NewCoin("upokt", math.NewInt(50)) + updateMsg := &gatewaytypes.MsgStakeGateway{ Address: addr, Stake: &updatedStake, } @@ -90,3 +91,31 @@ func TestMsgServer_StakeGateway_FailLoweringStake(t *testing.T) { require.True(t, isGatewayFound) require.Equal(t, initialStake.Amount, gatewayFound.Stake.Amount) } + +func TestMsgServer_StakeGateway_FailBelowMinStake(t *testing.T) { + k, ctx := keepertest.GatewayKeeper(t) + srv := keeper.NewMsgServerImpl(k) + + addr := sample.AccAddress() + gatewayStake := cosmostypes.NewInt64Coin(volatile.DenomuPOKT, 100) + minStake := gatewayStake.AddAmount(math.NewInt(1)) + expectedErr := gatewaytypes.ErrGatewayInvalidStake.Wrapf("gateway %q must stake at least %s", addr, minStake) + + // Set the minimum stake to be greater than the gateway stake. + err := k.SetParams(ctx, gatewaytypes.Params{ + MinStake: &minStake, + }) + require.NoError(t, err) + + // Prepare the gateway + stakeMsg := &gatewaytypes.MsgStakeGateway{ + Address: addr, + Stake: &gatewayStake, + } + + // Stake the gateway & verify that the gateway exists + _, err = srv.StakeGateway(ctx, stakeMsg) + require.ErrorContains(t, err, expectedErr.Error()) + _, isGatewayFound := k.GetGateway(ctx, addr) + require.False(t, isGatewayFound) +} From a21687fbe1e162e0e302d6977c5e58b7f34c7f6e Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 27 Sep 2024 10:10:08 +0200 Subject: [PATCH 021/139] feat: gateway min stake validation & grpc status error returns --- x/gateway/keeper/msg_server_stake_gateway.go | 64 ++++++++++++++------ 1 file changed, 46 insertions(+), 18 deletions(-) diff --git a/x/gateway/keeper/msg_server_stake_gateway.go b/x/gateway/keeper/msg_server_stake_gateway.go index bba203661..7d3ecdbfe 100644 --- a/x/gateway/keeper/msg_server_stake_gateway.go +++ b/x/gateway/keeper/msg_server_stake_gateway.go @@ -5,6 +5,8 @@ import ( "fmt" sdk "github.com/cosmos/cosmos-sdk/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" "github.com/pokt-network/poktroll/telemetry" "github.com/pokt-network/poktroll/x/gateway/types" @@ -24,46 +26,72 @@ func (k msgServer) StakeGateway( ctx := sdk.UnwrapSDKContext(goCtx) logger := k.Logger().With("method", "StakeGateway") - logger.Info(fmt.Sprintf("About to stake gateway with msg: %v", msg)) + logger.Info(fmt.Sprintf("about to stake gateway with msg: %v", msg)) if err := msg.ValidateBasic(); err != nil { - return nil, err + return nil, status.Error(codes.InvalidArgument, err.Error()) + } + + // Retrieve the address of the gateway + gatewayAddress, err := sdk.AccAddressFromBech32(msg.Address) + // NB: This SHOULD NEVER happen because msg.ValidateBasic() validates the address as bech32. + if err != nil { + // TODO_TECHDEBT(#384): determine whether to continue using cosmos logger for debug level. + logger.Info(fmt.Sprintf("could not parse address %q", msg.Address)) + return nil, status.Error(codes.InvalidArgument, err.Error()) } // Check if the gateway already exists or not - var err error - var coinsToEscrow sdk.Coin + var ( + coinsToEscrow sdk.Coin + totalStake sdk.Coin + ) gateway, isGatewayFound := k.GetGateway(ctx, msg.Address) if !isGatewayFound { - logger.Info(fmt.Sprintf("Gateway not found. Creating new gateway for address %q", msg.Address)) + logger.Info(fmt.Sprintf("gateway not found. Creating new gateway for address %q", msg.Address)) gateway = k.createGateway(ctx, msg) coinsToEscrow = *msg.Stake + totalStake = *msg.Stake } else { - logger.Info(fmt.Sprintf("Gateway found. About to try and update gateway for address %q", msg.Address)) + logger.Info(fmt.Sprintf("gateway found. About to try and update gateway for address %q", msg.Address)) currGatewayStake := *gateway.Stake if err = k.updateGateway(ctx, &gateway, msg); err != nil { logger.Error(fmt.Sprintf("could not update gateway for address %q due to error %v", msg.Address, err)) - return nil, err + return nil, status.Error(codes.InvalidArgument, err.Error()) } coinsToEscrow, err = (*msg.Stake).SafeSub(currGatewayStake) if err != nil { - return nil, err + return nil, status.Error( + codes.InvalidArgument, + types.ErrGatewayInvalidStake.Wrapf( + "stake (%s) must be higher than previous stake (%s)", + msg.Stake, currGatewayStake, + ).Error(), + ) } - logger.Info(fmt.Sprintf("Gateway is going to escrow an additional %+v coins", coinsToEscrow)) + totalStake = currGatewayStake.Add(*msg.Stake) + logger.Info(fmt.Sprintf("gateway is going to escrow an additional %+v coins", coinsToEscrow)) } - // Must always stake or upstake (> 0 delta) + // MUST ALWAYS stake or upstake (> 0 delta). if coinsToEscrow.IsZero() { - logger.Warn(fmt.Sprintf("Gateway %q must escrow more than 0 additional coins", msg.Address)) - return nil, types.ErrGatewayInvalidStake.Wrapf("gateway %q must escrow more than 0 additional coins", msg.Address) + errFmt := "gateway %q must escrow more than 0 additional coins" + logger.Info(fmt.Sprintf(errFmt, msg.Address)) + return nil, status.Error( + codes.InvalidArgument, + types.ErrGatewayInvalidStake.Wrapf(errFmt, msg.Address).Error(), + ) } - // Retrieve the address of the gateway - gatewayAddress, err := sdk.AccAddressFromBech32(msg.Address) - if err != nil { - // TODO_TECHDEBT(#384): determine whether to continue using cosmos logger for debug level. - logger.Error(fmt.Sprintf("could not parse address %q", msg.Address)) - return nil, err + // MUST ALWAYS have at least minimum stake. + minStake := k.GetParams(ctx).MinStake + if totalStake.Amount.LT(minStake.Amount) { + errFmt := "gateway %q must stake at least %s" + logger.Info(fmt.Sprintf(errFmt, msg.Address, minStake)) + return nil, status.Error( + codes.InvalidArgument, + types.ErrGatewayInvalidStake.Wrapf(errFmt, msg.Address, minStake).Error(), + ) } // Send the coins from the gateway to the staked gateway pool From 7e9f8570824a261e384cba26248cbaf511a22be3 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 27 Sep 2024 10:12:07 +0200 Subject: [PATCH 022/139] chore: cleanup comments --- .../keeper/msg_server_stake_gateway_test.go | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/x/gateway/keeper/msg_server_stake_gateway_test.go b/x/gateway/keeper/msg_server_stake_gateway_test.go index ff0b52440..b0fe31b2a 100644 --- a/x/gateway/keeper/msg_server_stake_gateway_test.go +++ b/x/gateway/keeper/msg_server_stake_gateway_test.go @@ -18,38 +18,38 @@ func TestMsgServer_StakeGateway_SuccessfulCreateAndUpdate(t *testing.T) { k, ctx := keepertest.GatewayKeeper(t) srv := keeper.NewMsgServerImpl(k) - // Generate an address for the gateway + // Generate an address for the gateway. addr := sample.AccAddress() - // Verify that the gateway does not exist yet + // Verify that the gateway does not exist yet. _, isGatewayFound := k.GetGateway(ctx, addr) require.False(t, isGatewayFound) - // Prepare the gateway + // Prepare the gateway. initialStake := cosmostypes.NewCoin("upokt", math.NewInt(100)) stakeMsg := &gatewaytypes.MsgStakeGateway{ Address: addr, Stake: &initialStake, } - // Stake the gateway + // Stake the gateway. _, err := srv.StakeGateway(ctx, stakeMsg) require.NoError(t, err) - // Verify that the gateway exists + // Verify that the gateway exists. foundGateway, isGatewayFound := k.GetGateway(ctx, addr) require.True(t, isGatewayFound) require.Equal(t, addr, foundGateway.Address) require.Equal(t, initialStake.Amount, foundGateway.Stake.Amount) - // Prepare an updated gateway with a higher stake + // Prepare an updated gateway with a higher stake. updatedStake := cosmostypes.NewCoin("upokt", math.NewInt(200)) updateMsg := &gatewaytypes.MsgStakeGateway{ Address: addr, Stake: &updatedStake, } - // Update the staked gateway + // Update the staked gateway. _, err = srv.StakeGateway(ctx, updateMsg) require.NoError(t, err) foundGateway, isGatewayFound = k.GetGateway(ctx, addr) @@ -61,7 +61,7 @@ func TestMsgServer_StakeGateway_FailLoweringStake(t *testing.T) { k, ctx := keepertest.GatewayKeeper(t) srv := keeper.NewMsgServerImpl(k) - // Prepare the gateway + // Prepare the gateway. addr := sample.AccAddress() initialStake := cosmostypes.NewCoin("upokt", math.NewInt(100)) stakeMsg := &gatewaytypes.MsgStakeGateway{ @@ -69,24 +69,24 @@ func TestMsgServer_StakeGateway_FailLoweringStake(t *testing.T) { Stake: &initialStake, } - // Stake the gateway & verify that the gateway exists + // Stake the gateway & verify that the gateway exists. _, err := srv.StakeGateway(ctx, stakeMsg) require.NoError(t, err) _, isGatewayFound := k.GetGateway(ctx, addr) require.True(t, isGatewayFound) - // Prepare an updated gateway with a lower stake + // Prepare an updated gateway with a lower stake. updatedStake := cosmostypes.NewCoin("upokt", math.NewInt(50)) updateMsg := &gatewaytypes.MsgStakeGateway{ Address: addr, Stake: &updatedStake, } - // Verify that it fails + // Verify that it fails. _, err = srv.StakeGateway(ctx, updateMsg) require.Error(t, err) - // Verify that the gateway stake is unchanged + // Verify that the gateway stake is unchanged. gatewayFound, isGatewayFound := k.GetGateway(ctx, addr) require.True(t, isGatewayFound) require.Equal(t, initialStake.Amount, gatewayFound.Stake.Amount) @@ -107,13 +107,13 @@ func TestMsgServer_StakeGateway_FailBelowMinStake(t *testing.T) { }) require.NoError(t, err) - // Prepare the gateway + // Prepare the gateway. stakeMsg := &gatewaytypes.MsgStakeGateway{ Address: addr, Stake: &gatewayStake, } - // Stake the gateway & verify that the gateway exists + // Attempt to stake the gateway & verify that the gateway does NOT exist. _, err = srv.StakeGateway(ctx, stakeMsg) require.ErrorContains(t, err, expectedErr.Error()) _, isGatewayFound := k.GetGateway(ctx, addr) From 414071046c71cb915f7859a1ae6b4e1d61ba1123 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 27 Sep 2024 11:03:48 +0200 Subject: [PATCH 023/139] scaffold: message update-param --module examplemod --signer authority name as_type --response params --- api/poktroll/application/tx.pulsar.go | 1484 ++++++++++++++--- api/poktroll/application/tx_grpc.pb.go | 38 + proto/poktroll/application/tx.proto | 43 +- .../keeper/msg_server_update_param.go | 18 + x/application/module/autocli.go | 6 + x/application/module/simulation.go | 23 + x/application/simulation/update_param.go | 29 + x/application/types/codec.go | 3 + x/application/types/message_update_param.go | 26 + .../types/message_update_param_test.go | 40 + x/application/types/tx.pb.go | 574 ++++++- 11 files changed, 2026 insertions(+), 258 deletions(-) create mode 100644 x/application/keeper/msg_server_update_param.go create mode 100644 x/application/simulation/update_param.go create mode 100644 x/application/types/message_update_param.go create mode 100644 x/application/types/message_update_param_test.go diff --git a/api/poktroll/application/tx.pulsar.go b/api/poktroll/application/tx.pulsar.go index 2f0cbcda3..2aa94521b 100644 --- a/api/poktroll/application/tx.pulsar.go +++ b/api/poktroll/application/tx.pulsar.go @@ -5,11 +5,11 @@ import ( _ "cosmossdk.io/api/amino" v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" _ "cosmossdk.io/api/cosmos/msg/v1" - shared "github.com/pokt-network/poktroll/api/poktroll/shared" fmt "fmt" _ "github.com/cosmos/cosmos-proto" runtime "github.com/cosmos/cosmos-proto/runtime" _ "github.com/cosmos/gogoproto/gogoproto" + shared "github.com/pokt-network/poktroll/api/poktroll/shared" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" @@ -5241,172 +5241,1140 @@ func (x *fastReflection_MsgTransferApplicationResponse) ProtoMethods() *protoifa } } -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.27.0 -// protoc (unknown) -// source: poktroll/application/tx.proto - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +var ( + md_MsgUpdateParam protoreflect.MessageDescriptor + fd_MsgUpdateParam_authority protoreflect.FieldDescriptor + fd_MsgUpdateParam_name protoreflect.FieldDescriptor + fd_MsgUpdateParam_asType protoreflect.FieldDescriptor ) -// MsgUpdateParams is the Msg/UpdateParams request type. -type MsgUpdateParams struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields +func init() { + file_poktroll_application_tx_proto_init() + md_MsgUpdateParam = File_poktroll_application_tx_proto.Messages().ByName("MsgUpdateParam") + fd_MsgUpdateParam_authority = md_MsgUpdateParam.Fields().ByName("authority") + fd_MsgUpdateParam_name = md_MsgUpdateParam.Fields().ByName("name") + fd_MsgUpdateParam_asType = md_MsgUpdateParam.Fields().ByName("asType") +} - // 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 x/application parameters to update. - // NOTE: All parameters must be supplied. - Params *Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty"` +var _ protoreflect.Message = (*fastReflection_MsgUpdateParam)(nil) + +type fastReflection_MsgUpdateParam MsgUpdateParam + +func (x *MsgUpdateParam) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUpdateParam)(x) } -func (x *MsgUpdateParams) Reset() { - *x = MsgUpdateParams{} - if protoimpl.UnsafeEnabled { - mi := &file_poktroll_application_tx_proto_msgTypes[0] +func (x *MsgUpdateParam) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_application_tx_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms } + return mi.MessageOf(x) } -func (x *MsgUpdateParams) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MsgUpdateParams) ProtoMessage() {} +var _fastReflection_MsgUpdateParam_messageType fastReflection_MsgUpdateParam_messageType +var _ protoreflect.MessageType = fastReflection_MsgUpdateParam_messageType{} -// Deprecated: Use MsgUpdateParams.ProtoReflect.Descriptor instead. -func (*MsgUpdateParams) Descriptor() ([]byte, []int) { - return file_poktroll_application_tx_proto_rawDescGZIP(), []int{0} -} +type fastReflection_MsgUpdateParam_messageType struct{} -func (x *MsgUpdateParams) GetAuthority() string { - if x != nil { - return x.Authority - } - return "" +func (x fastReflection_MsgUpdateParam_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUpdateParam)(nil) } - -func (x *MsgUpdateParams) GetParams() *Params { - if x != nil { - return x.Params - } - return nil +func (x fastReflection_MsgUpdateParam_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParam) } - -// MsgUpdateParamsResponse defines the response structure for executing a -// MsgUpdateParams message. -type MsgUpdateParamsResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields +func (x fastReflection_MsgUpdateParam_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParam } -func (x *MsgUpdateParamsResponse) Reset() { - *x = MsgUpdateParamsResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_poktroll_application_tx_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUpdateParam) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParam } -func (x *MsgUpdateParamsResponse) String() string { - return protoimpl.X.MessageStringOf(x) +// 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 } -func (*MsgUpdateParamsResponse) ProtoMessage() {} - -// Deprecated: Use MsgUpdateParamsResponse.ProtoReflect.Descriptor instead. -func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { - return file_poktroll_application_tx_proto_rawDescGZIP(), []int{1} +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUpdateParam) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParam) } -type MsgStakeApplication struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // The Bech32 address of the application. - Stake *v1beta1.Coin `protobuf:"bytes,2,opt,name=stake,proto3" json:"stake,omitempty"` // The total amount of uPOKT the application has staked. Must be ≥ to the current amount that the application has staked (if any) - Services []*shared.ApplicationServiceConfig `protobuf:"bytes,3,rep,name=services,proto3" json:"services,omitempty"` // The list of services this application is staked to request service for +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUpdateParam) Interface() protoreflect.ProtoMessage { + return (*MsgUpdateParam)(x) } -func (x *MsgStakeApplication) Reset() { - *x = MsgStakeApplication{} - if protoimpl.UnsafeEnabled { - mi := &file_poktroll_application_tx_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) +// 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 != "" { + value := protoreflect.ValueOfString(x.AsType) + if !f(fd_MsgUpdateParam_asType, value) { + return + } } } -func (x *MsgStakeApplication) String() string { - return protoimpl.X.MessageStringOf(x) +// 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.application.MsgUpdateParam.authority": + return x.Authority != "" + case "poktroll.application.MsgUpdateParam.name": + return x.Name != "" + case "poktroll.application.MsgUpdateParam.asType": + return x.AsType != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUpdateParam")) + } + panic(fmt.Errorf("message poktroll.application.MsgUpdateParam does not contain field %s", fd.FullName())) + } } -func (*MsgStakeApplication) ProtoMessage() {} - -// Deprecated: Use MsgStakeApplication.ProtoReflect.Descriptor instead. -func (*MsgStakeApplication) Descriptor() ([]byte, []int) { - return file_poktroll_application_tx_proto_rawDescGZIP(), []int{2} +// 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.application.MsgUpdateParam.authority": + x.Authority = "" + case "poktroll.application.MsgUpdateParam.name": + x.Name = "" + case "poktroll.application.MsgUpdateParam.asType": + x.AsType = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUpdateParam")) + } + panic(fmt.Errorf("message poktroll.application.MsgUpdateParam does not contain field %s", fd.FullName())) + } } -func (x *MsgStakeApplication) GetAddress() string { - if x != nil { - return x.Address +// 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.application.MsgUpdateParam.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + case "poktroll.application.MsgUpdateParam.name": + value := x.Name + return protoreflect.ValueOfString(value) + case "poktroll.application.MsgUpdateParam.asType": + value := x.AsType + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUpdateParam")) + } + panic(fmt.Errorf("message poktroll.application.MsgUpdateParam does not contain field %s", descriptor.FullName())) } - return "" } -func (x *MsgStakeApplication) GetStake() *v1beta1.Coin { - if x != nil { - return x.Stake +// 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.application.MsgUpdateParam.authority": + x.Authority = value.Interface().(string) + case "poktroll.application.MsgUpdateParam.name": + x.Name = value.Interface().(string) + case "poktroll.application.MsgUpdateParam.asType": + x.AsType = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUpdateParam")) + } + panic(fmt.Errorf("message poktroll.application.MsgUpdateParam does not contain field %s", fd.FullName())) } - return nil } -func (x *MsgStakeApplication) GetServices() []*shared.ApplicationServiceConfig { - if x != nil { - return x.Services +// 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.application.MsgUpdateParam.authority": + panic(fmt.Errorf("field authority of message poktroll.application.MsgUpdateParam is not mutable")) + case "poktroll.application.MsgUpdateParam.name": + panic(fmt.Errorf("field name of message poktroll.application.MsgUpdateParam is not mutable")) + case "poktroll.application.MsgUpdateParam.asType": + panic(fmt.Errorf("field asType of message poktroll.application.MsgUpdateParam is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUpdateParam")) + } + panic(fmt.Errorf("message poktroll.application.MsgUpdateParam does not contain field %s", fd.FullName())) } - return nil } -type MsgStakeApplicationResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields +// 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.application.MsgUpdateParam.authority": + return protoreflect.ValueOfString("") + case "poktroll.application.MsgUpdateParam.name": + return protoreflect.ValueOfString("") + case "poktroll.application.MsgUpdateParam.asType": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUpdateParam")) + } + panic(fmt.Errorf("message poktroll.application.MsgUpdateParam does not contain field %s", fd.FullName())) + } } -func (x *MsgStakeApplicationResponse) Reset() { - *x = MsgStakeApplicationResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_poktroll_application_tx_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) +// 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() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.application.MsgUpdateParam", d.FullName())) } + panic("unreachable") } -func (x *MsgStakeApplicationResponse) String() string { - return protoimpl.X.MessageStringOf(x) +// 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 } -func (*MsgStakeApplicationResponse) ProtoMessage() {} - -// Deprecated: Use MsgStakeApplicationResponse.ProtoReflect.Descriptor instead. -func (*MsgStakeApplicationResponse) Descriptor() ([]byte, []int) { - return file_poktroll_application_tx_proto_rawDescGZIP(), []int{3} +// 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 } -type MsgUnstakeApplication struct { +// 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)) + } + l = len(x.AsType) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*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) + } + if len(x.AsType) > 0 { + i -= len(x.AsType) + copy(dAtA[i:], x.AsType) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.AsType))) + i-- + dAtA[i] = 0x1a + } + 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 AsType", 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 = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgUpdateParamResponse protoreflect.MessageDescriptor + fd_MsgUpdateParamResponse_params protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_application_tx_proto_init() + md_MsgUpdateParamResponse = File_poktroll_application_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_application_tx_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_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 != "" { + value := protoreflect.ValueOfString(x.Params) + 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.application.MsgUpdateParamResponse.params": + return x.Params != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUpdateParamResponse")) + } + panic(fmt.Errorf("message poktroll.application.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.application.MsgUpdateParamResponse.params": + x.Params = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUpdateParamResponse")) + } + panic(fmt.Errorf("message poktroll.application.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.application.MsgUpdateParamResponse.params": + value := x.Params + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUpdateParamResponse")) + } + panic(fmt.Errorf("message poktroll.application.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.application.MsgUpdateParamResponse.params": + x.Params = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUpdateParamResponse")) + } + panic(fmt.Errorf("message poktroll.application.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.application.MsgUpdateParamResponse.params": + panic(fmt.Errorf("field params of message poktroll.application.MsgUpdateParamResponse is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUpdateParamResponse")) + } + panic(fmt.Errorf("message poktroll.application.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.application.MsgUpdateParamResponse.params": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUpdateParamResponse")) + } + panic(fmt.Errorf("message poktroll.application.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.application.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 + l = len(x.Params) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*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 len(x.Params) > 0 { + i -= len(x.Params) + copy(dAtA[i:], x.Params) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Params))) + 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 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.Params = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/application/tx.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// MsgUpdateParams is the Msg/UpdateParams request type. +type MsgUpdateParams struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // authority is the address that controls the module (defaults to x/gov unless overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the x/application parameters to update. + // NOTE: All parameters must be supplied. + Params *Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty"` +} + +func (x *MsgUpdateParams) Reset() { + *x = MsgUpdateParams{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_application_tx_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUpdateParams) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUpdateParams) ProtoMessage() {} + +// Deprecated: Use MsgUpdateParams.ProtoReflect.Descriptor instead. +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return file_poktroll_application_tx_proto_rawDescGZIP(), []int{0} +} + +func (x *MsgUpdateParams) GetAuthority() string { + if x != nil { + return x.Authority + } + return "" +} + +func (x *MsgUpdateParams) GetParams() *Params { + if x != nil { + return x.Params + } + return nil +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +type MsgUpdateParamsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgUpdateParamsResponse) Reset() { + *x = MsgUpdateParamsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_application_tx_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUpdateParamsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUpdateParamsResponse) ProtoMessage() {} + +// Deprecated: Use MsgUpdateParamsResponse.ProtoReflect.Descriptor instead. +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return file_poktroll_application_tx_proto_rawDescGZIP(), []int{1} +} + +type MsgStakeApplication struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // The Bech32 address of the application. + Stake *v1beta1.Coin `protobuf:"bytes,2,opt,name=stake,proto3" json:"stake,omitempty"` // The total amount of uPOKT the application has staked. Must be ≥ to the current amount that the application has staked (if any) + Services []*shared.ApplicationServiceConfig `protobuf:"bytes,3,rep,name=services,proto3" json:"services,omitempty"` // The list of services this application is staked to request service for +} + +func (x *MsgStakeApplication) Reset() { + *x = MsgStakeApplication{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_application_tx_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgStakeApplication) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgStakeApplication) ProtoMessage() {} + +// Deprecated: Use MsgStakeApplication.ProtoReflect.Descriptor instead. +func (*MsgStakeApplication) Descriptor() ([]byte, []int) { + return file_poktroll_application_tx_proto_rawDescGZIP(), []int{2} +} + +func (x *MsgStakeApplication) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +func (x *MsgStakeApplication) GetStake() *v1beta1.Coin { + if x != nil { + return x.Stake + } + return nil +} + +func (x *MsgStakeApplication) GetServices() []*shared.ApplicationServiceConfig { + if x != nil { + return x.Services + } + return nil +} + +type MsgStakeApplicationResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgStakeApplicationResponse) Reset() { + *x = MsgStakeApplicationResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_application_tx_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgStakeApplicationResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgStakeApplicationResponse) ProtoMessage() {} + +// Deprecated: Use MsgStakeApplicationResponse.ProtoReflect.Descriptor instead. +func (*MsgStakeApplicationResponse) Descriptor() ([]byte, []int) { + return file_poktroll_application_tx_proto_rawDescGZIP(), []int{3} +} + +type MsgUnstakeApplication struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -5683,6 +6651,92 @@ func (x *MsgTransferApplicationResponse) GetApplication() *Application { return nil } +type MsgUpdateParam struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + AsType string `protobuf:"bytes,3,opt,name=asType,proto3" json:"asType,omitempty"` +} + +func (x *MsgUpdateParam) Reset() { + *x = MsgUpdateParam{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_application_tx_proto_msgTypes[12] + 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_application_tx_proto_rawDescGZIP(), []int{12} +} + +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() string { + if x != nil { + return x.AsType + } + return "" +} + +type MsgUpdateParamResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Params string `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` +} + +func (x *MsgUpdateParamResponse) Reset() { + *x = MsgUpdateParamResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_application_tx_proto_msgTypes[13] + 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_application_tx_proto_rawDescGZIP(), []int{13} +} + +func (x *MsgUpdateParamResponse) GetParams() string { + if x != nil { + return x.Params + } + return "" +} + var File_poktroll_application_tx_proto protoreflect.FileDescriptor var file_poktroll_application_tx_proto_rawDesc = []byte{ @@ -5782,65 +6836,81 @@ var file_poktroll_application_tx_proto_rawDesc = []byte{ 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0b, 0x61, 0x70, - 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x32, 0xcd, 0x05, 0x0a, 0x03, 0x4d, 0x73, - 0x67, 0x12, 0x64, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x73, 0x12, 0x25, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, - 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x2d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 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, 0x70, 0x0a, 0x10, 0x53, 0x74, 0x61, 0x6b, 0x65, - 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x29, 0x2e, 0x70, 0x6f, - 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x31, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x6a, 0x0a, 0x0e, 0x4d, 0x73, 0x67, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x1c, 0x0a, 0x09, 0x61, + 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 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, 0x16, 0x0a, + 0x06, 0x61, 0x73, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, + 0x73, 0x54, 0x79, 0x70, 0x65, 0x3a, 0x0e, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, + 0x6f, 0x72, 0x69, 0x74, 0x79, 0x22, 0x30, 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, + 0x16, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x32, 0xb0, 0x06, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, + 0x64, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, + 0x25, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x2d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, - 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x76, 0x0a, 0x12, 0x55, 0x6e, 0x73, - 0x74, 0x61, 0x6b, 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, - 0x2b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, - 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x33, 0x2e, 0x70, - 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x41, 0x70, - 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x73, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x54, 0x6f, 0x47, - 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x2a, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, - 0x67, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x54, 0x6f, 0x47, 0x61, 0x74, 0x65, 0x77, - 0x61, 0x79, 0x1a, 0x32, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, - 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x6c, - 0x65, 0x67, 0x61, 0x74, 0x65, 0x54, 0x6f, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x7f, 0x0a, 0x15, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, - 0x67, 0x61, 0x74, 0x65, 0x46, 0x72, 0x6f, 0x6d, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, - 0x2e, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, - 0x67, 0x61, 0x74, 0x65, 0x46, 0x72, 0x6f, 0x6d, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x1a, - 0x36, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, - 0x67, 0x61, 0x74, 0x65, 0x46, 0x72, 0x6f, 0x6d, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x79, 0x0a, 0x13, 0x54, 0x72, 0x61, 0x6e, 0x73, - 0x66, 0x65, 0x72, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2c, - 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, - 0x72, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x34, 0x2e, 0x70, + 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x70, 0x0a, 0x10, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x41, 0x70, + 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x31, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, + 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x53, + 0x74, 0x61, 0x6b, 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x76, 0x0a, 0x12, 0x55, 0x6e, 0x73, 0x74, 0x61, + 0x6b, 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2b, 0x2e, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x41, + 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x33, 0x2e, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x41, 0x70, 0x70, 0x6c, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x73, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x54, 0x6f, 0x47, 0x61, 0x74, + 0x65, 0x77, 0x61, 0x79, 0x12, 0x2a, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, + 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x44, + 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x54, 0x6f, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, + 0x1a, 0x32, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x6c, 0x65, 0x67, + 0x61, 0x74, 0x65, 0x54, 0x6f, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x7f, 0x0a, 0x15, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, + 0x74, 0x65, 0x46, 0x72, 0x6f, 0x6d, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x2e, 0x2e, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, + 0x74, 0x65, 0x46, 0x72, 0x6f, 0x6d, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x1a, 0x36, 0x2e, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, + 0x74, 0x65, 0x46, 0x72, 0x6f, 0x6d, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x79, 0x0a, 0x13, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, + 0x72, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2c, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x41, - 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xbf, 0x01, 0xd8, 0xe2, 0x1e, 0x01, - 0x0a, 0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, - 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x25, 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, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xa2, 0x02, 0x03, 0x50, - 0x41, 0x58, 0xaa, 0x02, 0x14, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x41, 0x70, - 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xca, 0x02, 0x14, 0x50, 0x6f, 0x6b, 0x74, - 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0xe2, 0x02, 0x20, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x41, 0x70, 0x70, 0x6c, - 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0xea, 0x02, 0x15, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, - 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x34, 0x2e, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x41, 0x70, 0x70, + 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x61, 0x0a, 0x0b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, + 0x24, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x1a, 0x2c, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 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, 0xbf, 0x01, 0xd8, 0xe2, 0x1e, + 0x01, 0x0a, 0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, + 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x07, 0x54, 0x78, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x25, 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, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xa2, 0x02, 0x03, + 0x50, 0x41, 0x58, 0xaa, 0x02, 0x14, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x41, + 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xca, 0x02, 0x14, 0x50, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0xe2, 0x02, 0x20, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x41, 0x70, 0x70, + 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x15, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, + 0x3a, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -5855,7 +6925,7 @@ func file_poktroll_application_tx_proto_rawDescGZIP() []byte { return file_poktroll_application_tx_proto_rawDescData } -var file_poktroll_application_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 12) +var file_poktroll_application_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 14) var file_poktroll_application_tx_proto_goTypes = []interface{}{ (*MsgUpdateParams)(nil), // 0: poktroll.application.MsgUpdateParams (*MsgUpdateParamsResponse)(nil), // 1: poktroll.application.MsgUpdateParamsResponse @@ -5869,30 +6939,34 @@ var file_poktroll_application_tx_proto_goTypes = []interface{}{ (*MsgUndelegateFromGatewayResponse)(nil), // 9: poktroll.application.MsgUndelegateFromGatewayResponse (*MsgTransferApplication)(nil), // 10: poktroll.application.MsgTransferApplication (*MsgTransferApplicationResponse)(nil), // 11: poktroll.application.MsgTransferApplicationResponse - (*Params)(nil), // 12: poktroll.application.Params - (*v1beta1.Coin)(nil), // 13: cosmos.base.v1beta1.Coin - (*shared.ApplicationServiceConfig)(nil), // 14: poktroll.shared.ApplicationServiceConfig - (*Application)(nil), // 15: poktroll.application.Application + (*MsgUpdateParam)(nil), // 12: poktroll.application.MsgUpdateParam + (*MsgUpdateParamResponse)(nil), // 13: poktroll.application.MsgUpdateParamResponse + (*Params)(nil), // 14: poktroll.application.Params + (*v1beta1.Coin)(nil), // 15: cosmos.base.v1beta1.Coin + (*shared.ApplicationServiceConfig)(nil), // 16: poktroll.shared.ApplicationServiceConfig + (*Application)(nil), // 17: poktroll.application.Application } var file_poktroll_application_tx_proto_depIdxs = []int32{ - 12, // 0: poktroll.application.MsgUpdateParams.params:type_name -> poktroll.application.Params - 13, // 1: poktroll.application.MsgStakeApplication.stake:type_name -> cosmos.base.v1beta1.Coin - 14, // 2: poktroll.application.MsgStakeApplication.services:type_name -> poktroll.shared.ApplicationServiceConfig - 15, // 3: poktroll.application.MsgTransferApplicationResponse.application:type_name -> poktroll.application.Application + 14, // 0: poktroll.application.MsgUpdateParams.params:type_name -> poktroll.application.Params + 15, // 1: poktroll.application.MsgStakeApplication.stake:type_name -> cosmos.base.v1beta1.Coin + 16, // 2: poktroll.application.MsgStakeApplication.services:type_name -> poktroll.shared.ApplicationServiceConfig + 17, // 3: poktroll.application.MsgTransferApplicationResponse.application:type_name -> poktroll.application.Application 0, // 4: poktroll.application.Msg.UpdateParams:input_type -> poktroll.application.MsgUpdateParams 2, // 5: poktroll.application.Msg.StakeApplication:input_type -> poktroll.application.MsgStakeApplication 4, // 6: poktroll.application.Msg.UnstakeApplication:input_type -> poktroll.application.MsgUnstakeApplication 6, // 7: poktroll.application.Msg.DelegateToGateway:input_type -> poktroll.application.MsgDelegateToGateway 8, // 8: poktroll.application.Msg.UndelegateFromGateway:input_type -> poktroll.application.MsgUndelegateFromGateway 10, // 9: poktroll.application.Msg.TransferApplication:input_type -> poktroll.application.MsgTransferApplication - 1, // 10: poktroll.application.Msg.UpdateParams:output_type -> poktroll.application.MsgUpdateParamsResponse - 3, // 11: poktroll.application.Msg.StakeApplication:output_type -> poktroll.application.MsgStakeApplicationResponse - 5, // 12: poktroll.application.Msg.UnstakeApplication:output_type -> poktroll.application.MsgUnstakeApplicationResponse - 7, // 13: poktroll.application.Msg.DelegateToGateway:output_type -> poktroll.application.MsgDelegateToGatewayResponse - 9, // 14: poktroll.application.Msg.UndelegateFromGateway:output_type -> poktroll.application.MsgUndelegateFromGatewayResponse - 11, // 15: poktroll.application.Msg.TransferApplication:output_type -> poktroll.application.MsgTransferApplicationResponse - 10, // [10:16] is the sub-list for method output_type - 4, // [4:10] is the sub-list for method input_type + 12, // 10: poktroll.application.Msg.UpdateParam:input_type -> poktroll.application.MsgUpdateParam + 1, // 11: poktroll.application.Msg.UpdateParams:output_type -> poktroll.application.MsgUpdateParamsResponse + 3, // 12: poktroll.application.Msg.StakeApplication:output_type -> poktroll.application.MsgStakeApplicationResponse + 5, // 13: poktroll.application.Msg.UnstakeApplication:output_type -> poktroll.application.MsgUnstakeApplicationResponse + 7, // 14: poktroll.application.Msg.DelegateToGateway:output_type -> poktroll.application.MsgDelegateToGatewayResponse + 9, // 15: poktroll.application.Msg.UndelegateFromGateway:output_type -> poktroll.application.MsgUndelegateFromGatewayResponse + 11, // 16: poktroll.application.Msg.TransferApplication:output_type -> poktroll.application.MsgTransferApplicationResponse + 13, // 17: poktroll.application.Msg.UpdateParam:output_type -> poktroll.application.MsgUpdateParamResponse + 11, // [11:18] is the sub-list for method output_type + 4, // [4:11] is the sub-list for method input_type 4, // [4:4] is the sub-list for extension type_name 4, // [4:4] is the sub-list for extension extendee 0, // [0:4] is the sub-list for field type_name @@ -6050,6 +7124,30 @@ func file_poktroll_application_tx_proto_init() { return nil } } + file_poktroll_application_tx_proto_msgTypes[12].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_application_tx_proto_msgTypes[13].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 + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -6057,7 +7155,7 @@ func file_poktroll_application_tx_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_poktroll_application_tx_proto_rawDesc, NumEnums: 0, - NumMessages: 12, + NumMessages: 14, NumExtensions: 0, NumServices: 1, }, diff --git a/api/poktroll/application/tx_grpc.pb.go b/api/poktroll/application/tx_grpc.pb.go index b0d0aa03d..536793ba9 100644 --- a/api/poktroll/application/tx_grpc.pb.go +++ b/api/poktroll/application/tx_grpc.pb.go @@ -25,6 +25,7 @@ const ( Msg_DelegateToGateway_FullMethodName = "/poktroll.application.Msg/DelegateToGateway" Msg_UndelegateFromGateway_FullMethodName = "/poktroll.application.Msg/UndelegateFromGateway" Msg_TransferApplication_FullMethodName = "/poktroll.application.Msg/TransferApplication" + Msg_UpdateParam_FullMethodName = "/poktroll.application.Msg/UpdateParam" ) // MsgClient is the client API for Msg service. @@ -41,6 +42,7 @@ type MsgClient interface { DelegateToGateway(ctx context.Context, in *MsgDelegateToGateway, opts ...grpc.CallOption) (*MsgDelegateToGatewayResponse, error) UndelegateFromGateway(ctx context.Context, in *MsgUndelegateFromGateway, opts ...grpc.CallOption) (*MsgUndelegateFromGatewayResponse, error) TransferApplication(ctx context.Context, in *MsgTransferApplication, opts ...grpc.CallOption) (*MsgTransferApplicationResponse, error) + UpdateParam(ctx context.Context, in *MsgUpdateParam, opts ...grpc.CallOption) (*MsgUpdateParamResponse, error) } type msgClient struct { @@ -111,6 +113,16 @@ func (c *msgClient) TransferApplication(ctx context.Context, in *MsgTransferAppl return out, nil } +func (c *msgClient) UpdateParam(ctx context.Context, in *MsgUpdateParam, opts ...grpc.CallOption) (*MsgUpdateParamResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(MsgUpdateParamResponse) + err := c.cc.Invoke(ctx, Msg_UpdateParam_FullMethodName, in, out, cOpts...) + 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 @@ -125,6 +137,7 @@ type MsgServer interface { DelegateToGateway(context.Context, *MsgDelegateToGateway) (*MsgDelegateToGatewayResponse, error) UndelegateFromGateway(context.Context, *MsgUndelegateFromGateway) (*MsgUndelegateFromGatewayResponse, error) TransferApplication(context.Context, *MsgTransferApplication) (*MsgTransferApplicationResponse, error) + UpdateParam(context.Context, *MsgUpdateParam) (*MsgUpdateParamResponse, error) mustEmbedUnimplementedMsgServer() } @@ -150,6 +163,9 @@ func (UnimplementedMsgServer) UndelegateFromGateway(context.Context, *MsgUndeleg func (UnimplementedMsgServer) TransferApplication(context.Context, *MsgTransferApplication) (*MsgTransferApplicationResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method TransferApplication 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. @@ -271,6 +287,24 @@ func _Msg_TransferApplication_Handler(srv interface{}, ctx context.Context, dec 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) @@ -302,6 +336,10 @@ var Msg_ServiceDesc = grpc.ServiceDesc{ MethodName: "TransferApplication", Handler: _Msg_TransferApplication_Handler, }, + { + MethodName: "UpdateParam", + Handler: _Msg_UpdateParam_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "poktroll/application/tx.proto", diff --git a/proto/poktroll/application/tx.proto b/proto/poktroll/application/tx.proto index 73ce11d30..9a637e09b 100644 --- a/proto/poktroll/application/tx.proto +++ b/proto/poktroll/application/tx.proto @@ -17,28 +17,29 @@ import "poktroll/shared/service.proto"; // 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 StakeApplication (MsgStakeApplication) returns (MsgStakeApplicationResponse); - rpc UnstakeApplication (MsgUnstakeApplication) returns (MsgUnstakeApplicationResponse); - rpc DelegateToGateway (MsgDelegateToGateway) returns (MsgDelegateToGatewayResponse); - rpc UndelegateFromGateway (MsgUndelegateFromGateway) returns (MsgUndelegateFromGatewayResponse); - rpc TransferApplication (MsgTransferApplication) returns (MsgTransferApplicationResponse); + rpc UpdateParams (MsgUpdateParams ) returns (MsgUpdateParamsResponse ); + rpc StakeApplication (MsgStakeApplication ) returns (MsgStakeApplicationResponse ); + rpc UnstakeApplication (MsgUnstakeApplication ) returns (MsgUnstakeApplicationResponse ); + rpc DelegateToGateway (MsgDelegateToGateway ) returns (MsgDelegateToGatewayResponse ); + rpc UndelegateFromGateway (MsgUndelegateFromGateway) returns (MsgUndelegateFromGatewayResponse); + rpc TransferApplication (MsgTransferApplication ) returns (MsgTransferApplicationResponse ); + rpc UpdateParam (MsgUpdateParam ) returns (MsgUpdateParamResponse ); } // MsgUpdateParams is the Msg/UpdateParams request type. message MsgUpdateParams { - option (cosmos.msg.v1.signer) = "authority"; + option (cosmos.msg.v1.signer) = "authority"; option (amino.name) = "poktroll/x/application/MsgUpdateParams"; - + // authority is the address that controls the module (defaults to x/gov unless overwritten). string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // TODO_IMPROVE(#322): The requirement to provide all params is adopted from the // latest Cosmos SDK version. We should look into either improving this ourselves // or seeing if it is on their roadmap. - + // params defines the x/application parameters to update. // NOTE: All parameters must be supplied. Params params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; @@ -50,9 +51,10 @@ message MsgUpdateParamsResponse {} message MsgStakeApplication { option (cosmos.msg.v1.signer) = "address"; - string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the application. - cosmos.base.v1beta1.Coin stake = 2; // The total amount of uPOKT the application has staked. Must be ≥ to the current amount that the application has staked (if any) + string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the application. + cosmos.base.v1beta1.Coin stake = 2; // The total amount of uPOKT the application has staked. Must be ≥ to the current amount that the application has staked (if any) repeated poktroll.shared.ApplicationServiceConfig services = 3; // The list of services this application is staked to request service for + // TODO_POST_MAINNET_CONSIDERATION: Consdier allowing appplications to delegate // to gateways at time of staking for a better developer experience. // repeated string gateway_addresss @@ -69,7 +71,7 @@ message MsgUnstakeApplicationResponse {} message MsgDelegateToGateway { option (cosmos.msg.v1.signer) = "app_address"; // https://docs.cosmos.network/main/build/building-modules/messages-and-queries - string app_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the application. + string app_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the application. string gateway_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the gateway the application wants to delegate to. } @@ -77,7 +79,7 @@ message MsgDelegateToGatewayResponse {} message MsgUndelegateFromGateway { option (cosmos.msg.v1.signer) = "app_address"; // https://docs.cosmos.network/main/build/building-modules/messages-and-queries - string app_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the application. + string app_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the application. string gateway_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the gateway the application wants to undelegate from. } @@ -85,7 +87,7 @@ message MsgUndelegateFromGatewayResponse {} message MsgTransferApplication { option (cosmos.msg.v1.signer) = "source_address"; - string source_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string source_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; string destination_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } @@ -93,3 +95,14 @@ message MsgTransferApplicationResponse { poktroll.application.Application application = 1; } +message MsgUpdateParam { + option (cosmos.msg.v1.signer) = "authority"; + string authority = 1; + string name = 2; + string asType = 3; +} + +message MsgUpdateParamResponse { + string params = 1; +} + diff --git a/x/application/keeper/msg_server_update_param.go b/x/application/keeper/msg_server_update_param.go new file mode 100644 index 000000000..94bcae3e7 --- /dev/null +++ b/x/application/keeper/msg_server_update_param.go @@ -0,0 +1,18 @@ +package keeper + +import ( + "context" + + "github.com/pokt-network/poktroll/x/application/types" + sdk "github.com/cosmos/cosmos-sdk/types" +) + + +func (k msgServer) UpdateParam(goCtx context.Context, msg *types.MsgUpdateParam) (*types.MsgUpdateParamResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + // TODO: Handling the message + _ = ctx + + return &types.MsgUpdateParamResponse{}, nil +} diff --git a/x/application/module/autocli.go b/x/application/module/autocli.go index a39b9694c..54edaf5fa 100644 --- a/x/application/module/autocli.go +++ b/x/application/module/autocli.go @@ -103,6 +103,12 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { Short: "Transfer the application from [source app address] to [destination app address] and remove the source application", PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "source_address"}, {ProtoField: "destination_address"}}, }, + { + 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/application/module/simulation.go b/x/application/module/simulation.go index b1dabfa2d..d02795d87 100644 --- a/x/application/module/simulation.go +++ b/x/application/module/simulation.go @@ -43,6 +43,10 @@ const ( // TODO: Determine the simulation weight value defaultWeightMsgTransferApplication int = 100 + 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 ) @@ -126,6 +130,17 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp applicationsimulation.SimulateMsgTransferApplication(am.accountKeeper, am.bankKeeper, am.applicationKeeper), )) + var weightMsgUpdateParam int + simState.AppParams.GetOrGenerate(opWeightMsgUpdateParam, &weightMsgUpdateParam, nil, + func(_ *rand.Rand) { + weightMsgUpdateParam = defaultWeightMsgUpdateParam + }, + ) + operations = append(operations, simulation.NewWeightedOperation( + weightMsgUpdateParam, + applicationsimulation.SimulateMsgUpdateParam(am.accountKeeper, am.bankKeeper, am.keeper), + )) + // this line is used by starport scaffolding # simapp/module/operation return operations @@ -174,6 +189,14 @@ func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.Wei return nil }, ), + simulation.NewWeightedProposalMsg( + opWeightMsgUpdateParam, + defaultWeightMsgUpdateParam, + func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { + applicationsimulation.SimulateMsgUpdateParam(am.accountKeeper, am.bankKeeper, am.keeper) + return nil + }, + ), // this line is used by starport scaffolding # simapp/module/OpMsg } } diff --git a/x/application/simulation/update_param.go b/x/application/simulation/update_param.go new file mode 100644 index 000000000..ba62362c6 --- /dev/null +++ b/x/application/simulation/update_param.go @@ -0,0 +1,29 @@ +package simulation + +import ( + "math/rand" + + "github.com/pokt-network/poktroll/x/application/keeper" + "github.com/pokt-network/poktroll/x/application/types" + "github.com/cosmos/cosmos-sdk/baseapp" + sdk "github.com/cosmos/cosmos-sdk/types" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" +) + +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/application/types/codec.go b/x/application/types/codec.go index bdbcdde42..f289664e7 100644 --- a/x/application/types/codec.go +++ b/x/application/types/codec.go @@ -23,6 +23,9 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { registry.RegisterImplementations((*sdk.Msg)(nil), &MsgTransferApplication{}, ) + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgUpdateParam{}, + ) // this line is used by starport scaffolding # 3 registry.RegisterImplementations((*sdk.Msg)(nil), diff --git a/x/application/types/message_update_param.go b/x/application/types/message_update_param.go new file mode 100644 index 000000000..89d033fd5 --- /dev/null +++ b/x/application/types/message_update_param.go @@ -0,0 +1,26 @@ +package types + +import ( + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +var _ sdk.Msg = &MsgUpdateParam{} + +func NewMsgUpdateParam(authority string, name string, asType string) *MsgUpdateParam { + return &MsgUpdateParam{ + Authority: authority, + Name: name, + AsType: asType, + } +} + +func (msg *MsgUpdateParam) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.Authority) + if err != nil { + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid authority address (%s)", err) + } + return nil +} + diff --git a/x/application/types/message_update_param_test.go b/x/application/types/message_update_param_test.go new file mode 100644 index 000000000..406337ff2 --- /dev/null +++ b/x/application/types/message_update_param_test.go @@ -0,0 +1,40 @@ +package types + +import ( + "testing" + + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/stretchr/testify/require" + "github.com/pokt-network/poktroll/testutil/sample" +) + +func TestMsgUpdateParam_ValidateBasic(t *testing.T) { + tests := []struct { + name string + msg MsgUpdateParam + err error + }{ + { + name: "invalid address", + msg: MsgUpdateParam{ + Authority: "invalid_address", + }, + err: sdkerrors.ErrInvalidAddress, + }, { + name: "valid address", + msg: MsgUpdateParam{ + Authority: sample.AccAddress(), + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := tt.msg.ValidateBasic() + if tt.err != nil { + require.ErrorIs(t, err, tt.err) + return + } + require.NoError(t, err) + }) + } +} diff --git a/x/application/types/tx.pb.go b/x/application/types/tx.pb.go index 7a9b0cefa..45c09e6ec 100644 --- a/x/application/types/tx.pb.go +++ b/x/application/types/tx.pb.go @@ -527,6 +527,102 @@ func (m *MsgTransferApplicationResponse) GetApplication() *Application { return nil } +type MsgUpdateParam struct { + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + AsType string `protobuf:"bytes,3,opt,name=asType,proto3" json:"asType,omitempty"` +} + +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_bed224e38ab1cc6d, []int{12} +} +func (m *MsgUpdateParam) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParam) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + 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 + +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) GetAsType() string { + if m != nil { + return m.AsType + } + return "" +} + +type MsgUpdateParamResponse struct { + Params string `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_bed224e38ab1cc6d, []int{13} +} +func (m *MsgUpdateParamResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParamResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + 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() string { + if m != nil { + return m.Params + } + return "" +} + func init() { proto.RegisterType((*MsgUpdateParams)(nil), "poktroll.application.MsgUpdateParams") proto.RegisterType((*MsgUpdateParamsResponse)(nil), "poktroll.application.MsgUpdateParamsResponse") @@ -540,61 +636,67 @@ func init() { proto.RegisterType((*MsgUndelegateFromGatewayResponse)(nil), "poktroll.application.MsgUndelegateFromGatewayResponse") proto.RegisterType((*MsgTransferApplication)(nil), "poktroll.application.MsgTransferApplication") proto.RegisterType((*MsgTransferApplicationResponse)(nil), "poktroll.application.MsgTransferApplicationResponse") + proto.RegisterType((*MsgUpdateParam)(nil), "poktroll.application.MsgUpdateParam") + proto.RegisterType((*MsgUpdateParamResponse)(nil), "poktroll.application.MsgUpdateParamResponse") } func init() { proto.RegisterFile("poktroll/application/tx.proto", fileDescriptor_bed224e38ab1cc6d) } var fileDescriptor_bed224e38ab1cc6d = []byte{ - // 772 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x96, 0xcd, 0x4e, 0xdb, 0x4a, - 0x14, 0xc7, 0x63, 0x10, 0xdc, 0xcb, 0x09, 0x97, 0x0f, 0x27, 0x5c, 0x82, 0x0b, 0x26, 0x44, 0x6a, - 0x05, 0x69, 0xb1, 0x95, 0x80, 0x90, 0x60, 0x83, 0x80, 0x7e, 0xa8, 0x8b, 0x48, 0x55, 0xa0, 0x9b, - 0x6e, 0xd0, 0x24, 0x19, 0x8c, 0x45, 0xe2, 0xb1, 0x3c, 0x43, 0x20, 0xab, 0x56, 0x5d, 0x76, 0xd5, - 0xa7, 0xa8, 0xaa, 0xae, 0x58, 0x74, 0xd3, 0x07, 0xa8, 0xc4, 0xa6, 0x2a, 0xea, 0x8a, 0x55, 0x55, - 0x85, 0x05, 0xaf, 0x51, 0xd9, 0x1e, 0x3b, 0xc6, 0x99, 0x94, 0xb0, 0xeb, 0x06, 0xe2, 0x39, 0xff, - 0x73, 0xce, 0xff, 0x77, 0x46, 0x33, 0x36, 0xcc, 0xd9, 0xe4, 0x88, 0x39, 0xa4, 0x5e, 0xd7, 0x91, - 0x6d, 0xd7, 0xcd, 0x2a, 0x62, 0x26, 0xb1, 0x74, 0x76, 0xaa, 0xd9, 0x0e, 0x61, 0x44, 0x4e, 0x07, - 0x61, 0x2d, 0x12, 0x56, 0x26, 0x51, 0xc3, 0xb4, 0x88, 0xee, 0xfd, 0xf5, 0x85, 0xca, 0x4c, 0x95, - 0xd0, 0x06, 0xa1, 0xfb, 0xde, 0x93, 0xee, 0x3f, 0xf0, 0x90, 0xea, 0x3f, 0xe9, 0x15, 0x44, 0xb1, - 0xde, 0x2c, 0x54, 0x30, 0x43, 0x05, 0xbd, 0x4a, 0x4c, 0x8b, 0xc7, 0xa7, 0x79, 0xbc, 0x41, 0x0d, - 0xbd, 0x59, 0x70, 0xff, 0xf1, 0x40, 0xda, 0x20, 0x06, 0xf1, 0x0b, 0xba, 0xbf, 0xf8, 0x6a, 0x56, - 0xec, 0xb8, 0x65, 0xe3, 0xa0, 0xe1, 0x82, 0x50, 0x61, 0x23, 0x07, 0x35, 0x02, 0x49, 0x07, 0x9b, - 0x1e, 0x22, 0x07, 0xd7, 0x74, 0x8a, 0x9d, 0xa6, 0x59, 0xc5, 0x7e, 0x38, 0xf7, 0x55, 0x82, 0xf1, - 0x12, 0x35, 0x5e, 0xda, 0x35, 0xc4, 0xf0, 0x0b, 0x2f, 0x51, 0x5e, 0x83, 0x11, 0x74, 0xcc, 0x0e, - 0x89, 0x63, 0xb2, 0x56, 0x46, 0xca, 0x4a, 0x8b, 0x23, 0xdb, 0x99, 0x1f, 0x9f, 0x97, 0xd3, 0x9c, - 0x75, 0xab, 0x56, 0x73, 0x30, 0xa5, 0xbb, 0xcc, 0x31, 0x2d, 0xa3, 0xdc, 0x91, 0xca, 0x9b, 0x30, - 0xec, 0xb7, 0xce, 0x0c, 0x64, 0xa5, 0xc5, 0x64, 0x71, 0x56, 0x13, 0xcd, 0x54, 0xf3, 0xbb, 0x6c, - 0x8f, 0x9c, 0xff, 0x9c, 0x4f, 0x7c, 0xbc, 0x3e, 0xcb, 0x4b, 0x65, 0x9e, 0xb6, 0xb1, 0xfe, 0xf6, - 0xfa, 0x2c, 0xdf, 0x29, 0xf8, 0xee, 0xfa, 0x2c, 0xff, 0x20, 0xb4, 0x7f, 0x7a, 0x83, 0x31, 0xe6, - 0x39, 0x37, 0x03, 0xd3, 0xb1, 0xa5, 0x32, 0xa6, 0x36, 0xb1, 0x28, 0xce, 0x7d, 0x97, 0x20, 0x55, - 0xa2, 0xc6, 0x2e, 0x43, 0x47, 0x78, 0xab, 0x53, 0x42, 0x2e, 0xc2, 0x3f, 0xc8, 0x47, 0xb9, 0x15, - 0x32, 0x10, 0xca, 0x3a, 0x0c, 0x51, 0xb7, 0x0e, 0x27, 0x9c, 0xd1, 0xb8, 0xdc, 0xdd, 0x71, 0x8d, - 0xef, 0xb8, 0xb6, 0x43, 0x4c, 0xab, 0xec, 0xeb, 0xe4, 0x27, 0xf0, 0x2f, 0x1f, 0x38, 0xcd, 0x0c, - 0x66, 0x07, 0x17, 0x93, 0xc5, 0xa5, 0xce, 0x54, 0xfc, 0x1d, 0xd1, 0x22, 0xa6, 0x76, 0x7d, 0xed, - 0x0e, 0xb1, 0x0e, 0x4c, 0xa3, 0x1c, 0xa6, 0x6e, 0x8c, 0xba, 0x93, 0x09, 0x5c, 0xe4, 0xe6, 0xe0, - 0x9e, 0x00, 0x28, 0x04, 0xde, 0x84, 0x29, 0x77, 0x16, 0x16, 0x8d, 0x13, 0x67, 0x62, 0xc4, 0x21, - 0x57, 0xac, 0xfe, 0x3c, 0xcc, 0x09, 0x0b, 0x84, 0x1d, 0x3e, 0x48, 0x90, 0x2e, 0x51, 0xe3, 0x31, - 0xae, 0x63, 0x03, 0x31, 0xbc, 0x47, 0x9e, 0x21, 0x86, 0x4f, 0x50, 0x4b, 0x5e, 0x87, 0x24, 0xb2, - 0xed, 0xfd, 0x7e, 0xe7, 0x0a, 0xc8, 0xb6, 0xf9, 0x8a, 0xbc, 0x05, 0xe3, 0x86, 0x5f, 0x25, 0x4c, - 0x1f, 0xb8, 0x25, 0x7d, 0x8c, 0x27, 0xf0, 0xd5, 0x8d, 0x09, 0x97, 0x22, 0x6a, 0x20, 0xa7, 0xc2, - 0xac, 0xc8, 0x67, 0x08, 0xf2, 0x49, 0x82, 0x8c, 0x87, 0x5a, 0xe3, 0x92, 0xa7, 0x0e, 0x69, 0xfc, - 0xad, 0x30, 0x39, 0xc8, 0xf6, 0xf2, 0x1a, 0x02, 0x7d, 0x91, 0xe0, 0xff, 0x12, 0x35, 0xf6, 0x1c, - 0x64, 0xd1, 0x03, 0xec, 0x44, 0x77, 0x7f, 0x13, 0xc6, 0x28, 0x39, 0x76, 0xaa, 0xb8, 0x6f, 0xa2, - 0xff, 0x7c, 0x7d, 0x00, 0xf5, 0x1c, 0x52, 0x35, 0x4c, 0x99, 0x69, 0x79, 0xf5, 0xfa, 0x06, 0x93, - 0x23, 0x49, 0x01, 0x5c, 0xca, 0x85, 0x8b, 0xd9, 0xc9, 0x61, 0x50, 0xc5, 0xd6, 0x03, 0x3a, 0x79, - 0xc7, 0xdb, 0x91, 0x60, 0xd9, 0xf3, 0x9f, 0x2c, 0x2e, 0x88, 0xaf, 0x99, 0x68, 0x7e, 0x34, 0xab, - 0xf8, 0x6d, 0x08, 0x06, 0x4b, 0xd4, 0x90, 0x6b, 0x30, 0x7a, 0xe3, 0xda, 0xbb, 0x2f, 0xae, 0x13, - 0xbb, 0x56, 0x94, 0xe5, 0xbe, 0x64, 0xa1, 0x65, 0x1b, 0x26, 0xba, 0x6e, 0x9e, 0xa5, 0x9e, 0x25, - 0xe2, 0x52, 0xa5, 0xd0, 0xb7, 0x34, 0xec, 0xd8, 0x04, 0x59, 0x70, 0xf6, 0x1f, 0xf6, 0xb6, 0xdd, - 0x25, 0x56, 0x56, 0xee, 0x20, 0x0e, 0xfb, 0x52, 0x98, 0xec, 0xbe, 0x10, 0xf2, 0x3d, 0x2b, 0x75, - 0x69, 0x95, 0x62, 0xff, 0xda, 0xb0, 0xe9, 0x6b, 0x98, 0x12, 0x1f, 0x5e, 0xed, 0x0f, 0x08, 0x02, - 0xbd, 0xb2, 0x76, 0x37, 0x7d, 0x68, 0xa0, 0x05, 0x29, 0xd1, 0x61, 0x7b, 0xd4, 0xb3, 0x9c, 0x40, - 0xad, 0xac, 0xde, 0x45, 0x1d, 0xb4, 0x56, 0x86, 0xde, 0xb8, 0x6f, 0xcf, 0xed, 0xf2, 0x79, 0x5b, - 0x95, 0x2e, 0xda, 0xaa, 0x74, 0xd9, 0x56, 0xa5, 0x5f, 0x6d, 0x55, 0x7a, 0x7f, 0xa5, 0x26, 0x2e, - 0xae, 0xd4, 0xc4, 0xe5, 0x95, 0x9a, 0x78, 0xb5, 0x6a, 0x98, 0xec, 0xf0, 0xb8, 0xa2, 0x55, 0x49, - 0x43, 0x77, 0x9b, 0x2c, 0x5b, 0x98, 0x9d, 0x10, 0xe7, 0x48, 0xef, 0xf1, 0x62, 0xf5, 0x3e, 0x2f, - 0x2a, 0xc3, 0xde, 0xd7, 0xc1, 0xca, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0xb5, 0xa2, 0x5c, 0x80, - 0x35, 0x09, 0x00, 0x00, + // 842 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0x4d, 0x4f, 0xeb, 0x46, + 0x14, 0x8d, 0x5f, 0xfa, 0xd2, 0xe6, 0xe6, 0x35, 0x80, 0x13, 0x20, 0xb8, 0x60, 0x82, 0xd5, 0x56, + 0x90, 0x82, 0xdd, 0x04, 0x84, 0x44, 0x36, 0x08, 0xe8, 0x87, 0xba, 0x88, 0x54, 0x05, 0xba, 0xe9, + 0x06, 0x4d, 0x92, 0xc1, 0xb8, 0x24, 0x1e, 0xcb, 0x63, 0x02, 0x59, 0xb5, 0xea, 0xb2, 0xab, 0xfe, + 0x8a, 0xaa, 0xea, 0x2a, 0x8b, 0x6e, 0xfa, 0x03, 0x2a, 0xb1, 0x2b, 0xea, 0x8a, 0x55, 0x55, 0x85, + 0x05, 0x7f, 0xa3, 0xb2, 0x3d, 0x9e, 0x38, 0x8e, 0x53, 0xcc, 0xee, 0x6d, 0x12, 0xcf, 0xdc, 0x73, + 0xef, 0x3d, 0x67, 0xae, 0x7d, 0x34, 0xb0, 0x66, 0x91, 0x2b, 0xc7, 0x26, 0xdd, 0xae, 0x86, 0x2c, + 0xab, 0x6b, 0xb4, 0x91, 0x63, 0x10, 0x53, 0x73, 0x6e, 0x55, 0xcb, 0x26, 0x0e, 0x11, 0x8b, 0x41, + 0x58, 0x0d, 0x85, 0xa5, 0x05, 0xd4, 0x33, 0x4c, 0xa2, 0x79, 0xbf, 0x3e, 0x50, 0x5a, 0x69, 0x13, + 0xda, 0x23, 0xf4, 0xdc, 0x5b, 0x69, 0xfe, 0x82, 0x85, 0x64, 0x7f, 0xa5, 0xb5, 0x10, 0xc5, 0x5a, + 0xbf, 0xda, 0xc2, 0x0e, 0xaa, 0x6a, 0x6d, 0x62, 0x98, 0x2c, 0xbe, 0xcc, 0xe2, 0x3d, 0xaa, 0x6b, + 0xfd, 0xaa, 0xfb, 0xc7, 0x02, 0x45, 0x9d, 0xe8, 0xc4, 0x2f, 0xe8, 0x3e, 0xb1, 0xdd, 0x72, 0x3c, + 0xe3, 0x81, 0x85, 0x83, 0x86, 0x1b, 0xb1, 0x08, 0x0b, 0xd9, 0xa8, 0x17, 0x40, 0xc6, 0xb2, 0xe9, + 0x25, 0xb2, 0x71, 0x47, 0xa3, 0xd8, 0xee, 0x1b, 0x6d, 0xec, 0x87, 0x95, 0x3f, 0x05, 0x98, 0x6b, + 0x50, 0xfd, 0x1b, 0xab, 0x83, 0x1c, 0xfc, 0xb5, 0x97, 0x28, 0xee, 0x43, 0x16, 0x5d, 0x3b, 0x97, + 0xc4, 0x36, 0x9c, 0x41, 0x49, 0x28, 0x0b, 0x9b, 0xd9, 0xe3, 0xd2, 0xdf, 0xbf, 0xef, 0x14, 0x99, + 0xd6, 0xa3, 0x4e, 0xc7, 0xc6, 0x94, 0x9e, 0x3a, 0xb6, 0x61, 0xea, 0xcd, 0x31, 0x54, 0x3c, 0x84, + 0x8c, 0xdf, 0xba, 0xf4, 0xaa, 0x2c, 0x6c, 0xe6, 0x6a, 0xab, 0x6a, 0xdc, 0x99, 0xaa, 0x7e, 0x97, + 0xe3, 0xec, 0xdd, 0x3f, 0xeb, 0xa9, 0x5f, 0x9f, 0x86, 0x15, 0xa1, 0xc9, 0xd2, 0xea, 0x07, 0x3f, + 0x3e, 0x0d, 0x2b, 0xe3, 0x82, 0x3f, 0x3d, 0x0d, 0x2b, 0x1f, 0x73, 0xfa, 0xb7, 0x13, 0x1a, 0x23, + 0x9c, 0x95, 0x15, 0x58, 0x8e, 0x6c, 0x35, 0x31, 0xb5, 0x88, 0x49, 0xb1, 0xf2, 0x97, 0x00, 0x85, + 0x06, 0xd5, 0x4f, 0x1d, 0x74, 0x85, 0x8f, 0xc6, 0x25, 0xc4, 0x1a, 0xbc, 0x8b, 0x7c, 0x29, 0xcf, + 0x8a, 0x0c, 0x80, 0xa2, 0x06, 0xaf, 0xa9, 0x5b, 0x87, 0x29, 0x5c, 0x51, 0x19, 0xdc, 0x9d, 0xb8, + 0xca, 0x26, 0xae, 0x9e, 0x10, 0xc3, 0x6c, 0xfa, 0x38, 0xf1, 0x73, 0x78, 0x8f, 0x1d, 0x38, 0x2d, + 0xa5, 0xcb, 0xe9, 0xcd, 0x5c, 0x6d, 0x6b, 0x7c, 0x2a, 0xfe, 0x44, 0xd4, 0x10, 0xa9, 0x53, 0x1f, + 0x7b, 0x42, 0xcc, 0x0b, 0x43, 0x6f, 0xf2, 0xd4, 0xfa, 0x1b, 0xf7, 0x64, 0x02, 0x16, 0xca, 0x1a, + 0x7c, 0x10, 0x23, 0x88, 0x0b, 0x3e, 0x84, 0x45, 0xf7, 0x2c, 0x4c, 0x1a, 0x55, 0x5c, 0x8a, 0x28, + 0xe6, 0xba, 0x22, 0xf5, 0xd7, 0x61, 0x2d, 0xb6, 0x00, 0xef, 0xf0, 0x8b, 0x00, 0xc5, 0x06, 0xd5, + 0x3f, 0xc3, 0x5d, 0xac, 0x23, 0x07, 0x9f, 0x91, 0x2f, 0x91, 0x83, 0x6f, 0xd0, 0x40, 0x3c, 0x80, + 0x1c, 0xb2, 0xac, 0xf3, 0xa4, 0xe7, 0x0a, 0xc8, 0xb2, 0xd8, 0x8e, 0x78, 0x04, 0x73, 0xba, 0x5f, + 0x85, 0xa7, 0xbf, 0x7a, 0x26, 0x3d, 0xcf, 0x12, 0xd8, 0x6e, 0x7d, 0xde, 0x55, 0x11, 0x26, 0xa0, + 0xc8, 0xb0, 0x1a, 0xc7, 0x93, 0x0b, 0xf9, 0x4d, 0x80, 0x92, 0x27, 0xb5, 0xc3, 0x20, 0x5f, 0xd8, + 0xa4, 0xf7, 0xb6, 0x8a, 0x51, 0xa0, 0x3c, 0x8b, 0x2b, 0x17, 0xf4, 0x87, 0x00, 0x4b, 0x0d, 0xaa, + 0x9f, 0xd9, 0xc8, 0xa4, 0x17, 0xd8, 0x0e, 0x4f, 0xff, 0x10, 0xf2, 0x94, 0x5c, 0xdb, 0x6d, 0x9c, + 0x58, 0xd1, 0xfb, 0x3e, 0x3e, 0x10, 0xf5, 0x15, 0x14, 0x3a, 0x98, 0x3a, 0x86, 0xe9, 0xd5, 0x4b, + 0x2c, 0x4c, 0x0c, 0x25, 0x05, 0xe2, 0x0a, 0xae, 0xb8, 0x08, 0x1d, 0x05, 0x83, 0x1c, 0x4f, 0x3d, + 0x50, 0x27, 0x9e, 0x78, 0x13, 0x09, 0xb6, 0x3d, 0xfe, 0xb9, 0xda, 0x46, 0xbc, 0xcd, 0x84, 0xf3, + 0xc3, 0x59, 0xca, 0x77, 0x90, 0x9f, 0xb4, 0x0a, 0x71, 0x75, 0xca, 0xf0, 0xc2, 0xb6, 0x26, 0xc2, + 0x3b, 0x26, 0xea, 0xf9, 0x9f, 0x7c, 0xb6, 0xe9, 0x3d, 0x8b, 0x4b, 0x90, 0x41, 0xf4, 0x6c, 0x60, + 0xe1, 0x52, 0xda, 0xdb, 0x65, 0xab, 0x7a, 0x7e, 0xd2, 0xc1, 0x94, 0x4f, 0xbd, 0x69, 0x84, 0x7a, + 0x71, 0x29, 0x4b, 0xdc, 0x2c, 0xfd, 0x86, 0x6c, 0x55, 0x1b, 0x66, 0x20, 0xdd, 0xa0, 0xba, 0xd8, + 0x81, 0x37, 0x13, 0xa6, 0xfc, 0x51, 0xbc, 0xca, 0x88, 0xe9, 0x49, 0x3b, 0x89, 0x60, 0x9c, 0x85, + 0x05, 0xf3, 0x53, 0xbe, 0xb8, 0x35, 0xb3, 0x44, 0x14, 0x2a, 0x55, 0x13, 0x43, 0x79, 0xc7, 0x3e, + 0x88, 0x31, 0xce, 0xf4, 0xc9, 0x6c, 0xda, 0x53, 0x60, 0x69, 0xf7, 0x05, 0x60, 0xde, 0x97, 0xc2, + 0xc2, 0xb4, 0x5d, 0x55, 0x66, 0x56, 0x9a, 0xc2, 0x4a, 0xb5, 0xe4, 0x58, 0xde, 0xf4, 0x7b, 0x58, + 0x8c, 0xb7, 0x16, 0xf5, 0x7f, 0x24, 0xc4, 0xe0, 0xa5, 0xfd, 0x97, 0xe1, 0x39, 0x81, 0x01, 0x14, + 0xe2, 0xac, 0x60, 0x7b, 0x66, 0xb9, 0x18, 0xb4, 0xb4, 0xf7, 0x12, 0x34, 0x6f, 0x8d, 0x20, 0x17, + 0xfe, 0xc6, 0x3e, 0x4c, 0xf2, 0x62, 0x4a, 0xdb, 0x49, 0x50, 0x41, 0x0b, 0xe9, 0xf5, 0x0f, 0xee, + 0xf5, 0xe1, 0xb8, 0x79, 0x37, 0x92, 0x85, 0xfb, 0x91, 0x2c, 0x3c, 0x8c, 0x64, 0xe1, 0xdf, 0x91, + 0x2c, 0xfc, 0xfc, 0x28, 0xa7, 0xee, 0x1f, 0xe5, 0xd4, 0xc3, 0xa3, 0x9c, 0xfa, 0x76, 0x4f, 0x37, + 0x9c, 0xcb, 0xeb, 0x96, 0xda, 0x26, 0x3d, 0xcd, 0x2d, 0xbe, 0x63, 0x62, 0xe7, 0x86, 0xd8, 0x57, + 0xda, 0x8c, 0x9b, 0x85, 0x77, 0xbf, 0x6a, 0x65, 0xbc, 0xeb, 0xd1, 0xee, 0x7f, 0x01, 0x00, 0x00, + 0xff, 0xff, 0x8d, 0xff, 0x85, 0xb7, 0x36, 0x0a, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -617,6 +719,7 @@ type MsgClient interface { DelegateToGateway(ctx context.Context, in *MsgDelegateToGateway, opts ...grpc.CallOption) (*MsgDelegateToGatewayResponse, error) UndelegateFromGateway(ctx context.Context, in *MsgUndelegateFromGateway, opts ...grpc.CallOption) (*MsgUndelegateFromGatewayResponse, error) TransferApplication(ctx context.Context, in *MsgTransferApplication, opts ...grpc.CallOption) (*MsgTransferApplicationResponse, error) + UpdateParam(ctx context.Context, in *MsgUpdateParam, opts ...grpc.CallOption) (*MsgUpdateParamResponse, error) } type msgClient struct { @@ -681,6 +784,15 @@ func (c *msgClient) TransferApplication(ctx context.Context, in *MsgTransferAppl 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.application.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 @@ -691,6 +803,7 @@ type MsgServer interface { DelegateToGateway(context.Context, *MsgDelegateToGateway) (*MsgDelegateToGatewayResponse, error) UndelegateFromGateway(context.Context, *MsgUndelegateFromGateway) (*MsgUndelegateFromGatewayResponse, error) TransferApplication(context.Context, *MsgTransferApplication) (*MsgTransferApplicationResponse, error) + UpdateParam(context.Context, *MsgUpdateParam) (*MsgUpdateParamResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -715,6 +828,9 @@ func (*UnimplementedMsgServer) UndelegateFromGateway(ctx context.Context, req *M func (*UnimplementedMsgServer) TransferApplication(ctx context.Context, req *MsgTransferApplication) (*MsgTransferApplicationResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method TransferApplication 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) @@ -828,6 +944,24 @@ func _Msg_TransferApplication_Handler(srv interface{}, ctx context.Context, dec 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.application.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.application.Msg", HandlerType: (*MsgServer)(nil), @@ -856,6 +990,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "TransferApplication", Handler: _Msg_TransferApplication_Handler, }, + { + MethodName: "UpdateParam", + Handler: _Msg_UpdateParam_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "poktroll/application/tx.proto", @@ -1248,6 +1386,80 @@ func (m *MsgTransferApplicationResponse) MarshalToSizedBuffer(dAtA []byte) (int, 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 len(m.AsType) > 0 { + i -= len(m.AsType) + copy(dAtA[i:], m.AsType) + i = encodeVarintTx(dAtA, i, uint64(len(m.AsType))) + i-- + dAtA[i] = 0x1a + } + 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 *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 len(m.Params) > 0 { + i -= len(m.Params) + copy(dAtA[i:], m.Params) + i = encodeVarintTx(dAtA, i, uint64(len(m.Params))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -1419,6 +1631,40 @@ func (m *MsgTransferApplicationResponse) 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)) + } + l = len(m.AsType) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgUpdateParamResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Params) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -2452,6 +2698,234 @@ func (m *MsgTransferApplicationResponse) 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 AsType", 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 = string(dAtA[iNdEx:postIndex]) + 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 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.Params = string(dAtA[iNdEx:postIndex]) + 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 From 0a8d922ff1b028345636df3ea26a698cbd9b9b49 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 27 Sep 2024 11:13:30 +0200 Subject: [PATCH 024/139] chore: update MsgUpdateParam fields --- api/poktroll/application/tx.pulsar.go | 333 ++++++++++++++++---------- proto/poktroll/application/tx.proto | 41 ++-- x/application/types/tx.pb.go | 218 +++++++++++------ 3 files changed, 374 insertions(+), 218 deletions(-) diff --git a/api/poktroll/application/tx.pulsar.go b/api/poktroll/application/tx.pulsar.go index 2aa94521b..9da9cfb1c 100644 --- a/api/poktroll/application/tx.pulsar.go +++ b/api/poktroll/application/tx.pulsar.go @@ -5245,7 +5245,7 @@ var ( md_MsgUpdateParam protoreflect.MessageDescriptor fd_MsgUpdateParam_authority protoreflect.FieldDescriptor fd_MsgUpdateParam_name protoreflect.FieldDescriptor - fd_MsgUpdateParam_asType protoreflect.FieldDescriptor + fd_MsgUpdateParam_as_coin protoreflect.FieldDescriptor ) func init() { @@ -5253,7 +5253,7 @@ func init() { md_MsgUpdateParam = File_poktroll_application_tx_proto.Messages().ByName("MsgUpdateParam") fd_MsgUpdateParam_authority = md_MsgUpdateParam.Fields().ByName("authority") fd_MsgUpdateParam_name = md_MsgUpdateParam.Fields().ByName("name") - fd_MsgUpdateParam_asType = md_MsgUpdateParam.Fields().ByName("asType") + fd_MsgUpdateParam_as_coin = md_MsgUpdateParam.Fields().ByName("as_coin") } var _ protoreflect.Message = (*fastReflection_MsgUpdateParam)(nil) @@ -5333,10 +5333,14 @@ func (x *fastReflection_MsgUpdateParam) Range(f func(protoreflect.FieldDescripto return } } - if x.AsType != "" { - value := protoreflect.ValueOfString(x.AsType) - if !f(fd_MsgUpdateParam_asType, value) { - return + if x.AsType != nil { + switch o := x.AsType.(type) { + case *MsgUpdateParam_AsCoin: + v := o.AsCoin + value := protoreflect.ValueOfMessage(v.ProtoReflect()) + if !f(fd_MsgUpdateParam_as_coin, value) { + return + } } } } @@ -5358,8 +5362,14 @@ func (x *fastReflection_MsgUpdateParam) Has(fd protoreflect.FieldDescriptor) boo return x.Authority != "" case "poktroll.application.MsgUpdateParam.name": return x.Name != "" - case "poktroll.application.MsgUpdateParam.asType": - return x.AsType != "" + case "poktroll.application.MsgUpdateParam.as_coin": + if x.AsType == nil { + return false + } else if _, ok := x.AsType.(*MsgUpdateParam_AsCoin); ok { + return true + } else { + return false + } default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUpdateParam")) @@ -5380,8 +5390,8 @@ func (x *fastReflection_MsgUpdateParam) Clear(fd protoreflect.FieldDescriptor) { x.Authority = "" case "poktroll.application.MsgUpdateParam.name": x.Name = "" - case "poktroll.application.MsgUpdateParam.asType": - x.AsType = "" + case "poktroll.application.MsgUpdateParam.as_coin": + x.AsType = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUpdateParam")) @@ -5404,9 +5414,14 @@ func (x *fastReflection_MsgUpdateParam) Get(descriptor protoreflect.FieldDescrip case "poktroll.application.MsgUpdateParam.name": value := x.Name return protoreflect.ValueOfString(value) - case "poktroll.application.MsgUpdateParam.asType": - value := x.AsType - return protoreflect.ValueOfString(value) + case "poktroll.application.MsgUpdateParam.as_coin": + if x.AsType == nil { + return protoreflect.ValueOfMessage((*v1beta1.Coin)(nil).ProtoReflect()) + } else if v, ok := x.AsType.(*MsgUpdateParam_AsCoin); ok { + return protoreflect.ValueOfMessage(v.AsCoin.ProtoReflect()) + } else { + return protoreflect.ValueOfMessage((*v1beta1.Coin)(nil).ProtoReflect()) + } default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUpdateParam")) @@ -5431,8 +5446,9 @@ func (x *fastReflection_MsgUpdateParam) Set(fd protoreflect.FieldDescriptor, val x.Authority = value.Interface().(string) case "poktroll.application.MsgUpdateParam.name": x.Name = value.Interface().(string) - case "poktroll.application.MsgUpdateParam.asType": - x.AsType = value.Interface().(string) + case "poktroll.application.MsgUpdateParam.as_coin": + cv := value.Message().Interface().(*v1beta1.Coin) + x.AsType = &MsgUpdateParam_AsCoin{AsCoin: cv} default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUpdateParam")) @@ -5453,12 +5469,26 @@ func (x *fastReflection_MsgUpdateParam) Set(fd protoreflect.FieldDescriptor, val // 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.application.MsgUpdateParam.as_coin": + if x.AsType == nil { + value := &v1beta1.Coin{} + oneofValue := &MsgUpdateParam_AsCoin{AsCoin: value} + x.AsType = oneofValue + return protoreflect.ValueOfMessage(value.ProtoReflect()) + } + switch m := x.AsType.(type) { + case *MsgUpdateParam_AsCoin: + return protoreflect.ValueOfMessage(m.AsCoin.ProtoReflect()) + default: + value := &v1beta1.Coin{} + oneofValue := &MsgUpdateParam_AsCoin{AsCoin: value} + x.AsType = oneofValue + return protoreflect.ValueOfMessage(value.ProtoReflect()) + } case "poktroll.application.MsgUpdateParam.authority": panic(fmt.Errorf("field authority of message poktroll.application.MsgUpdateParam is not mutable")) case "poktroll.application.MsgUpdateParam.name": panic(fmt.Errorf("field name of message poktroll.application.MsgUpdateParam is not mutable")) - case "poktroll.application.MsgUpdateParam.asType": - panic(fmt.Errorf("field asType of message poktroll.application.MsgUpdateParam is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUpdateParam")) @@ -5476,8 +5506,9 @@ func (x *fastReflection_MsgUpdateParam) NewField(fd protoreflect.FieldDescriptor return protoreflect.ValueOfString("") case "poktroll.application.MsgUpdateParam.name": return protoreflect.ValueOfString("") - case "poktroll.application.MsgUpdateParam.asType": - return protoreflect.ValueOfString("") + case "poktroll.application.MsgUpdateParam.as_coin": + value := &v1beta1.Coin{} + return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUpdateParam")) @@ -5491,6 +5522,14 @@ func (x *fastReflection_MsgUpdateParam) NewField(fd protoreflect.FieldDescriptor // 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.application.MsgUpdateParam.asType": + if x.AsType == nil { + return nil + } + switch x.AsType.(type) { + case *MsgUpdateParam_AsCoin: + return x.Descriptor().Fields().ByName("as_coin") + } default: panic(fmt.Errorf("%s is not a oneof field in poktroll.application.MsgUpdateParam", d.FullName())) } @@ -5555,8 +5594,12 @@ func (x *fastReflection_MsgUpdateParam) ProtoMethods() *protoiface.Methods { if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } - l = len(x.AsType) - if l > 0 { + switch x := x.AsType.(type) { + case *MsgUpdateParam_AsCoin: + if x == nil { + break + } + l = options.Size(x.AsCoin) n += 1 + l + runtime.Sov(uint64(l)) } if x.unknownFields != nil { @@ -5588,10 +5631,18 @@ func (x *fastReflection_MsgUpdateParam) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if len(x.AsType) > 0 { - i -= len(x.AsType) - copy(dAtA[i:], x.AsType) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.AsType))) + switch x := x.AsType.(type) { + case *MsgUpdateParam_AsCoin: + encoded, err := options.Marshal(x.AsCoin) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) i-- dAtA[i] = 0x1a } @@ -5724,9 +5775,9 @@ func (x *fastReflection_MsgUpdateParam) ProtoMethods() *protoiface.Methods { iNdEx = postIndex case 3: if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AsType", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AsCoin", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -5736,23 +5787,26 @@ func (x *fastReflection_MsgUpdateParam) ProtoMethods() *protoiface.Methods { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.AsType = string(dAtA[iNdEx:postIndex]) + v := &v1beta1.Coin{} + if err := options.Unmarshal(dAtA[iNdEx:postIndex], v); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + x.AsType = &MsgUpdateParam_AsCoin{v} iNdEx = postIndex default: iNdEx = preIndex @@ -6656,9 +6710,13 @@ type MsgUpdateParam struct { 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"` - AsType string `protobuf:"bytes,3,opt,name=asType,proto3" json:"asType,omitempty"` + // Types that are assignable to AsType: + // + // *MsgUpdateParam_AsCoin + AsType isMsgUpdateParam_AsType `protobuf_oneof:"asType"` } func (x *MsgUpdateParam) Reset() { @@ -6695,13 +6753,30 @@ func (x *MsgUpdateParam) GetName() string { return "" } -func (x *MsgUpdateParam) GetAsType() string { +func (x *MsgUpdateParam) GetAsType() isMsgUpdateParam_AsType { if x != nil { return x.AsType } - return "" + return nil } +func (x *MsgUpdateParam) GetAsCoin() *v1beta1.Coin { + if x, ok := x.GetAsType().(*MsgUpdateParam_AsCoin); ok { + return x.AsCoin + } + return nil +} + +type isMsgUpdateParam_AsType interface { + isMsgUpdateParam_AsType() +} + +type MsgUpdateParam_AsCoin struct { + AsCoin *v1beta1.Coin `protobuf:"bytes,3,opt,name=as_coin,json=asCoin,proto3,oneof"` +} + +func (*MsgUpdateParam_AsCoin) isMsgUpdateParam_AsType() {} + type MsgUpdateParamResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -6836,81 +6911,85 @@ var file_poktroll_application_tx_proto_rawDesc = []byte{ 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0b, 0x61, 0x70, - 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x6a, 0x0a, 0x0e, 0x4d, 0x73, 0x67, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x1c, 0x0a, 0x09, 0x61, - 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 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, 0x16, 0x0a, - 0x06, 0x61, 0x73, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, - 0x73, 0x54, 0x79, 0x70, 0x65, 0x3a, 0x0e, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, - 0x6f, 0x72, 0x69, 0x74, 0x79, 0x22, 0x30, 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, - 0x16, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x32, 0xb0, 0x06, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, - 0x64, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, - 0x25, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x2d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 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, 0x70, 0x0a, 0x10, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x41, 0x70, - 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, + 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xac, 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, 0x34, 0x0a, 0x07, 0x61, 0x73, 0x5f, 0x63, + 0x6f, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, + 0x43, 0x6f, 0x69, 0x6e, 0x48, 0x00, 0x52, 0x06, 0x61, 0x73, 0x43, 0x6f, 0x69, 0x6e, 0x3a, 0x0e, + 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x42, 0x08, + 0x0a, 0x06, 0x61, 0x73, 0x54, 0x79, 0x70, 0x65, 0x22, 0x30, 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, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x32, 0xb0, 0x06, 0x0a, 0x03, 0x4d, + 0x73, 0x67, 0x12, 0x64, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x12, 0x25, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, + 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x2d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x31, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, - 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x53, - 0x74, 0x61, 0x6b, 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x76, 0x0a, 0x12, 0x55, 0x6e, 0x73, 0x74, 0x61, - 0x6b, 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2b, 0x2e, + 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, 0x70, 0x0a, 0x10, 0x53, 0x74, 0x61, 0x6b, + 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x29, 0x2e, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x41, 0x70, 0x70, 0x6c, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x31, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, + 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x76, 0x0a, 0x12, 0x55, 0x6e, + 0x73, 0x74, 0x61, 0x6b, 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x12, 0x2b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, + 0x6b, 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x33, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x41, - 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x33, 0x2e, 0x70, 0x6f, 0x6b, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x41, 0x70, 0x70, 0x6c, - 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x73, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x54, 0x6f, 0x47, 0x61, 0x74, - 0x65, 0x77, 0x61, 0x79, 0x12, 0x2a, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, - 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x44, - 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x54, 0x6f, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, - 0x1a, 0x32, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, - 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x6c, 0x65, 0x67, - 0x61, 0x74, 0x65, 0x54, 0x6f, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x7f, 0x0a, 0x15, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, - 0x74, 0x65, 0x46, 0x72, 0x6f, 0x6d, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x2e, 0x2e, + 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x73, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x54, 0x6f, + 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x2a, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, + 0x73, 0x67, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x54, 0x6f, 0x47, 0x61, 0x74, 0x65, + 0x77, 0x61, 0x79, 0x1a, 0x32, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, + 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x65, + 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x54, 0x6f, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x7f, 0x0a, 0x15, 0x55, 0x6e, 0x64, 0x65, 0x6c, + 0x65, 0x67, 0x61, 0x74, 0x65, 0x46, 0x72, 0x6f, 0x6d, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, + 0x12, 0x2e, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x64, 0x65, 0x6c, + 0x65, 0x67, 0x61, 0x74, 0x65, 0x46, 0x72, 0x6f, 0x6d, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, + 0x1a, 0x36, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x64, 0x65, 0x6c, + 0x65, 0x67, 0x61, 0x74, 0x65, 0x46, 0x72, 0x6f, 0x6d, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x79, 0x0a, 0x13, 0x54, 0x72, 0x61, 0x6e, + 0x73, 0x66, 0x65, 0x72, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x2c, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, + 0x65, 0x72, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x34, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, - 0x74, 0x65, 0x46, 0x72, 0x6f, 0x6d, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x1a, 0x36, 0x2e, - 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, - 0x74, 0x65, 0x46, 0x72, 0x6f, 0x6d, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x79, 0x0a, 0x13, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, - 0x72, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2c, 0x2e, 0x70, - 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x41, - 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x34, 0x2e, 0x70, 0x6f, 0x6b, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x41, 0x70, 0x70, - 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x61, 0x0a, 0x0b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, - 0x24, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x1a, 0x2c, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 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, 0xbf, 0x01, 0xd8, 0xe2, 0x1e, - 0x01, 0x0a, 0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, - 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x07, 0x54, 0x78, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x25, 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, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xa2, 0x02, 0x03, - 0x50, 0x41, 0x58, 0xaa, 0x02, 0x14, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x41, - 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xca, 0x02, 0x14, 0x50, 0x6f, 0x6b, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0xe2, 0x02, 0x20, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x41, 0x70, 0x70, - 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x15, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, - 0x3a, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, + 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x61, 0x0a, 0x0b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, + 0x61, 0x6d, 0x12, 0x24, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, + 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x1a, 0x2c, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 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, 0xbf, 0x01, + 0xd8, 0xe2, 0x1e, 0x01, 0x0a, 0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x07, + 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x25, 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, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0xa2, 0x02, 0x03, 0x50, 0x41, 0x58, 0xaa, 0x02, 0x14, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xca, 0x02, 0x14, + 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0xe2, 0x02, 0x20, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, + 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x15, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x3a, 0x3a, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -6951,25 +7030,26 @@ var file_poktroll_application_tx_proto_depIdxs = []int32{ 15, // 1: poktroll.application.MsgStakeApplication.stake:type_name -> cosmos.base.v1beta1.Coin 16, // 2: poktroll.application.MsgStakeApplication.services:type_name -> poktroll.shared.ApplicationServiceConfig 17, // 3: poktroll.application.MsgTransferApplicationResponse.application:type_name -> poktroll.application.Application - 0, // 4: poktroll.application.Msg.UpdateParams:input_type -> poktroll.application.MsgUpdateParams - 2, // 5: poktroll.application.Msg.StakeApplication:input_type -> poktroll.application.MsgStakeApplication - 4, // 6: poktroll.application.Msg.UnstakeApplication:input_type -> poktroll.application.MsgUnstakeApplication - 6, // 7: poktroll.application.Msg.DelegateToGateway:input_type -> poktroll.application.MsgDelegateToGateway - 8, // 8: poktroll.application.Msg.UndelegateFromGateway:input_type -> poktroll.application.MsgUndelegateFromGateway - 10, // 9: poktroll.application.Msg.TransferApplication:input_type -> poktroll.application.MsgTransferApplication - 12, // 10: poktroll.application.Msg.UpdateParam:input_type -> poktroll.application.MsgUpdateParam - 1, // 11: poktroll.application.Msg.UpdateParams:output_type -> poktroll.application.MsgUpdateParamsResponse - 3, // 12: poktroll.application.Msg.StakeApplication:output_type -> poktroll.application.MsgStakeApplicationResponse - 5, // 13: poktroll.application.Msg.UnstakeApplication:output_type -> poktroll.application.MsgUnstakeApplicationResponse - 7, // 14: poktroll.application.Msg.DelegateToGateway:output_type -> poktroll.application.MsgDelegateToGatewayResponse - 9, // 15: poktroll.application.Msg.UndelegateFromGateway:output_type -> poktroll.application.MsgUndelegateFromGatewayResponse - 11, // 16: poktroll.application.Msg.TransferApplication:output_type -> poktroll.application.MsgTransferApplicationResponse - 13, // 17: poktroll.application.Msg.UpdateParam:output_type -> poktroll.application.MsgUpdateParamResponse - 11, // [11:18] is the sub-list for method output_type - 4, // [4:11] is the sub-list for method input_type - 4, // [4:4] is the sub-list for extension type_name - 4, // [4:4] is the sub-list for extension extendee - 0, // [0:4] is the sub-list for field type_name + 15, // 4: poktroll.application.MsgUpdateParam.as_coin:type_name -> cosmos.base.v1beta1.Coin + 0, // 5: poktroll.application.Msg.UpdateParams:input_type -> poktroll.application.MsgUpdateParams + 2, // 6: poktroll.application.Msg.StakeApplication:input_type -> poktroll.application.MsgStakeApplication + 4, // 7: poktroll.application.Msg.UnstakeApplication:input_type -> poktroll.application.MsgUnstakeApplication + 6, // 8: poktroll.application.Msg.DelegateToGateway:input_type -> poktroll.application.MsgDelegateToGateway + 8, // 9: poktroll.application.Msg.UndelegateFromGateway:input_type -> poktroll.application.MsgUndelegateFromGateway + 10, // 10: poktroll.application.Msg.TransferApplication:input_type -> poktroll.application.MsgTransferApplication + 12, // 11: poktroll.application.Msg.UpdateParam:input_type -> poktroll.application.MsgUpdateParam + 1, // 12: poktroll.application.Msg.UpdateParams:output_type -> poktroll.application.MsgUpdateParamsResponse + 3, // 13: poktroll.application.Msg.StakeApplication:output_type -> poktroll.application.MsgStakeApplicationResponse + 5, // 14: poktroll.application.Msg.UnstakeApplication:output_type -> poktroll.application.MsgUnstakeApplicationResponse + 7, // 15: poktroll.application.Msg.DelegateToGateway:output_type -> poktroll.application.MsgDelegateToGatewayResponse + 9, // 16: poktroll.application.Msg.UndelegateFromGateway:output_type -> poktroll.application.MsgUndelegateFromGatewayResponse + 11, // 17: poktroll.application.Msg.TransferApplication:output_type -> poktroll.application.MsgTransferApplicationResponse + 13, // 18: poktroll.application.Msg.UpdateParam:output_type -> poktroll.application.MsgUpdateParamResponse + 12, // [12:19] is the sub-list for method output_type + 5, // [5:12] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name } func init() { file_poktroll_application_tx_proto_init() } @@ -7149,6 +7229,9 @@ func file_poktroll_application_tx_proto_init() { } } } + file_poktroll_application_tx_proto_msgTypes[12].OneofWrappers = []interface{}{ + (*MsgUpdateParam_AsCoin)(nil), + } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/proto/poktroll/application/tx.proto b/proto/poktroll/application/tx.proto index 9a637e09b..167dd2b4f 100644 --- a/proto/poktroll/application/tx.proto +++ b/proto/poktroll/application/tx.proto @@ -17,29 +17,29 @@ import "poktroll/shared/service.proto"; // 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 StakeApplication (MsgStakeApplication ) returns (MsgStakeApplicationResponse ); - rpc UnstakeApplication (MsgUnstakeApplication ) returns (MsgUnstakeApplicationResponse ); - rpc DelegateToGateway (MsgDelegateToGateway ) returns (MsgDelegateToGatewayResponse ); + rpc UpdateParams (MsgUpdateParams) returns (MsgUpdateParamsResponse); + rpc StakeApplication (MsgStakeApplication) returns (MsgStakeApplicationResponse); + rpc UnstakeApplication (MsgUnstakeApplication) returns (MsgUnstakeApplicationResponse); + rpc DelegateToGateway (MsgDelegateToGateway) returns (MsgDelegateToGatewayResponse); rpc UndelegateFromGateway (MsgUndelegateFromGateway) returns (MsgUndelegateFromGatewayResponse); - rpc TransferApplication (MsgTransferApplication ) returns (MsgTransferApplicationResponse ); - rpc UpdateParam (MsgUpdateParam ) returns (MsgUpdateParamResponse ); + rpc TransferApplication (MsgTransferApplication) returns (MsgTransferApplicationResponse); + rpc UpdateParam (MsgUpdateParam) returns (MsgUpdateParamResponse); } // MsgUpdateParams is the Msg/UpdateParams request type. message MsgUpdateParams { - option (cosmos.msg.v1.signer) = "authority"; + option (cosmos.msg.v1.signer) = "authority"; option (amino.name) = "poktroll/x/application/MsgUpdateParams"; - + // authority is the address that controls the module (defaults to x/gov unless overwritten). string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // TODO_IMPROVE(#322): The requirement to provide all params is adopted from the // latest Cosmos SDK version. We should look into either improving this ourselves // or seeing if it is on their roadmap. - + // params defines the x/application parameters to update. // NOTE: All parameters must be supplied. Params params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; @@ -51,8 +51,8 @@ message MsgUpdateParamsResponse {} message MsgStakeApplication { option (cosmos.msg.v1.signer) = "address"; - string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the application. - cosmos.base.v1beta1.Coin stake = 2; // The total amount of uPOKT the application has staked. Must be ≥ to the current amount that the application has staked (if any) + string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the application. + cosmos.base.v1beta1.Coin stake = 2; // The total amount of uPOKT the application has staked. Must be ≥ to the current amount that the application has staked (if any) repeated poktroll.shared.ApplicationServiceConfig services = 3; // The list of services this application is staked to request service for // TODO_POST_MAINNET_CONSIDERATION: Consdier allowing appplications to delegate @@ -71,7 +71,7 @@ message MsgUnstakeApplicationResponse {} message MsgDelegateToGateway { option (cosmos.msg.v1.signer) = "app_address"; // https://docs.cosmos.network/main/build/building-modules/messages-and-queries - string app_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the application. + string app_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the application. string gateway_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the gateway the application wants to delegate to. } @@ -79,7 +79,7 @@ message MsgDelegateToGatewayResponse {} message MsgUndelegateFromGateway { option (cosmos.msg.v1.signer) = "app_address"; // https://docs.cosmos.network/main/build/building-modules/messages-and-queries - string app_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the application. + string app_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the application. string gateway_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the gateway the application wants to undelegate from. } @@ -87,7 +87,7 @@ message MsgUndelegateFromGatewayResponse {} message MsgTransferApplication { option (cosmos.msg.v1.signer) = "source_address"; - string source_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string source_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; string destination_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } @@ -97,9 +97,14 @@ message MsgTransferApplicationResponse { message MsgUpdateParam { option (cosmos.msg.v1.signer) = "authority"; - string authority = 1; - string name = 2; - string asType = 3; + + // 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 asType { + cosmos.base.v1beta1.Coin as_coin = 3; + }; } message MsgUpdateParamResponse { diff --git a/x/application/types/tx.pb.go b/x/application/types/tx.pb.go index 45c09e6ec..75d7edc8f 100644 --- a/x/application/types/tx.pb.go +++ b/x/application/types/tx.pb.go @@ -528,9 +528,13 @@ func (m *MsgTransferApplicationResponse) GetApplication() *Application { } 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"` - AsType string `protobuf:"bytes,3,opt,name=asType,proto3" json:"asType,omitempty"` + // Types that are valid to be assigned to AsType: + // + // *MsgUpdateParam_AsCoin + AsType isMsgUpdateParam_AsType `protobuf_oneof:"asType"` } func (m *MsgUpdateParam) Reset() { *m = MsgUpdateParam{} } @@ -562,6 +566,25 @@ func (m *MsgUpdateParam) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateParam proto.InternalMessageInfo +type isMsgUpdateParam_AsType interface { + isMsgUpdateParam_AsType() + MarshalTo([]byte) (int, error) + Size() int +} + +type MsgUpdateParam_AsCoin struct { + AsCoin *types.Coin `protobuf:"bytes,3,opt,name=as_coin,json=asCoin,proto3,oneof" json:"as_coin,omitempty"` +} + +func (*MsgUpdateParam_AsCoin) 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 @@ -576,11 +599,18 @@ func (m *MsgUpdateParam) GetName() string { return "" } -func (m *MsgUpdateParam) GetAsType() string { - if m != nil { - return m.AsType +func (m *MsgUpdateParam) GetAsCoin() *types.Coin { + if x, ok := m.GetAsType().(*MsgUpdateParam_AsCoin); ok { + return x.AsCoin + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*MsgUpdateParam) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*MsgUpdateParam_AsCoin)(nil), } - return "" } type MsgUpdateParamResponse struct { @@ -643,60 +673,61 @@ func init() { func init() { proto.RegisterFile("poktroll/application/tx.proto", fileDescriptor_bed224e38ab1cc6d) } var fileDescriptor_bed224e38ab1cc6d = []byte{ - // 842 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0x4d, 0x4f, 0xeb, 0x46, - 0x14, 0x8d, 0x5f, 0xfa, 0xd2, 0xe6, 0xe6, 0x35, 0x80, 0x13, 0x20, 0xb8, 0x60, 0x82, 0xd5, 0x56, - 0x90, 0x82, 0xdd, 0x04, 0x84, 0x44, 0x36, 0x08, 0xe8, 0x87, 0xba, 0x88, 0x54, 0x05, 0xba, 0xe9, - 0x06, 0x4d, 0x92, 0xc1, 0xb8, 0x24, 0x1e, 0xcb, 0x63, 0x02, 0x59, 0xb5, 0xea, 0xb2, 0xab, 0xfe, - 0x8a, 0xaa, 0xea, 0x2a, 0x8b, 0x6e, 0xfa, 0x03, 0x2a, 0xb1, 0x2b, 0xea, 0x8a, 0x55, 0x55, 0x85, - 0x05, 0x7f, 0xa3, 0xb2, 0x3d, 0x9e, 0x38, 0x8e, 0x53, 0xcc, 0xee, 0x6d, 0x12, 0xcf, 0xdc, 0x73, - 0xef, 0x3d, 0x67, 0xae, 0x7d, 0x34, 0xb0, 0x66, 0x91, 0x2b, 0xc7, 0x26, 0xdd, 0xae, 0x86, 0x2c, - 0xab, 0x6b, 0xb4, 0x91, 0x63, 0x10, 0x53, 0x73, 0x6e, 0x55, 0xcb, 0x26, 0x0e, 0x11, 0x8b, 0x41, - 0x58, 0x0d, 0x85, 0xa5, 0x05, 0xd4, 0x33, 0x4c, 0xa2, 0x79, 0xbf, 0x3e, 0x50, 0x5a, 0x69, 0x13, - 0xda, 0x23, 0xf4, 0xdc, 0x5b, 0x69, 0xfe, 0x82, 0x85, 0x64, 0x7f, 0xa5, 0xb5, 0x10, 0xc5, 0x5a, - 0xbf, 0xda, 0xc2, 0x0e, 0xaa, 0x6a, 0x6d, 0x62, 0x98, 0x2c, 0xbe, 0xcc, 0xe2, 0x3d, 0xaa, 0x6b, - 0xfd, 0xaa, 0xfb, 0xc7, 0x02, 0x45, 0x9d, 0xe8, 0xc4, 0x2f, 0xe8, 0x3e, 0xb1, 0xdd, 0x72, 0x3c, - 0xe3, 0x81, 0x85, 0x83, 0x86, 0x1b, 0xb1, 0x08, 0x0b, 0xd9, 0xa8, 0x17, 0x40, 0xc6, 0xb2, 0xe9, - 0x25, 0xb2, 0x71, 0x47, 0xa3, 0xd8, 0xee, 0x1b, 0x6d, 0xec, 0x87, 0x95, 0x3f, 0x05, 0x98, 0x6b, - 0x50, 0xfd, 0x1b, 0xab, 0x83, 0x1c, 0xfc, 0xb5, 0x97, 0x28, 0xee, 0x43, 0x16, 0x5d, 0x3b, 0x97, - 0xc4, 0x36, 0x9c, 0x41, 0x49, 0x28, 0x0b, 0x9b, 0xd9, 0xe3, 0xd2, 0xdf, 0xbf, 0xef, 0x14, 0x99, - 0xd6, 0xa3, 0x4e, 0xc7, 0xc6, 0x94, 0x9e, 0x3a, 0xb6, 0x61, 0xea, 0xcd, 0x31, 0x54, 0x3c, 0x84, - 0x8c, 0xdf, 0xba, 0xf4, 0xaa, 0x2c, 0x6c, 0xe6, 0x6a, 0xab, 0x6a, 0xdc, 0x99, 0xaa, 0x7e, 0x97, - 0xe3, 0xec, 0xdd, 0x3f, 0xeb, 0xa9, 0x5f, 0x9f, 0x86, 0x15, 0xa1, 0xc9, 0xd2, 0xea, 0x07, 0x3f, - 0x3e, 0x0d, 0x2b, 0xe3, 0x82, 0x3f, 0x3d, 0x0d, 0x2b, 0x1f, 0x73, 0xfa, 0xb7, 0x13, 0x1a, 0x23, - 0x9c, 0x95, 0x15, 0x58, 0x8e, 0x6c, 0x35, 0x31, 0xb5, 0x88, 0x49, 0xb1, 0xf2, 0x97, 0x00, 0x85, - 0x06, 0xd5, 0x4f, 0x1d, 0x74, 0x85, 0x8f, 0xc6, 0x25, 0xc4, 0x1a, 0xbc, 0x8b, 0x7c, 0x29, 0xcf, - 0x8a, 0x0c, 0x80, 0xa2, 0x06, 0xaf, 0xa9, 0x5b, 0x87, 0x29, 0x5c, 0x51, 0x19, 0xdc, 0x9d, 0xb8, - 0xca, 0x26, 0xae, 0x9e, 0x10, 0xc3, 0x6c, 0xfa, 0x38, 0xf1, 0x73, 0x78, 0x8f, 0x1d, 0x38, 0x2d, - 0xa5, 0xcb, 0xe9, 0xcd, 0x5c, 0x6d, 0x6b, 0x7c, 0x2a, 0xfe, 0x44, 0xd4, 0x10, 0xa9, 0x53, 0x1f, - 0x7b, 0x42, 0xcc, 0x0b, 0x43, 0x6f, 0xf2, 0xd4, 0xfa, 0x1b, 0xf7, 0x64, 0x02, 0x16, 0xca, 0x1a, - 0x7c, 0x10, 0x23, 0x88, 0x0b, 0x3e, 0x84, 0x45, 0xf7, 0x2c, 0x4c, 0x1a, 0x55, 0x5c, 0x8a, 0x28, - 0xe6, 0xba, 0x22, 0xf5, 0xd7, 0x61, 0x2d, 0xb6, 0x00, 0xef, 0xf0, 0x8b, 0x00, 0xc5, 0x06, 0xd5, - 0x3f, 0xc3, 0x5d, 0xac, 0x23, 0x07, 0x9f, 0x91, 0x2f, 0x91, 0x83, 0x6f, 0xd0, 0x40, 0x3c, 0x80, - 0x1c, 0xb2, 0xac, 0xf3, 0xa4, 0xe7, 0x0a, 0xc8, 0xb2, 0xd8, 0x8e, 0x78, 0x04, 0x73, 0xba, 0x5f, - 0x85, 0xa7, 0xbf, 0x7a, 0x26, 0x3d, 0xcf, 0x12, 0xd8, 0x6e, 0x7d, 0xde, 0x55, 0x11, 0x26, 0xa0, - 0xc8, 0xb0, 0x1a, 0xc7, 0x93, 0x0b, 0xf9, 0x4d, 0x80, 0x92, 0x27, 0xb5, 0xc3, 0x20, 0x5f, 0xd8, - 0xa4, 0xf7, 0xb6, 0x8a, 0x51, 0xa0, 0x3c, 0x8b, 0x2b, 0x17, 0xf4, 0x87, 0x00, 0x4b, 0x0d, 0xaa, - 0x9f, 0xd9, 0xc8, 0xa4, 0x17, 0xd8, 0x0e, 0x4f, 0xff, 0x10, 0xf2, 0x94, 0x5c, 0xdb, 0x6d, 0x9c, - 0x58, 0xd1, 0xfb, 0x3e, 0x3e, 0x10, 0xf5, 0x15, 0x14, 0x3a, 0x98, 0x3a, 0x86, 0xe9, 0xd5, 0x4b, - 0x2c, 0x4c, 0x0c, 0x25, 0x05, 0xe2, 0x0a, 0xae, 0xb8, 0x08, 0x1d, 0x05, 0x83, 0x1c, 0x4f, 0x3d, - 0x50, 0x27, 0x9e, 0x78, 0x13, 0x09, 0xb6, 0x3d, 0xfe, 0xb9, 0xda, 0x46, 0xbc, 0xcd, 0x84, 0xf3, - 0xc3, 0x59, 0xca, 0x77, 0x90, 0x9f, 0xb4, 0x0a, 0x71, 0x75, 0xca, 0xf0, 0xc2, 0xb6, 0x26, 0xc2, - 0x3b, 0x26, 0xea, 0xf9, 0x9f, 0x7c, 0xb6, 0xe9, 0x3d, 0x8b, 0x4b, 0x90, 0x41, 0xf4, 0x6c, 0x60, - 0xe1, 0x52, 0xda, 0xdb, 0x65, 0xab, 0x7a, 0x7e, 0xd2, 0xc1, 0x94, 0x4f, 0xbd, 0x69, 0x84, 0x7a, - 0x71, 0x29, 0x4b, 0xdc, 0x2c, 0xfd, 0x86, 0x6c, 0x55, 0x1b, 0x66, 0x20, 0xdd, 0xa0, 0xba, 0xd8, - 0x81, 0x37, 0x13, 0xa6, 0xfc, 0x51, 0xbc, 0xca, 0x88, 0xe9, 0x49, 0x3b, 0x89, 0x60, 0x9c, 0x85, - 0x05, 0xf3, 0x53, 0xbe, 0xb8, 0x35, 0xb3, 0x44, 0x14, 0x2a, 0x55, 0x13, 0x43, 0x79, 0xc7, 0x3e, - 0x88, 0x31, 0xce, 0xf4, 0xc9, 0x6c, 0xda, 0x53, 0x60, 0x69, 0xf7, 0x05, 0x60, 0xde, 0x97, 0xc2, - 0xc2, 0xb4, 0x5d, 0x55, 0x66, 0x56, 0x9a, 0xc2, 0x4a, 0xb5, 0xe4, 0x58, 0xde, 0xf4, 0x7b, 0x58, - 0x8c, 0xb7, 0x16, 0xf5, 0x7f, 0x24, 0xc4, 0xe0, 0xa5, 0xfd, 0x97, 0xe1, 0x39, 0x81, 0x01, 0x14, - 0xe2, 0xac, 0x60, 0x7b, 0x66, 0xb9, 0x18, 0xb4, 0xb4, 0xf7, 0x12, 0x34, 0x6f, 0x8d, 0x20, 0x17, - 0xfe, 0xc6, 0x3e, 0x4c, 0xf2, 0x62, 0x4a, 0xdb, 0x49, 0x50, 0x41, 0x0b, 0xe9, 0xf5, 0x0f, 0xee, - 0xf5, 0xe1, 0xb8, 0x79, 0x37, 0x92, 0x85, 0xfb, 0x91, 0x2c, 0x3c, 0x8c, 0x64, 0xe1, 0xdf, 0x91, - 0x2c, 0xfc, 0xfc, 0x28, 0xa7, 0xee, 0x1f, 0xe5, 0xd4, 0xc3, 0xa3, 0x9c, 0xfa, 0x76, 0x4f, 0x37, - 0x9c, 0xcb, 0xeb, 0x96, 0xda, 0x26, 0x3d, 0xcd, 0x2d, 0xbe, 0x63, 0x62, 0xe7, 0x86, 0xd8, 0x57, - 0xda, 0x8c, 0x9b, 0x85, 0x77, 0xbf, 0x6a, 0x65, 0xbc, 0xeb, 0xd1, 0xee, 0x7f, 0x01, 0x00, 0x00, - 0xff, 0xff, 0x8d, 0xff, 0x85, 0xb7, 0x36, 0x0a, 0x00, 0x00, + // 858 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0xcf, 0x4f, 0xe3, 0x46, + 0x14, 0x8e, 0x37, 0xdd, 0xec, 0xe6, 0x65, 0x9b, 0xdd, 0x75, 0xb2, 0xbb, 0xc1, 0x5d, 0xbc, 0xc1, + 0x6a, 0x2b, 0x48, 0xc1, 0x6e, 0x02, 0x42, 0x22, 0x17, 0x44, 0xe8, 0xcf, 0x43, 0xa4, 0xca, 0xd0, + 0x4b, 0x2f, 0x68, 0x92, 0x0c, 0xc6, 0x22, 0xf1, 0x58, 0x1e, 0x13, 0xc8, 0xa9, 0x55, 0x8f, 0x3d, + 0xf5, 0xaf, 0xa8, 0xaa, 0xaa, 0x87, 0x1c, 0x7a, 0xe9, 0x1f, 0x50, 0x89, 0x5b, 0x51, 0x4f, 0x9c, + 0xaa, 0x2a, 0x1c, 0xf8, 0x37, 0x2a, 0xdb, 0xe3, 0x89, 0xe3, 0x38, 0xc5, 0xf4, 0xb4, 0x17, 0x98, + 0x99, 0xf7, 0xbd, 0xf7, 0xbe, 0xef, 0x4d, 0xfc, 0x69, 0x60, 0xd9, 0x26, 0xa7, 0xae, 0x43, 0xfa, + 0x7d, 0x0d, 0xd9, 0x76, 0xdf, 0xec, 0x22, 0xd7, 0x24, 0x96, 0xe6, 0x5e, 0xa8, 0xb6, 0x43, 0x5c, + 0x22, 0x96, 0xc3, 0xb0, 0x1a, 0x09, 0x4b, 0xcf, 0xd1, 0xc0, 0xb4, 0x88, 0xe6, 0xff, 0x0d, 0x80, + 0xd2, 0x52, 0x97, 0xd0, 0x01, 0xa1, 0x47, 0xfe, 0x4e, 0x0b, 0x36, 0x2c, 0x24, 0x07, 0x3b, 0xad, + 0x83, 0x28, 0xd6, 0x86, 0xf5, 0x0e, 0x76, 0x51, 0x5d, 0xeb, 0x12, 0xd3, 0x62, 0xf1, 0x57, 0x2c, + 0x3e, 0xa0, 0x86, 0x36, 0xac, 0x7b, 0xff, 0x58, 0xa0, 0x6c, 0x10, 0x83, 0x04, 0x05, 0xbd, 0x15, + 0x3b, 0xad, 0x26, 0x33, 0x1e, 0xd9, 0x38, 0x6c, 0xb8, 0x92, 0x88, 0xb0, 0x91, 0x83, 0x06, 0x21, + 0x64, 0x2a, 0x9b, 0x9e, 0x20, 0x07, 0xf7, 0x34, 0x8a, 0x9d, 0xa1, 0xd9, 0xc5, 0x41, 0x58, 0xf9, + 0x43, 0x80, 0xa7, 0x6d, 0x6a, 0x7c, 0x6d, 0xf7, 0x90, 0x8b, 0xbf, 0xf2, 0x13, 0xc5, 0x6d, 0xc8, + 0xa3, 0x33, 0xf7, 0x84, 0x38, 0xa6, 0x3b, 0xaa, 0x08, 0x55, 0x61, 0x35, 0xdf, 0xaa, 0xfc, 0xf5, + 0xdb, 0x46, 0x99, 0x69, 0xdd, 0xeb, 0xf5, 0x1c, 0x4c, 0xe9, 0x81, 0xeb, 0x98, 0x96, 0xa1, 0x4f, + 0xa1, 0xe2, 0x2e, 0xe4, 0x82, 0xd6, 0x95, 0x07, 0x55, 0x61, 0xb5, 0xd0, 0x78, 0xad, 0x26, 0xcd, + 0x54, 0x0d, 0xba, 0xb4, 0xf2, 0x97, 0x7f, 0xbf, 0xc9, 0xfc, 0x7c, 0x3b, 0xae, 0x09, 0x3a, 0x4b, + 0x6b, 0xee, 0x7c, 0x7f, 0x3b, 0xae, 0x4d, 0x0b, 0xfe, 0x70, 0x3b, 0xae, 0x7d, 0xc8, 0xe9, 0x5f, + 0xcc, 0x68, 0x8c, 0x71, 0x56, 0x96, 0xe0, 0x55, 0xec, 0x48, 0xc7, 0xd4, 0x26, 0x16, 0xc5, 0xca, + 0x9f, 0x02, 0x94, 0xda, 0xd4, 0x38, 0x70, 0xd1, 0x29, 0xde, 0x9b, 0x96, 0x10, 0x1b, 0xf0, 0x08, + 0x05, 0x52, 0xee, 0x14, 0x19, 0x02, 0x45, 0x0d, 0x1e, 0x52, 0xaf, 0x0e, 0x53, 0xb8, 0xa4, 0x32, + 0xb8, 0x77, 0xe3, 0x2a, 0xbb, 0x71, 0x75, 0x9f, 0x98, 0x96, 0x1e, 0xe0, 0xc4, 0x4f, 0xe1, 0x31, + 0x1b, 0x38, 0xad, 0x64, 0xab, 0xd9, 0xd5, 0x42, 0x63, 0x6d, 0x3a, 0x95, 0xe0, 0x46, 0xd4, 0x08, + 0xa9, 0x83, 0x00, 0xbb, 0x4f, 0xac, 0x63, 0xd3, 0xd0, 0x79, 0x6a, 0xf3, 0x89, 0x37, 0x99, 0x90, + 0x85, 0xb2, 0x0c, 0xef, 0x25, 0x08, 0xe2, 0x82, 0x77, 0xe1, 0x85, 0x37, 0x0b, 0x8b, 0xc6, 0x15, + 0x57, 0x62, 0x8a, 0xb9, 0xae, 0x58, 0xfd, 0x37, 0xb0, 0x9c, 0x58, 0x80, 0x77, 0xf8, 0x49, 0x80, + 0x72, 0x9b, 0x1a, 0x9f, 0xe0, 0x3e, 0x36, 0x90, 0x8b, 0x0f, 0xc9, 0xe7, 0xc8, 0xc5, 0xe7, 0x68, + 0x24, 0xee, 0x40, 0x01, 0xd9, 0xf6, 0x51, 0xda, 0xb9, 0x02, 0xb2, 0x6d, 0x76, 0x22, 0xee, 0xc1, + 0x53, 0x23, 0xa8, 0xc2, 0xd3, 0x1f, 0xdc, 0x91, 0x5e, 0x64, 0x09, 0xec, 0xb4, 0xf9, 0xcc, 0x53, + 0x11, 0x25, 0xa0, 0xc8, 0xf0, 0x3a, 0x89, 0x27, 0x17, 0xf2, 0x8b, 0x00, 0x15, 0x5f, 0x6a, 0x8f, + 0x41, 0x3e, 0x73, 0xc8, 0xe0, 0x6d, 0x15, 0xa3, 0x40, 0x75, 0x11, 0x57, 0x2e, 0xe8, 0x77, 0x01, + 0x5e, 0xb6, 0xa9, 0x71, 0xe8, 0x20, 0x8b, 0x1e, 0x63, 0x27, 0x7a, 0xfb, 0xbb, 0x50, 0xa4, 0xe4, + 0xcc, 0xe9, 0xe2, 0xd4, 0x8a, 0xde, 0x0d, 0xf0, 0xa1, 0xa8, 0x2f, 0xa1, 0xd4, 0xc3, 0xd4, 0x35, + 0x2d, 0xbf, 0x5e, 0x6a, 0x61, 0x62, 0x24, 0x29, 0x14, 0x57, 0xf2, 0xc4, 0xc5, 0xe8, 0x28, 0x18, + 0xe4, 0x64, 0xea, 0xa1, 0x3a, 0x71, 0xdf, 0xbf, 0x91, 0xf0, 0xd8, 0xe7, 0x5f, 0x68, 0xac, 0x24, + 0xdb, 0x4c, 0x34, 0x3f, 0x9a, 0xa5, 0xfc, 0x2a, 0x40, 0x71, 0xd6, 0x2b, 0xfe, 0xb7, 0xe3, 0x89, + 0xf0, 0x8e, 0x85, 0x06, 0x81, 0x1b, 0xe4, 0x75, 0x7f, 0x2d, 0x6e, 0xc1, 0x23, 0x44, 0x8f, 0x3c, + 0xd7, 0xaf, 0x64, 0xef, 0x30, 0x89, 0x2f, 0x32, 0x7a, 0x0e, 0x51, 0x6f, 0xd5, 0x2c, 0xce, 0x5a, + 0x5f, 0xeb, 0x31, 0xe4, 0x10, 0x3d, 0x1c, 0xd9, 0x58, 0xf9, 0xd8, 0xbf, 0xd0, 0x08, 0x5b, 0x3e, + 0x8d, 0x97, 0xdc, 0x6f, 0x83, 0xaf, 0x99, 0xed, 0x1a, 0xe3, 0x1c, 0x64, 0xdb, 0xd4, 0x10, 0x7b, + 0xf0, 0x64, 0xc6, 0xd7, 0x3f, 0x48, 0x1e, 0x54, 0xcc, 0x37, 0xa5, 0x8d, 0x54, 0x30, 0xce, 0xc2, + 0x86, 0x67, 0x73, 0xd6, 0xba, 0xb6, 0xb0, 0x44, 0x1c, 0x2a, 0xd5, 0x53, 0x43, 0x79, 0xc7, 0x21, + 0x88, 0x09, 0xe6, 0xf6, 0xd1, 0x62, 0xda, 0x73, 0x60, 0x69, 0xf3, 0x1e, 0x60, 0xde, 0x97, 0xc2, + 0xf3, 0x79, 0xc7, 0xab, 0x2d, 0xac, 0x34, 0x87, 0x95, 0x1a, 0xe9, 0xb1, 0xbc, 0xe9, 0xb7, 0xf0, + 0x22, 0xd9, 0x9d, 0xd4, 0xff, 0x90, 0x90, 0x80, 0x97, 0xb6, 0xef, 0x87, 0xe7, 0x04, 0x46, 0x50, + 0x4a, 0x72, 0x93, 0xf5, 0x85, 0xe5, 0x12, 0xd0, 0xd2, 0xd6, 0x7d, 0xd0, 0xbc, 0x35, 0x82, 0x42, + 0xf4, 0x2b, 0x7d, 0x3f, 0xcd, 0x0f, 0x53, 0x5a, 0x4f, 0x83, 0x0a, 0x5b, 0x48, 0x0f, 0xbf, 0xf3, + 0x5e, 0x20, 0x2d, 0xfd, 0x72, 0x22, 0x0b, 0x57, 0x13, 0x59, 0xb8, 0x9e, 0xc8, 0xc2, 0x3f, 0x13, + 0x59, 0xf8, 0xf1, 0x46, 0xce, 0x5c, 0xdd, 0xc8, 0x99, 0xeb, 0x1b, 0x39, 0xf3, 0xcd, 0x96, 0x61, + 0xba, 0x27, 0x67, 0x1d, 0xb5, 0x4b, 0x06, 0x9a, 0x57, 0x7c, 0xc3, 0xc2, 0xee, 0x39, 0x71, 0x4e, + 0xb5, 0x05, 0x8f, 0x13, 0xff, 0x89, 0xd6, 0xc9, 0xf9, 0x2f, 0xac, 0xcd, 0x7f, 0x03, 0x00, 0x00, + 0xff, 0xff, 0xf8, 0x73, 0x1e, 0x98, 0x79, 0x0a, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1406,12 +1437,14 @@ func (m *MsgUpdateParam) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.AsType) > 0 { - i -= len(m.AsType) - copy(dAtA[i:], m.AsType) - i = encodeVarintTx(dAtA, i, uint64(len(m.AsType))) - i-- - dAtA[i] = 0x1a + 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) @@ -1430,6 +1463,27 @@ func (m *MsgUpdateParam) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *MsgUpdateParam_AsCoin) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParam_AsCoin) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.AsCoin != nil { + { + size, err := m.AsCoin.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + return len(dAtA) - i, nil +} func (m *MsgUpdateParamResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1645,13 +1699,24 @@ func (m *MsgUpdateParam) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.AsType) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) + if m.AsType != nil { + n += m.AsType.Size() } return n } +func (m *MsgUpdateParam_AsCoin) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.AsCoin != nil { + l = m.AsCoin.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n +} func (m *MsgUpdateParamResponse) Size() (n int) { if m == nil { return 0 @@ -2793,9 +2858,9 @@ func (m *MsgUpdateParam) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AsType", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field AsCoin", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -2805,23 +2870,26 @@ func (m *MsgUpdateParam) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.AsType = string(dAtA[iNdEx:postIndex]) + v := &types.Coin{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.AsType = &MsgUpdateParam_AsCoin{v} iNdEx = postIndex default: iNdEx = preIndex From c88edd6d4df7c05e501ffefcb6ebc90502cc6aab Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 27 Sep 2024 11:13:46 +0200 Subject: [PATCH 025/139] chore: comment out application MsgUpdateParam autocli --- x/application/module/autocli.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/x/application/module/autocli.go b/x/application/module/autocli.go index 54edaf5fa..0271f1ab5 100644 --- a/x/application/module/autocli.go +++ b/x/application/module/autocli.go @@ -103,12 +103,12 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { Short: "Transfer the application from [source app address] to [destination app address] and remove the source application", PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "source_address"}, {ProtoField: "destination_address"}}, }, - { - RpcMethod: "UpdateParam", - Use: "update-param [name] [as-type]", - Short: "Send a update-param tx", - PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "name"}, {ProtoField: "asType"}}, - }, + //{ + // 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 }, }, From da51239e4e88b5191f048b2175098c1666f6bb67 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 27 Sep 2024 11:15:23 +0200 Subject: [PATCH 026/139] chore: add application MsgUpdateParam to dao genesis authorizations --- tools/scripts/authz/dao_genesis_authorizations.json | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tools/scripts/authz/dao_genesis_authorizations.json b/tools/scripts/authz/dao_genesis_authorizations.json index 3eead39e5..6f257a438 100644 --- a/tools/scripts/authz/dao_genesis_authorizations.json +++ b/tools/scripts/authz/dao_genesis_authorizations.json @@ -152,6 +152,15 @@ }, "expiration": "2500-01-01T00:00:00Z" }, + { + "granter": "pokt10d07y265gmmuvt4z0w9aw880jnsr700j8yv32t", + "grantee": "pokt1eeeksh2tvkh7wzmfrljnhw4wrhs55lcuvmekkw", + "authorization": { + "@type": "\/cosmos.authz.v1beta1.GenericAuthorization", + "msg": "\/poktroll.application.MsgUpdateParam" + }, + "expiration": "2500-01-01T00:00:00Z" + }, { "granter": "pokt10d07y265gmmuvt4z0w9aw880jnsr700j8yv32t", "grantee": "pokt1eeeksh2tvkh7wzmfrljnhw4wrhs55lcuvmekkw", From 45c5a99773241358dbd3c4c032545d4ade3c3607 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 27 Sep 2024 11:46:50 +0200 Subject: [PATCH 027/139] chore: update NewMsgUpdateParam constructor --- x/application/types/message_update_param.go | 34 +++++++++++++-------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/x/application/types/message_update_param.go b/x/application/types/message_update_param.go index 89d033fd5..fa8709020 100644 --- a/x/application/types/message_update_param.go +++ b/x/application/types/message_update_param.go @@ -1,26 +1,36 @@ package types import ( + "fmt" + errorsmod "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" + cosmostypes "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) -var _ sdk.Msg = &MsgUpdateParam{} +var _ cosmostypes.Msg = &MsgUpdateParam{} + +func NewMsgUpdateParam(authority string, name string, asType any) *MsgUpdateParam { + var asTypeIface isMsgUpdateParam_AsType + + switch t := asType.(type) { + case *cosmostypes.Coin: + asTypeIface = &MsgUpdateParam_AsCoin{AsCoin: t} + default: + panic(fmt.Sprintf("unexpected param value type: %T", asType)) + } -func NewMsgUpdateParam(authority string, name string, asType string) *MsgUpdateParam { - return &MsgUpdateParam{ + return &MsgUpdateParam{ Authority: authority, - Name: name, - AsType: asType, + Name: name, + AsType: asTypeIface, } } func (msg *MsgUpdateParam) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(msg.Authority) - if err != nil { - return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid authority address (%s)", err) - } - return nil + _, err := cosmostypes.AccAddressFromBech32(msg.Authority) + if err != nil { + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid authority address (%s)", err) + } + return nil } - From d987e097fd07a77a6370980de9e7cc132601e67c Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 27 Sep 2024 11:47:01 +0200 Subject: [PATCH 028/139] fix: simulations generated code --- x/application/module/simulation.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x/application/module/simulation.go b/x/application/module/simulation.go index d02795d87..1497b58b9 100644 --- a/x/application/module/simulation.go +++ b/x/application/module/simulation.go @@ -138,7 +138,7 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp ) operations = append(operations, simulation.NewWeightedOperation( weightMsgUpdateParam, - applicationsimulation.SimulateMsgUpdateParam(am.accountKeeper, am.bankKeeper, am.keeper), + applicationsimulation.SimulateMsgUpdateParam(am.accountKeeper, am.bankKeeper, am.applicationKeeper), )) // this line is used by starport scaffolding # simapp/module/operation @@ -193,7 +193,7 @@ func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.Wei opWeightMsgUpdateParam, defaultWeightMsgUpdateParam, func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { - applicationsimulation.SimulateMsgUpdateParam(am.accountKeeper, am.bankKeeper, am.keeper) + applicationsimulation.SimulateMsgUpdateParam(am.accountKeeper, am.bankKeeper, am.applicationKeeper) return nil }, ), From 0da255df63f965c876c9238de435032bd5bc7085 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 27 Sep 2024 11:52:50 +0200 Subject: [PATCH 029/139] chore: add min_stake param to application module params --- api/poktroll/application/params.pulsar.go | 146 ++++++++++++++++++---- proto/poktroll/application/params.proto | 2 + x/application/types/params.pb.go | 97 +++++++++++--- 3 files changed, 207 insertions(+), 38 deletions(-) diff --git a/api/poktroll/application/params.pulsar.go b/api/poktroll/application/params.pulsar.go index 0b6923014..8647c2f13 100644 --- a/api/poktroll/application/params.pulsar.go +++ b/api/poktroll/application/params.pulsar.go @@ -3,6 +3,7 @@ package application import ( _ "cosmossdk.io/api/amino" + v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" fmt "fmt" runtime "github.com/cosmos/cosmos-proto/runtime" _ "github.com/cosmos/gogoproto/gogoproto" @@ -17,12 +18,14 @@ import ( var ( md_Params protoreflect.MessageDescriptor fd_Params_max_delegated_gateways protoreflect.FieldDescriptor + fd_Params_min_stake protoreflect.FieldDescriptor ) func init() { file_poktroll_application_params_proto_init() md_Params = File_poktroll_application_params_proto.Messages().ByName("Params") fd_Params_max_delegated_gateways = md_Params.Fields().ByName("max_delegated_gateways") + fd_Params_min_stake = md_Params.Fields().ByName("min_stake") } var _ protoreflect.Message = (*fastReflection_Params)(nil) @@ -96,6 +99,12 @@ func (x *fastReflection_Params) Range(f func(protoreflect.FieldDescriptor, proto return } } + if x.MinStake != nil { + value := protoreflect.ValueOfMessage(x.MinStake.ProtoReflect()) + if !f(fd_Params_min_stake, value) { + return + } + } } // Has reports whether a field is populated. @@ -113,6 +122,8 @@ func (x *fastReflection_Params) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { case "poktroll.application.Params.max_delegated_gateways": return x.MaxDelegatedGateways != uint64(0) + case "poktroll.application.Params.min_stake": + return x.MinStake != nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.Params")) @@ -131,6 +142,8 @@ func (x *fastReflection_Params) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { case "poktroll.application.Params.max_delegated_gateways": x.MaxDelegatedGateways = uint64(0) + case "poktroll.application.Params.min_stake": + x.MinStake = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.Params")) @@ -150,6 +163,9 @@ func (x *fastReflection_Params) Get(descriptor protoreflect.FieldDescriptor) pro case "poktroll.application.Params.max_delegated_gateways": value := x.MaxDelegatedGateways return protoreflect.ValueOfUint64(value) + case "poktroll.application.Params.min_stake": + value := x.MinStake + return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.Params")) @@ -172,6 +188,8 @@ func (x *fastReflection_Params) Set(fd protoreflect.FieldDescriptor, value proto switch fd.FullName() { case "poktroll.application.Params.max_delegated_gateways": x.MaxDelegatedGateways = value.Uint() + case "poktroll.application.Params.min_stake": + x.MinStake = value.Message().Interface().(*v1beta1.Coin) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.Params")) @@ -192,6 +210,11 @@ func (x *fastReflection_Params) Set(fd protoreflect.FieldDescriptor, value proto // Mutable is a mutating operation and unsafe for concurrent use. func (x *fastReflection_Params) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { + case "poktroll.application.Params.min_stake": + if x.MinStake == nil { + x.MinStake = new(v1beta1.Coin) + } + return protoreflect.ValueOfMessage(x.MinStake.ProtoReflect()) case "poktroll.application.Params.max_delegated_gateways": panic(fmt.Errorf("field max_delegated_gateways of message poktroll.application.Params is not mutable")) default: @@ -209,6 +232,9 @@ func (x *fastReflection_Params) NewField(fd protoreflect.FieldDescriptor) protor switch fd.FullName() { case "poktroll.application.Params.max_delegated_gateways": return protoreflect.ValueOfUint64(uint64(0)) + case "poktroll.application.Params.min_stake": + m := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(m.ProtoReflect()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.Params")) @@ -281,6 +307,10 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { if x.MaxDelegatedGateways != 0 { n += 1 + runtime.Sov(uint64(x.MaxDelegatedGateways)) } + if x.MinStake != nil { + l = options.Size(x.MinStake) + n += 1 + l + runtime.Sov(uint64(l)) + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -310,6 +340,20 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if x.MinStake != nil { + encoded, err := options.Marshal(x.MinStake) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } if x.MaxDelegatedGateways != 0 { i = runtime.EncodeVarint(dAtA, i, uint64(x.MaxDelegatedGateways)) i-- @@ -383,6 +427,42 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { break } } + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field MinStake", 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.MinStake == nil { + x.MinStake = &v1beta1.Coin{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.MinStake); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -440,7 +520,8 @@ type Params struct { // max_delegated_gateways defines the maximum number of gateways that a single // application can delegate to. This is used to prevent performance issues // in case the relay ring signature becomes too large. - MaxDelegatedGateways uint64 `protobuf:"varint,1,opt,name=max_delegated_gateways,json=maxDelegatedGateways,proto3" json:"max_delegated_gateways,omitempty"` + MaxDelegatedGateways uint64 `protobuf:"varint,1,opt,name=max_delegated_gateways,json=maxDelegatedGateways,proto3" json:"max_delegated_gateways,omitempty"` + MinStake *v1beta1.Coin `protobuf:"bytes,2,opt,name=min_stake,json=minStake,proto3" json:"min_stake,omitempty"` } func (x *Params) Reset() { @@ -470,6 +551,13 @@ func (x *Params) GetMaxDelegatedGateways() uint64 { return 0 } +func (x *Params) GetMinStake() *v1beta1.Coin { + if x != nil { + return x.MinStake + } + return nil +} + var File_poktroll_application_params_proto protoreflect.FileDescriptor var file_poktroll_application_params_proto_rawDesc = []byte{ @@ -479,7 +567,9 @@ var file_poktroll_application_params_proto_rawDesc = []byte{ 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x22, 0xa3, 0x01, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x71, 0x0a, + 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0xfe, 0x01, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x71, 0x0a, 0x16, 0x6d, 0x61, 0x78, 0x5f, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x3b, 0xea, 0xde, 0x1f, 0x16, 0x6d, 0x61, 0x78, 0x5f, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x64, @@ -487,22 +577,28 @@ var file_poktroll_application_params_proto_rawDesc = []byte{ 0x6c, 0x3a, 0x22, 0x6d, 0x61, 0x78, 0x5f, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x73, 0x22, 0x52, 0x14, 0x6d, 0x61, 0x78, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x64, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x73, - 0x3a, 0x26, 0xe8, 0xa0, 0x1f, 0x01, 0x8a, 0xe7, 0xb0, 0x2a, 0x1d, 0x70, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x2f, 0x78, 0x2f, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x2f, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0xc3, 0x01, 0xd8, 0xe2, 0x1e, 0x01, 0x0a, - 0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, - 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0b, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x25, 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, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xa2, - 0x02, 0x03, 0x50, 0x41, 0x58, 0xaa, 0x02, 0x14, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xca, 0x02, 0x14, 0x50, - 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0xe2, 0x02, 0x20, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x41, - 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x15, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x3a, 0x3a, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x12, 0x59, 0x0a, 0x09, 0x6d, 0x69, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, + 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x21, + 0xea, 0xde, 0x1f, 0x09, 0x6d, 0x69, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x6b, 0x65, 0xf2, 0xde, 0x1f, + 0x10, 0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x6d, 0x69, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x6b, 0x65, + 0x22, 0x52, 0x08, 0x6d, 0x69, 0x6e, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x3a, 0x26, 0xe8, 0xa0, 0x1f, + 0x01, 0x8a, 0xe7, 0xb0, 0x2a, 0x1d, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x78, + 0x2f, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x50, 0x61, 0x72, + 0x61, 0x6d, 0x73, 0x42, 0xc3, 0x01, 0xd8, 0xe2, 0x1e, 0x01, 0x0a, 0x18, 0x63, 0x6f, 0x6d, 0x2e, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0b, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x50, 0x72, 0x6f, 0x74, + 0x6f, 0x50, 0x01, 0x5a, 0x25, 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, 0x61, + 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xa2, 0x02, 0x03, 0x50, 0x41, 0x58, + 0xaa, 0x02, 0x14, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x41, 0x70, 0x70, 0x6c, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xca, 0x02, 0x14, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x5c, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xe2, 0x02, + 0x20, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0xea, 0x02, 0x15, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x41, 0x70, + 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( @@ -519,14 +615,16 @@ func file_poktroll_application_params_proto_rawDescGZIP() []byte { var file_poktroll_application_params_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_poktroll_application_params_proto_goTypes = []interface{}{ - (*Params)(nil), // 0: poktroll.application.Params + (*Params)(nil), // 0: poktroll.application.Params + (*v1beta1.Coin)(nil), // 1: cosmos.base.v1beta1.Coin } var file_poktroll_application_params_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name + 1, // 0: poktroll.application.Params.min_stake:type_name -> cosmos.base.v1beta1.Coin + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name } func init() { file_poktroll_application_params_proto_init() } diff --git a/proto/poktroll/application/params.proto b/proto/poktroll/application/params.proto index 74811d61c..fad719cea 100644 --- a/proto/poktroll/application/params.proto +++ b/proto/poktroll/application/params.proto @@ -6,6 +6,7 @@ option (gogoproto.stable_marshaler_all) = true; import "amino/amino.proto"; import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; // Params defines the parameters for the module. message Params { @@ -15,4 +16,5 @@ message Params { // application can delegate to. This is used to prevent performance issues // in case the relay ring signature becomes too large. uint64 max_delegated_gateways = 1 [(gogoproto.jsontag) = "max_delegated_gateways", (gogoproto.moretags) = "yaml:\"max_delegated_gateways\""]; + cosmos.base.v1beta1.Coin min_stake = 2 [(gogoproto.jsontag) = "min_stake", (gogoproto.moretags) = "yaml:\"min_stake\""]; } diff --git a/x/application/types/params.pb.go b/x/application/types/params.pb.go index 83ea72845..7723e6004 100644 --- a/x/application/types/params.pb.go +++ b/x/application/types/params.pb.go @@ -5,6 +5,7 @@ package types import ( fmt "fmt" + types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" @@ -29,7 +30,8 @@ type Params struct { // max_delegated_gateways defines the maximum number of gateways that a single // application can delegate to. This is used to prevent performance issues // in case the relay ring signature becomes too large. - MaxDelegatedGateways uint64 `protobuf:"varint,1,opt,name=max_delegated_gateways,json=maxDelegatedGateways,proto3" json:"max_delegated_gateways" yaml:"max_delegated_gateways"` + MaxDelegatedGateways uint64 `protobuf:"varint,1,opt,name=max_delegated_gateways,json=maxDelegatedGateways,proto3" json:"max_delegated_gateways" yaml:"max_delegated_gateways"` + MinStake *types.Coin `protobuf:"bytes,2,opt,name=min_stake,json=minStake,proto3" json:"min_stake" yaml:"min_stake"` } func (m *Params) Reset() { *m = Params{} } @@ -68,6 +70,13 @@ func (m *Params) GetMaxDelegatedGateways() uint64 { return 0 } +func (m *Params) GetMinStake() *types.Coin { + if m != nil { + return m.MinStake + } + return nil +} + func init() { proto.RegisterType((*Params)(nil), "poktroll.application.Params") } @@ -75,23 +84,28 @@ func init() { func init() { proto.RegisterFile("poktroll/application/params.proto", fileDescriptor_16533d77d399ef60) } var fileDescriptor_16533d77d399ef60 = []byte{ - // 248 bytes of a gzipped FileDescriptorProto + // 335 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x2c, 0xc8, 0xcf, 0x2e, 0x29, 0xca, 0xcf, 0xc9, 0xd1, 0x4f, 0x2c, 0x28, 0xc8, 0xc9, 0x4c, 0x4e, 0x2c, 0xc9, 0xcc, 0xcf, 0xd3, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x81, 0x29, 0xd1, 0x43, 0x52, 0x22, 0x25, 0x98, 0x98, 0x9b, 0x99, 0x97, 0xaf, 0x0f, 0x26, 0x21, 0x0a, - 0xa5, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0x4c, 0x7d, 0x10, 0x0b, 0x22, 0xaa, 0xb4, 0x98, 0x91, - 0x8b, 0x2d, 0x00, 0x6c, 0x9e, 0x50, 0x21, 0x97, 0x58, 0x6e, 0x62, 0x45, 0x7c, 0x4a, 0x6a, 0x4e, - 0x6a, 0x7a, 0x62, 0x49, 0x6a, 0x4a, 0x3c, 0x88, 0x2c, 0x4f, 0xac, 0x2c, 0x96, 0x60, 0x54, 0x60, - 0xd4, 0x60, 0x71, 0xb2, 0x7e, 0x75, 0x4f, 0x1e, 0x87, 0x8a, 0x4f, 0xf7, 0xe4, 0x65, 0x2b, 0x13, - 0x73, 0x73, 0xac, 0x94, 0xb0, 0xcb, 0x2b, 0x05, 0x89, 0xe4, 0x26, 0x56, 0xb8, 0xc0, 0xc4, 0xdd, - 0xa1, 0xc2, 0x56, 0x6a, 0x2f, 0x16, 0xc8, 0x33, 0x76, 0x3d, 0xdf, 0xa0, 0x25, 0x0b, 0xf7, 0x68, - 0x05, 0x8a, 0x57, 0x21, 0x4e, 0x73, 0x0a, 0x3a, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, - 0x1b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, - 0x86, 0x1b, 0x8f, 0xe5, 0x18, 0xa2, 0x4c, 0xd2, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, - 0x73, 0xf5, 0x41, 0xe6, 0xe8, 0xe6, 0xa5, 0x96, 0x94, 0xe7, 0x17, 0x65, 0xeb, 0xe3, 0x30, 0xb4, - 0xa4, 0xb2, 0x20, 0xb5, 0x38, 0x89, 0x0d, 0x1c, 0x00, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, - 0xcb, 0xd1, 0x5a, 0xaa, 0x64, 0x01, 0x00, 0x00, + 0xa5, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0x4c, 0x7d, 0x10, 0x0b, 0x2a, 0x2a, 0x97, 0x9c, 0x5f, + 0x9c, 0x9b, 0x5f, 0xac, 0x9f, 0x94, 0x58, 0x9c, 0xaa, 0x5f, 0x66, 0x98, 0x94, 0x5a, 0x92, 0x68, + 0xa8, 0x9f, 0x9c, 0x9f, 0x99, 0x07, 0x91, 0x57, 0xfa, 0xc7, 0xc8, 0xc5, 0x16, 0x00, 0xb6, 0x4f, + 0xa8, 0x90, 0x4b, 0x2c, 0x37, 0xb1, 0x22, 0x3e, 0x25, 0x35, 0x27, 0x35, 0x3d, 0xb1, 0x24, 0x35, + 0x25, 0x1e, 0x44, 0x96, 0x27, 0x56, 0x16, 0x4b, 0x30, 0x2a, 0x30, 0x6a, 0xb0, 0x38, 0x59, 0xbf, + 0xba, 0x27, 0x8f, 0x43, 0xc5, 0xa7, 0x7b, 0xf2, 0xb2, 0x95, 0x89, 0xb9, 0x39, 0x56, 0x4a, 0xd8, + 0xe5, 0x95, 0x82, 0x44, 0x72, 0x13, 0x2b, 0x5c, 0x60, 0xe2, 0xee, 0x50, 0x61, 0xa1, 0x48, 0x2e, + 0xce, 0xdc, 0xcc, 0xbc, 0xf8, 0xe2, 0x92, 0xc4, 0xec, 0x54, 0x09, 0x26, 0x05, 0x46, 0x0d, 0x6e, + 0x23, 0x49, 0x3d, 0x88, 0x8b, 0xf5, 0x40, 0x2e, 0xd6, 0x83, 0xba, 0x58, 0xcf, 0x39, 0x3f, 0x33, + 0xcf, 0x49, 0xf1, 0xd5, 0x3d, 0x79, 0x84, 0xfa, 0x4f, 0xf7, 0xe4, 0x05, 0xa0, 0x76, 0xc2, 0x84, + 0x94, 0x82, 0x38, 0x72, 0x33, 0xf3, 0x82, 0x41, 0x4c, 0x2b, 0xb5, 0x17, 0x0b, 0xe4, 0x19, 0xbb, + 0x9e, 0x6f, 0xd0, 0x92, 0x85, 0x87, 0x71, 0x05, 0x4a, 0x28, 0x43, 0x7c, 0xed, 0x14, 0x74, 0xe2, + 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x37, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, + 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, 0x99, 0xa4, 0x67, + 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x83, 0xcc, 0xd1, 0xcd, 0x4b, 0x2d, 0x29, + 0xcf, 0x2f, 0xca, 0xd6, 0xc7, 0x61, 0x68, 0x49, 0x65, 0x41, 0x6a, 0x71, 0x12, 0x1b, 0x38, 0x6c, + 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x81, 0x50, 0x13, 0x0c, 0xdf, 0x01, 0x00, 0x00, } func (this *Params) Equal(that interface{}) bool { @@ -116,6 +130,9 @@ func (this *Params) Equal(that interface{}) bool { if this.MaxDelegatedGateways != that1.MaxDelegatedGateways { return false } + if !this.MinStake.Equal(that1.MinStake) { + return false + } return true } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -138,6 +155,18 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.MinStake != nil { + { + size, err := m.MinStake.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } if m.MaxDelegatedGateways != 0 { i = encodeVarintParams(dAtA, i, uint64(m.MaxDelegatedGateways)) i-- @@ -166,6 +195,10 @@ func (m *Params) Size() (n int) { if m.MaxDelegatedGateways != 0 { n += 1 + sovParams(uint64(m.MaxDelegatedGateways)) } + if m.MinStake != nil { + l = m.MinStake.Size() + n += 1 + l + sovParams(uint64(l)) + } return n } @@ -223,6 +256,42 @@ func (m *Params) Unmarshal(dAtA []byte) error { break } } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinStake", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MinStake == nil { + m.MinStake = &types.Coin{} + } + if err := m.MinStake.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipParams(dAtA[iNdEx:]) From 454262868903fc05447cdeb4ddecff9f74ad0417 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 27 Sep 2024 11:54:06 +0200 Subject: [PATCH 030/139] chore: update params config for param updates test suite --- testutil/integration/suites/param_configs.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/testutil/integration/suites/param_configs.go b/testutil/integration/suites/param_configs.go index 13c8b8330..aded8d557 100644 --- a/testutil/integration/suites/param_configs.go +++ b/testutil/integration/suites/param_configs.go @@ -136,11 +136,17 @@ var ( ParamsMsgs: ModuleParamsMessages{ MsgUpdateParams: apptypes.MsgUpdateParams{}, MsgUpdateParamsResponse: apptypes.MsgUpdateParamsResponse{}, + MsgUpdateParam: apptypes.MsgUpdateParam{}, + MsgUpdateParamResponse: apptypes.MsgUpdateParamResponse{}, QueryParamsRequest: apptypes.QueryParamsRequest{}, QueryParamsResponse: apptypes.QueryParamsResponse{}, }, ValidParams: apptypes.Params{ MaxDelegatedGateways: 999, + MinStake: &ValidActorMinStake, + }, + ParamTypes: map[ParamType]any{ + ParamTypeCoin: apptypes.MsgUpdateParam_AsCoin{}, }, DefaultParams: apptypes.DefaultParams(), NewParamClientFn: apptypes.NewQueryClient, From b81ca9eb4afc9a28f985c2889e78e2ec5fba0392 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 27 Sep 2024 13:36:18 +0200 Subject: [PATCH 031/139] chore: add parameter validation --- x/application/keeper/params_test.go | 86 +++++++++++++++++++++++++++++ x/application/types/errors.go | 28 +++++----- x/application/types/params.go | 61 +++++++++++++++----- 3 files changed, 146 insertions(+), 29 deletions(-) diff --git a/x/application/keeper/params_test.go b/x/application/keeper/params_test.go index ae438b984..d5f7b5f43 100644 --- a/x/application/keeper/params_test.go +++ b/x/application/keeper/params_test.go @@ -3,8 +3,11 @@ package keeper_test import ( "testing" + "cosmossdk.io/math" + cosmostypes "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" + "github.com/pokt-network/poktroll/app/volatile" keepertest "github.com/pokt-network/poktroll/testutil/keeper" "github.com/pokt-network/poktroll/x/application/types" ) @@ -16,3 +19,86 @@ func TestGetParams(t *testing.T) { require.NoError(t, k.SetParams(ctx, params)) require.EqualValues(t, params, k.GetParams(ctx)) } + +func TestParams_ValidateMaxDelegatedGateways(t *testing.T) { + tests := []struct { + desc string + maxDelegatedGateways any + expectedErr error + }{ + { + desc: "invalid type", + maxDelegatedGateways: "0", + expectedErr: types.ErrAppParamInvalid.Wrap("invalid parameter type: string"), + }, + { + desc: "MaxDelegatedGateways less than 1", + maxDelegatedGateways: uint64(0), + expectedErr: types.ErrAppParamInvalid.Wrapf("max_delegated_gateways must be greater than 0: got %d", 0), + }, + { + desc: "valid MaxDelegatedGateways", + maxDelegatedGateways: types.DefaultMaxDelegatedGateways, + }, + } + + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + err := types.ValidateMaxDelegatedGateways(test.maxDelegatedGateways) + if test.expectedErr != nil { + require.ErrorContains(t, err, test.expectedErr.Error()) + } else { + require.NoError(t, err) + } + }) + } +} + +func TestParams_ValidateMinStake(t *testing.T) { + tests := []struct { + desc string + minStake any + expectedErr error + }{ + { + desc: "invalid type", + minStake: "0", + expectedErr: types.ErrAppParamInvalid.Wrapf("invalid parameter type: string"), + }, + { + desc: "MinStake with invalid denom", + minStake: &cosmostypes.Coin{ + Denom: "💩coin", + Amount: math.NewInt(1), + }, + expectedErr: types.ErrAppParamInvalid.Wrapf( + "invalid min_stake denom %q; expected %q", + "💩coin", volatile.DenomuPOKT, + ), + }, + { + desc: "MinStake less than zero", + minStake: &cosmostypes.Coin{ + Denom: volatile.DenomuPOKT, + Amount: math.NewInt(-1), + }, + expectedErr: types.ErrAppParamInvalid.Wrapf("invalid min_stake amount: -1%s <= 0", volatile.DenomuPOKT), + }, + { + desc: "valid MinStake", + minStake: &types.DefaultMinStake, + expectedErr: nil, + }, + } + + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + err := types.ValidateMinStake(test.minStake) + if test.expectedErr != nil { + require.ErrorContains(t, err, test.expectedErr.Error()) + } else { + require.NoError(t, err) + } + }) + } +} diff --git a/x/application/types/errors.go b/x/application/types/errors.go index b20120506..cafc8e85f 100644 --- a/x/application/types/errors.go +++ b/x/application/types/errors.go @@ -6,18 +6,18 @@ import sdkerrors "cosmossdk.io/errors" // x/application module sentinel errors var ( - ErrAppInvalidSigner = sdkerrors.Register(ModuleName, 1100, "expected gov account as only signer for proposal message") - ErrAppInvalidStake = sdkerrors.Register(ModuleName, 1101, "invalid application stake") - ErrAppInvalidAddress = sdkerrors.Register(ModuleName, 1102, "invalid application address") - ErrAppUnauthorized = sdkerrors.Register(ModuleName, 1103, "unauthorized application signer") - ErrAppNotFound = sdkerrors.Register(ModuleName, 1104, "application not found") - ErrAppInvalidServiceConfigs = sdkerrors.Register(ModuleName, 1106, "invalid service configs") - ErrAppGatewayNotFound = sdkerrors.Register(ModuleName, 1107, "gateway not found") - ErrAppInvalidGatewayAddress = sdkerrors.Register(ModuleName, 1108, "invalid gateway address") - ErrAppAlreadyDelegated = sdkerrors.Register(ModuleName, 1109, "application already delegated to gateway") - ErrAppMaxDelegatedGateways = sdkerrors.Register(ModuleName, 1110, "maximum number of delegated gateways reached") - ErrAppInvalidMaxDelegatedGateways = sdkerrors.Register(ModuleName, 1111, "invalid MaxDelegatedGateways parameter") - ErrAppNotDelegated = sdkerrors.Register(ModuleName, 1112, "application not delegated to gateway") - ErrAppIsUnstaking = sdkerrors.Register(ModuleName, 1113, "application is in unbonding period") - ErrAppDuplicateAddress = sdkerrors.Register(ModuleName, 1114, "duplicate application address") + ErrAppInvalidSigner = sdkerrors.Register(ModuleName, 1100, "expected gov account as only signer for proposal message") + ErrAppInvalidStake = sdkerrors.Register(ModuleName, 1101, "invalid application stake") + ErrAppInvalidAddress = sdkerrors.Register(ModuleName, 1102, "invalid application address") + ErrAppUnauthorized = sdkerrors.Register(ModuleName, 1103, "unauthorized application signer") + ErrAppNotFound = sdkerrors.Register(ModuleName, 1104, "application not found") + ErrAppInvalidServiceConfigs = sdkerrors.Register(ModuleName, 1106, "invalid service configs") + ErrAppGatewayNotFound = sdkerrors.Register(ModuleName, 1107, "gateway not found") + ErrAppInvalidGatewayAddress = sdkerrors.Register(ModuleName, 1108, "invalid gateway address") + ErrAppAlreadyDelegated = sdkerrors.Register(ModuleName, 1109, "application already delegated to gateway") + ErrAppMaxDelegatedGateways = sdkerrors.Register(ModuleName, 1110, "maximum number of delegated gateways reached") + ErrAppNotDelegated = sdkerrors.Register(ModuleName, 1111, "application not delegated to gateway") + ErrAppIsUnstaking = sdkerrors.Register(ModuleName, 1112, "application is in unbonding period") + ErrAppDuplicateAddress = sdkerrors.Register(ModuleName, 1113, "duplicate application address") + ErrAppParamInvalid = sdkerrors.Register(ModuleName, 1114, "the provided param is invalid") ) diff --git a/x/application/types/params.go b/x/application/types/params.go index fc990971b..9d00e9722 100644 --- a/x/application/types/params.go +++ b/x/application/types/params.go @@ -1,19 +1,23 @@ package types import ( - "fmt" - + cosmostypes "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" -) -const ParamMaxDelegatedGateways = "max_delegated_gateways" + "github.com/pokt-network/poktroll/app/volatile" +) var ( _ paramtypes.ParamSet = (*Params)(nil) - KeyMaxDelegatedGateways = []byte("MaxDelegatedGateways") + KeyMaxDelegatedGateways = []byte("MaxDelegatedGateways") + ParamMaxDelegatedGateways = "max_delegated_gateways" // TODO_MAINNET: Determine the default value DefaultMaxDelegatedGateways uint64 = 7 + KeyMinStake = []byte("MinStake") + ParamMinStake = "min_stake" + // TODO_MAINNET: Determine the default value + DefaultMinStake = cosmostypes.NewInt64Coin(volatile.DenomuPOKT, 100) ) // ParamKeyTable the param key table for launch module @@ -22,44 +26,71 @@ func ParamKeyTable() paramtypes.KeyTable { } // NewParams creates a new Params instance -func NewParams(maxDelegatedGateways uint64) Params { +func NewParams(maxDelegatedGateways uint64, minStake *cosmostypes.Coin) Params { return Params{ MaxDelegatedGateways: maxDelegatedGateways, + MinStake: minStake, } } // DefaultParams returns a default set of parameters func DefaultParams() Params { - return NewParams(DefaultMaxDelegatedGateways) + return NewParams(DefaultMaxDelegatedGateways, &DefaultMinStake) } // ParamSetPairs get the params.ParamSet func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { return paramtypes.ParamSetPairs{ - paramtypes.NewParamSetPair(KeyMaxDelegatedGateways, &p.MaxDelegatedGateways, validateMaxDelegatedGateways), + paramtypes.NewParamSetPair(KeyMaxDelegatedGateways, &p.MaxDelegatedGateways, ValidateMaxDelegatedGateways), + paramtypes.NewParamSetPair(KeyMinStake, &p.MinStake, ValidateMinStake), } } // Validate validates the set of params func (p Params) Validate() error { - if err := validateMaxDelegatedGateways(p.MaxDelegatedGateways); err != nil { + if err := ValidateMaxDelegatedGateways(p.MaxDelegatedGateways); err != nil { return err } return nil } -// validateMaxDelegatedGateways validates the MaxDelegatedGateways param -func validateMaxDelegatedGateways(v interface{}) error { - maxDelegatedGateways, ok := v.(uint64) +// ValidateMaxDelegatedGateways validates the MaxDelegatedGateways param +func ValidateMaxDelegatedGateways(maxDelegatedGatewaysAny any) error { + maxDelegatedGateways, ok := maxDelegatedGatewaysAny.(uint64) if !ok { - return fmt.Errorf("invalid parameter type: %T", v) + return ErrAppParamInvalid.Wrapf("invalid parameter type: %T", maxDelegatedGatewaysAny) } // Hard-coding a value of 1 because we never expect this to change. - // If an application choses to delegate, at least one is required. + // If an application chooses to delegate, at least one is required. if maxDelegatedGateways < 1 { - return ErrAppInvalidMaxDelegatedGateways.Wrapf("MaxDelegatedGateways param < 1: got %d", maxDelegatedGateways) + return ErrAppParamInvalid.Wrapf("max_delegated_gateways must be greater than 0: got %d", maxDelegatedGateways) + } + + return nil +} + +// ValidateMinStake validates the MinStake param +func ValidateMinStake(minStakeAny any) error { + minStakeCoin, ok := minStakeAny.(*cosmostypes.Coin) + if !ok { + return ErrAppParamInvalid.Wrapf("invalid parameter type: %T", minStakeAny) + } + + if minStakeCoin == nil { + return ErrAppParamInvalid.Wrapf("missing min_stake") + } + + if minStakeCoin.Denom != volatile.DenomuPOKT { + return ErrAppParamInvalid.Wrapf( + "invalid min_stake denom %q; expected %q", + minStakeCoin.Denom, volatile.DenomuPOKT, + ) + } + + if minStakeCoin.IsZero() || minStakeCoin.IsNegative() { + return ErrAppParamInvalid.Wrapf("invalid min_stake amount: %s <= 0", minStakeCoin) } return nil From cdff4b3f2333f40fc2c748a958de6db0c620dba4 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 27 Sep 2024 16:30:37 +0200 Subject: [PATCH 032/139] chore: add param update make targets and JSON msgs --- makefiles/params.mk | 17 +++++++++++++++++ tools/scripts/params/application_all.json | 17 +++++++++++++++++ tools/scripts/params/application_min_stake.json | 15 +++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 tools/scripts/params/application_all.json create mode 100644 tools/scripts/params/application_min_stake.json diff --git a/makefiles/params.mk b/makefiles/params.mk index 8594b1e19..a822b5cfc 100644 --- a/makefiles/params.mk +++ b/makefiles/params.mk @@ -110,6 +110,23 @@ params_update_gateway_all: ## Update the session module params params_update_gateway_min_stake: ## Update the gateway module min_stake param poktrolld tx authz exec ./tools/scripts/params/gateway_min_stake.json $(PARAM_FLAGS) +### Application Module Params ### +.PHONY: params_get_application +params_get_application: ## Get the application module params + poktrolld query application params --node $(POCKET_NODE) + +.PHONY: params_update_application_all +params_update_application_all: ## Update the application module params + poktrolld tx authz exec ./tools/scripts/params/application_all.json $(PARAM_FLAGS) + +.PHONY: params_update_application_max_delegated_gateways +params_update_application_max_delegated_gateways: ## Update the application module max_delegated_gateways param + poktrolld tx authz exec ./tools/scripts/params/application_max_delegated_gateways.json $(PARAM_FLAGS) + +.PHONY: params_update_application_min_stake +params_update_application_min_stake: ## Update the application module min_stake param + poktrolld tx authz exec ./tools/scripts/params/application_min_stake.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/tools/scripts/params/application_all.json b/tools/scripts/params/application_all.json new file mode 100644 index 000000000..acbeb3c86 --- /dev/null +++ b/tools/scripts/params/application_all.json @@ -0,0 +1,17 @@ +{ + "body": { + "messages": [ + { + "@type": "/poktroll.application.MsgUpdateParams", + "authority": "pokt10d07y265gmmuvt4z0w9aw880jnsr700j8yv32t", + "params": { + "max_delegated_gateways": "7", + "min_stake": { + "denom": "upokt", + "amount": "1000000" + } + } + } + ] + } +} \ No newline at end of file diff --git a/tools/scripts/params/application_min_stake.json b/tools/scripts/params/application_min_stake.json new file mode 100644 index 000000000..7b21a6f29 --- /dev/null +++ b/tools/scripts/params/application_min_stake.json @@ -0,0 +1,15 @@ +{ + "body": { + "messages": [ + { + "@type": "/poktroll.application.MsgUpdateParam", + "authority": "pokt10d07y265gmmuvt4z0w9aw880jnsr700j8yv32t", + "name": "min_stake", + "as_coin": { + "denom": "upokt", + "amount": "1000000" + } + } + ] + } +} From be2475375fc0a9ca1132ad6290f892703470193b Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 27 Sep 2024 16:31:05 +0200 Subject: [PATCH 033/139] chore: add default application min_stake param of 1 POKT to genesis config --- config.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config.yml b/config.yml index 8691475a8..6c6946fbd 100644 --- a/config.yml +++ b/config.yml @@ -165,6 +165,10 @@ genesis: application: params: max_delegated_gateways: "7" + min_stake: + # TODO_MAINNET: Determine realistic amount for minimum application stake amount. + amount: "1000000" # 1 POKT + denom: upokt applicationList: - address: pokt1mrqt5f7qh8uxs27cjm9t7v9e74a9vvdnq5jva4 delegatee_gateway_addresses: [] From 45b6e5cbcf3cdac3f48791008b51059c594f8769 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 27 Sep 2024 17:42:00 +0200 Subject: [PATCH 034/139] chore: update MsgUpdateParamResponse & add AsUint64 AsType type --- api/poktroll/application/tx.pulsar.go | 327 +++++++++++++++++--------- proto/poktroll/application/tx.proto | 5 +- x/application/types/tx.pb.go | 211 +++++++++++------ 3 files changed, 354 insertions(+), 189 deletions(-) diff --git a/api/poktroll/application/tx.pulsar.go b/api/poktroll/application/tx.pulsar.go index 9da9cfb1c..f24ea3d03 100644 --- a/api/poktroll/application/tx.pulsar.go +++ b/api/poktroll/application/tx.pulsar.go @@ -5245,6 +5245,7 @@ var ( md_MsgUpdateParam protoreflect.MessageDescriptor fd_MsgUpdateParam_authority protoreflect.FieldDescriptor fd_MsgUpdateParam_name protoreflect.FieldDescriptor + fd_MsgUpdateParam_as_uint64 protoreflect.FieldDescriptor fd_MsgUpdateParam_as_coin protoreflect.FieldDescriptor ) @@ -5253,6 +5254,7 @@ func init() { md_MsgUpdateParam = File_poktroll_application_tx_proto.Messages().ByName("MsgUpdateParam") fd_MsgUpdateParam_authority = md_MsgUpdateParam.Fields().ByName("authority") fd_MsgUpdateParam_name = md_MsgUpdateParam.Fields().ByName("name") + fd_MsgUpdateParam_as_uint64 = md_MsgUpdateParam.Fields().ByName("as_uint64") fd_MsgUpdateParam_as_coin = md_MsgUpdateParam.Fields().ByName("as_coin") } @@ -5335,6 +5337,12 @@ func (x *fastReflection_MsgUpdateParam) Range(f func(protoreflect.FieldDescripto } if x.AsType != nil { switch o := x.AsType.(type) { + case *MsgUpdateParam_AsUint64: + v := o.AsUint64 + value := protoreflect.ValueOfUint64(v) + if !f(fd_MsgUpdateParam_as_uint64, value) { + return + } case *MsgUpdateParam_AsCoin: v := o.AsCoin value := protoreflect.ValueOfMessage(v.ProtoReflect()) @@ -5362,6 +5370,14 @@ func (x *fastReflection_MsgUpdateParam) Has(fd protoreflect.FieldDescriptor) boo return x.Authority != "" case "poktroll.application.MsgUpdateParam.name": return x.Name != "" + case "poktroll.application.MsgUpdateParam.as_uint64": + if x.AsType == nil { + return false + } else if _, ok := x.AsType.(*MsgUpdateParam_AsUint64); ok { + return true + } else { + return false + } case "poktroll.application.MsgUpdateParam.as_coin": if x.AsType == nil { return false @@ -5390,6 +5406,8 @@ func (x *fastReflection_MsgUpdateParam) Clear(fd protoreflect.FieldDescriptor) { x.Authority = "" case "poktroll.application.MsgUpdateParam.name": x.Name = "" + case "poktroll.application.MsgUpdateParam.as_uint64": + x.AsType = nil case "poktroll.application.MsgUpdateParam.as_coin": x.AsType = nil default: @@ -5414,6 +5432,14 @@ func (x *fastReflection_MsgUpdateParam) Get(descriptor protoreflect.FieldDescrip case "poktroll.application.MsgUpdateParam.name": value := x.Name return protoreflect.ValueOfString(value) + case "poktroll.application.MsgUpdateParam.as_uint64": + if x.AsType == nil { + return protoreflect.ValueOfUint64(uint64(0)) + } else if v, ok := x.AsType.(*MsgUpdateParam_AsUint64); ok { + return protoreflect.ValueOfUint64(v.AsUint64) + } else { + return protoreflect.ValueOfUint64(uint64(0)) + } case "poktroll.application.MsgUpdateParam.as_coin": if x.AsType == nil { return protoreflect.ValueOfMessage((*v1beta1.Coin)(nil).ProtoReflect()) @@ -5446,6 +5472,9 @@ func (x *fastReflection_MsgUpdateParam) Set(fd protoreflect.FieldDescriptor, val x.Authority = value.Interface().(string) case "poktroll.application.MsgUpdateParam.name": x.Name = value.Interface().(string) + case "poktroll.application.MsgUpdateParam.as_uint64": + cv := value.Uint() + x.AsType = &MsgUpdateParam_AsUint64{AsUint64: cv} case "poktroll.application.MsgUpdateParam.as_coin": cv := value.Message().Interface().(*v1beta1.Coin) x.AsType = &MsgUpdateParam_AsCoin{AsCoin: cv} @@ -5489,6 +5518,8 @@ func (x *fastReflection_MsgUpdateParam) Mutable(fd protoreflect.FieldDescriptor) panic(fmt.Errorf("field authority of message poktroll.application.MsgUpdateParam is not mutable")) case "poktroll.application.MsgUpdateParam.name": panic(fmt.Errorf("field name of message poktroll.application.MsgUpdateParam is not mutable")) + case "poktroll.application.MsgUpdateParam.as_uint64": + panic(fmt.Errorf("field as_uint64 of message poktroll.application.MsgUpdateParam is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUpdateParam")) @@ -5506,6 +5537,8 @@ func (x *fastReflection_MsgUpdateParam) NewField(fd protoreflect.FieldDescriptor return protoreflect.ValueOfString("") case "poktroll.application.MsgUpdateParam.name": return protoreflect.ValueOfString("") + case "poktroll.application.MsgUpdateParam.as_uint64": + return protoreflect.ValueOfUint64(uint64(0)) case "poktroll.application.MsgUpdateParam.as_coin": value := &v1beta1.Coin{} return protoreflect.ValueOfMessage(value.ProtoReflect()) @@ -5527,6 +5560,8 @@ func (x *fastReflection_MsgUpdateParam) WhichOneof(d protoreflect.OneofDescripto return nil } switch x.AsType.(type) { + case *MsgUpdateParam_AsUint64: + return x.Descriptor().Fields().ByName("as_uint64") case *MsgUpdateParam_AsCoin: return x.Descriptor().Fields().ByName("as_coin") } @@ -5595,6 +5630,11 @@ func (x *fastReflection_MsgUpdateParam) ProtoMethods() *protoiface.Methods { n += 1 + l + runtime.Sov(uint64(l)) } switch x := x.AsType.(type) { + case *MsgUpdateParam_AsUint64: + if x == nil { + break + } + n += 1 + runtime.Sov(uint64(x.AsUint64)) case *MsgUpdateParam_AsCoin: if x == nil { break @@ -5632,6 +5672,10 @@ func (x *fastReflection_MsgUpdateParam) ProtoMethods() *protoiface.Methods { copy(dAtA[i:], x.unknownFields) } switch x := x.AsType.(type) { + case *MsgUpdateParam_AsUint64: + i = runtime.EncodeVarint(dAtA, i, uint64(x.AsUint64)) + i-- + dAtA[i] = 0x18 case *MsgUpdateParam_AsCoin: encoded, err := options.Marshal(x.AsCoin) if err != nil { @@ -5644,7 +5688,7 @@ func (x *fastReflection_MsgUpdateParam) ProtoMethods() *protoiface.Methods { copy(dAtA[i:], encoded) i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) i-- - dAtA[i] = 0x1a + dAtA[i] = 0x22 } if len(x.Name) > 0 { i -= len(x.Name) @@ -5774,6 +5818,26 @@ func (x *fastReflection_MsgUpdateParam) ProtoMethods() *protoiface.Methods { x.Name = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AsUint64", wireType) + } + var v 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++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + x.AsType = &MsgUpdateParam_AsUint64{v} + case 4: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AsCoin", wireType) } @@ -5919,8 +5983,8 @@ func (x *fastReflection_MsgUpdateParamResponse) Interface() protoreflect.ProtoMe // 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 != "" { - value := protoreflect.ValueOfString(x.Params) + if x.Params != nil { + value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) if !f(fd_MsgUpdateParamResponse_params, value) { return } @@ -5941,7 +6005,7 @@ func (x *fastReflection_MsgUpdateParamResponse) Range(f func(protoreflect.FieldD func (x *fastReflection_MsgUpdateParamResponse) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { case "poktroll.application.MsgUpdateParamResponse.params": - return x.Params != "" + return x.Params != nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUpdateParamResponse")) @@ -5959,7 +6023,7 @@ func (x *fastReflection_MsgUpdateParamResponse) Has(fd protoreflect.FieldDescrip func (x *fastReflection_MsgUpdateParamResponse) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { case "poktroll.application.MsgUpdateParamResponse.params": - x.Params = "" + x.Params = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUpdateParamResponse")) @@ -5978,7 +6042,7 @@ func (x *fastReflection_MsgUpdateParamResponse) Get(descriptor protoreflect.Fiel switch descriptor.FullName() { case "poktroll.application.MsgUpdateParamResponse.params": value := x.Params - return protoreflect.ValueOfString(value) + return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUpdateParamResponse")) @@ -6000,7 +6064,7 @@ func (x *fastReflection_MsgUpdateParamResponse) Get(descriptor protoreflect.Fiel func (x *fastReflection_MsgUpdateParamResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { case "poktroll.application.MsgUpdateParamResponse.params": - x.Params = value.Interface().(string) + x.Params = value.Message().Interface().(*Params) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUpdateParamResponse")) @@ -6022,7 +6086,10 @@ func (x *fastReflection_MsgUpdateParamResponse) Set(fd protoreflect.FieldDescrip func (x *fastReflection_MsgUpdateParamResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { case "poktroll.application.MsgUpdateParamResponse.params": - panic(fmt.Errorf("field params of message poktroll.application.MsgUpdateParamResponse is not mutable")) + 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.application.MsgUpdateParamResponse")) @@ -6037,7 +6104,8 @@ func (x *fastReflection_MsgUpdateParamResponse) Mutable(fd protoreflect.FieldDes func (x *fastReflection_MsgUpdateParamResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { case "poktroll.application.MsgUpdateParamResponse.params": - return protoreflect.ValueOfString("") + m := new(Params) + return protoreflect.ValueOfMessage(m.ProtoReflect()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUpdateParamResponse")) @@ -6107,8 +6175,8 @@ func (x *fastReflection_MsgUpdateParamResponse) ProtoMethods() *protoiface.Metho var n int var l int _ = l - l = len(x.Params) - if l > 0 { + if x.Params != nil { + l = options.Size(x.Params) n += 1 + l + runtime.Sov(uint64(l)) } if x.unknownFields != nil { @@ -6140,10 +6208,17 @@ func (x *fastReflection_MsgUpdateParamResponse) ProtoMethods() *protoiface.Metho i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if len(x.Params) > 0 { - i -= len(x.Params) - copy(dAtA[i:], x.Params) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Params))) + 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 } @@ -6200,7 +6275,7 @@ func (x *fastReflection_MsgUpdateParamResponse) ProtoMethods() *protoiface.Metho if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -6210,23 +6285,27 @@ func (x *fastReflection_MsgUpdateParamResponse) ProtoMethods() *protoiface.Metho } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.Params = string(dAtA[iNdEx:postIndex]) + 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 @@ -6715,6 +6794,7 @@ type MsgUpdateParam struct { Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // Types that are assignable to AsType: // + // *MsgUpdateParam_AsUint64 // *MsgUpdateParam_AsCoin AsType isMsgUpdateParam_AsType `protobuf_oneof:"asType"` } @@ -6760,6 +6840,13 @@ func (x *MsgUpdateParam) GetAsType() isMsgUpdateParam_AsType { return nil } +func (x *MsgUpdateParam) GetAsUint64() uint64 { + if x, ok := x.GetAsType().(*MsgUpdateParam_AsUint64); ok { + return x.AsUint64 + } + return 0 +} + func (x *MsgUpdateParam) GetAsCoin() *v1beta1.Coin { if x, ok := x.GetAsType().(*MsgUpdateParam_AsCoin); ok { return x.AsCoin @@ -6771,10 +6858,16 @@ type isMsgUpdateParam_AsType interface { isMsgUpdateParam_AsType() } +type MsgUpdateParam_AsUint64 struct { + AsUint64 uint64 `protobuf:"varint,3,opt,name=as_uint64,json=asUint64,proto3,oneof"` +} + type MsgUpdateParam_AsCoin struct { - AsCoin *v1beta1.Coin `protobuf:"bytes,3,opt,name=as_coin,json=asCoin,proto3,oneof"` + AsCoin *v1beta1.Coin `protobuf:"bytes,4,opt,name=as_coin,json=asCoin,proto3,oneof"` } +func (*MsgUpdateParam_AsUint64) isMsgUpdateParam_AsType() {} + func (*MsgUpdateParam_AsCoin) isMsgUpdateParam_AsType() {} type MsgUpdateParamResponse struct { @@ -6782,7 +6875,7 @@ type MsgUpdateParamResponse struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Params string `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` } func (x *MsgUpdateParamResponse) Reset() { @@ -6805,11 +6898,11 @@ func (*MsgUpdateParamResponse) Descriptor() ([]byte, []int) { return file_poktroll_application_tx_proto_rawDescGZIP(), []int{13} } -func (x *MsgUpdateParamResponse) GetParams() string { +func (x *MsgUpdateParamResponse) GetParams() *Params { if x != nil { return x.Params } - return "" + return nil } var File_poktroll_application_tx_proto protoreflect.FileDescriptor @@ -6911,85 +7004,89 @@ var file_poktroll_application_tx_proto_rawDesc = []byte{ 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0b, 0x61, 0x70, - 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xac, 0x01, 0x0a, 0x0e, 0x4d, 0x73, + 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xcb, 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, 0x34, 0x0a, 0x07, 0x61, 0x73, 0x5f, 0x63, - 0x6f, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, - 0x43, 0x6f, 0x69, 0x6e, 0x48, 0x00, 0x52, 0x06, 0x61, 0x73, 0x43, 0x6f, 0x69, 0x6e, 0x3a, 0x0e, - 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x42, 0x08, - 0x0a, 0x06, 0x61, 0x73, 0x54, 0x79, 0x70, 0x65, 0x22, 0x30, 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, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x32, 0xb0, 0x06, 0x0a, 0x03, 0x4d, - 0x73, 0x67, 0x12, 0x64, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x12, 0x25, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, - 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x2d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, + 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x09, 0x61, 0x73, 0x5f, 0x75, + 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x48, 0x00, 0x52, 0x08, 0x61, + 0x73, 0x55, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x34, 0x0a, 0x07, 0x61, 0x73, 0x5f, 0x63, 0x6f, + 0x69, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, + 0x6f, 0x69, 0x6e, 0x48, 0x00, 0x52, 0x06, 0x61, 0x73, 0x43, 0x6f, 0x69, 0x6e, 0x3a, 0x0e, 0x82, + 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x42, 0x08, 0x0a, + 0x06, 0x61, 0x73, 0x54, 0x79, 0x70, 0x65, 0x22, 0x4e, 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, 0x34, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, + 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, + 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x32, 0xb0, 0x06, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, + 0x64, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, + 0x25, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x2d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 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, 0x70, 0x0a, 0x10, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x41, 0x70, + 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 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, 0x70, 0x0a, 0x10, 0x53, 0x74, 0x61, 0x6b, - 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x29, 0x2e, 0x70, - 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x41, 0x70, 0x70, 0x6c, - 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x31, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, - 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, - 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x76, 0x0a, 0x12, 0x55, 0x6e, - 0x73, 0x74, 0x61, 0x6b, 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x2b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, - 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, - 0x6b, 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x33, 0x2e, + 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x31, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, + 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x53, + 0x74, 0x61, 0x6b, 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x76, 0x0a, 0x12, 0x55, 0x6e, 0x73, 0x74, 0x61, + 0x6b, 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x41, - 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x73, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x54, 0x6f, - 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x2a, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, - 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, - 0x73, 0x67, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x54, 0x6f, 0x47, 0x61, 0x74, 0x65, - 0x77, 0x61, 0x79, 0x1a, 0x32, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, - 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x65, - 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x54, 0x6f, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x7f, 0x0a, 0x15, 0x55, 0x6e, 0x64, 0x65, 0x6c, - 0x65, 0x67, 0x61, 0x74, 0x65, 0x46, 0x72, 0x6f, 0x6d, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, - 0x12, 0x2e, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, - 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x64, 0x65, 0x6c, - 0x65, 0x67, 0x61, 0x74, 0x65, 0x46, 0x72, 0x6f, 0x6d, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, - 0x1a, 0x36, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, - 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x64, 0x65, 0x6c, - 0x65, 0x67, 0x61, 0x74, 0x65, 0x46, 0x72, 0x6f, 0x6d, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x79, 0x0a, 0x13, 0x54, 0x72, 0x61, 0x6e, - 0x73, 0x66, 0x65, 0x72, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, - 0x2c, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, - 0x65, 0x72, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x34, 0x2e, + 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x33, 0x2e, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x41, 0x70, 0x70, 0x6c, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x73, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x54, 0x6f, 0x47, 0x61, 0x74, + 0x65, 0x77, 0x61, 0x79, 0x12, 0x2a, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, + 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x44, + 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x54, 0x6f, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, + 0x1a, 0x32, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x6c, 0x65, 0x67, + 0x61, 0x74, 0x65, 0x54, 0x6f, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x7f, 0x0a, 0x15, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, + 0x74, 0x65, 0x46, 0x72, 0x6f, 0x6d, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x2e, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, - 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x61, 0x0a, 0x0b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, - 0x61, 0x6d, 0x12, 0x24, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, - 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x1a, 0x2c, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 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, 0xbf, 0x01, - 0xd8, 0xe2, 0x1e, 0x01, 0x0a, 0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, - 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x07, - 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x25, 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, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0xa2, 0x02, 0x03, 0x50, 0x41, 0x58, 0xaa, 0x02, 0x14, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xca, 0x02, 0x14, - 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0xe2, 0x02, 0x20, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, - 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x15, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, - 0x6c, 0x6c, 0x3a, 0x3a, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, + 0x74, 0x65, 0x46, 0x72, 0x6f, 0x6d, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x1a, 0x36, 0x2e, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, + 0x74, 0x65, 0x46, 0x72, 0x6f, 0x6d, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x79, 0x0a, 0x13, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, + 0x72, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2c, 0x2e, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x41, + 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x34, 0x2e, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x41, 0x70, 0x70, + 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x61, 0x0a, 0x0b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, + 0x24, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x1a, 0x2c, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 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, 0xbf, 0x01, 0xd8, 0xe2, 0x1e, + 0x01, 0x0a, 0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, + 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x07, 0x54, 0x78, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x25, 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, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xa2, 0x02, 0x03, + 0x50, 0x41, 0x58, 0xaa, 0x02, 0x14, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x41, + 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xca, 0x02, 0x14, 0x50, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0xe2, 0x02, 0x20, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x41, 0x70, 0x70, + 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x15, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, + 0x3a, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -7031,25 +7128,26 @@ var file_poktroll_application_tx_proto_depIdxs = []int32{ 16, // 2: poktroll.application.MsgStakeApplication.services:type_name -> poktroll.shared.ApplicationServiceConfig 17, // 3: poktroll.application.MsgTransferApplicationResponse.application:type_name -> poktroll.application.Application 15, // 4: poktroll.application.MsgUpdateParam.as_coin:type_name -> cosmos.base.v1beta1.Coin - 0, // 5: poktroll.application.Msg.UpdateParams:input_type -> poktroll.application.MsgUpdateParams - 2, // 6: poktroll.application.Msg.StakeApplication:input_type -> poktroll.application.MsgStakeApplication - 4, // 7: poktroll.application.Msg.UnstakeApplication:input_type -> poktroll.application.MsgUnstakeApplication - 6, // 8: poktroll.application.Msg.DelegateToGateway:input_type -> poktroll.application.MsgDelegateToGateway - 8, // 9: poktroll.application.Msg.UndelegateFromGateway:input_type -> poktroll.application.MsgUndelegateFromGateway - 10, // 10: poktroll.application.Msg.TransferApplication:input_type -> poktroll.application.MsgTransferApplication - 12, // 11: poktroll.application.Msg.UpdateParam:input_type -> poktroll.application.MsgUpdateParam - 1, // 12: poktroll.application.Msg.UpdateParams:output_type -> poktroll.application.MsgUpdateParamsResponse - 3, // 13: poktroll.application.Msg.StakeApplication:output_type -> poktroll.application.MsgStakeApplicationResponse - 5, // 14: poktroll.application.Msg.UnstakeApplication:output_type -> poktroll.application.MsgUnstakeApplicationResponse - 7, // 15: poktroll.application.Msg.DelegateToGateway:output_type -> poktroll.application.MsgDelegateToGatewayResponse - 9, // 16: poktroll.application.Msg.UndelegateFromGateway:output_type -> poktroll.application.MsgUndelegateFromGatewayResponse - 11, // 17: poktroll.application.Msg.TransferApplication:output_type -> poktroll.application.MsgTransferApplicationResponse - 13, // 18: poktroll.application.Msg.UpdateParam:output_type -> poktroll.application.MsgUpdateParamResponse - 12, // [12:19] is the sub-list for method output_type - 5, // [5:12] is the sub-list for method input_type - 5, // [5:5] is the sub-list for extension type_name - 5, // [5:5] is the sub-list for extension extendee - 0, // [0:5] is the sub-list for field type_name + 14, // 5: poktroll.application.MsgUpdateParamResponse.params:type_name -> poktroll.application.Params + 0, // 6: poktroll.application.Msg.UpdateParams:input_type -> poktroll.application.MsgUpdateParams + 2, // 7: poktroll.application.Msg.StakeApplication:input_type -> poktroll.application.MsgStakeApplication + 4, // 8: poktroll.application.Msg.UnstakeApplication:input_type -> poktroll.application.MsgUnstakeApplication + 6, // 9: poktroll.application.Msg.DelegateToGateway:input_type -> poktroll.application.MsgDelegateToGateway + 8, // 10: poktroll.application.Msg.UndelegateFromGateway:input_type -> poktroll.application.MsgUndelegateFromGateway + 10, // 11: poktroll.application.Msg.TransferApplication:input_type -> poktroll.application.MsgTransferApplication + 12, // 12: poktroll.application.Msg.UpdateParam:input_type -> poktroll.application.MsgUpdateParam + 1, // 13: poktroll.application.Msg.UpdateParams:output_type -> poktroll.application.MsgUpdateParamsResponse + 3, // 14: poktroll.application.Msg.StakeApplication:output_type -> poktroll.application.MsgStakeApplicationResponse + 5, // 15: poktroll.application.Msg.UnstakeApplication:output_type -> poktroll.application.MsgUnstakeApplicationResponse + 7, // 16: poktroll.application.Msg.DelegateToGateway:output_type -> poktroll.application.MsgDelegateToGatewayResponse + 9, // 17: poktroll.application.Msg.UndelegateFromGateway:output_type -> poktroll.application.MsgUndelegateFromGatewayResponse + 11, // 18: poktroll.application.Msg.TransferApplication:output_type -> poktroll.application.MsgTransferApplicationResponse + 13, // 19: poktroll.application.Msg.UpdateParam:output_type -> poktroll.application.MsgUpdateParamResponse + 13, // [13:20] is the sub-list for method output_type + 6, // [6:13] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name } func init() { file_poktroll_application_tx_proto_init() } @@ -7230,6 +7328,7 @@ func file_poktroll_application_tx_proto_init() { } } file_poktroll_application_tx_proto_msgTypes[12].OneofWrappers = []interface{}{ + (*MsgUpdateParam_AsUint64)(nil), (*MsgUpdateParam_AsCoin)(nil), } type x struct{} diff --git a/proto/poktroll/application/tx.proto b/proto/poktroll/application/tx.proto index 167dd2b4f..76300a623 100644 --- a/proto/poktroll/application/tx.proto +++ b/proto/poktroll/application/tx.proto @@ -103,11 +103,12 @@ message MsgUpdateParam { string name = 2; oneof asType { - cosmos.base.v1beta1.Coin as_coin = 3; + uint64 as_uint64 = 3; + cosmos.base.v1beta1.Coin as_coin = 4; }; } message MsgUpdateParamResponse { - string params = 1; + Params params = 1; } diff --git a/x/application/types/tx.pb.go b/x/application/types/tx.pb.go index 75d7edc8f..c601978e6 100644 --- a/x/application/types/tx.pb.go +++ b/x/application/types/tx.pb.go @@ -533,6 +533,7 @@ type MsgUpdateParam struct { Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // Types that are valid to be assigned to AsType: // + // *MsgUpdateParam_AsUint64 // *MsgUpdateParam_AsCoin AsType isMsgUpdateParam_AsType `protobuf_oneof:"asType"` } @@ -572,11 +573,15 @@ type isMsgUpdateParam_AsType interface { Size() int } +type MsgUpdateParam_AsUint64 struct { + AsUint64 uint64 `protobuf:"varint,3,opt,name=as_uint64,json=asUint64,proto3,oneof" json:"as_uint64,omitempty"` +} type MsgUpdateParam_AsCoin struct { - AsCoin *types.Coin `protobuf:"bytes,3,opt,name=as_coin,json=asCoin,proto3,oneof" json:"as_coin,omitempty"` + AsCoin *types.Coin `protobuf:"bytes,4,opt,name=as_coin,json=asCoin,proto3,oneof" json:"as_coin,omitempty"` } -func (*MsgUpdateParam_AsCoin) isMsgUpdateParam_AsType() {} +func (*MsgUpdateParam_AsUint64) isMsgUpdateParam_AsType() {} +func (*MsgUpdateParam_AsCoin) isMsgUpdateParam_AsType() {} func (m *MsgUpdateParam) GetAsType() isMsgUpdateParam_AsType { if m != nil { @@ -599,6 +604,13 @@ func (m *MsgUpdateParam) GetName() string { return "" } +func (m *MsgUpdateParam) GetAsUint64() uint64 { + if x, ok := m.GetAsType().(*MsgUpdateParam_AsUint64); ok { + return x.AsUint64 + } + return 0 +} + func (m *MsgUpdateParam) GetAsCoin() *types.Coin { if x, ok := m.GetAsType().(*MsgUpdateParam_AsCoin); ok { return x.AsCoin @@ -609,12 +621,13 @@ func (m *MsgUpdateParam) GetAsCoin() *types.Coin { // XXX_OneofWrappers is for the internal use of the proto package. func (*MsgUpdateParam) XXX_OneofWrappers() []interface{} { return []interface{}{ + (*MsgUpdateParam_AsUint64)(nil), (*MsgUpdateParam_AsCoin)(nil), } } type MsgUpdateParamResponse struct { - Params string `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` } func (m *MsgUpdateParamResponse) Reset() { *m = MsgUpdateParamResponse{} } @@ -646,11 +659,11 @@ func (m *MsgUpdateParamResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateParamResponse proto.InternalMessageInfo -func (m *MsgUpdateParamResponse) GetParams() string { +func (m *MsgUpdateParamResponse) GetParams() *Params { if m != nil { return m.Params } - return "" + return nil } func init() { @@ -673,61 +686,63 @@ func init() { func init() { proto.RegisterFile("poktroll/application/tx.proto", fileDescriptor_bed224e38ab1cc6d) } var fileDescriptor_bed224e38ab1cc6d = []byte{ - // 858 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0xcf, 0x4f, 0xe3, 0x46, - 0x14, 0x8e, 0x37, 0xdd, 0xec, 0xe6, 0x65, 0x9b, 0xdd, 0x75, 0xb2, 0xbb, 0xc1, 0x5d, 0xbc, 0xc1, - 0x6a, 0x2b, 0x48, 0xc1, 0x6e, 0x02, 0x42, 0x22, 0x17, 0x44, 0xe8, 0xcf, 0x43, 0xa4, 0xca, 0xd0, - 0x4b, 0x2f, 0x68, 0x92, 0x0c, 0xc6, 0x22, 0xf1, 0x58, 0x1e, 0x13, 0xc8, 0xa9, 0x55, 0x8f, 0x3d, - 0xf5, 0xaf, 0xa8, 0xaa, 0xaa, 0x87, 0x1c, 0x7a, 0xe9, 0x1f, 0x50, 0x89, 0x5b, 0x51, 0x4f, 0x9c, - 0xaa, 0x2a, 0x1c, 0xf8, 0x37, 0x2a, 0xdb, 0xe3, 0x89, 0xe3, 0x38, 0xc5, 0xf4, 0xb4, 0x17, 0x98, - 0x99, 0xf7, 0xbd, 0xf7, 0xbe, 0xef, 0x4d, 0xfc, 0x69, 0x60, 0xd9, 0x26, 0xa7, 0xae, 0x43, 0xfa, - 0x7d, 0x0d, 0xd9, 0x76, 0xdf, 0xec, 0x22, 0xd7, 0x24, 0x96, 0xe6, 0x5e, 0xa8, 0xb6, 0x43, 0x5c, - 0x22, 0x96, 0xc3, 0xb0, 0x1a, 0x09, 0x4b, 0xcf, 0xd1, 0xc0, 0xb4, 0x88, 0xe6, 0xff, 0x0d, 0x80, - 0xd2, 0x52, 0x97, 0xd0, 0x01, 0xa1, 0x47, 0xfe, 0x4e, 0x0b, 0x36, 0x2c, 0x24, 0x07, 0x3b, 0xad, - 0x83, 0x28, 0xd6, 0x86, 0xf5, 0x0e, 0x76, 0x51, 0x5d, 0xeb, 0x12, 0xd3, 0x62, 0xf1, 0x57, 0x2c, - 0x3e, 0xa0, 0x86, 0x36, 0xac, 0x7b, 0xff, 0x58, 0xa0, 0x6c, 0x10, 0x83, 0x04, 0x05, 0xbd, 0x15, - 0x3b, 0xad, 0x26, 0x33, 0x1e, 0xd9, 0x38, 0x6c, 0xb8, 0x92, 0x88, 0xb0, 0x91, 0x83, 0x06, 0x21, - 0x64, 0x2a, 0x9b, 0x9e, 0x20, 0x07, 0xf7, 0x34, 0x8a, 0x9d, 0xa1, 0xd9, 0xc5, 0x41, 0x58, 0xf9, - 0x43, 0x80, 0xa7, 0x6d, 0x6a, 0x7c, 0x6d, 0xf7, 0x90, 0x8b, 0xbf, 0xf2, 0x13, 0xc5, 0x6d, 0xc8, - 0xa3, 0x33, 0xf7, 0x84, 0x38, 0xa6, 0x3b, 0xaa, 0x08, 0x55, 0x61, 0x35, 0xdf, 0xaa, 0xfc, 0xf5, - 0xdb, 0x46, 0x99, 0x69, 0xdd, 0xeb, 0xf5, 0x1c, 0x4c, 0xe9, 0x81, 0xeb, 0x98, 0x96, 0xa1, 0x4f, - 0xa1, 0xe2, 0x2e, 0xe4, 0x82, 0xd6, 0x95, 0x07, 0x55, 0x61, 0xb5, 0xd0, 0x78, 0xad, 0x26, 0xcd, - 0x54, 0x0d, 0xba, 0xb4, 0xf2, 0x97, 0x7f, 0xbf, 0xc9, 0xfc, 0x7c, 0x3b, 0xae, 0x09, 0x3a, 0x4b, - 0x6b, 0xee, 0x7c, 0x7f, 0x3b, 0xae, 0x4d, 0x0b, 0xfe, 0x70, 0x3b, 0xae, 0x7d, 0xc8, 0xe9, 0x5f, - 0xcc, 0x68, 0x8c, 0x71, 0x56, 0x96, 0xe0, 0x55, 0xec, 0x48, 0xc7, 0xd4, 0x26, 0x16, 0xc5, 0xca, - 0x9f, 0x02, 0x94, 0xda, 0xd4, 0x38, 0x70, 0xd1, 0x29, 0xde, 0x9b, 0x96, 0x10, 0x1b, 0xf0, 0x08, - 0x05, 0x52, 0xee, 0x14, 0x19, 0x02, 0x45, 0x0d, 0x1e, 0x52, 0xaf, 0x0e, 0x53, 0xb8, 0xa4, 0x32, - 0xb8, 0x77, 0xe3, 0x2a, 0xbb, 0x71, 0x75, 0x9f, 0x98, 0x96, 0x1e, 0xe0, 0xc4, 0x4f, 0xe1, 0x31, - 0x1b, 0x38, 0xad, 0x64, 0xab, 0xd9, 0xd5, 0x42, 0x63, 0x6d, 0x3a, 0x95, 0xe0, 0x46, 0xd4, 0x08, - 0xa9, 0x83, 0x00, 0xbb, 0x4f, 0xac, 0x63, 0xd3, 0xd0, 0x79, 0x6a, 0xf3, 0x89, 0x37, 0x99, 0x90, - 0x85, 0xb2, 0x0c, 0xef, 0x25, 0x08, 0xe2, 0x82, 0x77, 0xe1, 0x85, 0x37, 0x0b, 0x8b, 0xc6, 0x15, - 0x57, 0x62, 0x8a, 0xb9, 0xae, 0x58, 0xfd, 0x37, 0xb0, 0x9c, 0x58, 0x80, 0x77, 0xf8, 0x49, 0x80, - 0x72, 0x9b, 0x1a, 0x9f, 0xe0, 0x3e, 0x36, 0x90, 0x8b, 0x0f, 0xc9, 0xe7, 0xc8, 0xc5, 0xe7, 0x68, - 0x24, 0xee, 0x40, 0x01, 0xd9, 0xf6, 0x51, 0xda, 0xb9, 0x02, 0xb2, 0x6d, 0x76, 0x22, 0xee, 0xc1, - 0x53, 0x23, 0xa8, 0xc2, 0xd3, 0x1f, 0xdc, 0x91, 0x5e, 0x64, 0x09, 0xec, 0xb4, 0xf9, 0xcc, 0x53, - 0x11, 0x25, 0xa0, 0xc8, 0xf0, 0x3a, 0x89, 0x27, 0x17, 0xf2, 0x8b, 0x00, 0x15, 0x5f, 0x6a, 0x8f, - 0x41, 0x3e, 0x73, 0xc8, 0xe0, 0x6d, 0x15, 0xa3, 0x40, 0x75, 0x11, 0x57, 0x2e, 0xe8, 0x77, 0x01, - 0x5e, 0xb6, 0xa9, 0x71, 0xe8, 0x20, 0x8b, 0x1e, 0x63, 0x27, 0x7a, 0xfb, 0xbb, 0x50, 0xa4, 0xe4, - 0xcc, 0xe9, 0xe2, 0xd4, 0x8a, 0xde, 0x0d, 0xf0, 0xa1, 0xa8, 0x2f, 0xa1, 0xd4, 0xc3, 0xd4, 0x35, - 0x2d, 0xbf, 0x5e, 0x6a, 0x61, 0x62, 0x24, 0x29, 0x14, 0x57, 0xf2, 0xc4, 0xc5, 0xe8, 0x28, 0x18, - 0xe4, 0x64, 0xea, 0xa1, 0x3a, 0x71, 0xdf, 0xbf, 0x91, 0xf0, 0xd8, 0xe7, 0x5f, 0x68, 0xac, 0x24, - 0xdb, 0x4c, 0x34, 0x3f, 0x9a, 0xa5, 0xfc, 0x2a, 0x40, 0x71, 0xd6, 0x2b, 0xfe, 0xb7, 0xe3, 0x89, - 0xf0, 0x8e, 0x85, 0x06, 0x81, 0x1b, 0xe4, 0x75, 0x7f, 0x2d, 0x6e, 0xc1, 0x23, 0x44, 0x8f, 0x3c, - 0xd7, 0xaf, 0x64, 0xef, 0x30, 0x89, 0x2f, 0x32, 0x7a, 0x0e, 0x51, 0x6f, 0xd5, 0x2c, 0xce, 0x5a, - 0x5f, 0xeb, 0x31, 0xe4, 0x10, 0x3d, 0x1c, 0xd9, 0x58, 0xf9, 0xd8, 0xbf, 0xd0, 0x08, 0x5b, 0x3e, - 0x8d, 0x97, 0xdc, 0x6f, 0x83, 0xaf, 0x99, 0xed, 0x1a, 0xe3, 0x1c, 0x64, 0xdb, 0xd4, 0x10, 0x7b, - 0xf0, 0x64, 0xc6, 0xd7, 0x3f, 0x48, 0x1e, 0x54, 0xcc, 0x37, 0xa5, 0x8d, 0x54, 0x30, 0xce, 0xc2, - 0x86, 0x67, 0x73, 0xd6, 0xba, 0xb6, 0xb0, 0x44, 0x1c, 0x2a, 0xd5, 0x53, 0x43, 0x79, 0xc7, 0x21, - 0x88, 0x09, 0xe6, 0xf6, 0xd1, 0x62, 0xda, 0x73, 0x60, 0x69, 0xf3, 0x1e, 0x60, 0xde, 0x97, 0xc2, - 0xf3, 0x79, 0xc7, 0xab, 0x2d, 0xac, 0x34, 0x87, 0x95, 0x1a, 0xe9, 0xb1, 0xbc, 0xe9, 0xb7, 0xf0, - 0x22, 0xd9, 0x9d, 0xd4, 0xff, 0x90, 0x90, 0x80, 0x97, 0xb6, 0xef, 0x87, 0xe7, 0x04, 0x46, 0x50, - 0x4a, 0x72, 0x93, 0xf5, 0x85, 0xe5, 0x12, 0xd0, 0xd2, 0xd6, 0x7d, 0xd0, 0xbc, 0x35, 0x82, 0x42, - 0xf4, 0x2b, 0x7d, 0x3f, 0xcd, 0x0f, 0x53, 0x5a, 0x4f, 0x83, 0x0a, 0x5b, 0x48, 0x0f, 0xbf, 0xf3, - 0x5e, 0x20, 0x2d, 0xfd, 0x72, 0x22, 0x0b, 0x57, 0x13, 0x59, 0xb8, 0x9e, 0xc8, 0xc2, 0x3f, 0x13, - 0x59, 0xf8, 0xf1, 0x46, 0xce, 0x5c, 0xdd, 0xc8, 0x99, 0xeb, 0x1b, 0x39, 0xf3, 0xcd, 0x96, 0x61, - 0xba, 0x27, 0x67, 0x1d, 0xb5, 0x4b, 0x06, 0x9a, 0x57, 0x7c, 0xc3, 0xc2, 0xee, 0x39, 0x71, 0x4e, - 0xb5, 0x05, 0x8f, 0x13, 0xff, 0x89, 0xd6, 0xc9, 0xf9, 0x2f, 0xac, 0xcd, 0x7f, 0x03, 0x00, 0x00, - 0xff, 0xff, 0xf8, 0x73, 0x1e, 0x98, 0x79, 0x0a, 0x00, 0x00, + // 885 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0xbf, 0x6f, 0xdb, 0x46, + 0x14, 0xd6, 0xc5, 0x8e, 0x62, 0x3d, 0xa5, 0x4e, 0x42, 0x3b, 0x0d, 0xcd, 0xc6, 0x8c, 0x42, 0xb4, + 0x85, 0xe3, 0xc6, 0x24, 0xac, 0x08, 0x06, 0xa2, 0xc5, 0xb0, 0xdc, 0x1f, 0xe9, 0xa0, 0xa2, 0xa0, + 0x9d, 0xa5, 0x8b, 0x70, 0x92, 0x2e, 0x34, 0x61, 0x89, 0x47, 0xf0, 0x4e, 0x4a, 0x34, 0xb5, 0xe8, + 0xd8, 0xa9, 0x7f, 0x45, 0x51, 0x74, 0xd2, 0xd0, 0xa5, 0x7f, 0x40, 0x81, 0x00, 0x1d, 0x1a, 0x74, + 0xca, 0x54, 0x14, 0xf2, 0xe0, 0x7f, 0xa3, 0xe0, 0xaf, 0x13, 0x45, 0x51, 0x15, 0xdd, 0x29, 0x8b, + 0xc4, 0xbb, 0xf7, 0xbd, 0xf7, 0xbe, 0xef, 0x9d, 0xf4, 0xf1, 0x60, 0xdb, 0xa5, 0xe7, 0xdc, 0xa3, + 0xbd, 0x9e, 0x81, 0x5d, 0xb7, 0x67, 0x77, 0x30, 0xb7, 0xa9, 0x63, 0xf0, 0x57, 0xba, 0xeb, 0x51, + 0x4e, 0xa5, 0xcd, 0x38, 0xac, 0x27, 0xc2, 0xca, 0x1d, 0xdc, 0xb7, 0x1d, 0x6a, 0x04, 0x9f, 0x21, + 0x50, 0xd9, 0xea, 0x50, 0xd6, 0xa7, 0xac, 0x15, 0xac, 0x8c, 0x70, 0x11, 0x85, 0xd4, 0x70, 0x65, + 0xb4, 0x31, 0x23, 0xc6, 0x70, 0xbf, 0x4d, 0x38, 0xde, 0x37, 0x3a, 0xd4, 0x76, 0xa2, 0xf8, 0xbd, + 0x28, 0xde, 0x67, 0x96, 0x31, 0xdc, 0xf7, 0xbf, 0xa2, 0xc0, 0xa6, 0x45, 0x2d, 0x1a, 0x16, 0xf4, + 0x9f, 0xa2, 0xdd, 0x4a, 0x36, 0xe3, 0x91, 0x4b, 0xe2, 0x86, 0x0f, 0x33, 0x11, 0x2e, 0xf6, 0x70, + 0x3f, 0x86, 0x4c, 0x65, 0xb3, 0x33, 0xec, 0x91, 0xae, 0xc1, 0x88, 0x37, 0xb4, 0x3b, 0x24, 0x0c, + 0x6b, 0xbf, 0x23, 0xb8, 0xd5, 0x64, 0xd6, 0x73, 0xb7, 0x8b, 0x39, 0xf9, 0x3a, 0x48, 0x94, 0x0e, + 0xa0, 0x84, 0x07, 0xfc, 0x8c, 0x7a, 0x36, 0x1f, 0xc9, 0xa8, 0x82, 0x76, 0x4a, 0x0d, 0xf9, 0xaf, + 0x5f, 0xf7, 0x36, 0x23, 0xad, 0x47, 0xdd, 0xae, 0x47, 0x18, 0x3b, 0xe1, 0x9e, 0xed, 0x58, 0xe6, + 0x14, 0x2a, 0x1d, 0x42, 0x31, 0x6c, 0x2d, 0x5f, 0xab, 0xa0, 0x9d, 0x72, 0xf5, 0xbe, 0x9e, 0x35, + 0x53, 0x3d, 0xec, 0xd2, 0x28, 0xbd, 0xfe, 0xfb, 0x41, 0xe1, 0xe7, 0xcb, 0xf1, 0x2e, 0x32, 0xa3, + 0xb4, 0xfa, 0xd3, 0xef, 0x2f, 0xc7, 0xbb, 0xd3, 0x82, 0x3f, 0x5c, 0x8e, 0x77, 0x3f, 0x16, 0xf4, + 0x5f, 0xcd, 0x68, 0x4c, 0x71, 0xd6, 0xb6, 0xe0, 0x5e, 0x6a, 0xcb, 0x24, 0xcc, 0xa5, 0x0e, 0x23, + 0xda, 0x9f, 0x08, 0x36, 0x9a, 0xcc, 0x3a, 0xe1, 0xf8, 0x9c, 0x1c, 0x4d, 0x4b, 0x48, 0x55, 0xb8, + 0x81, 0x43, 0x29, 0x4b, 0x45, 0xc6, 0x40, 0xc9, 0x80, 0xeb, 0xcc, 0xaf, 0x13, 0x29, 0xdc, 0xd2, + 0x23, 0xb8, 0x7f, 0xe2, 0x7a, 0x74, 0xe2, 0xfa, 0x31, 0xb5, 0x1d, 0x33, 0xc4, 0x49, 0x9f, 0xc1, + 0x5a, 0x34, 0x70, 0x26, 0xaf, 0x54, 0x56, 0x76, 0xca, 0xd5, 0x47, 0xd3, 0xa9, 0x84, 0x27, 0xa2, + 0x27, 0x48, 0x9d, 0x84, 0xd8, 0x63, 0xea, 0xbc, 0xb0, 0x2d, 0x53, 0xa4, 0xd6, 0x6f, 0xfa, 0x93, + 0x89, 0x59, 0x68, 0xdb, 0xf0, 0x41, 0x86, 0x20, 0x21, 0xf8, 0x10, 0xee, 0xfa, 0xb3, 0x70, 0x58, + 0x5a, 0xb1, 0x9c, 0x52, 0x2c, 0x74, 0xa5, 0xea, 0x3f, 0x80, 0xed, 0xcc, 0x02, 0xa2, 0xc3, 0x4f, + 0x08, 0x36, 0x9b, 0xcc, 0xfa, 0x94, 0xf4, 0x88, 0x85, 0x39, 0x39, 0xa5, 0x5f, 0x60, 0x4e, 0x5e, + 0xe2, 0x91, 0xf4, 0x14, 0xca, 0xd8, 0x75, 0x5b, 0x79, 0xe7, 0x0a, 0xd8, 0x75, 0xa3, 0x1d, 0xe9, + 0x08, 0x6e, 0x59, 0x61, 0x15, 0x91, 0x7e, 0x6d, 0x49, 0xfa, 0x7a, 0x94, 0x10, 0xed, 0xd6, 0x6f, + 0xfb, 0x2a, 0x92, 0x04, 0x34, 0x15, 0xee, 0x67, 0xf1, 0x14, 0x42, 0x7e, 0x41, 0x20, 0x07, 0x52, + 0xbb, 0x11, 0xe4, 0x73, 0x8f, 0xf6, 0xdf, 0x55, 0x31, 0x1a, 0x54, 0x16, 0x71, 0x15, 0x82, 0x7e, + 0x43, 0xf0, 0x7e, 0x93, 0x59, 0xa7, 0x1e, 0x76, 0xd8, 0x0b, 0xe2, 0x25, 0x4f, 0xff, 0x10, 0xd6, + 0x19, 0x1d, 0x78, 0x1d, 0x92, 0x5b, 0xd1, 0x7b, 0x21, 0x3e, 0x16, 0xf5, 0x25, 0x6c, 0x74, 0x09, + 0xe3, 0xb6, 0x13, 0xd4, 0xcb, 0x2d, 0x4c, 0x4a, 0x24, 0xc5, 0xe2, 0x36, 0x7c, 0x71, 0x29, 0x3a, + 0x1a, 0x01, 0x35, 0x9b, 0x7a, 0xac, 0x4e, 0x3a, 0x0e, 0x4e, 0x24, 0xde, 0x0e, 0xf8, 0x97, 0xab, + 0x0f, 0xb3, 0x6d, 0x26, 0x99, 0x9f, 0xcc, 0xd2, 0xfe, 0x40, 0xb0, 0x3e, 0xeb, 0x15, 0xff, 0xdb, + 0xf1, 0x24, 0x58, 0x75, 0x70, 0x3f, 0x74, 0x83, 0x92, 0x19, 0x3c, 0x4b, 0xdb, 0x50, 0xc2, 0xac, + 0x35, 0xb0, 0x1d, 0x7e, 0x50, 0x93, 0x57, 0x2a, 0x68, 0x67, 0xf5, 0x59, 0xc1, 0x5c, 0xc3, 0xec, + 0x79, 0xb0, 0x23, 0xd5, 0xe0, 0x06, 0x66, 0x2d, 0xff, 0xa5, 0x20, 0xaf, 0x2e, 0xf1, 0x90, 0x67, + 0x05, 0xb3, 0x88, 0x99, 0xff, 0x54, 0x5f, 0x9f, 0x75, 0xc6, 0xc6, 0x1a, 0x14, 0x31, 0x3b, 0x1d, + 0xb9, 0x44, 0xfb, 0x2a, 0x38, 0xef, 0x84, 0x18, 0x31, 0xac, 0x9a, 0xb0, 0x63, 0xb4, 0xdc, 0x8e, + 0x63, 0x0f, 0xae, 0x8e, 0x8b, 0xb0, 0xd2, 0x64, 0x96, 0xd4, 0x85, 0x9b, 0x33, 0x2f, 0x85, 0x8f, + 0xb2, 0xb3, 0x53, 0xa6, 0xab, 0xec, 0xe5, 0x82, 0x09, 0x8e, 0x2e, 0xdc, 0x9e, 0xf3, 0xe5, 0x47, + 0x0b, 0x4b, 0xa4, 0xa1, 0xca, 0x7e, 0x6e, 0xa8, 0xe8, 0x38, 0x04, 0x29, 0xc3, 0x19, 0x3f, 0x59, + 0x4c, 0x7b, 0x0e, 0xac, 0x3c, 0xb9, 0x02, 0x58, 0xf4, 0x65, 0x70, 0x67, 0xde, 0x2e, 0x77, 0x17, + 0x56, 0x9a, 0xc3, 0x2a, 0xd5, 0xfc, 0x58, 0xd1, 0xf4, 0x5b, 0xb8, 0x9b, 0x6d, 0x6d, 0xfa, 0x7f, + 0x48, 0xc8, 0xc0, 0x2b, 0x07, 0x57, 0xc3, 0x0b, 0x02, 0x23, 0xd8, 0xc8, 0xb2, 0xa2, 0xc7, 0x0b, + 0xcb, 0x65, 0xa0, 0x95, 0xda, 0x55, 0xd0, 0xa2, 0x35, 0x86, 0x72, 0xf2, 0x2f, 0xfe, 0x61, 0x9e, + 0x1f, 0xa6, 0xf2, 0x38, 0x0f, 0x2a, 0x6e, 0xa1, 0x5c, 0xff, 0xce, 0xbf, 0xbe, 0x34, 0xcc, 0xd7, + 0x13, 0x15, 0xbd, 0x99, 0xa8, 0xe8, 0xed, 0x44, 0x45, 0xff, 0x4c, 0x54, 0xf4, 0xe3, 0x85, 0x5a, + 0x78, 0x73, 0xa1, 0x16, 0xde, 0x5e, 0xa8, 0x85, 0x6f, 0x6a, 0x96, 0xcd, 0xcf, 0x06, 0x6d, 0xbd, + 0x43, 0xfb, 0x86, 0x5f, 0x7c, 0xcf, 0x21, 0xfc, 0x25, 0xf5, 0xce, 0x8d, 0x05, 0x37, 0x9b, 0xe0, + 0x7e, 0xd7, 0x2e, 0x06, 0xd7, 0xb3, 0x27, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x88, 0xe2, 0xfa, + 0x0e, 0xb6, 0x0a, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1463,6 +1478,18 @@ func (m *MsgUpdateParam) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *MsgUpdateParam_AsUint64) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParam_AsUint64) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + i = encodeVarintTx(dAtA, i, uint64(m.AsUint64)) + i-- + dAtA[i] = 0x18 + return len(dAtA) - i, nil +} func (m *MsgUpdateParam_AsCoin) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) @@ -1480,7 +1507,7 @@ func (m *MsgUpdateParam_AsCoin) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTx(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x1a + dAtA[i] = 0x22 } return len(dAtA) - i, nil } @@ -1504,10 +1531,15 @@ func (m *MsgUpdateParamResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) _ = i var l int _ = l - if len(m.Params) > 0 { - i -= len(m.Params) - copy(dAtA[i:], m.Params) - i = encodeVarintTx(dAtA, i, uint64(len(m.Params))) + 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 } @@ -1705,6 +1737,15 @@ func (m *MsgUpdateParam) Size() (n int) { return n } +func (m *MsgUpdateParam_AsUint64) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + n += 1 + sovTx(uint64(m.AsUint64)) + return n +} func (m *MsgUpdateParam_AsCoin) Size() (n int) { if m == nil { return 0 @@ -1723,8 +1764,8 @@ func (m *MsgUpdateParamResponse) Size() (n int) { } var l int _ = l - l = len(m.Params) - if l > 0 { + if m.Params != nil { + l = m.Params.Size() n += 1 + l + sovTx(uint64(l)) } return n @@ -2857,6 +2898,26 @@ func (m *MsgUpdateParam) Unmarshal(dAtA []byte) error { m.Name = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AsUint64", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.AsType = &MsgUpdateParam_AsUint64{v} + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field AsCoin", wireType) } @@ -2945,7 +3006,7 @@ func (m *MsgUpdateParamResponse) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -2955,23 +3016,27 @@ func (m *MsgUpdateParamResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.Params = string(dAtA[iNdEx:postIndex]) + if m.Params == nil { + m.Params = &Params{} + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex From b3e139a4d37e859f0874a3e45dfb6cd890822a2c Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 27 Sep 2024 17:43:41 +0200 Subject: [PATCH 035/139] feat: implement MsgUpdateParam handler --- .../keeper/msg_server_update_param.go | 49 ++++++++++++++++--- 1 file changed, 42 insertions(+), 7 deletions(-) diff --git a/x/application/keeper/msg_server_update_param.go b/x/application/keeper/msg_server_update_param.go index 94bcae3e7..141667997 100644 --- a/x/application/keeper/msg_server_update_param.go +++ b/x/application/keeper/msg_server_update_param.go @@ -3,16 +3,51 @@ package keeper import ( "context" - "github.com/pokt-network/poktroll/x/application/types" - sdk "github.com/cosmos/cosmos-sdk/types" + apptypes "github.com/pokt-network/poktroll/x/application/types" ) +func (k msgServer) UpdateParam(ctx context.Context, msg *apptypes.MsgUpdateParam) (*apptypes.MsgUpdateParamResponse, error) { + if err := msg.ValidateBasic(); err != nil { + return nil, err + } -func (k msgServer) UpdateParam(goCtx context.Context, msg *types.MsgUpdateParam) (*types.MsgUpdateParamResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) + if k.GetAuthority() != msg.Authority { + return nil, apptypes.ErrAppInvalidSigner.Wrapf("invalid authority; expected %s, got %s", k.GetAuthority(), msg.Authority) + } - // TODO: Handling the message - _ = ctx + params := k.GetParams(ctx) - return &types.MsgUpdateParamResponse{}, nil + switch msg.Name { + case apptypes.ParamMaxDelegatedGateways: + if _, ok := msg.AsType.(*apptypes.MsgUpdateParam_AsUint64); !ok { + return nil, apptypes.ErrAppParamInvalid.Wrapf("unsupported value type for %s param: %T", msg.Name, msg.AsType) + } + maxDelegatedGateways := msg.GetAsUint64() + + if err := apptypes.ValidateMaxDelegatedGateways(maxDelegatedGateways); err != nil { + return nil, apptypes.ErrAppParamInvalid.Wrapf("maxdelegegated_gateways (%d): %v", maxDelegatedGateways, err) + } + params.MaxDelegatedGateways = maxDelegatedGateways + case apptypes.ParamMinStake: + if _, ok := msg.AsType.(*apptypes.MsgUpdateParam_AsCoin); !ok { + return nil, apptypes.ErrAppParamInvalid.Wrapf("unsupported value type for %s param: %T", msg.Name, msg.AsType) + } + minStake := msg.GetAsCoin() + + if err := apptypes.ValidateMinStake(minStake); err != nil { + return nil, err + } + params.MinStake = minStake + default: + return nil, apptypes.ErrAppParamInvalid.Wrapf("unsupported param %q", msg.Name) + } + + if err := k.SetParams(ctx, params); err != nil { + return nil, err + } + + updatedParams := k.GetParams(ctx) + return &apptypes.MsgUpdateParamResponse{ + Params: &updatedParams, + }, nil } From 872202b1bee6b7f7c75dc0287b433eb0e9944f2e Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 27 Sep 2024 17:46:07 +0200 Subject: [PATCH 036/139] test: MsgUpdateParam handler --- .../keeper/msg_server_update_param_test.go | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 x/application/keeper/msg_server_update_param_test.go diff --git a/x/application/keeper/msg_server_update_param_test.go b/x/application/keeper/msg_server_update_param_test.go new file mode 100644 index 000000000..cf075e2ec --- /dev/null +++ b/x/application/keeper/msg_server_update_param_test.go @@ -0,0 +1,68 @@ +package keeper_test + +import ( + "testing" + + cosmostypes "github.com/cosmos/cosmos-sdk/types" + 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/app/volatile" + testkeeper "github.com/pokt-network/poktroll/testutil/keeper" + apptypes "github.com/pokt-network/poktroll/x/application/types" +) + +func TestMsgUpdateParam_UpdateMaxDelegatedGatewaysOnly(t *testing.T) { + expectedMaxDelegatedGateways := uint64(999) + + // Set the parameters to their default values + k, msgSrv, ctx := setupMsgServer(t) + defaultParams := apptypes.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, expectedMaxDelegatedGateways, defaultParams.MaxDelegatedGateways) + + // Update the max delegated gateways + updateParamMsg := &apptypes.MsgUpdateParam{ + Authority: authtypes.NewModuleAddress(govtypes.ModuleName).String(), + Name: apptypes.ParamMaxDelegatedGateways, + AsType: &apptypes.MsgUpdateParam_AsUint64{AsUint64: expectedMaxDelegatedGateways}, + } + res, err := msgSrv.UpdateParam(ctx, updateParamMsg) + require.NoError(t, err) + + require.NotEqual(t, defaultParams.MaxDelegatedGateways, res.Params.MaxDelegatedGateways) + require.Equal(t, expectedMaxDelegatedGateways, res.Params.MaxDelegatedGateways) + + // Ensure the other parameters are unchanged + testkeeper.AssertDefaultParamsEqualExceptFields(t, &defaultParams, res.Params, "MaxDelegatedGateways") +} + +func TestMsgUpdateParam_UpdateMinStakeOnly(t *testing.T) { + expectedMinStake := cosmostypes.NewInt64Coin(volatile.DenomuPOKT, 420) + + // Set the parameters to their default values + k, msgSrv, ctx := setupMsgServer(t) + defaultParams := apptypes.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, expectedMinStake, defaultParams.MinStake) + + // Update the min relay difficulty bits + updateParamMsg := &apptypes.MsgUpdateParam{ + Authority: authtypes.NewModuleAddress(govtypes.ModuleName).String(), + Name: apptypes.ParamMinStake, + AsType: &apptypes.MsgUpdateParam_AsCoin{AsCoin: &expectedMinStake}, + } + res, err := msgSrv.UpdateParam(ctx, updateParamMsg) + require.NoError(t, err) + + require.NotEqual(t, defaultParams.MinStake, res.Params.MinStake) + require.Equal(t, expectedMinStake.Amount, res.Params.MinStake.Amount) + + // Ensure the other parameters are unchanged + testkeeper.AssertDefaultParamsEqualExceptFields(t, &defaultParams, res.Params, "MinStake") +} From a49d69b3b6555ced9c6bf88f04d0ebd3e39a7e24 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 27 Sep 2024 17:47:05 +0200 Subject: [PATCH 037/139] feat: implement NewMsgUpdateParam constructor --- x/application/types/message_update_param.go | 36 +++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/x/application/types/message_update_param.go b/x/application/types/message_update_param.go index fa8709020..a6d31da10 100644 --- a/x/application/types/message_update_param.go +++ b/x/application/types/message_update_param.go @@ -14,6 +14,8 @@ func NewMsgUpdateParam(authority string, name string, asType any) *MsgUpdatePara var asTypeIface isMsgUpdateParam_AsType switch t := asType.(type) { + case uint64: + asTypeIface = &MsgUpdateParam_AsUint64{AsUint64: t} case *cosmostypes.Coin: asTypeIface = &MsgUpdateParam_AsCoin{AsCoin: t} default: @@ -32,5 +34,39 @@ func (msg *MsgUpdateParam) ValidateBasic() error { if err != nil { return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid authority address (%s)", err) } + + // Parameter value MUST NOT be nil. + if msg.AsType == nil { + return ErrAppParamInvalid.Wrapf("missing param AsType for parameter %q", msg.Name) + } + + // Parameter name MUST be supported by this module. + switch msg.Name { + case ParamMaxDelegatedGateways: + return msg.paramTypeIsUint64() + case ParamMinStake: + return msg.paramTypeIsCoin() + default: + return ErrAppParamInvalid.Wrapf("unsupported param %q", msg.Name) + } +} + +func (msg *MsgUpdateParam) paramTypeIsUint64() error { + if _, ok := msg.AsType.(*MsgUpdateParam_AsUint64); !ok { + return ErrAppParamInvalid.Wrapf(""+ + "invalid type for param %q; expected %T, got %T", + msg.Name, &MsgUpdateParam_AsUint64{}, msg.AsType, + ) + } + return nil +} + +func (msg *MsgUpdateParam) paramTypeIsCoin() error { + if _, ok := msg.AsType.(*MsgUpdateParam_AsCoin); !ok { + return ErrAppParamInvalid.Wrapf(""+ + "invalid type for param %q; expected %T, got %T", + msg.Name, &MsgUpdateParam_AsCoin{}, msg.AsType, + ) + } return nil } From d63a429bfffff6dd1de443efb7e19a209536f322 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 27 Sep 2024 17:47:29 +0200 Subject: [PATCH 038/139] chore: add min_stake validation --- x/application/types/params.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/x/application/types/params.go b/x/application/types/params.go index 9d00e9722..240c7ecd2 100644 --- a/x/application/types/params.go +++ b/x/application/types/params.go @@ -17,7 +17,7 @@ var ( KeyMinStake = []byte("MinStake") ParamMinStake = "min_stake" // TODO_MAINNET: Determine the default value - DefaultMinStake = cosmostypes.NewInt64Coin(volatile.DenomuPOKT, 100) + DefaultMinStake = cosmostypes.NewInt64Coin(volatile.DenomuPOKT, 1000000) // 1 POKT ) // ParamKeyTable the param key table for launch module @@ -52,6 +52,10 @@ func (p Params) Validate() error { return err } + if err := ValidateMinStake(p.MinStake); err != nil { + return err + } + return nil } From 9040bf0e6122300c5ae629535e1c1241e799a0aa Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 27 Sep 2024 17:47:49 +0200 Subject: [PATCH 039/139] chore: tidy up --- testutil/integration/suites/param_configs.go | 3 ++- x/application/keeper/msg_update_params_test.go | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/testutil/integration/suites/param_configs.go b/testutil/integration/suites/param_configs.go index aded8d557..4df3b85c0 100644 --- a/testutil/integration/suites/param_configs.go +++ b/testutil/integration/suites/param_configs.go @@ -146,7 +146,8 @@ var ( MinStake: &ValidActorMinStake, }, ParamTypes: map[ParamType]any{ - ParamTypeCoin: apptypes.MsgUpdateParam_AsCoin{}, + ParamTypeUint64: apptypes.MsgUpdateParam_AsUint64{}, + ParamTypeCoin: apptypes.MsgUpdateParam_AsCoin{}, }, DefaultParams: apptypes.DefaultParams(), NewParamClientFn: apptypes.NewQueryClient, diff --git a/x/application/keeper/msg_update_params_test.go b/x/application/keeper/msg_update_params_test.go index ee7fb3879..0580c988e 100644 --- a/x/application/keeper/msg_update_params_test.go +++ b/x/application/keeper/msg_update_params_test.go @@ -31,14 +31,14 @@ func TestMsgUpdateParams(t *testing.T) { expectedErrMsg: "invalid authority", }, { - desc: "send empty params", + desc: "invalid: send empty params", input: &types.MsgUpdateParams{ Authority: k.GetAuthority(), Params: types.Params{}, }, shouldError: true, - expectedErrMsg: "invalid MaxDelegatedGateways parameter", + expectedErrMsg: "max_delegated_gateways must be greater than 0", }, { desc: "valid: send default params", From 434059064f218dc68d3f15c325b32d704bc46332 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Mon, 30 Sep 2024 11:12:09 +0200 Subject: [PATCH 040/139] chore: review feedback improvements Co-authored-by: Redouane Lakrache --- x/gateway/keeper/msg_server_update_param.go | 1 + 1 file changed, 1 insertion(+) diff --git a/x/gateway/keeper/msg_server_update_param.go b/x/gateway/keeper/msg_server_update_param.go index b1f5d25ef..3315a0804 100644 --- a/x/gateway/keeper/msg_server_update_param.go +++ b/x/gateway/keeper/msg_server_update_param.go @@ -4,6 +4,7 @@ import ( "context" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/pokt-network/poktroll/x/gateway/types" ) From 352afa1b8647f87e61375c719a9accfa0bfae1f6 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Mon, 30 Sep 2024 11:13:22 +0200 Subject: [PATCH 041/139] chore: review feedback improvements Co-authored-by: Redouane Lakrache --- x/application/keeper/msg_server_update_param.go | 3 ++- x/application/simulation/update_param.go | 5 +++-- x/application/types/message_update_param_test.go | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/x/application/keeper/msg_server_update_param.go b/x/application/keeper/msg_server_update_param.go index 94bcae3e7..3ee0ecbbd 100644 --- a/x/application/keeper/msg_server_update_param.go +++ b/x/application/keeper/msg_server_update_param.go @@ -3,8 +3,9 @@ package keeper import ( "context" - "github.com/pokt-network/poktroll/x/application/types" sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/pokt-network/poktroll/x/application/types" ) diff --git a/x/application/simulation/update_param.go b/x/application/simulation/update_param.go index ba62362c6..9910027e8 100644 --- a/x/application/simulation/update_param.go +++ b/x/application/simulation/update_param.go @@ -3,11 +3,12 @@ package simulation import ( "math/rand" - "github.com/pokt-network/poktroll/x/application/keeper" - "github.com/pokt-network/poktroll/x/application/types" "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/application/keeper" + "github.com/pokt-network/poktroll/x/application/types" ) func SimulateMsgUpdateParam( diff --git a/x/application/types/message_update_param_test.go b/x/application/types/message_update_param_test.go index 406337ff2..b72a6147b 100644 --- a/x/application/types/message_update_param_test.go +++ b/x/application/types/message_update_param_test.go @@ -5,6 +5,7 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" + "github.com/pokt-network/poktroll/testutil/sample" ) From 6afdaefc629d5f4cff6b3c70213fe26abdd2a735 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Mon, 30 Sep 2024 11:51:29 +0200 Subject: [PATCH 042/139] fix: linter errors --- x/application/keeper/msg_server_update_param.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/x/application/keeper/msg_server_update_param.go b/x/application/keeper/msg_server_update_param.go index 3ee0ecbbd..8a4781f08 100644 --- a/x/application/keeper/msg_server_update_param.go +++ b/x/application/keeper/msg_server_update_param.go @@ -8,12 +8,11 @@ import ( "github.com/pokt-network/poktroll/x/application/types" ) - -func (k msgServer) UpdateParam(goCtx context.Context, msg *types.MsgUpdateParam) (*types.MsgUpdateParamResponse, error) { +func (k msgServer) UpdateParam(goCtx context.Context, msg *types.MsgUpdateParam) (*types.MsgUpdateParamResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - // TODO: Handling the message - _ = ctx + // TODO: Handling the message + _ = ctx return &types.MsgUpdateParamResponse{}, nil } From 0839ae4d2abc00955ddf833ccc1c76f80a216032 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Mon, 30 Sep 2024 12:06:22 +0200 Subject: [PATCH 043/139] chore: review feedback improvements --- config.yml | 4 ++- tools/scripts/params/gateway_all.json | 16 ++++++++++++ tools/scripts/params/gateway_min_stake.json | 5 +++- x/gateway/keeper/params_test.go | 2 +- x/gateway/types/params.go | 25 ++++++------------- .../keeper/msg_server_update_param_test.go | 2 +- 6 files changed, 33 insertions(+), 21 deletions(-) create mode 100644 tools/scripts/params/gateway_all.json diff --git a/config.yml b/config.yml index 8691475a8..4ec9a33e0 100644 --- a/config.yml +++ b/config.yml @@ -225,7 +225,9 @@ genesis: gateway: params: # TODO_MAINNET: Determine realistic amount for minimum gateway stake amount. - min_stake: 100 + min_stake: + amount: "1000000" # 1 POKT + denom: upokt gatewayList: - address: pokt15vzxjqklzjtlz7lahe8z2dfe9nm5vxwwmscne4 stake: diff --git a/tools/scripts/params/gateway_all.json b/tools/scripts/params/gateway_all.json new file mode 100644 index 000000000..83ae4f2dd --- /dev/null +++ b/tools/scripts/params/gateway_all.json @@ -0,0 +1,16 @@ +{ + "body": { + "messages": [ + { + "@type": "/poktroll.gateway.MsgUpdateParams", + "authority": "pokt10d07y265gmmuvt4z0w9aw880jnsr700j8yv32t", + "params": { + "min_stake": { + "amount": "1000000", + "denom": "upokt" + } + } + } + ] + } +} \ No newline at end of file diff --git a/tools/scripts/params/gateway_min_stake.json b/tools/scripts/params/gateway_min_stake.json index fb30d5351..0d6d10347 100644 --- a/tools/scripts/params/gateway_min_stake.json +++ b/tools/scripts/params/gateway_min_stake.json @@ -5,7 +5,10 @@ "@type": "/poktroll.gateway.MsgUpdateParam", "authority": "pokt10d07y265gmmuvt4z0w9aw880jnsr700j8yv32t", "name": "min_stake", - "as_int64": "42" + "as_coin": { + "amount": "1000000", + "denom": "upokt" + } } ] } diff --git a/x/gateway/keeper/params_test.go b/x/gateway/keeper/params_test.go index 93f0a73f0..fce11d4e1 100644 --- a/x/gateway/keeper/params_test.go +++ b/x/gateway/keeper/params_test.go @@ -21,7 +21,7 @@ func TestGetParams(t *testing.T) { require.EqualValues(t, params, k.GetParams(ctx)) } -func TestParams_ValidateMinRelayDifficulty(t *testing.T) { +func TestParams_ValidateMinStake(t *testing.T) { tests := []struct { desc string minStake any diff --git a/x/gateway/types/params.go b/x/gateway/types/params.go index 320e0a97d..a9e21ed43 100644 --- a/x/gateway/types/params.go +++ b/x/gateway/types/params.go @@ -62,27 +62,18 @@ func ValidateMinStake(minStakeAny any) error { return ErrGatewayParamInvalid.Wrap("missing min_stake") } - if err := ValidateMinStakeDenom(minStakeCoin); err != nil { - return err + if minStakeCoin.Denom != volatile.DenomuPOKT { + return ErrGatewayParamInvalid.Wrapf( + "invalid min_stake denom %q; expected %q", + minStakeCoin.Denom, volatile.DenomuPOKT, + ) } - - if err := ValidateMinStakeAboveZero(minStakeCoin); err != nil { - return err + if minStakeCoin.IsZero() || minStakeCoin.IsNegative() { + return ErrGatewayParamInvalid.Wrapf("invalid min_stake amount: %s <= 0", minStakeCoin) } - - return nil -} - -func ValidateMinStakeDenom(minStakeCoin *cosmostypes.Coin) error { if minStakeCoin.Denom != volatile.DenomuPOKT { - return ErrGatewayParamInvalid.Wrapf("min stake denom must be %s: %s", volatile.DenomuPOKT, minStakeCoin) + return ErrGatewayParamInvalid.Wrapf("invalid min_stake amount denom %s", minStakeCoin) } - return nil -} -func ValidateMinStakeAboveZero(minStakeCoin *cosmostypes.Coin) error { - if minStakeCoin.Amount.Int64() <= 0 { - return ErrGatewayParamInvalid.Wrapf("min stake amount must be greater than zero: %s", minStakeCoin) - } return nil } diff --git a/x/proof/keeper/msg_server_update_param_test.go b/x/proof/keeper/msg_server_update_param_test.go index 3b6ba5c58..52078f52a 100644 --- a/x/proof/keeper/msg_server_update_param_test.go +++ b/x/proof/keeper/msg_server_update_param_test.go @@ -27,7 +27,7 @@ func TestMsgUpdateParam_UpdateMinRelayDifficultyBitsOnly(t *testing.T) { // Ensure the default values are different from the new values we want to set require.NotEqual(t, expectedRelayDifficultyTargetHash, defaultParams.RelayDifficultyTargetHash) - // Update the min relay difficulty bits + // Update the min stake. updateParamMsg := &prooftypes.MsgUpdateParam{ Authority: authtypes.NewModuleAddress(govtypes.ModuleName).String(), Name: prooftypes.ParamRelayDifficultyTargetHash, From 6c5e13f266fdde602d46d236e5f9dda1d026fe23 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Mon, 30 Sep 2024 12:14:59 +0200 Subject: [PATCH 044/139] chore: review feedback improvements --- x/gateway/keeper/msg_server_stake_gateway.go | 9 ++------- x/gateway/keeper/msg_server_stake_gateway_test.go | 6 +++--- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/x/gateway/keeper/msg_server_stake_gateway.go b/x/gateway/keeper/msg_server_stake_gateway.go index 7d3ecdbfe..0abbe50af 100644 --- a/x/gateway/keeper/msg_server_stake_gateway.go +++ b/x/gateway/keeper/msg_server_stake_gateway.go @@ -42,16 +42,12 @@ func (k msgServer) StakeGateway( } // Check if the gateway already exists or not - var ( - coinsToEscrow sdk.Coin - totalStake sdk.Coin - ) + var coinsToEscrow sdk.Coin gateway, isGatewayFound := k.GetGateway(ctx, msg.Address) if !isGatewayFound { logger.Info(fmt.Sprintf("gateway not found. Creating new gateway for address %q", msg.Address)) gateway = k.createGateway(ctx, msg) coinsToEscrow = *msg.Stake - totalStake = *msg.Stake } else { logger.Info(fmt.Sprintf("gateway found. About to try and update gateway for address %q", msg.Address)) currGatewayStake := *gateway.Stake @@ -69,7 +65,6 @@ func (k msgServer) StakeGateway( ).Error(), ) } - totalStake = currGatewayStake.Add(*msg.Stake) logger.Info(fmt.Sprintf("gateway is going to escrow an additional %+v coins", coinsToEscrow)) } @@ -85,7 +80,7 @@ func (k msgServer) StakeGateway( // MUST ALWAYS have at least minimum stake. minStake := k.GetParams(ctx).MinStake - if totalStake.Amount.LT(minStake.Amount) { + if msg.Stake.Amount.LT(minStake.Amount) { errFmt := "gateway %q must stake at least %s" logger.Info(fmt.Sprintf(errFmt, msg.Address, minStake)) return nil, status.Error( diff --git a/x/gateway/keeper/msg_server_stake_gateway_test.go b/x/gateway/keeper/msg_server_stake_gateway_test.go index b0fe31b2a..6e21a2edc 100644 --- a/x/gateway/keeper/msg_server_stake_gateway_test.go +++ b/x/gateway/keeper/msg_server_stake_gateway_test.go @@ -102,9 +102,9 @@ func TestMsgServer_StakeGateway_FailBelowMinStake(t *testing.T) { expectedErr := gatewaytypes.ErrGatewayInvalidStake.Wrapf("gateway %q must stake at least %s", addr, minStake) // Set the minimum stake to be greater than the gateway stake. - err := k.SetParams(ctx, gatewaytypes.Params{ - MinStake: &minStake, - }) + params := k.GetParams(ctx) + params.MinStake = &minStake + err := k.SetParams(ctx, params) require.NoError(t, err) // Prepare the gateway. From a77877b68a77da6b81e72b4de879d5deee9afdb6 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Mon, 30 Sep 2024 12:45:34 +0200 Subject: [PATCH 045/139] fix: test error message --- x/gateway/types/params.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/gateway/types/params.go b/x/gateway/types/params.go index a9e21ed43..14817db64 100644 --- a/x/gateway/types/params.go +++ b/x/gateway/types/params.go @@ -69,7 +69,7 @@ func ValidateMinStake(minStakeAny any) error { ) } if minStakeCoin.IsZero() || minStakeCoin.IsNegative() { - return ErrGatewayParamInvalid.Wrapf("invalid min_stake amount: %s <= 0", minStakeCoin) + return ErrGatewayParamInvalid.Wrapf("invalid min stake amount must be greater than zero: %s", minStakeCoin) } if minStakeCoin.Denom != volatile.DenomuPOKT { return ErrGatewayParamInvalid.Wrapf("invalid min_stake amount denom %s", minStakeCoin) From 36e5f2e6f6595b677ebe2fde268754747c799d9d Mon Sep 17 00:00:00 2001 From: Bryan White Date: Mon, 30 Sep 2024 13:34:47 +0200 Subject: [PATCH 046/139] chore: update message_update_param_test.go --- x/application/types/message_update_param_test.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/x/application/types/message_update_param_test.go b/x/application/types/message_update_param_test.go index b72a6147b..9c4e45596 100644 --- a/x/application/types/message_update_param_test.go +++ b/x/application/types/message_update_param_test.go @@ -16,15 +16,27 @@ func TestMsgUpdateParam_ValidateBasic(t *testing.T) { err error }{ { - name: "invalid address", + name: "invalid: authority address invalid", msg: MsgUpdateParam{ Authority: "invalid_address", + Name: "", + AsType: &MsgUpdateParam_AsCoin{AsCoin: &DefaultMinStake}, }, err: sdkerrors.ErrInvalidAddress, }, { - name: "valid address", + name: "invalid: param name incorrect (non-existent)", msg: MsgUpdateParam{ Authority: sample.AccAddress(), + Name: "non_existent", + AsType: &MsgUpdateParam_AsCoin{AsCoin: nil}, + }, + err: ErrAppParamInvalid, + }, { + name: "valid: correct authority, param name, and type", + msg: MsgUpdateParam{ + Authority: sample.AccAddress(), + Name: ParamMinStake, + AsType: &MsgUpdateParam_AsCoin{AsCoin: &DefaultMinStake}, }, }, } From 2baa173e0440ddd0ab892b3ce7a579495534d85a Mon Sep 17 00:00:00 2001 From: Bryan White Date: Mon, 30 Sep 2024 13:56:21 +0200 Subject: [PATCH 047/139] fix: genesis tests --- x/application/types/genesis_test.go | 53 ++++++++--------------------- 1 file changed, 14 insertions(+), 39 deletions(-) diff --git a/x/application/types/genesis_test.go b/x/application/types/genesis_test.go index 36d0f4e4f..8c7214747 100644 --- a/x/application/types/genesis_test.go +++ b/x/application/types/genesis_test.go @@ -38,9 +38,7 @@ func TestGenesisState_Validate(t *testing.T) { { desc: "valid genesis state", genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, + Params: types.DefaultParams(), ApplicationList: []types.Application{ { Address: addr1, @@ -62,9 +60,7 @@ func TestGenesisState_Validate(t *testing.T) { { desc: "invalid - zero app stake", genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, + Params: types.DefaultParams(), ApplicationList: []types.Application{ { Address: addr1, @@ -108,9 +104,7 @@ func TestGenesisState_Validate(t *testing.T) { { desc: "invalid - wrong stake denom", genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, + Params: types.DefaultParams(), ApplicationList: []types.Application{ { Address: addr1, @@ -131,9 +125,7 @@ func TestGenesisState_Validate(t *testing.T) { { desc: "invalid - missing denom", genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, + Params: types.DefaultParams(), ApplicationList: []types.Application{ { Address: addr1, @@ -154,9 +146,7 @@ func TestGenesisState_Validate(t *testing.T) { { desc: "invalid - due to duplicated app address", genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, + Params: types.DefaultParams(), ApplicationList: []types.Application{ { Address: addr1, @@ -177,9 +167,7 @@ func TestGenesisState_Validate(t *testing.T) { { desc: "invalid - due to nil app stake", genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, + Params: types.DefaultParams(), ApplicationList: []types.Application{ { Address: addr1, @@ -200,9 +188,7 @@ func TestGenesisState_Validate(t *testing.T) { { desc: "invalid - due to missing app stake", genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, + Params: types.DefaultParams(), ApplicationList: []types.Application{ { Address: addr1, @@ -223,9 +209,7 @@ func TestGenesisState_Validate(t *testing.T) { { desc: "invalid - due to invalid delegatee pub key", genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, + Params: types.DefaultParams(), ApplicationList: []types.Application{ { Address: addr1, @@ -246,9 +230,7 @@ func TestGenesisState_Validate(t *testing.T) { { desc: "invalid - due to invalid delegatee pub keys", genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, + Params: types.DefaultParams(), ApplicationList: []types.Application{ { Address: addr1, @@ -269,9 +251,7 @@ func TestGenesisState_Validate(t *testing.T) { { desc: "invalid - service config not present", genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, + Params: types.DefaultParams(), ApplicationList: []types.Application{ { Address: addr1, @@ -286,9 +266,7 @@ func TestGenesisState_Validate(t *testing.T) { { desc: "invalid - empty service config", genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, + Params: types.DefaultParams(), ApplicationList: []types.Application{ { Address: addr1, @@ -303,9 +281,7 @@ func TestGenesisState_Validate(t *testing.T) { { desc: "invalid - service ID too long", genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, + Params: types.DefaultParams(), ApplicationList: []types.Application{ { Address: addr1, @@ -322,9 +298,7 @@ func TestGenesisState_Validate(t *testing.T) { { desc: "invalid - service ID with invalid characters", genState: &types.GenesisState{ - Params: types.Params{ - MaxDelegatedGateways: 7, - }, + Params: types.DefaultParams(), ApplicationList: []types.Application{ { Address: addr1, @@ -350,6 +324,7 @@ func TestGenesisState_Validate(t *testing.T) { { desc: "duplicated application", genState: &types.GenesisState{ + Params: types.DefaultParams(), ApplicationList: []types.Application{ { Address: addr1, From 7018149538e8e42d8321d5a2ff0a8c6a0615fedc Mon Sep 17 00:00:00 2001 From: Bryan White Date: Mon, 30 Sep 2024 14:53:33 +0200 Subject: [PATCH 048/139] chore: use AsInt64 to update MaxDelegatedGateways for consistency --- api/poktroll/application/tx.pulsar.go | 228 +++++++++--------- proto/poktroll/application/tx.proto | 2 +- testutil/integration/suites/param_configs.go | 4 +- .../keeper/msg_server_update_param.go | 5 +- .../keeper/msg_server_update_param_test.go | 2 +- x/application/types/message_update_param.go | 6 +- x/application/types/tx.pb.go | 148 ++++++------ x/shared/types/message_update_param.go | 1 + 8 files changed, 200 insertions(+), 196 deletions(-) diff --git a/api/poktroll/application/tx.pulsar.go b/api/poktroll/application/tx.pulsar.go index f24ea3d03..691b26a1d 100644 --- a/api/poktroll/application/tx.pulsar.go +++ b/api/poktroll/application/tx.pulsar.go @@ -5245,7 +5245,7 @@ var ( md_MsgUpdateParam protoreflect.MessageDescriptor fd_MsgUpdateParam_authority protoreflect.FieldDescriptor fd_MsgUpdateParam_name protoreflect.FieldDescriptor - fd_MsgUpdateParam_as_uint64 protoreflect.FieldDescriptor + fd_MsgUpdateParam_as_int64 protoreflect.FieldDescriptor fd_MsgUpdateParam_as_coin protoreflect.FieldDescriptor ) @@ -5254,7 +5254,7 @@ func init() { md_MsgUpdateParam = File_poktroll_application_tx_proto.Messages().ByName("MsgUpdateParam") fd_MsgUpdateParam_authority = md_MsgUpdateParam.Fields().ByName("authority") fd_MsgUpdateParam_name = md_MsgUpdateParam.Fields().ByName("name") - fd_MsgUpdateParam_as_uint64 = md_MsgUpdateParam.Fields().ByName("as_uint64") + fd_MsgUpdateParam_as_int64 = md_MsgUpdateParam.Fields().ByName("as_int64") fd_MsgUpdateParam_as_coin = md_MsgUpdateParam.Fields().ByName("as_coin") } @@ -5337,10 +5337,10 @@ func (x *fastReflection_MsgUpdateParam) Range(f func(protoreflect.FieldDescripto } if x.AsType != nil { switch o := x.AsType.(type) { - case *MsgUpdateParam_AsUint64: - v := o.AsUint64 - value := protoreflect.ValueOfUint64(v) - if !f(fd_MsgUpdateParam_as_uint64, value) { + case *MsgUpdateParam_AsInt64: + v := o.AsInt64 + value := protoreflect.ValueOfInt64(v) + if !f(fd_MsgUpdateParam_as_int64, value) { return } case *MsgUpdateParam_AsCoin: @@ -5370,10 +5370,10 @@ func (x *fastReflection_MsgUpdateParam) Has(fd protoreflect.FieldDescriptor) boo return x.Authority != "" case "poktroll.application.MsgUpdateParam.name": return x.Name != "" - case "poktroll.application.MsgUpdateParam.as_uint64": + case "poktroll.application.MsgUpdateParam.as_int64": if x.AsType == nil { return false - } else if _, ok := x.AsType.(*MsgUpdateParam_AsUint64); ok { + } else if _, ok := x.AsType.(*MsgUpdateParam_AsInt64); ok { return true } else { return false @@ -5406,7 +5406,7 @@ func (x *fastReflection_MsgUpdateParam) Clear(fd protoreflect.FieldDescriptor) { x.Authority = "" case "poktroll.application.MsgUpdateParam.name": x.Name = "" - case "poktroll.application.MsgUpdateParam.as_uint64": + case "poktroll.application.MsgUpdateParam.as_int64": x.AsType = nil case "poktroll.application.MsgUpdateParam.as_coin": x.AsType = nil @@ -5432,13 +5432,13 @@ func (x *fastReflection_MsgUpdateParam) Get(descriptor protoreflect.FieldDescrip case "poktroll.application.MsgUpdateParam.name": value := x.Name return protoreflect.ValueOfString(value) - case "poktroll.application.MsgUpdateParam.as_uint64": + case "poktroll.application.MsgUpdateParam.as_int64": if x.AsType == nil { - return protoreflect.ValueOfUint64(uint64(0)) - } else if v, ok := x.AsType.(*MsgUpdateParam_AsUint64); ok { - return protoreflect.ValueOfUint64(v.AsUint64) + return protoreflect.ValueOfInt64(int64(0)) + } else if v, ok := x.AsType.(*MsgUpdateParam_AsInt64); ok { + return protoreflect.ValueOfInt64(v.AsInt64) } else { - return protoreflect.ValueOfUint64(uint64(0)) + return protoreflect.ValueOfInt64(int64(0)) } case "poktroll.application.MsgUpdateParam.as_coin": if x.AsType == nil { @@ -5472,9 +5472,9 @@ func (x *fastReflection_MsgUpdateParam) Set(fd protoreflect.FieldDescriptor, val x.Authority = value.Interface().(string) case "poktroll.application.MsgUpdateParam.name": x.Name = value.Interface().(string) - case "poktroll.application.MsgUpdateParam.as_uint64": - cv := value.Uint() - x.AsType = &MsgUpdateParam_AsUint64{AsUint64: cv} + case "poktroll.application.MsgUpdateParam.as_int64": + cv := value.Int() + x.AsType = &MsgUpdateParam_AsInt64{AsInt64: cv} case "poktroll.application.MsgUpdateParam.as_coin": cv := value.Message().Interface().(*v1beta1.Coin) x.AsType = &MsgUpdateParam_AsCoin{AsCoin: cv} @@ -5518,8 +5518,8 @@ func (x *fastReflection_MsgUpdateParam) Mutable(fd protoreflect.FieldDescriptor) panic(fmt.Errorf("field authority of message poktroll.application.MsgUpdateParam is not mutable")) case "poktroll.application.MsgUpdateParam.name": panic(fmt.Errorf("field name of message poktroll.application.MsgUpdateParam is not mutable")) - case "poktroll.application.MsgUpdateParam.as_uint64": - panic(fmt.Errorf("field as_uint64 of message poktroll.application.MsgUpdateParam is not mutable")) + case "poktroll.application.MsgUpdateParam.as_int64": + panic(fmt.Errorf("field as_int64 of message poktroll.application.MsgUpdateParam is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.application.MsgUpdateParam")) @@ -5537,8 +5537,8 @@ func (x *fastReflection_MsgUpdateParam) NewField(fd protoreflect.FieldDescriptor return protoreflect.ValueOfString("") case "poktroll.application.MsgUpdateParam.name": return protoreflect.ValueOfString("") - case "poktroll.application.MsgUpdateParam.as_uint64": - return protoreflect.ValueOfUint64(uint64(0)) + case "poktroll.application.MsgUpdateParam.as_int64": + return protoreflect.ValueOfInt64(int64(0)) case "poktroll.application.MsgUpdateParam.as_coin": value := &v1beta1.Coin{} return protoreflect.ValueOfMessage(value.ProtoReflect()) @@ -5560,8 +5560,8 @@ func (x *fastReflection_MsgUpdateParam) WhichOneof(d protoreflect.OneofDescripto return nil } switch x.AsType.(type) { - case *MsgUpdateParam_AsUint64: - return x.Descriptor().Fields().ByName("as_uint64") + case *MsgUpdateParam_AsInt64: + return x.Descriptor().Fields().ByName("as_int64") case *MsgUpdateParam_AsCoin: return x.Descriptor().Fields().ByName("as_coin") } @@ -5630,11 +5630,11 @@ func (x *fastReflection_MsgUpdateParam) ProtoMethods() *protoiface.Methods { n += 1 + l + runtime.Sov(uint64(l)) } switch x := x.AsType.(type) { - case *MsgUpdateParam_AsUint64: + case *MsgUpdateParam_AsInt64: if x == nil { break } - n += 1 + runtime.Sov(uint64(x.AsUint64)) + n += 1 + runtime.Sov(uint64(x.AsInt64)) case *MsgUpdateParam_AsCoin: if x == nil { break @@ -5672,8 +5672,8 @@ func (x *fastReflection_MsgUpdateParam) ProtoMethods() *protoiface.Methods { copy(dAtA[i:], x.unknownFields) } switch x := x.AsType.(type) { - case *MsgUpdateParam_AsUint64: - i = runtime.EncodeVarint(dAtA, i, uint64(x.AsUint64)) + case *MsgUpdateParam_AsInt64: + i = runtime.EncodeVarint(dAtA, i, uint64(x.AsInt64)) i-- dAtA[i] = 0x18 case *MsgUpdateParam_AsCoin: @@ -5819,9 +5819,9 @@ func (x *fastReflection_MsgUpdateParam) ProtoMethods() *protoiface.Methods { iNdEx = postIndex case 3: if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AsUint64", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AsInt64", wireType) } - var v uint64 + var v int64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -5831,12 +5831,12 @@ func (x *fastReflection_MsgUpdateParam) ProtoMethods() *protoiface.Methods { } b := dAtA[iNdEx] iNdEx++ - v |= uint64(b&0x7F) << shift + v |= int64(b&0x7F) << shift if b < 0x80 { break } } - x.AsType = &MsgUpdateParam_AsUint64{v} + x.AsType = &MsgUpdateParam_AsInt64{v} case 4: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AsCoin", wireType) @@ -6794,7 +6794,7 @@ type MsgUpdateParam struct { Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // Types that are assignable to AsType: // - // *MsgUpdateParam_AsUint64 + // *MsgUpdateParam_AsInt64 // *MsgUpdateParam_AsCoin AsType isMsgUpdateParam_AsType `protobuf_oneof:"asType"` } @@ -6840,9 +6840,9 @@ func (x *MsgUpdateParam) GetAsType() isMsgUpdateParam_AsType { return nil } -func (x *MsgUpdateParam) GetAsUint64() uint64 { - if x, ok := x.GetAsType().(*MsgUpdateParam_AsUint64); ok { - return x.AsUint64 +func (x *MsgUpdateParam) GetAsInt64() int64 { + if x, ok := x.GetAsType().(*MsgUpdateParam_AsInt64); ok { + return x.AsInt64 } return 0 } @@ -6858,15 +6858,15 @@ type isMsgUpdateParam_AsType interface { isMsgUpdateParam_AsType() } -type MsgUpdateParam_AsUint64 struct { - AsUint64 uint64 `protobuf:"varint,3,opt,name=as_uint64,json=asUint64,proto3,oneof"` +type MsgUpdateParam_AsInt64 struct { + AsInt64 int64 `protobuf:"varint,3,opt,name=as_int64,json=asInt64,proto3,oneof"` } type MsgUpdateParam_AsCoin struct { AsCoin *v1beta1.Coin `protobuf:"bytes,4,opt,name=as_coin,json=asCoin,proto3,oneof"` } -func (*MsgUpdateParam_AsUint64) isMsgUpdateParam_AsType() {} +func (*MsgUpdateParam_AsInt64) isMsgUpdateParam_AsType() {} func (*MsgUpdateParam_AsCoin) isMsgUpdateParam_AsType() {} @@ -7004,89 +7004,89 @@ var file_poktroll_application_tx_proto_rawDesc = []byte{ 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0b, 0x61, 0x70, - 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xcb, 0x01, 0x0a, 0x0e, 0x4d, 0x73, + 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xc9, 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, 0x1d, 0x0a, 0x09, 0x61, 0x73, 0x5f, 0x75, - 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x48, 0x00, 0x52, 0x08, 0x61, - 0x73, 0x55, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x34, 0x0a, 0x07, 0x61, 0x73, 0x5f, 0x63, 0x6f, - 0x69, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, - 0x6f, 0x69, 0x6e, 0x48, 0x00, 0x52, 0x06, 0x61, 0x73, 0x43, 0x6f, 0x69, 0x6e, 0x3a, 0x0e, 0x82, - 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x42, 0x08, 0x0a, - 0x06, 0x61, 0x73, 0x54, 0x79, 0x70, 0x65, 0x22, 0x4e, 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, 0x34, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, - 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, - 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x32, 0xb0, 0x06, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, - 0x64, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, - 0x25, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x2d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 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, 0x70, 0x0a, 0x10, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x41, 0x70, - 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, - 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x31, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, - 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x53, - 0x74, 0x61, 0x6b, 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x76, 0x0a, 0x12, 0x55, 0x6e, 0x73, 0x74, 0x61, - 0x6b, 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2b, 0x2e, - 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x41, - 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x33, 0x2e, 0x70, 0x6f, 0x6b, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x41, 0x70, 0x70, 0x6c, - 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x73, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x54, 0x6f, 0x47, 0x61, 0x74, - 0x65, 0x77, 0x61, 0x79, 0x12, 0x2a, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, - 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x44, - 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x54, 0x6f, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, - 0x1a, 0x32, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, - 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x6c, 0x65, 0x67, - 0x61, 0x74, 0x65, 0x54, 0x6f, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x7f, 0x0a, 0x15, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, - 0x74, 0x65, 0x46, 0x72, 0x6f, 0x6d, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x2e, 0x2e, + 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x08, 0x61, 0x73, 0x5f, 0x69, + 0x6e, 0x74, 0x36, 0x34, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x07, 0x61, 0x73, + 0x49, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x34, 0x0a, 0x07, 0x61, 0x73, 0x5f, 0x63, 0x6f, 0x69, 0x6e, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, + 0x6e, 0x48, 0x00, 0x52, 0x06, 0x61, 0x73, 0x43, 0x6f, 0x69, 0x6e, 0x3a, 0x0e, 0x82, 0xe7, 0xb0, + 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x42, 0x08, 0x0a, 0x06, 0x61, + 0x73, 0x54, 0x79, 0x70, 0x65, 0x22, 0x4e, 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, + 0x34, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1c, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x06, 0x70, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x32, 0xb0, 0x06, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x64, 0x0a, + 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x25, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, - 0x74, 0x65, 0x46, 0x72, 0x6f, 0x6d, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x1a, 0x36, 0x2e, - 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, - 0x74, 0x65, 0x46, 0x72, 0x6f, 0x6d, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x79, 0x0a, 0x13, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, - 0x72, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2c, 0x2e, 0x70, - 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x41, - 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x34, 0x2e, 0x70, 0x6f, 0x6b, + 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x2d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, + 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 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, 0x70, 0x0a, 0x10, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x41, 0x70, 0x70, 0x6c, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, + 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x1a, 0x31, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, + 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, + 0x6b, 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x76, 0x0a, 0x12, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, + 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2b, 0x2e, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x41, 0x70, 0x70, + 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x33, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, + 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x73, 0x0a, + 0x11, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x54, 0x6f, 0x47, 0x61, 0x74, 0x65, 0x77, + 0x61, 0x79, 0x12, 0x2a, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, + 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x6c, + 0x65, 0x67, 0x61, 0x74, 0x65, 0x54, 0x6f, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x1a, 0x32, + 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, + 0x65, 0x54, 0x6f, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x7f, 0x0a, 0x15, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, + 0x46, 0x72, 0x6f, 0x6d, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x2e, 0x2e, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, + 0x46, 0x72, 0x6f, 0x6d, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x1a, 0x36, 0x2e, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, + 0x46, 0x72, 0x6f, 0x6d, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x79, 0x0a, 0x13, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x41, + 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2c, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x41, 0x70, 0x70, - 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x61, 0x0a, 0x0b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, - 0x24, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x1a, 0x2c, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 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, 0xbf, 0x01, 0xd8, 0xe2, 0x1e, - 0x01, 0x0a, 0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, - 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x07, 0x54, 0x78, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x25, 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, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xa2, 0x02, 0x03, - 0x50, 0x41, 0x58, 0xaa, 0x02, 0x14, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x41, - 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xca, 0x02, 0x14, 0x50, 0x6f, 0x6b, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0xe2, 0x02, 0x20, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x41, 0x70, 0x70, - 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x15, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, - 0x3a, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x34, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, + 0x4d, 0x73, 0x67, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x41, 0x70, 0x70, 0x6c, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x61, + 0x0a, 0x0b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x24, 0x2e, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x1a, 0x2c, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, + 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 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, 0xbf, 0x01, 0xd8, 0xe2, 0x1e, 0x01, 0x0a, + 0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x61, 0x70, + 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x25, 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, + 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xa2, 0x02, 0x03, 0x50, 0x41, + 0x58, 0xaa, 0x02, 0x14, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x41, 0x70, 0x70, + 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xca, 0x02, 0x14, 0x50, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x5c, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xe2, + 0x02, 0x20, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x41, 0x70, 0x70, 0x6c, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0xea, 0x02, 0x15, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x41, + 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( @@ -7328,7 +7328,7 @@ func file_poktroll_application_tx_proto_init() { } } file_poktroll_application_tx_proto_msgTypes[12].OneofWrappers = []interface{}{ - (*MsgUpdateParam_AsUint64)(nil), + (*MsgUpdateParam_AsInt64)(nil), (*MsgUpdateParam_AsCoin)(nil), } type x struct{} diff --git a/proto/poktroll/application/tx.proto b/proto/poktroll/application/tx.proto index 76300a623..9e41ceb4b 100644 --- a/proto/poktroll/application/tx.proto +++ b/proto/poktroll/application/tx.proto @@ -103,7 +103,7 @@ message MsgUpdateParam { string name = 2; oneof asType { - uint64 as_uint64 = 3; + int64 as_int64 = 3; cosmos.base.v1beta1.Coin as_coin = 4; }; } diff --git a/testutil/integration/suites/param_configs.go b/testutil/integration/suites/param_configs.go index 4df3b85c0..62950c0fa 100644 --- a/testutil/integration/suites/param_configs.go +++ b/testutil/integration/suites/param_configs.go @@ -81,6 +81,7 @@ var ( QueryParamsResponse: sharedtypes.QueryParamsResponse{}, }, ParamTypes: map[ParamType]any{ + // TODO_IMPROVE: Add a Uint64 asType instead of using int64 for uint64 params. ParamTypeUint64: sharedtypes.MsgUpdateParam_AsInt64{}, ParamTypeInt64: sharedtypes.MsgUpdateParam_AsInt64{}, ParamTypeString: sharedtypes.MsgUpdateParam_AsString{}, @@ -146,7 +147,8 @@ var ( MinStake: &ValidActorMinStake, }, ParamTypes: map[ParamType]any{ - ParamTypeUint64: apptypes.MsgUpdateParam_AsUint64{}, + // TODO_IMPROVE: Add a Uint64 asType instead of using int64 for uint64 params. + ParamTypeUint64: apptypes.MsgUpdateParam_AsInt64{}, ParamTypeCoin: apptypes.MsgUpdateParam_AsCoin{}, }, DefaultParams: apptypes.DefaultParams(), diff --git a/x/application/keeper/msg_server_update_param.go b/x/application/keeper/msg_server_update_param.go index 141667997..9f8ab8918 100644 --- a/x/application/keeper/msg_server_update_param.go +++ b/x/application/keeper/msg_server_update_param.go @@ -18,11 +18,12 @@ func (k msgServer) UpdateParam(ctx context.Context, msg *apptypes.MsgUpdateParam params := k.GetParams(ctx) switch msg.Name { + // TODO_IMPROVE: Add a Uint64 asType instead of using int64 for uint64 params. case apptypes.ParamMaxDelegatedGateways: - if _, ok := msg.AsType.(*apptypes.MsgUpdateParam_AsUint64); !ok { + if _, ok := msg.AsType.(*apptypes.MsgUpdateParam_AsInt64); !ok { return nil, apptypes.ErrAppParamInvalid.Wrapf("unsupported value type for %s param: %T", msg.Name, msg.AsType) } - maxDelegatedGateways := msg.GetAsUint64() + maxDelegatedGateways := uint64(msg.GetAsInt64()) if err := apptypes.ValidateMaxDelegatedGateways(maxDelegatedGateways); err != nil { return nil, apptypes.ErrAppParamInvalid.Wrapf("maxdelegegated_gateways (%d): %v", maxDelegatedGateways, err) diff --git a/x/application/keeper/msg_server_update_param_test.go b/x/application/keeper/msg_server_update_param_test.go index cf075e2ec..0066722d2 100644 --- a/x/application/keeper/msg_server_update_param_test.go +++ b/x/application/keeper/msg_server_update_param_test.go @@ -28,7 +28,7 @@ func TestMsgUpdateParam_UpdateMaxDelegatedGatewaysOnly(t *testing.T) { updateParamMsg := &apptypes.MsgUpdateParam{ Authority: authtypes.NewModuleAddress(govtypes.ModuleName).String(), Name: apptypes.ParamMaxDelegatedGateways, - AsType: &apptypes.MsgUpdateParam_AsUint64{AsUint64: expectedMaxDelegatedGateways}, + AsType: &apptypes.MsgUpdateParam_AsInt64{AsInt64: int64(expectedMaxDelegatedGateways)}, } res, err := msgSrv.UpdateParam(ctx, updateParamMsg) require.NoError(t, err) diff --git a/x/application/types/message_update_param.go b/x/application/types/message_update_param.go index a6d31da10..7cbac5b8a 100644 --- a/x/application/types/message_update_param.go +++ b/x/application/types/message_update_param.go @@ -15,7 +15,7 @@ func NewMsgUpdateParam(authority string, name string, asType any) *MsgUpdatePara switch t := asType.(type) { case uint64: - asTypeIface = &MsgUpdateParam_AsUint64{AsUint64: t} + asTypeIface = &MsgUpdateParam_AsInt64{AsInt64: int64(t)} case *cosmostypes.Coin: asTypeIface = &MsgUpdateParam_AsCoin{AsCoin: t} default: @@ -52,10 +52,10 @@ func (msg *MsgUpdateParam) ValidateBasic() error { } func (msg *MsgUpdateParam) paramTypeIsUint64() error { - if _, ok := msg.AsType.(*MsgUpdateParam_AsUint64); !ok { + if _, ok := msg.AsType.(*MsgUpdateParam_AsInt64); !ok { return ErrAppParamInvalid.Wrapf(""+ "invalid type for param %q; expected %T, got %T", - msg.Name, &MsgUpdateParam_AsUint64{}, msg.AsType, + msg.Name, &MsgUpdateParam_AsInt64{}, msg.AsType, ) } return nil diff --git a/x/application/types/tx.pb.go b/x/application/types/tx.pb.go index c601978e6..f0e534c1c 100644 --- a/x/application/types/tx.pb.go +++ b/x/application/types/tx.pb.go @@ -533,7 +533,7 @@ type MsgUpdateParam struct { Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // Types that are valid to be assigned to AsType: // - // *MsgUpdateParam_AsUint64 + // *MsgUpdateParam_AsInt64 // *MsgUpdateParam_AsCoin AsType isMsgUpdateParam_AsType `protobuf_oneof:"asType"` } @@ -573,15 +573,15 @@ type isMsgUpdateParam_AsType interface { Size() int } -type MsgUpdateParam_AsUint64 struct { - AsUint64 uint64 `protobuf:"varint,3,opt,name=as_uint64,json=asUint64,proto3,oneof" json:"as_uint64,omitempty"` +type MsgUpdateParam_AsInt64 struct { + AsInt64 int64 `protobuf:"varint,3,opt,name=as_int64,json=asInt64,proto3,oneof" json:"as_int64,omitempty"` } type MsgUpdateParam_AsCoin struct { AsCoin *types.Coin `protobuf:"bytes,4,opt,name=as_coin,json=asCoin,proto3,oneof" json:"as_coin,omitempty"` } -func (*MsgUpdateParam_AsUint64) isMsgUpdateParam_AsType() {} -func (*MsgUpdateParam_AsCoin) isMsgUpdateParam_AsType() {} +func (*MsgUpdateParam_AsInt64) isMsgUpdateParam_AsType() {} +func (*MsgUpdateParam_AsCoin) isMsgUpdateParam_AsType() {} func (m *MsgUpdateParam) GetAsType() isMsgUpdateParam_AsType { if m != nil { @@ -604,9 +604,9 @@ func (m *MsgUpdateParam) GetName() string { return "" } -func (m *MsgUpdateParam) GetAsUint64() uint64 { - if x, ok := m.GetAsType().(*MsgUpdateParam_AsUint64); ok { - return x.AsUint64 +func (m *MsgUpdateParam) GetAsInt64() int64 { + if x, ok := m.GetAsType().(*MsgUpdateParam_AsInt64); ok { + return x.AsInt64 } return 0 } @@ -621,7 +621,7 @@ func (m *MsgUpdateParam) GetAsCoin() *types.Coin { // XXX_OneofWrappers is for the internal use of the proto package. func (*MsgUpdateParam) XXX_OneofWrappers() []interface{} { return []interface{}{ - (*MsgUpdateParam_AsUint64)(nil), + (*MsgUpdateParam_AsInt64)(nil), (*MsgUpdateParam_AsCoin)(nil), } } @@ -686,63 +686,63 @@ func init() { func init() { proto.RegisterFile("poktroll/application/tx.proto", fileDescriptor_bed224e38ab1cc6d) } var fileDescriptor_bed224e38ab1cc6d = []byte{ - // 885 bytes of a gzipped FileDescriptorProto + // 883 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0xbf, 0x6f, 0xdb, 0x46, - 0x14, 0xd6, 0xc5, 0x8e, 0x62, 0x3d, 0xa5, 0x4e, 0x42, 0x3b, 0x0d, 0xcd, 0xc6, 0x8c, 0x42, 0xb4, - 0x85, 0xe3, 0xc6, 0x24, 0xac, 0x08, 0x06, 0xa2, 0xc5, 0xb0, 0xdc, 0x1f, 0xe9, 0xa0, 0xa2, 0xa0, - 0x9d, 0xa5, 0x8b, 0x70, 0x92, 0x2e, 0x34, 0x61, 0x89, 0x47, 0xf0, 0x4e, 0x4a, 0x34, 0xb5, 0xe8, - 0xd8, 0xa9, 0x7f, 0x45, 0x51, 0x74, 0xd2, 0xd0, 0xa5, 0x7f, 0x40, 0x81, 0x00, 0x1d, 0x1a, 0x74, - 0xca, 0x54, 0x14, 0xf2, 0xe0, 0x7f, 0xa3, 0xe0, 0xaf, 0x13, 0x45, 0x51, 0x15, 0xdd, 0x29, 0x8b, - 0xc4, 0xbb, 0xf7, 0xbd, 0xf7, 0xbe, 0xef, 0x9d, 0xf4, 0xf1, 0x60, 0xdb, 0xa5, 0xe7, 0xdc, 0xa3, - 0xbd, 0x9e, 0x81, 0x5d, 0xb7, 0x67, 0x77, 0x30, 0xb7, 0xa9, 0x63, 0xf0, 0x57, 0xba, 0xeb, 0x51, - 0x4e, 0xa5, 0xcd, 0x38, 0xac, 0x27, 0xc2, 0xca, 0x1d, 0xdc, 0xb7, 0x1d, 0x6a, 0x04, 0x9f, 0x21, - 0x50, 0xd9, 0xea, 0x50, 0xd6, 0xa7, 0xac, 0x15, 0xac, 0x8c, 0x70, 0x11, 0x85, 0xd4, 0x70, 0x65, - 0xb4, 0x31, 0x23, 0xc6, 0x70, 0xbf, 0x4d, 0x38, 0xde, 0x37, 0x3a, 0xd4, 0x76, 0xa2, 0xf8, 0xbd, - 0x28, 0xde, 0x67, 0x96, 0x31, 0xdc, 0xf7, 0xbf, 0xa2, 0xc0, 0xa6, 0x45, 0x2d, 0x1a, 0x16, 0xf4, - 0x9f, 0xa2, 0xdd, 0x4a, 0x36, 0xe3, 0x91, 0x4b, 0xe2, 0x86, 0x0f, 0x33, 0x11, 0x2e, 0xf6, 0x70, - 0x3f, 0x86, 0x4c, 0x65, 0xb3, 0x33, 0xec, 0x91, 0xae, 0xc1, 0x88, 0x37, 0xb4, 0x3b, 0x24, 0x0c, - 0x6b, 0xbf, 0x23, 0xb8, 0xd5, 0x64, 0xd6, 0x73, 0xb7, 0x8b, 0x39, 0xf9, 0x3a, 0x48, 0x94, 0x0e, - 0xa0, 0x84, 0x07, 0xfc, 0x8c, 0x7a, 0x36, 0x1f, 0xc9, 0xa8, 0x82, 0x76, 0x4a, 0x0d, 0xf9, 0xaf, - 0x5f, 0xf7, 0x36, 0x23, 0xad, 0x47, 0xdd, 0xae, 0x47, 0x18, 0x3b, 0xe1, 0x9e, 0xed, 0x58, 0xe6, - 0x14, 0x2a, 0x1d, 0x42, 0x31, 0x6c, 0x2d, 0x5f, 0xab, 0xa0, 0x9d, 0x72, 0xf5, 0xbe, 0x9e, 0x35, - 0x53, 0x3d, 0xec, 0xd2, 0x28, 0xbd, 0xfe, 0xfb, 0x41, 0xe1, 0xe7, 0xcb, 0xf1, 0x2e, 0x32, 0xa3, - 0xb4, 0xfa, 0xd3, 0xef, 0x2f, 0xc7, 0xbb, 0xd3, 0x82, 0x3f, 0x5c, 0x8e, 0x77, 0x3f, 0x16, 0xf4, - 0x5f, 0xcd, 0x68, 0x4c, 0x71, 0xd6, 0xb6, 0xe0, 0x5e, 0x6a, 0xcb, 0x24, 0xcc, 0xa5, 0x0e, 0x23, - 0xda, 0x9f, 0x08, 0x36, 0x9a, 0xcc, 0x3a, 0xe1, 0xf8, 0x9c, 0x1c, 0x4d, 0x4b, 0x48, 0x55, 0xb8, - 0x81, 0x43, 0x29, 0x4b, 0x45, 0xc6, 0x40, 0xc9, 0x80, 0xeb, 0xcc, 0xaf, 0x13, 0x29, 0xdc, 0xd2, - 0x23, 0xb8, 0x7f, 0xe2, 0x7a, 0x74, 0xe2, 0xfa, 0x31, 0xb5, 0x1d, 0x33, 0xc4, 0x49, 0x9f, 0xc1, - 0x5a, 0x34, 0x70, 0x26, 0xaf, 0x54, 0x56, 0x76, 0xca, 0xd5, 0x47, 0xd3, 0xa9, 0x84, 0x27, 0xa2, - 0x27, 0x48, 0x9d, 0x84, 0xd8, 0x63, 0xea, 0xbc, 0xb0, 0x2d, 0x53, 0xa4, 0xd6, 0x6f, 0xfa, 0x93, - 0x89, 0x59, 0x68, 0xdb, 0xf0, 0x41, 0x86, 0x20, 0x21, 0xf8, 0x10, 0xee, 0xfa, 0xb3, 0x70, 0x58, - 0x5a, 0xb1, 0x9c, 0x52, 0x2c, 0x74, 0xa5, 0xea, 0x3f, 0x80, 0xed, 0xcc, 0x02, 0xa2, 0xc3, 0x4f, - 0x08, 0x36, 0x9b, 0xcc, 0xfa, 0x94, 0xf4, 0x88, 0x85, 0x39, 0x39, 0xa5, 0x5f, 0x60, 0x4e, 0x5e, - 0xe2, 0x91, 0xf4, 0x14, 0xca, 0xd8, 0x75, 0x5b, 0x79, 0xe7, 0x0a, 0xd8, 0x75, 0xa3, 0x1d, 0xe9, - 0x08, 0x6e, 0x59, 0x61, 0x15, 0x91, 0x7e, 0x6d, 0x49, 0xfa, 0x7a, 0x94, 0x10, 0xed, 0xd6, 0x6f, - 0xfb, 0x2a, 0x92, 0x04, 0x34, 0x15, 0xee, 0x67, 0xf1, 0x14, 0x42, 0x7e, 0x41, 0x20, 0x07, 0x52, - 0xbb, 0x11, 0xe4, 0x73, 0x8f, 0xf6, 0xdf, 0x55, 0x31, 0x1a, 0x54, 0x16, 0x71, 0x15, 0x82, 0x7e, - 0x43, 0xf0, 0x7e, 0x93, 0x59, 0xa7, 0x1e, 0x76, 0xd8, 0x0b, 0xe2, 0x25, 0x4f, 0xff, 0x10, 0xd6, - 0x19, 0x1d, 0x78, 0x1d, 0x92, 0x5b, 0xd1, 0x7b, 0x21, 0x3e, 0x16, 0xf5, 0x25, 0x6c, 0x74, 0x09, - 0xe3, 0xb6, 0x13, 0xd4, 0xcb, 0x2d, 0x4c, 0x4a, 0x24, 0xc5, 0xe2, 0x36, 0x7c, 0x71, 0x29, 0x3a, - 0x1a, 0x01, 0x35, 0x9b, 0x7a, 0xac, 0x4e, 0x3a, 0x0e, 0x4e, 0x24, 0xde, 0x0e, 0xf8, 0x97, 0xab, - 0x0f, 0xb3, 0x6d, 0x26, 0x99, 0x9f, 0xcc, 0xd2, 0xfe, 0x40, 0xb0, 0x3e, 0xeb, 0x15, 0xff, 0xdb, - 0xf1, 0x24, 0x58, 0x75, 0x70, 0x3f, 0x74, 0x83, 0x92, 0x19, 0x3c, 0x4b, 0xdb, 0x50, 0xc2, 0xac, - 0x35, 0xb0, 0x1d, 0x7e, 0x50, 0x93, 0x57, 0x2a, 0x68, 0x67, 0xf5, 0x59, 0xc1, 0x5c, 0xc3, 0xec, - 0x79, 0xb0, 0x23, 0xd5, 0xe0, 0x06, 0x66, 0x2d, 0xff, 0xa5, 0x20, 0xaf, 0x2e, 0xf1, 0x90, 0x67, - 0x05, 0xb3, 0x88, 0x99, 0xff, 0x54, 0x5f, 0x9f, 0x75, 0xc6, 0xc6, 0x1a, 0x14, 0x31, 0x3b, 0x1d, - 0xb9, 0x44, 0xfb, 0x2a, 0x38, 0xef, 0x84, 0x18, 0x31, 0xac, 0x9a, 0xb0, 0x63, 0xb4, 0xdc, 0x8e, - 0x63, 0x0f, 0xae, 0x8e, 0x8b, 0xb0, 0xd2, 0x64, 0x96, 0xd4, 0x85, 0x9b, 0x33, 0x2f, 0x85, 0x8f, - 0xb2, 0xb3, 0x53, 0xa6, 0xab, 0xec, 0xe5, 0x82, 0x09, 0x8e, 0x2e, 0xdc, 0x9e, 0xf3, 0xe5, 0x47, - 0x0b, 0x4b, 0xa4, 0xa1, 0xca, 0x7e, 0x6e, 0xa8, 0xe8, 0x38, 0x04, 0x29, 0xc3, 0x19, 0x3f, 0x59, - 0x4c, 0x7b, 0x0e, 0xac, 0x3c, 0xb9, 0x02, 0x58, 0xf4, 0x65, 0x70, 0x67, 0xde, 0x2e, 0x77, 0x17, - 0x56, 0x9a, 0xc3, 0x2a, 0xd5, 0xfc, 0x58, 0xd1, 0xf4, 0x5b, 0xb8, 0x9b, 0x6d, 0x6d, 0xfa, 0x7f, - 0x48, 0xc8, 0xc0, 0x2b, 0x07, 0x57, 0xc3, 0x0b, 0x02, 0x23, 0xd8, 0xc8, 0xb2, 0xa2, 0xc7, 0x0b, - 0xcb, 0x65, 0xa0, 0x95, 0xda, 0x55, 0xd0, 0xa2, 0x35, 0x86, 0x72, 0xf2, 0x2f, 0xfe, 0x61, 0x9e, - 0x1f, 0xa6, 0xf2, 0x38, 0x0f, 0x2a, 0x6e, 0xa1, 0x5c, 0xff, 0xce, 0xbf, 0xbe, 0x34, 0xcc, 0xd7, - 0x13, 0x15, 0xbd, 0x99, 0xa8, 0xe8, 0xed, 0x44, 0x45, 0xff, 0x4c, 0x54, 0xf4, 0xe3, 0x85, 0x5a, - 0x78, 0x73, 0xa1, 0x16, 0xde, 0x5e, 0xa8, 0x85, 0x6f, 0x6a, 0x96, 0xcd, 0xcf, 0x06, 0x6d, 0xbd, - 0x43, 0xfb, 0x86, 0x5f, 0x7c, 0xcf, 0x21, 0xfc, 0x25, 0xf5, 0xce, 0x8d, 0x05, 0x37, 0x9b, 0xe0, - 0x7e, 0xd7, 0x2e, 0x06, 0xd7, 0xb3, 0x27, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x88, 0xe2, 0xfa, - 0x0e, 0xb6, 0x0a, 0x00, 0x00, + 0x14, 0xd6, 0x45, 0x89, 0x6c, 0x3f, 0xa5, 0x4e, 0x42, 0x3b, 0x0d, 0xcd, 0xc4, 0x8c, 0x42, 0xb4, + 0x85, 0xe3, 0xc6, 0x24, 0xa4, 0x08, 0x06, 0xa2, 0xc5, 0xb0, 0xdc, 0x1f, 0xc9, 0xa0, 0xa2, 0xa0, + 0xdd, 0xa5, 0x8b, 0x70, 0x92, 0x2e, 0x34, 0x61, 0x89, 0x47, 0xf0, 0xce, 0x4a, 0x34, 0xb5, 0xe8, + 0xd8, 0xa9, 0x7f, 0x45, 0x51, 0x74, 0xd2, 0xd0, 0xa5, 0x7f, 0x40, 0x81, 0x74, 0x6a, 0xd0, 0x29, + 0x53, 0x51, 0xc8, 0x83, 0xff, 0x8d, 0x82, 0xbf, 0x4e, 0x14, 0x45, 0x55, 0x74, 0xa7, 0x2e, 0x12, + 0xef, 0xde, 0xf7, 0xde, 0xfb, 0xbe, 0x77, 0xd2, 0xc7, 0x83, 0x6d, 0x97, 0x9e, 0x71, 0x8f, 0xf6, + 0xfb, 0x06, 0x76, 0xdd, 0xbe, 0xdd, 0xc5, 0xdc, 0xa6, 0x8e, 0xc1, 0x5f, 0xeb, 0xae, 0x47, 0x39, + 0x95, 0x36, 0xe3, 0xb0, 0x9e, 0x08, 0x2b, 0x77, 0xf0, 0xc0, 0x76, 0xa8, 0x11, 0x7c, 0x86, 0x40, + 0x65, 0xab, 0x4b, 0xd9, 0x80, 0xb2, 0x76, 0xb0, 0x32, 0xc2, 0x45, 0x14, 0x52, 0xc3, 0x95, 0xd1, + 0xc1, 0x8c, 0x18, 0xc3, 0x6a, 0x87, 0x70, 0x5c, 0x35, 0xba, 0xd4, 0x76, 0xa2, 0xf8, 0xbd, 0x28, + 0x3e, 0x60, 0x96, 0x31, 0xac, 0xfa, 0x5f, 0x51, 0x60, 0xd3, 0xa2, 0x16, 0x0d, 0x0b, 0xfa, 0x4f, + 0xd1, 0x6e, 0x25, 0x9b, 0xf1, 0xc8, 0x25, 0x71, 0xc3, 0x47, 0x99, 0x08, 0x17, 0x7b, 0x78, 0x10, + 0x43, 0xa6, 0xb2, 0xd9, 0x29, 0xf6, 0x48, 0xcf, 0x60, 0xc4, 0x1b, 0xda, 0x5d, 0x12, 0x86, 0xb5, + 0xdf, 0x10, 0xdc, 0x6a, 0x31, 0xeb, 0x2b, 0xb7, 0x87, 0x39, 0xf9, 0x32, 0x48, 0x94, 0xf6, 0x61, + 0x0d, 0x9f, 0xf3, 0x53, 0xea, 0xd9, 0x7c, 0x24, 0xa3, 0x0a, 0xda, 0x59, 0x6b, 0xca, 0x7f, 0xfe, + 0xb2, 0xb7, 0x19, 0x69, 0x3d, 0xec, 0xf5, 0x3c, 0xc2, 0xd8, 0x31, 0xf7, 0x6c, 0xc7, 0x32, 0xa7, + 0x50, 0xe9, 0x00, 0x4a, 0x61, 0x6b, 0xf9, 0x5a, 0x05, 0xed, 0x94, 0x6b, 0x0f, 0xf4, 0xac, 0x99, + 0xea, 0x61, 0x97, 0xe6, 0xda, 0x9b, 0xbf, 0x1e, 0x16, 0x7e, 0xba, 0x1c, 0xef, 0x22, 0x33, 0x4a, + 0x6b, 0x3c, 0xfb, 0xee, 0x72, 0xbc, 0x3b, 0x2d, 0xf8, 0xfd, 0xe5, 0x78, 0xf7, 0x23, 0x41, 0xff, + 0xf5, 0x8c, 0xc6, 0x14, 0x67, 0x6d, 0x0b, 0xee, 0xa5, 0xb6, 0x4c, 0xc2, 0x5c, 0xea, 0x30, 0xa2, + 0xfd, 0x81, 0x60, 0xa3, 0xc5, 0xac, 0x63, 0x8e, 0xcf, 0xc8, 0xe1, 0xb4, 0x84, 0x54, 0x83, 0x15, + 0x1c, 0x4a, 0x59, 0x2a, 0x32, 0x06, 0x4a, 0x06, 0xdc, 0x60, 0x7e, 0x9d, 0x48, 0xe1, 0x96, 0x1e, + 0xc1, 0xfd, 0x13, 0xd7, 0xa3, 0x13, 0xd7, 0x8f, 0xa8, 0xed, 0x98, 0x21, 0x4e, 0xfa, 0x14, 0x56, + 0xa3, 0x81, 0x33, 0xb9, 0x58, 0x29, 0xee, 0x94, 0x6b, 0x8f, 0xa7, 0x53, 0x09, 0x4f, 0x44, 0x4f, + 0x90, 0x3a, 0x0e, 0xb1, 0x47, 0xd4, 0x79, 0x69, 0x5b, 0xa6, 0x48, 0x6d, 0xdc, 0xf4, 0x27, 0x13, + 0xb3, 0xd0, 0xb6, 0xe1, 0x7e, 0x86, 0x20, 0x21, 0xf8, 0x00, 0xee, 0xfa, 0xb3, 0x70, 0x58, 0x5a, + 0xb1, 0x9c, 0x52, 0x2c, 0x74, 0xa5, 0xea, 0x3f, 0x84, 0xed, 0xcc, 0x02, 0xa2, 0xc3, 0x8f, 0x08, + 0x36, 0x5b, 0xcc, 0xfa, 0x84, 0xf4, 0x89, 0x85, 0x39, 0x39, 0xa1, 0x9f, 0x63, 0x4e, 0x5e, 0xe1, + 0x91, 0xf4, 0x0c, 0xca, 0xd8, 0x75, 0xdb, 0x79, 0xe7, 0x0a, 0xd8, 0x75, 0xa3, 0x1d, 0xe9, 0x10, + 0x6e, 0x59, 0x61, 0x15, 0x91, 0x7e, 0x6d, 0x49, 0xfa, 0x7a, 0x94, 0x10, 0xed, 0x36, 0x6e, 0xfb, + 0x2a, 0x92, 0x04, 0x34, 0x15, 0x1e, 0x64, 0xf1, 0x14, 0x42, 0x7e, 0x46, 0x20, 0x07, 0x52, 0x7b, + 0x11, 0xe4, 0x33, 0x8f, 0x0e, 0xfe, 0xaf, 0x62, 0x34, 0xa8, 0x2c, 0xe2, 0x2a, 0x04, 0xfd, 0x8a, + 0xe0, 0xfd, 0x16, 0xb3, 0x4e, 0x3c, 0xec, 0xb0, 0x97, 0xc4, 0x4b, 0x9e, 0xfe, 0x01, 0xac, 0x33, + 0x7a, 0xee, 0x75, 0x49, 0x6e, 0x45, 0xef, 0x85, 0xf8, 0x58, 0xd4, 0x0b, 0xd8, 0xe8, 0x11, 0xc6, + 0x6d, 0x27, 0xa8, 0x97, 0x5b, 0x98, 0x94, 0x48, 0x8a, 0xc5, 0x6d, 0xf8, 0xe2, 0x52, 0x74, 0x34, + 0x02, 0x6a, 0x36, 0xf5, 0x58, 0x9d, 0x74, 0x14, 0x9c, 0x48, 0xbc, 0x1d, 0xf0, 0x2f, 0xd7, 0x1e, + 0x65, 0xdb, 0x4c, 0x32, 0x3f, 0x99, 0xa5, 0xfd, 0x8e, 0x60, 0x7d, 0xd6, 0x2b, 0xfe, 0xb3, 0xe3, + 0x49, 0x70, 0xdd, 0xc1, 0x83, 0xd0, 0x0d, 0xd6, 0xcc, 0xe0, 0x59, 0xba, 0x0f, 0xab, 0x98, 0xb5, + 0x6d, 0x87, 0xef, 0xd7, 0xe5, 0x62, 0x05, 0xed, 0x14, 0x9f, 0x17, 0xcc, 0x15, 0xcc, 0x5e, 0xf8, + 0x1b, 0x52, 0x1d, 0x56, 0x30, 0x6b, 0xfb, 0xaf, 0x04, 0xf9, 0xfa, 0x12, 0x07, 0x79, 0x5e, 0x30, + 0x4b, 0x98, 0xf9, 0x4f, 0x8d, 0xf5, 0x59, 0x5f, 0x6c, 0xae, 0x42, 0x09, 0xb3, 0x93, 0x91, 0x4b, + 0xb4, 0x2f, 0x82, 0xd3, 0x4e, 0x48, 0x11, 0xa3, 0xaa, 0x0b, 0x33, 0x46, 0xcb, 0xcd, 0x38, 0x76, + 0xe0, 0xda, 0xb8, 0x04, 0xc5, 0x16, 0xb3, 0xa4, 0x1e, 0xdc, 0x9c, 0x79, 0x25, 0x7c, 0x98, 0x9d, + 0x9d, 0xb2, 0x5c, 0x65, 0x2f, 0x17, 0x4c, 0x70, 0x74, 0xe1, 0xf6, 0x9c, 0x2b, 0x3f, 0x5e, 0x58, + 0x22, 0x0d, 0x55, 0xaa, 0xb9, 0xa1, 0xa2, 0xe3, 0x10, 0xa4, 0x0c, 0x5f, 0xfc, 0x78, 0x31, 0xed, + 0x39, 0xb0, 0xf2, 0xf4, 0x0a, 0x60, 0xd1, 0x97, 0xc1, 0x9d, 0x79, 0xb3, 0xdc, 0x5d, 0x58, 0x69, + 0x0e, 0xab, 0xd4, 0xf2, 0x63, 0x45, 0xd3, 0x6f, 0xe0, 0x6e, 0xb6, 0xb1, 0xe9, 0xff, 0x22, 0x21, + 0x03, 0xaf, 0xec, 0x5f, 0x0d, 0x2f, 0x08, 0x8c, 0x60, 0x23, 0xcb, 0x88, 0x9e, 0x2c, 0x2c, 0x97, + 0x81, 0x56, 0xea, 0x57, 0x41, 0x8b, 0xd6, 0x18, 0xca, 0xc9, 0x3f, 0xf8, 0x07, 0x79, 0x7e, 0x98, + 0xca, 0x93, 0x3c, 0xa8, 0xb8, 0x85, 0x72, 0xe3, 0x5b, 0xff, 0xf2, 0xd2, 0x34, 0xdf, 0x4c, 0x54, + 0xf4, 0x76, 0xa2, 0xa2, 0x77, 0x13, 0x15, 0xfd, 0x3d, 0x51, 0xd1, 0x0f, 0x17, 0x6a, 0xe1, 0xed, + 0x85, 0x5a, 0x78, 0x77, 0xa1, 0x16, 0xbe, 0xae, 0x5b, 0x36, 0x3f, 0x3d, 0xef, 0xe8, 0x5d, 0x3a, + 0x30, 0xfc, 0xe2, 0x7b, 0x0e, 0xe1, 0xaf, 0xa8, 0x77, 0x66, 0x2c, 0xb8, 0xd7, 0x04, 0xb7, 0xbb, + 0x4e, 0x29, 0xb8, 0x9c, 0x3d, 0xfd, 0x27, 0x00, 0x00, 0xff, 0xff, 0xc0, 0xbb, 0xb5, 0x90, 0xb4, + 0x0a, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1478,14 +1478,14 @@ func (m *MsgUpdateParam) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgUpdateParam_AsUint64) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgUpdateParam_AsInt64) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgUpdateParam_AsUint64) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgUpdateParam_AsInt64) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) - i = encodeVarintTx(dAtA, i, uint64(m.AsUint64)) + i = encodeVarintTx(dAtA, i, uint64(m.AsInt64)) i-- dAtA[i] = 0x18 return len(dAtA) - i, nil @@ -1737,13 +1737,13 @@ func (m *MsgUpdateParam) Size() (n int) { return n } -func (m *MsgUpdateParam_AsUint64) Size() (n int) { +func (m *MsgUpdateParam_AsInt64) Size() (n int) { if m == nil { return 0 } var l int _ = l - n += 1 + sovTx(uint64(m.AsUint64)) + n += 1 + sovTx(uint64(m.AsInt64)) return n } func (m *MsgUpdateParam_AsCoin) Size() (n int) { @@ -2899,9 +2899,9 @@ func (m *MsgUpdateParam) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AsUint64", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field AsInt64", wireType) } - var v uint64 + var v int64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -2911,12 +2911,12 @@ func (m *MsgUpdateParam) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= uint64(b&0x7F) << shift + v |= int64(b&0x7F) << shift if b < 0x80 { break } } - m.AsType = &MsgUpdateParam_AsUint64{v} + m.AsType = &MsgUpdateParam_AsInt64{v} case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field AsCoin", wireType) diff --git a/x/shared/types/message_update_param.go b/x/shared/types/message_update_param.go index 9ba5f4ac5..f609b0fd8 100644 --- a/x/shared/types/message_update_param.go +++ b/x/shared/types/message_update_param.go @@ -47,6 +47,7 @@ func (msg *MsgUpdateParam) ValidateBasic() error { // Parameter name must be supported by this module. switch msg.Name { + // TODO_IMPROVE: Add a Uint64 asType instead of using int64 for uint64 params. case ParamNumBlocksPerSession, ParamGracePeriodEndOffsetBlocks, ParamClaimWindowOpenOffsetBlocks, From c36fe790b5d0d88cbd6a1054f123403f4353bb54 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Mon, 30 Sep 2024 14:56:03 +0200 Subject: [PATCH 049/139] chore: ensure application stake handler returns grpc status errors --- .../keeper/msg_server_stake_application.go | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/x/application/keeper/msg_server_stake_application.go b/x/application/keeper/msg_server_stake_application.go index a5a778da7..07ab80273 100644 --- a/x/application/keeper/msg_server_stake_application.go +++ b/x/application/keeper/msg_server_stake_application.go @@ -5,6 +5,8 @@ import ( "fmt" sdk "github.com/cosmos/cosmos-sdk/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" "github.com/pokt-network/poktroll/telemetry" "github.com/pokt-network/poktroll/x/application/types" @@ -23,7 +25,7 @@ func (k msgServer) StakeApplication(ctx context.Context, msg *types.MsgStakeAppl if err := msg.ValidateBasic(); err != nil { logger.Error(fmt.Sprintf("invalid MsgStakeApplication: %v", err)) - return nil, err + return nil, status.Error(codes.InvalidArgument, err.Error()) } // Check if the application already exists or not @@ -38,13 +40,13 @@ func (k msgServer) StakeApplication(ctx context.Context, msg *types.MsgStakeAppl logger.Info(fmt.Sprintf("Application found. About to try and update application for address %q", msg.Address)) currAppStake := *foundApp.Stake if err = k.updateApplication(ctx, &foundApp, msg); err != nil { - logger.Error(fmt.Sprintf("could not update application for address %q due to error %v", msg.Address, err)) - return nil, err + logger.Info(fmt.Sprintf("could not update application for address %q due to error %v", msg.Address, err)) + return nil, status.Error(codes.InvalidArgument, err.Error()) } coinsToEscrow, err = (*msg.Stake).SafeSub(currAppStake) if err != nil { - logger.Error(fmt.Sprintf("could not calculate coins to escrow due to error %v", err)) - return nil, err + logger.Info(fmt.Sprintf("could not calculate coins to escrow due to error %v", err)) + return nil, status.Error(codes.InvalidArgument, err.Error()) } logger.Info(fmt.Sprintf("Application is going to escrow an additional %+v coins", coinsToEscrow)) @@ -55,21 +57,26 @@ func (k msgServer) StakeApplication(ctx context.Context, msg *types.MsgStakeAppl // Must always stake or upstake (> 0 delta) if coinsToEscrow.IsZero() { logger.Warn(fmt.Sprintf("Application %q must escrow more than 0 additional coins", msg.Address)) - return nil, types.ErrAppInvalidStake.Wrapf("application %q must escrow more than 0 additional coins", msg.Address) + return nil, status.Error( + codes.InvalidArgument, + types.ErrAppInvalidStake.Wrapf( + "application %q must escrow more than 0 additional coins", + msg.Address, + ).Error()) } // Retrieve the address of the application appAddress, err := sdk.AccAddressFromBech32(msg.Address) if err != nil { - logger.Error(fmt.Sprintf("could not parse address %q", msg.Address)) - return nil, err + logger.Info(fmt.Sprintf("could not parse address %q", msg.Address)) + return nil, status.Error(codes.InvalidArgument, err.Error()) } // Send the coins from the application to the staked application pool err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, appAddress, types.ModuleName, []sdk.Coin{coinsToEscrow}) if err != nil { logger.Error(fmt.Sprintf("could not send %v coins from %q to %q module account due to %v", coinsToEscrow, appAddress, types.ModuleName, err)) - return nil, err + return nil, status.Error(codes.Internal, err.Error()) } logger.Info(fmt.Sprintf("Successfully escrowed %v coins from %q to %q module account", coinsToEscrow, appAddress, types.ModuleName)) From eab941721ccbd8ff205c6d544dd20afbb9a05218 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Mon, 30 Sep 2024 15:19:24 +0200 Subject: [PATCH 050/139] tests: update app stake msg handler unit tests --- .../msg_server_stake_application_test.go | 88 +++++++++++++++---- 1 file changed, 69 insertions(+), 19 deletions(-) diff --git a/x/application/keeper/msg_server_stake_application_test.go b/x/application/keeper/msg_server_stake_application_test.go index 81049bc59..6ed4316ff 100644 --- a/x/application/keeper/msg_server_stake_application_test.go +++ b/x/application/keeper/msg_server_stake_application_test.go @@ -4,13 +4,14 @@ import ( "testing" "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" + cosmostypes "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" + "github.com/pokt-network/poktroll/app/volatile" keepertest "github.com/pokt-network/poktroll/testutil/keeper" "github.com/pokt-network/poktroll/testutil/sample" "github.com/pokt-network/poktroll/x/application/keeper" - "github.com/pokt-network/poktroll/x/application/types" + apptypes "github.com/pokt-network/poktroll/x/application/types" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" ) @@ -26,9 +27,10 @@ func TestMsgServer_StakeApplication_SuccessfulCreateAndUpdate(t *testing.T) { require.False(t, isAppFound) // Prepare the application - stakeMsg := &types.MsgStakeApplication{ + initialStake := apptypes.DefaultMinStake + stakeMsg := &apptypes.MsgStakeApplication{ Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + Stake: &initialStake, Services: []*sharedtypes.ApplicationServiceConfig{ {ServiceId: "svc1"}, }, @@ -42,14 +44,19 @@ func TestMsgServer_StakeApplication_SuccessfulCreateAndUpdate(t *testing.T) { foundApp, isAppFound := k.GetApplication(ctx, appAddr) require.True(t, isAppFound) require.Equal(t, appAddr, foundApp.Address) - require.Equal(t, int64(100), foundApp.Stake.Amount.Int64()) + require.Truef(t, + initialStake.Amount.Equal(foundApp.Stake.Amount), + "expected %d, got %d", + initialStake.Amount.Int64(), foundApp.Stake.Amount.Int64(), + ) require.Len(t, foundApp.ServiceConfigs, 1) require.Equal(t, "svc1", foundApp.ServiceConfigs[0].ServiceId) // Prepare an updated application with a higher stake and another service - updateStakeMsg := &types.MsgStakeApplication{ + upStake := initialStake.AddAmount(math.NewInt(100)) + updateStakeMsg := &apptypes.MsgStakeApplication{ Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(200)}, + Stake: &upStake, Services: []*sharedtypes.ApplicationServiceConfig{ {ServiceId: "svc1"}, {ServiceId: "svc2"}, @@ -61,7 +68,11 @@ func TestMsgServer_StakeApplication_SuccessfulCreateAndUpdate(t *testing.T) { require.NoError(t, err) foundApp, isAppFound = k.GetApplication(ctx, appAddr) require.True(t, isAppFound) - require.Equal(t, int64(200), foundApp.Stake.Amount.Int64()) + require.Truef(t, + upStake.Amount.Equal(foundApp.Stake.Amount), + "expected %d, got %d", + upStake.Amount.Int64(), foundApp.Stake.Amount.Int64(), + ) require.Len(t, foundApp.ServiceConfigs, 2) require.Equal(t, "svc1", foundApp.ServiceConfigs[0].ServiceId) require.Equal(t, "svc2", foundApp.ServiceConfigs[1].ServiceId) @@ -74,9 +85,10 @@ func TestMsgServer_StakeApplication_FailRestakingDueToInvalidServices(t *testing appAddr := sample.AccAddress() // Prepare the application stake message - stakeMsg := &types.MsgStakeApplication{ + initialStake := apptypes.DefaultMinStake + stakeMsg := &apptypes.MsgStakeApplication{ Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + Stake: &initialStake, Services: []*sharedtypes.ApplicationServiceConfig{ {ServiceId: "svc1"}, }, @@ -87,9 +99,10 @@ func TestMsgServer_StakeApplication_FailRestakingDueToInvalidServices(t *testing require.NoError(t, err) // Prepare the application stake message without any services - updateStakeMsg := &types.MsgStakeApplication{ + upStake := initialStake.AddAmount(math.NewInt(100)) + updateStakeMsg := &apptypes.MsgStakeApplication{ Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + Stake: &upStake, Services: []*sharedtypes.ApplicationServiceConfig{}, } @@ -105,9 +118,9 @@ func TestMsgServer_StakeApplication_FailRestakingDueToInvalidServices(t *testing require.Equal(t, "svc1", foundApp.ServiceConfigs[0].ServiceId) // Prepare the application stake message with an invalid service ID - updateStakeMsg = &types.MsgStakeApplication{ + updateStakeMsg = &apptypes.MsgStakeApplication{ Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + Stake: &upStake, Services: []*sharedtypes.ApplicationServiceConfig{ {ServiceId: "svc1 INVALID ! & *"}, }, @@ -130,10 +143,11 @@ func TestMsgServer_StakeApplication_FailLoweringStake(t *testing.T) { srv := keeper.NewMsgServerImpl(k) // Prepare the application + initialStake := apptypes.DefaultMinStake appAddr := sample.AccAddress() - stakeMsg := &types.MsgStakeApplication{ + stakeMsg := &apptypes.MsgStakeApplication{ Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + Stake: &initialStake, Services: []*sharedtypes.ApplicationServiceConfig{ {ServiceId: "svc1"}, }, @@ -146,9 +160,10 @@ func TestMsgServer_StakeApplication_FailLoweringStake(t *testing.T) { require.True(t, isAppFound) // Prepare an updated application with a lower stake - updateMsg := &types.MsgStakeApplication{ + downStake := initialStake.SubAmount(math.NewInt(1000)) + updateMsg := &apptypes.MsgStakeApplication{ Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(50)}, + Stake: &downStake, Services: []*sharedtypes.ApplicationServiceConfig{ {ServiceId: "svc1"}, }, @@ -161,5 +176,40 @@ func TestMsgServer_StakeApplication_FailLoweringStake(t *testing.T) { // Verify that the application stake is unchanged foundApp, isAppFound := k.GetApplication(ctx, appAddr) require.True(t, isAppFound) - require.Equal(t, int64(100), foundApp.Stake.Amount.Int64()) + require.Truef(t, + initialStake.Amount.Equal(foundApp.Stake.Amount), + "expected %d, got %d", + initialStake.Amount.Int64(), foundApp.Stake.Amount.Int64(), + ) +} + +func TestMsgServer_StakeApplication_FailBelowMinStake(t *testing.T) { + k, ctx := keepertest.ApplicationKeeper(t) + srv := keeper.NewMsgServerImpl(k) + + addr := sample.AccAddress() + appStake := cosmostypes.NewInt64Coin(volatile.DenomuPOKT, 100) + minStake := appStake.AddAmount(math.NewInt(1)) + expectedErr := apptypes.ErrAppInvalidStake.Wrapf("application %q must stake at least %s", addr, minStake) + + // Set the minimum stake to be greater than the application stake. + params := k.GetParams(ctx) + params.MinStake = &minStake + err := k.SetParams(ctx, params) + require.NoError(t, err) + + // Prepare the application. + stakeMsg := &apptypes.MsgStakeApplication{ + Address: addr, + Stake: &appStake, + Services: []*sharedtypes.ApplicationServiceConfig{ + {ServiceId: "svc1"}, + }, + } + + // Attempt to stake the application & verify that the application does NOT exist. + _, err = srv.StakeApplication(ctx, stakeMsg) + require.ErrorContains(t, err, expectedErr.Error()) + _, isGatewayFound := k.GetApplication(ctx, addr) + require.False(t, isGatewayFound) } From da9b32218ed3a1a421d1cc652464fa1f214083e1 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Mon, 30 Sep 2024 15:28:34 +0200 Subject: [PATCH 051/139] feat: enforce application min stake when staking --- .../keeper/msg_server_stake_application.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/x/application/keeper/msg_server_stake_application.go b/x/application/keeper/msg_server_stake_application.go index 07ab80273..f9e9e65db 100644 --- a/x/application/keeper/msg_server_stake_application.go +++ b/x/application/keeper/msg_server_stake_application.go @@ -54,7 +54,7 @@ func (k msgServer) StakeApplication(ctx context.Context, msg *types.MsgStakeAppl foundApp.UnstakeSessionEndHeight = types.ApplicationNotUnstaking } - // Must always stake or upstake (> 0 delta) + // MUST ALWAYS stake or upstake (> 0 delta) if coinsToEscrow.IsZero() { logger.Warn(fmt.Sprintf("Application %q must escrow more than 0 additional coins", msg.Address)) return nil, status.Error( @@ -65,6 +65,17 @@ func (k msgServer) StakeApplication(ctx context.Context, msg *types.MsgStakeAppl ).Error()) } + // MUST ALWAYS have at least minimum stake. + minStake := k.GetParams(ctx).MinStake + if msg.Stake.Amount.LT(minStake.Amount) { + errFmt := "application %q must stake at least %s" + logger.Info(fmt.Sprintf(errFmt, msg.Address, minStake)) + return nil, status.Error( + codes.InvalidArgument, + types.ErrAppInvalidStake.Wrapf(errFmt, msg.Address, minStake).Error(), + ) + } + // Retrieve the address of the application appAddress, err := sdk.AccAddressFromBech32(msg.Address) if err != nil { From 5e47c9868e6989ae05433692ad496f638a443b79 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Mon, 30 Sep 2024 16:03:28 +0200 Subject: [PATCH 052/139] fix: failing unit tests --- .../msg_server_delegate_to_gateway_test.go | 39 +++++++++---------- ..._server_transfer_application_stake_test.go | 12 +++--- ...msg_server_undelegate_from_gateway_test.go | 9 ++--- .../msg_server_unstake_application_test.go | 31 +++++++-------- 4 files changed, 45 insertions(+), 46 deletions(-) diff --git a/x/application/keeper/msg_server_delegate_to_gateway_test.go b/x/application/keeper/msg_server_delegate_to_gateway_test.go index 722fc8e39..a0f8ec98b 100644 --- a/x/application/keeper/msg_server_delegate_to_gateway_test.go +++ b/x/application/keeper/msg_server_delegate_to_gateway_test.go @@ -4,14 +4,13 @@ import ( "fmt" "testing" - "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" keepertest "github.com/pokt-network/poktroll/testutil/keeper" "github.com/pokt-network/poktroll/testutil/sample" "github.com/pokt-network/poktroll/x/application/keeper" - "github.com/pokt-network/poktroll/x/application/types" + apptypes "github.com/pokt-network/poktroll/x/application/types" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" ) @@ -28,9 +27,9 @@ func TestMsgServer_DelegateToGateway_SuccessfullyDelegate(t *testing.T) { keepertest.AddGatewayToStakedGatewayMap(t, gatewayAddr2) // Prepare the application - stakeMsg := &types.MsgStakeApplication{ + stakeMsg := &apptypes.MsgStakeApplication{ Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + Stake: &apptypes.DefaultMinStake, Services: []*sharedtypes.ApplicationServiceConfig{ { ServiceId: "svc1", @@ -45,7 +44,7 @@ func TestMsgServer_DelegateToGateway_SuccessfullyDelegate(t *testing.T) { require.True(t, isAppFound) // Prepare the delegation message - delegateMsg := &types.MsgDelegateToGateway{ + delegateMsg := &apptypes.MsgDelegateToGateway{ AppAddress: appAddr, GatewayAddress: gatewayAddr1, } @@ -72,7 +71,7 @@ func TestMsgServer_DelegateToGateway_SuccessfullyDelegate(t *testing.T) { require.Equal(t, gatewayAddr1, foundApp.DelegateeGatewayAddresses[0]) // Prepare a second delegation message - delegateMsg2 := &types.MsgDelegateToGateway{ + delegateMsg2 := &apptypes.MsgDelegateToGateway{ AppAddress: appAddr, GatewayAddress: gatewayAddr2, } @@ -108,9 +107,9 @@ func TestMsgServer_DelegateToGateway_FailDuplicate(t *testing.T) { keepertest.AddGatewayToStakedGatewayMap(t, gatewayAddr) // Prepare the application - stakeMsg := &types.MsgStakeApplication{ + stakeMsg := &apptypes.MsgStakeApplication{ Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + Stake: &apptypes.DefaultMinStake, Services: []*sharedtypes.ApplicationServiceConfig{ { ServiceId: "svc1", @@ -125,7 +124,7 @@ func TestMsgServer_DelegateToGateway_FailDuplicate(t *testing.T) { require.True(t, isAppFound) // Prepare the delegation message - delegateMsg := &types.MsgDelegateToGateway{ + delegateMsg := &apptypes.MsgDelegateToGateway{ AppAddress: appAddr, GatewayAddress: gatewayAddr, } @@ -152,14 +151,14 @@ func TestMsgServer_DelegateToGateway_FailDuplicate(t *testing.T) { require.Equal(t, gatewayAddr, foundApp.DelegateeGatewayAddresses[0]) // Prepare a second delegation message - delegateMsg2 := &types.MsgDelegateToGateway{ + delegateMsg2 := &apptypes.MsgDelegateToGateway{ AppAddress: appAddr, GatewayAddress: gatewayAddr, } // Attempt to delegate the application to the gateway again _, err = srv.DelegateToGateway(ctx, delegateMsg2) - require.ErrorIs(t, err, types.ErrAppAlreadyDelegated) + require.ErrorIs(t, err, apptypes.ErrAppAlreadyDelegated) events = sdkCtx.EventManager().Events() require.Equal(t, 1, len(events)) foundApp, isAppFound = k.GetApplication(ctx, appAddr) @@ -177,9 +176,9 @@ func TestMsgServer_DelegateToGateway_FailGatewayNotStaked(t *testing.T) { gatewayAddr := sample.AccAddress() // Prepare the application - stakeMsg := &types.MsgStakeApplication{ + stakeMsg := &apptypes.MsgStakeApplication{ Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + Stake: &apptypes.DefaultMinStake, Services: []*sharedtypes.ApplicationServiceConfig{ { ServiceId: "svc1", @@ -194,14 +193,14 @@ func TestMsgServer_DelegateToGateway_FailGatewayNotStaked(t *testing.T) { require.True(t, isAppFound) // Prepare the delegation message - delegateMsg := &types.MsgDelegateToGateway{ + delegateMsg := &apptypes.MsgDelegateToGateway{ AppAddress: appAddr, GatewayAddress: gatewayAddr, } // Attempt to delegate the application to the unstaked gateway _, err = srv.DelegateToGateway(ctx, delegateMsg) - require.ErrorIs(t, err, types.ErrAppGatewayNotFound) + require.ErrorIs(t, err, apptypes.ErrAppGatewayNotFound) foundApp, isAppFound := k.GetApplication(ctx, appAddr) require.True(t, isAppFound) require.Equal(t, 0, len(foundApp.DelegateeGatewayAddresses)) @@ -215,9 +214,9 @@ func TestMsgServer_DelegateToGateway_FailMaxReached(t *testing.T) { appAddr := sample.AccAddress() // Prepare the application - stakeMsg := &types.MsgStakeApplication{ + stakeMsg := &apptypes.MsgStakeApplication{ Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + Stake: &apptypes.DefaultMinStake, Services: []*sharedtypes.ApplicationServiceConfig{ { ServiceId: "svc1", @@ -240,7 +239,7 @@ func TestMsgServer_DelegateToGateway_FailMaxReached(t *testing.T) { gatewayAddresses[i] = gatewayAddr // Mock the gateway being staked via the staked gateway map keepertest.AddGatewayToStakedGatewayMap(t, gatewayAddr) - delegateMsg := &types.MsgDelegateToGateway{ + delegateMsg := &apptypes.MsgDelegateToGateway{ AppAddress: appAddr, GatewayAddress: gatewayAddr, } @@ -270,14 +269,14 @@ func TestMsgServer_DelegateToGateway_FailMaxReached(t *testing.T) { keepertest.AddGatewayToStakedGatewayMap(t, gatewayAddr) // Prepare the delegation message - delegateMsg := &types.MsgDelegateToGateway{ + delegateMsg := &apptypes.MsgDelegateToGateway{ AppAddress: appAddr, GatewayAddress: gatewayAddr, } // Attempt to delegate the application when the max is already reached _, err = srv.DelegateToGateway(ctx, delegateMsg) - require.ErrorIs(t, err, types.ErrAppMaxDelegatedGateways) + require.ErrorIs(t, err, apptypes.ErrAppMaxDelegatedGateways) events = sdkCtx.EventManager().Events() require.Equal(t, int(maxDelegatedParam), len(events)) foundApp, isStakedAppFound := k.GetApplication(ctx, appAddr) diff --git a/x/application/keeper/msg_server_transfer_application_stake_test.go b/x/application/keeper/msg_server_transfer_application_stake_test.go index b3b47bf3b..e64c28759 100644 --- a/x/application/keeper/msg_server_transfer_application_stake_test.go +++ b/x/application/keeper/msg_server_transfer_application_stake_test.go @@ -3,8 +3,6 @@ package keeper_test import ( "testing" - "cosmossdk.io/math" - cosmostypes "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" keepertest "github.com/pokt-network/poktroll/testutil/keeper" @@ -26,7 +24,7 @@ func TestMsgServer_TransferApplication_Success(t *testing.T) { _, isSrcFound := k.GetApplication(ctx, srcAddr) require.False(t, isSrcFound) - expectedAppStake := &cosmostypes.Coin{Denom: "upokt", Amount: math.NewInt(100)} + expectedAppStake := &apptypes.DefaultMinStake // Prepare the application. stakeMsg := &apptypes.MsgStakeApplication{ @@ -89,7 +87,7 @@ func TestMsgServer_TransferApplication_Error_DestinationExists(t *testing.T) { _, isDstFound := k.GetApplication(ctx, dstAddr) require.False(t, isDstFound) - expectedAppStake := &cosmostypes.Coin{Denom: "upokt", Amount: math.NewInt(100)} + expectedAppStake := &apptypes.DefaultMinStake // Prepare and stake the source application. appStakeMsg := &apptypes.MsgStakeApplication{ @@ -130,7 +128,11 @@ func TestMsgServer_TransferApplication_Error_DestinationExists(t *testing.T) { foundApp, isSrcFound = k.GetApplication(ctx, srcAddr) require.True(t, isSrcFound) require.Equal(t, srcAddr, foundApp.Address) - require.Equal(t, int64(100), foundApp.Stake.Amount.Int64()) + require.Truef(t, + expectedAppStake.Amount.Equal(foundApp.Stake.Amount), + "expected %d, got %d", + expectedAppStake.Amount.Int64(), foundApp.Stake.Amount.Int64(), + ) require.Len(t, foundApp.ServiceConfigs, 1) require.Equal(t, "svc1", foundApp.ServiceConfigs[0].ServiceId) } diff --git a/x/application/keeper/msg_server_undelegate_from_gateway_test.go b/x/application/keeper/msg_server_undelegate_from_gateway_test.go index 7f4785ace..a3f1abf8b 100644 --- a/x/application/keeper/msg_server_undelegate_from_gateway_test.go +++ b/x/application/keeper/msg_server_undelegate_from_gateway_test.go @@ -5,7 +5,6 @@ import ( "fmt" "testing" - "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" @@ -39,7 +38,7 @@ func TestMsgServer_UndelegateFromGateway_SuccessfullyUndelegate(t *testing.T) { // Prepare the application stakeMsg := &types.MsgStakeApplication{ Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + Stake: &apptypes.DefaultMinStake, Services: []*sharedtypes.ApplicationServiceConfig{ {ServiceId: "svc1"}, }, @@ -131,7 +130,7 @@ func TestMsgServer_UndelegateFromGateway_FailNotDelegated(t *testing.T) { // Prepare the application stakeMsg := &types.MsgStakeApplication{ Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + Stake: &apptypes.DefaultMinStake, Services: []*sharedtypes.ApplicationServiceConfig{ {ServiceId: "svc1"}, }, @@ -206,7 +205,7 @@ func TestMsgServer_UndelegateFromGateway_SuccessfullyUndelegateFromUnstakedGatew // Prepare the application stakeMsg := &types.MsgStakeApplication{ Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + Stake: &apptypes.DefaultMinStake, Services: []*sharedtypes.ApplicationServiceConfig{ {ServiceId: "svc1"}, }, @@ -514,7 +513,7 @@ func createAppStakeDelegateAndUndelegate( appAddr := sample.AccAddress() stakeMsg := &types.MsgStakeApplication{ Address: appAddr, - Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(100)}, + Stake: &apptypes.DefaultMinStake, Services: []*sharedtypes.ApplicationServiceConfig{ {ServiceId: "svc1"}, }, diff --git a/x/application/keeper/msg_server_unstake_application_test.go b/x/application/keeper/msg_server_unstake_application_test.go index 442b65a98..a5ed5801f 100644 --- a/x/application/keeper/msg_server_unstake_application_test.go +++ b/x/application/keeper/msg_server_unstake_application_test.go @@ -3,14 +3,13 @@ package keeper_test import ( "testing" - "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" keepertest "github.com/pokt-network/poktroll/testutil/keeper" "github.com/pokt-network/poktroll/testutil/sample" "github.com/pokt-network/poktroll/x/application/keeper" - "github.com/pokt-network/poktroll/x/application/types" + apptypes "github.com/pokt-network/poktroll/x/application/types" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" ) @@ -27,7 +26,7 @@ func TestMsgServer_UnstakeApplication_Success(t *testing.T) { require.False(t, isAppFound) // Prepare the application - initialStake := int64(100) + initialStake := apptypes.DefaultMinStake.Amount.Int64() stakeMsg := createAppStakeMsg(unstakingAppAddr, initialStake) // Stake the application @@ -54,7 +53,7 @@ func TestMsgServer_UnstakeApplication_Success(t *testing.T) { require.True(t, isAppFound) // Unstake the application - unstakeMsg := &types.MsgUnstakeApplication{Address: unstakingAppAddr} + unstakeMsg := &apptypes.MsgUnstakeApplication{Address: unstakingAppAddr} _, err = srv.UnstakeApplication(ctx, unstakeMsg) require.NoError(t, err) @@ -64,7 +63,7 @@ func TestMsgServer_UnstakeApplication_Success(t *testing.T) { require.True(t, foundApp.IsUnbonding()) // Move block height to the end of the unbonding period - unbondingHeight := types.GetApplicationUnbondingHeight(&sharedParams, &foundApp) + unbondingHeight := apptypes.GetApplicationUnbondingHeight(&sharedParams, &foundApp) ctx = keepertest.SetBlockHeight(ctx, unbondingHeight) // Run the endblocker to unbond applications @@ -91,7 +90,7 @@ func TestMsgServer_UnstakeApplication_CancelUnbondingIfRestaked(t *testing.T) { appAddr := sample.AccAddress() // Stake the application - initialStake := int64(100) + initialStake := apptypes.DefaultMinStake.Amount.Int64() stakeMsg := createAppStakeMsg(appAddr, initialStake) _, err := srv.StakeApplication(ctx, stakeMsg) require.NoError(t, err) @@ -102,7 +101,7 @@ func TestMsgServer_UnstakeApplication_CancelUnbondingIfRestaked(t *testing.T) { require.False(t, foundApp.IsUnbonding()) // Initiate the application unstaking - unstakeMsg := &types.MsgUnstakeApplication{Address: appAddr} + unstakeMsg := &apptypes.MsgUnstakeApplication{Address: appAddr} _, err = srv.UnstakeApplication(ctx, unstakeMsg) require.NoError(t, err) @@ -111,7 +110,7 @@ func TestMsgServer_UnstakeApplication_CancelUnbondingIfRestaked(t *testing.T) { require.True(t, isAppFound) require.True(t, foundApp.IsUnbonding()) - unbondingHeight := types.GetApplicationUnbondingHeight(&sharedParams, &foundApp) + unbondingHeight := apptypes.GetApplicationUnbondingHeight(&sharedParams, &foundApp) // Stake the application again stakeMsg = createAppStakeMsg(appAddr, initialStake+1) @@ -147,10 +146,10 @@ func TestMsgServer_UnstakeApplication_FailIfNotStaked(t *testing.T) { require.False(t, isAppFound) // Unstake the application - unstakeMsg := &types.MsgUnstakeApplication{Address: appAddr} + unstakeMsg := &apptypes.MsgUnstakeApplication{Address: appAddr} _, err := srv.UnstakeApplication(ctx, unstakeMsg) require.Error(t, err) - require.ErrorIs(t, err, types.ErrAppNotFound) + require.ErrorIs(t, err, apptypes.ErrAppNotFound) _, isAppFound = applicationModuleKeepers.GetApplication(ctx, appAddr) require.False(t, isAppFound) @@ -164,13 +163,13 @@ func TestMsgServer_UnstakeApplication_FailIfCurrentlyUnstaking(t *testing.T) { appAddr := sample.AccAddress() // Stake the application - initialStake := int64(100) + initialStake := apptypes.DefaultMinStake.Amount.Int64() stakeMsg := createAppStakeMsg(appAddr, initialStake) _, err := srv.StakeApplication(ctx, stakeMsg) require.NoError(t, err) // Initiate the application unstaking - unstakeMsg := &types.MsgUnstakeApplication{Address: appAddr} + unstakeMsg := &apptypes.MsgUnstakeApplication{Address: appAddr} _, err = srv.UnstakeApplication(ctx, unstakeMsg) require.NoError(t, err) @@ -179,13 +178,13 @@ func TestMsgServer_UnstakeApplication_FailIfCurrentlyUnstaking(t *testing.T) { // Verify that the application cannot unstake if it is already unstaking. _, err = srv.UnstakeApplication(ctx, unstakeMsg) - require.ErrorIs(t, err, types.ErrAppIsUnstaking) + require.ErrorIs(t, err, apptypes.ErrAppIsUnstaking) } -func createAppStakeMsg(appAddr string, stakeAmount int64) *types.MsgStakeApplication { - initialStake := sdk.NewCoin("upokt", math.NewInt(stakeAmount)) +func createAppStakeMsg(appAddr string, stakeAmount int64) *apptypes.MsgStakeApplication { + initialStake := sdk.NewInt64Coin("upokt", stakeAmount) - return &types.MsgStakeApplication{ + return &apptypes.MsgStakeApplication{ Address: appAddr, Stake: &initialStake, Services: []*sharedtypes.ApplicationServiceConfig{ From 323299e941b29a8deb833b570cb24c0dd7e682bc Mon Sep 17 00:00:00 2001 From: Bryan White Date: Tue, 1 Oct 2024 15:09:39 +0200 Subject: [PATCH 053/139] chore: add PreGeneratedAccountIterator#MustNext() --- testutil/testkeyring/accounts.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/testutil/testkeyring/accounts.go b/testutil/testkeyring/accounts.go index 9769f3469..29139aef6 100644 --- a/testutil/testkeyring/accounts.go +++ b/testutil/testkeyring/accounts.go @@ -101,6 +101,16 @@ func NewPreGeneratedAccountIterator(accounts ...*PreGeneratedAccount) *PreGenera } } +// MustNext returns the next account in the iterator. It panics if the iterator +// is out of accounts; see testutil/testkeyring/gen_accounts. +func (iter *PreGeneratedAccountIterator) MustNext() *PreGeneratedAccount { + account, ok := iter.Next() + if !ok { + panic("pre-generated account iterator out of accounts; see testutil/testkeyring/gen_accounts") + } + return account +} + // Next returns the next account in the iterator. It is safe to call // concurrently and is guaranteed to return a unique account on each call. // If the iterator index goes out of range, it returns nil and false. From d888548718bc57aba1a646ec454ff8584f807a7a Mon Sep 17 00:00:00 2001 From: Bryan White Date: Tue, 1 Oct 2024 15:09:56 +0200 Subject: [PATCH 054/139] chore: update require deps for RingClient --- pkg/crypto/rings/client.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/crypto/rings/client.go b/pkg/crypto/rings/client.go index 62489792b..53ab1f3ae 100644 --- a/pkg/crypto/rings/client.go +++ b/pkg/crypto/rings/client.go @@ -46,6 +46,7 @@ type ringClient struct { // - polylog.Logger // - client.ApplicationQueryClient // - client.AccountQueryClient +// - client.SharedQueryClient func NewRingClient(deps depinject.Config) (_ crypto.RingClient, err error) { rc := new(ringClient) From e87564da7c7186af9ffc69574ff2c76d9cf827b5 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Tue, 1 Oct 2024 15:10:27 +0200 Subject: [PATCH 055/139] refactor: extract application unbonding to method --- x/application/keeper/unbond_applications.go | 53 ++++++++++++--------- x/tokenomics/types/expected_keepers.go | 1 + 2 files changed, 32 insertions(+), 22 deletions(-) diff --git a/x/application/keeper/unbond_applications.go b/x/application/keeper/unbond_applications.go index 38bbe2ef9..f7f4c64a6 100644 --- a/x/application/keeper/unbond_applications.go +++ b/x/application/keeper/unbond_applications.go @@ -6,7 +6,8 @@ import ( cosmostypes "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/pokt-network/poktroll/x/application/types" + + apptypes "github.com/pokt-network/poktroll/x/application/types" ) // EndBlockerUnbondApplications unbonds applications whose unbonding period has elapsed. @@ -20,8 +21,6 @@ func (k Keeper) EndBlockerUnbondApplications(ctx context.Context) error { return nil } - logger := k.Logger().With("method", "UnbondApplication") - // Iterate over all applications and unbond the ones that have finished the unbonding period. // TODO_IMPROVE: Use an index to iterate over the applications that have initiated // the unbonding action instead of iterating over all of them. @@ -31,7 +30,7 @@ func (k Keeper) EndBlockerUnbondApplications(ctx context.Context) error { continue } - unbondingHeight := types.GetApplicationUnbondingHeight(&sharedParams, &application) + unbondingHeight := apptypes.GetApplicationUnbondingHeight(&sharedParams, &application) // If the unbonding height is ahead of the current height, the application // stays in the unbonding state. @@ -39,29 +38,39 @@ func (k Keeper) EndBlockerUnbondApplications(ctx context.Context) error { continue } - // Retrieve the account address of the application. - applicationAccAddress, err := cosmostypes.AccAddressFromBech32(application.Address) - if err != nil { - logger.Error(fmt.Sprintf("could not parse address %s", application.Address)) + if err := k.UnbondApplication(ctx, &application); err != nil { return err } + } - // Send the coins from the application pool back to the application - err = k.bankKeeper.SendCoinsFromModuleToAccount( - ctx, types.ModuleName, applicationAccAddress, []sdk.Coin{*application.Stake}, - ) - if err != nil { - logger.Error(fmt.Sprintf( - "could not send %v coins from module %s to account %s due to %v", - application.Stake, applicationAccAddress, types.ModuleName, err, - )) - return err - } + return nil +} + +func (k Keeper) UnbondApplication(ctx context.Context, app *apptypes.Application) error { + logger := k.Logger().With("method", "UnbondApplication") - // Update the Application in the store - k.RemoveApplication(ctx, applicationAccAddress.String()) - logger.Info(fmt.Sprintf("Successfully removed the application: %+v", application)) + // Retrieve the account address of the application. + appAddr, err := cosmostypes.AccAddressFromBech32(app.Address) + if err != nil { + logger.Error(fmt.Sprintf("could not parse address %s", app.Address)) + return err } + // Send the coins from the application pool back to the application. + err = k.bankKeeper.SendCoinsFromModuleToAccount( + ctx, apptypes.ModuleName, appAddr, []sdk.Coin{*app.Stake}, + ) + if err != nil { + logger.Error(fmt.Sprintf( + "could not send %v coins from module %s to account %s due to %v", + app.Stake, appAddr, apptypes.ModuleName, err, + )) + return err + } + + // Remove the Application from the store. + k.RemoveApplication(ctx, app.GetAddress()) + logger.Info(fmt.Sprintf("Successfully removed the application: %+v", app)) + return nil } diff --git a/x/tokenomics/types/expected_keepers.go b/x/tokenomics/types/expected_keepers.go index 6cb4318d9..01a568390 100644 --- a/x/tokenomics/types/expected_keepers.go +++ b/x/tokenomics/types/expected_keepers.go @@ -43,6 +43,7 @@ type ApplicationKeeper interface { GetApplication(ctx context.Context, appAddr string) (app apptypes.Application, found bool) SetApplication(ctx context.Context, app apptypes.Application) GetAllApplications(ctx context.Context) []apptypes.Application + UnbondApplication(ctx context.Context, app *apptypes.Application) error } type ProofKeeper interface { From 7d5c17b575ed8c611f23f2e5e09955fa3ba5fa2e Mon Sep 17 00:00:00 2001 From: Bryan White Date: Tue, 1 Oct 2024 15:11:01 +0200 Subject: [PATCH 056/139] test: app is unbonded when settlement lowers stake below min --- .../integration/application/min_stake_test.go | 236 ++++++++++++++++++ 1 file changed, 236 insertions(+) create mode 100644 tests/integration/application/min_stake_test.go diff --git a/tests/integration/application/min_stake_test.go b/tests/integration/application/min_stake_test.go new file mode 100644 index 000000000..f0a69de6d --- /dev/null +++ b/tests/integration/application/min_stake_test.go @@ -0,0 +1,236 @@ +package application + +import ( + "context" + "testing" + + "cosmossdk.io/depinject" + cosmoslog "cosmossdk.io/log" + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/crypto/keyring" + "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" + "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + cosmostypes "github.com/cosmos/cosmos-sdk/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" + + "github.com/pokt-network/poktroll/app/volatile" + "github.com/pokt-network/poktroll/cmd/poktrolld/cmd" + "github.com/pokt-network/poktroll/pkg/crypto" + "github.com/pokt-network/poktroll/pkg/crypto/rings" + "github.com/pokt-network/poktroll/pkg/polylog" + _ "github.com/pokt-network/poktroll/pkg/polylog/polyzero" + "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/testutil/sample" + "github.com/pokt-network/poktroll/testutil/testkeyring" + "github.com/pokt-network/poktroll/testutil/testtree" + apptypes "github.com/pokt-network/poktroll/x/application/types" + prooftypes "github.com/pokt-network/poktroll/x/proof/types" + sessiontypes "github.com/pokt-network/poktroll/x/session/types" + sharedtypes "github.com/pokt-network/poktroll/x/shared/types" +) + +type applicationMinStakeTestSuite struct { + suite.Suite + + ctx context.Context + keepers keeper.TokenomicsModuleKeepers + keyRing keyring.Keyring + ringClient crypto.RingClient + + serviceId, + appKeyUid, + appBech32, + supplierKeyUid, + supplierBech32 string +} + +func TestApplicationMinStakeTestSuite(t *testing.T) { + cmd.InitSDKConfig() + + suite.Run(t, new(applicationMinStakeTestSuite)) +} + +func (s *applicationMinStakeTestSuite) SetupTest() { + s.serviceId = "svc1" + s.appKeyUid = "app" + s.supplierKeyUid = "supplier" + s.keepers, s.ctx = keeper.NewTokenomicsModuleKeepers(s.T(), cosmoslog.NewNopLogger()) + + s.setupRingClient() + s.setupKeyring() + s.setupAccounts() + + // Set block height to 1. + s.ctx = cosmostypes.UnwrapSDKContext(s.ctx).WithBlockHeight(1) +} + +func (s *applicationMinStakeTestSuite) TestAppCannotStakeLessThanMinStake() { + s.T().Skip("this case is well covered in x/application/keeper/msg_server_stake_application_test.go") +} + +func (s *applicationMinStakeTestSuite) TestAppIsUnbondedIfBelowMinStakeWhenSettling() { + // Assert that the application's initial bank balance is 0. + appBalance := s.getAppBalance() + require.Equal(s.T(), int64(0), appBalance.Amount.Int64()) + + // Add service 1 + s.addService() + + // Stake an application for service 1 with min stake. + s.stakeApp() + + // Stake a supplier for service 1. + s.stakeSupplier() + + // Get the session header. + sessionHeader := s.getSessionHeader() + + // Create a claim whose settlement amount drops the application below min stake + claim := s.getClaim(sessionHeader) + + // Process TLMs for the claim. + err := s.keepers.Keeper.ProcessTokenLogicModules(s.ctx, claim) + require.NoError(s.T(), err) + + // Assert that the application was unbonded. + _, isAppFound := s.keepers.ApplicationKeeper.GetApplication(s.ctx, s.appBech32) + require.False(s.T(), isAppFound) + + // Assert that the application's stake was returned to its bank balance. + appBalance = s.getAppBalance() + require.Greater(s.T(), appBalance.Amount.Int64(), int64(0)) + require.Less(s.T(), appBalance.Amount.Int64(), apptypes.DefaultMinStake.Amount.Int64()) + +} + +// setupRingClient initializes the suite's ring client. +func (s *applicationMinStakeTestSuite) setupRingClient() { + var err error + deps := depinject.Supply( + polylog.Ctx(s.ctx), + prooftypes.NewAppKeeperQueryClient(s.keepers.ApplicationKeeper), + prooftypes.NewAccountKeeperQueryClient(s.keepers.AccountKeeper), + prooftypes.NewSharedKeeperQueryClient(s.keepers.SharedKeeper, s.keepers.SessionKeeper), + ) + s.ringClient, err = rings.NewRingClient(deps) + require.NoError(s.T(), err) +} + +// setupKeyring initializes the suite's keyring. +func (s *applicationMinStakeTestSuite) setupKeyring() { + registry := codectypes.NewInterfaceRegistry() + registry.RegisterImplementations((*cryptotypes.PubKey)(nil), &secp256k1.PubKey{}, &ed25519.PubKey{}) + registry.RegisterImplementations((*cryptotypes.PrivKey)(nil), &secp256k1.PrivKey{}, &ed25519.PrivKey{}) + cdc := codec.NewProtoCodec(registry) + s.keyRing = keyring.NewInMemory(cdc) +} + +// setupAccounts uses pre-generated accounts to populate the necessary +// accounts in the keyring and account module state. It also populates +// the suite's addresses for the application and supplier. +func (s *applicationMinStakeTestSuite) setupAccounts() { + acctIterator := testkeyring.PreGeneratedAccounts() + s.appBech32 = testkeyring.CreateOnChainAccount( + s.ctx, s.T(), + s.appKeyUid, + s.keyRing, + s.keepers.AccountKeeper, + acctIterator, + ).String() + s.supplierBech32 = testkeyring.CreateOnChainAccount( + s.ctx, s.T(), + s.supplierKeyUid, + s.keyRing, + s.keepers.AccountKeeper, + acctIterator, + ).String() +} + +// addService adds the test service to the service module state. +func (s *applicationMinStakeTestSuite) addService() { + s.keepers.ServiceKeeper.SetService(s.ctx, sharedtypes.Service{ + Id: s.serviceId, + ComputeUnitsPerRelay: 1, + OwnerAddress: sample.AccAddress(), // random address. + }) +} + +// stakeApp stakes an application for service 1 with min stake. +func (s *applicationMinStakeTestSuite) stakeApp() { + s.keepers.ApplicationKeeper.SetApplication(s.ctx, apptypes.Application{ + Address: s.appBech32, + Stake: &apptypes.DefaultMinStake, + ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{{ServiceId: s.serviceId}}, + }) +} + +// stakeSupplier stakes a supplier for service 1. +func (s *applicationMinStakeTestSuite) stakeSupplier() { + // TODO_NEXT(@bryanchriswhite, #612): Replace supplierStake with suppleirtypes.DefaultMinStake. + supplierStake := cosmostypes.NewInt64Coin(volatile.DenomuPOKT, 1000000) // 1 POKT. + s.keepers.SupplierKeeper.SetSupplier(s.ctx, sharedtypes.Supplier{ + OwnerAddress: s.supplierBech32, + OperatorAddress: s.supplierBech32, + Stake: &supplierStake, + Services: []*sharedtypes.SupplierServiceConfig{ + { + ServiceId: s.serviceId, + RevShare: []*sharedtypes.ServiceRevenueShare{ + { + Address: s.supplierBech32, + RevSharePercentage: 1, + }, + }, + }, + }, + }) +} + +// getSessionHeader gets the session header for the test session. +func (s *applicationMinStakeTestSuite) getSessionHeader() *sessiontypes.SessionHeader { + sdkCtx := cosmostypes.UnwrapSDKContext(s.ctx) + currentHeight := sdkCtx.BlockHeight() + sessionRes, err := s.keepers.SessionKeeper.GetSession(s.ctx, &sessiontypes.QueryGetSessionRequest{ + ApplicationAddress: s.appBech32, + ServiceId: s.serviceId, + BlockHeight: currentHeight, + }) + require.NoError(s.T(), err) + + return sessionRes.GetSession().GetHeader() +} + +// getClaim creates a claim whose settlement amount drops the application below min stake. +func (s *applicationMinStakeTestSuite) getClaim( + sessionHeader *sessiontypes.SessionHeader, +) *prooftypes.Claim { + sessionTree := testtree.NewFilledSessionTree( + s.ctx, s.T(), + 1, 100, + s.supplierKeyUid, s.supplierBech32, + sessionHeader, sessionHeader, sessionHeader, + s.keyRing, s.ringClient, + ) + claimRoot, err := sessionTree.Flush() + require.NoError(s.T(), err) + + return &prooftypes.Claim{ + SupplierOperatorAddress: s.supplierBech32, + SessionHeader: sessionHeader, + RootHash: claimRoot, + } +} + +// TODO_IN_THIS_COMMIT: godoc... +func (s *applicationMinStakeTestSuite) getAppBalance() *cosmostypes.Coin { + appBalRes, err := s.keepers.BankKeeper.Balance(s.ctx, &banktypes.QueryBalanceRequest{ + Address: s.appBech32, Denom: volatile.DenomuPOKT, + }) + require.NoError(s.T(), err) + + return appBalRes.GetBalance() +} From 030f2ef2e293fb9f2d020c35d55f0675d2b7a422 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Tue, 1 Oct 2024 15:11:30 +0200 Subject: [PATCH 057/139] feat: unbond app when stake drops below min when settling --- .../keeper/msg_server_stake_application.go | 2 ++ x/tokenomics/keeper/token_logic_modules.go | 16 +++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/x/application/keeper/msg_server_stake_application.go b/x/application/keeper/msg_server_stake_application.go index f9e9e65db..b4fd631c6 100644 --- a/x/application/keeper/msg_server_stake_application.go +++ b/x/application/keeper/msg_server_stake_application.go @@ -67,6 +67,8 @@ func (k msgServer) StakeApplication(ctx context.Context, msg *types.MsgStakeAppl // MUST ALWAYS have at least minimum stake. minStake := k.GetParams(ctx).MinStake + // TODO_CONSIDERATION: If we support multiple native tokens, we will need to + // start checking the denom here. if msg.Stake.Amount.LT(minStake.Amount) { errFmt := "application %q must stake at least %s" logger.Info(fmt.Sprintf(errFmt, msg.Address, minStake)) diff --git a/x/tokenomics/keeper/token_logic_modules.go b/x/tokenomics/keeper/token_logic_modules.go index 288c82f73..d7b8d2062 100644 --- a/x/tokenomics/keeper/token_logic_modules.go +++ b/x/tokenomics/keeper/token_logic_modules.go @@ -279,9 +279,19 @@ func (k Keeper) ProcessTokenLogicModules( logger.Info(fmt.Sprintf("Finished TLM processing: %q", tlm)) } - // State mutation: update the application's on-chain record - k.applicationKeeper.SetApplication(ctx, application) - logger.Info(fmt.Sprintf("updated on-chain application record with address %q", application.Address)) + // TODO_CONSIDERATION: If we support multiple native tokens, we will need to + // start checking the denom here. + if application.Stake.Amount.LT(apptypes.DefaultMinStake.Amount) { + // Unbond the application because it has less than the minimum stake. + if err := k.applicationKeeper.UnbondApplication(ctx, &application); err != nil { + return err + } + } else { + // State mutation: update the application's on-chain record. + k.applicationKeeper.SetApplication(ctx, application) + logger.Info(fmt.Sprintf("updated on-chain application record with address %q", application.Address)) + + } // TODO_MAINNET: If the application stake has dropped to (near?) zero, should // we unstake it? Should we use it's balance? Should there be a payee of last resort? From 3e77f7c922e56c100794733d467725474cb96b95 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Tue, 1 Oct 2024 15:20:58 +0200 Subject: [PATCH 058/139] chore: add TODO_NEXT comments --- x/application/keeper/msg_server_stake_application.go | 1 + x/application/keeper/msg_server_unstake_application.go | 2 ++ .../keeper/msg_server_unstake_application_test.go | 8 ++++++++ x/application/keeper/unbond_applications.go | 2 ++ 4 files changed, 13 insertions(+) diff --git a/x/application/keeper/msg_server_stake_application.go b/x/application/keeper/msg_server_stake_application.go index b4fd631c6..5991c0e4e 100644 --- a/x/application/keeper/msg_server_stake_application.go +++ b/x/application/keeper/msg_server_stake_application.go @@ -51,6 +51,7 @@ func (k msgServer) StakeApplication(ctx context.Context, msg *types.MsgStakeAppl logger.Info(fmt.Sprintf("Application is going to escrow an additional %+v coins", coinsToEscrow)) // If the application has initiated an unstake action, cancel it since it is staking again. + // TODO_NEXT:(@bryanchriswhite): assert on EventApplicationUnbondingCanceled foundApp.UnstakeSessionEndHeight = types.ApplicationNotUnstaking } diff --git a/x/application/keeper/msg_server_unstake_application.go b/x/application/keeper/msg_server_unstake_application.go index 7fbdc9f58..6617edf4e 100644 --- a/x/application/keeper/msg_server_unstake_application.go +++ b/x/application/keeper/msg_server_unstake_application.go @@ -51,6 +51,8 @@ func (k msgServer) UnstakeApplication( foundApp.UnstakeSessionEndHeight = uint64(shared.GetSessionEndHeight(&sharedParams, currentHeight)) k.SetApplication(ctx, foundApp) + // TODO_NEXT:(@bryanchriswhite): emit a new EventApplicationUnbondingBegin + isSuccessful = true return &types.MsgUnstakeApplicationResponse{}, nil } diff --git a/x/application/keeper/msg_server_unstake_application_test.go b/x/application/keeper/msg_server_unstake_application_test.go index a5ed5801f..784b2177a 100644 --- a/x/application/keeper/msg_server_unstake_application_test.go +++ b/x/application/keeper/msg_server_unstake_application_test.go @@ -57,6 +57,8 @@ func TestMsgServer_UnstakeApplication_Success(t *testing.T) { _, err = srv.UnstakeApplication(ctx, unstakeMsg) require.NoError(t, err) + // TODO_NEXT:(@bryanchriswhite): assert on EventApplicationUnbondingBegin + // Make sure the application entered the unbonding period foundApp, isAppFound = applicationModuleKeepers.GetApplication(ctx, unstakingAppAddr) require.True(t, isAppFound) @@ -70,6 +72,8 @@ func TestMsgServer_UnstakeApplication_Success(t *testing.T) { err = applicationModuleKeepers.EndBlockerUnbondApplications(ctx) require.NoError(t, err) + // TODO_NEXT:(@bryanchriswhite): assert on EventApplicationUnbondingEnd + // Make sure the unstaking application is removed from the applications list when // the unbonding period is over. _, isAppFound = applicationModuleKeepers.GetApplication(ctx, unstakingAppAddr) @@ -105,6 +109,8 @@ func TestMsgServer_UnstakeApplication_CancelUnbondingIfRestaked(t *testing.T) { _, err = srv.UnstakeApplication(ctx, unstakeMsg) require.NoError(t, err) + // TODO_NEXT:(@bryanchriswhite): assert on EventApplicationUnbondingBegin + // Make sure the application entered the unbonding period foundApp, isAppFound = applicationModuleKeepers.GetApplication(ctx, appAddr) require.True(t, isAppFound) @@ -117,6 +123,8 @@ func TestMsgServer_UnstakeApplication_CancelUnbondingIfRestaked(t *testing.T) { _, err = srv.StakeApplication(ctx, stakeMsg) require.NoError(t, err) + // TODO_NEXT:(@bryanchriswhite): assert on EventApplicationUnbondingCancelled + // Make sure the application is no longer in the unbonding period foundApp, isAppFound = applicationModuleKeepers.GetApplication(ctx, appAddr) require.True(t, isAppFound) diff --git a/x/application/keeper/unbond_applications.go b/x/application/keeper/unbond_applications.go index f7f4c64a6..19324c525 100644 --- a/x/application/keeper/unbond_applications.go +++ b/x/application/keeper/unbond_applications.go @@ -41,6 +41,8 @@ func (k Keeper) EndBlockerUnbondApplications(ctx context.Context) error { if err := k.UnbondApplication(ctx, &application); err != nil { return err } + + // TODO_NEXT(@bryanchriswhite): emit a new EventApplicationUnbondingEnd. } return nil From 090ca9a11836b54a61696509b340914b50353d05 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Tue, 1 Oct 2024 20:09:37 +0200 Subject: [PATCH 059/139] fix: failing tests --- .../integration/application/min_stake_test.go | 19 +++++++++++++++---- testutil/keeper/tokenomics.go | 4 ++++ .../keeper/token_logic_modules_test.go | 6 +++--- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/tests/integration/application/min_stake_test.go b/tests/integration/application/min_stake_test.go index f0a69de6d..7b68e2a38 100644 --- a/tests/integration/application/min_stake_test.go +++ b/tests/integration/application/min_stake_test.go @@ -6,6 +6,7 @@ import ( "cosmossdk.io/depinject" cosmoslog "cosmossdk.io/log" + "cosmossdk.io/math" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/crypto/keyring" @@ -46,6 +47,11 @@ type applicationMinStakeTestSuite struct { appBech32, supplierKeyUid, supplierBech32 string + + appStake *cosmostypes.Coin + + numRelays, + numComputeUnitsPerRelay uint64 } func TestApplicationMinStakeTestSuite(t *testing.T) { @@ -66,6 +72,10 @@ func (s *applicationMinStakeTestSuite) SetupTest() { // Set block height to 1. s.ctx = cosmostypes.UnwrapSDKContext(s.ctx).WithBlockHeight(1) + + s.appStake = &apptypes.DefaultMinStake + s.numRelays = 10 + s.numComputeUnitsPerRelay = 1 } func (s *applicationMinStakeTestSuite) TestAppCannotStakeLessThanMinStake() { @@ -101,9 +111,10 @@ func (s *applicationMinStakeTestSuite) TestAppIsUnbondedIfBelowMinStakeWhenSettl require.False(s.T(), isAppFound) // Assert that the application's stake was returned to its bank balance. + expectedAppBurn := math.NewInt(int64(s.numRelays * s.numComputeUnitsPerRelay * sharedtypes.DefaultComputeUnitsToTokensMultiplier)) + expectedAppBalance := s.appStake.SubAmount(expectedAppBurn) appBalance = s.getAppBalance() - require.Greater(s.T(), appBalance.Amount.Int64(), int64(0)) - require.Less(s.T(), appBalance.Amount.Int64(), apptypes.DefaultMinStake.Amount.Int64()) + require.Equal(s.T(), expectedAppBalance.Amount.Int64(), appBalance.Amount.Int64()) } @@ -163,7 +174,7 @@ func (s *applicationMinStakeTestSuite) addService() { func (s *applicationMinStakeTestSuite) stakeApp() { s.keepers.ApplicationKeeper.SetApplication(s.ctx, apptypes.Application{ Address: s.appBech32, - Stake: &apptypes.DefaultMinStake, + Stake: s.appStake, ServiceConfigs: []*sharedtypes.ApplicationServiceConfig{{ServiceId: s.serviceId}}, }) } @@ -210,7 +221,7 @@ func (s *applicationMinStakeTestSuite) getClaim( ) *prooftypes.Claim { sessionTree := testtree.NewFilledSessionTree( s.ctx, s.T(), - 1, 100, + s.numRelays, s.numComputeUnitsPerRelay, s.supplierKeyUid, s.supplierBech32, sessionHeader, sessionHeader, sessionHeader, s.keyRing, s.ringClient, diff --git a/testutil/keeper/tokenomics.go b/testutil/keeper/tokenomics.go index 610824cee..4659654cf 100644 --- a/testutil/keeper/tokenomics.go +++ b/testutil/keeper/tokenomics.go @@ -158,6 +158,10 @@ func TokenomicsKeeperWithActorAddrs(t testing.TB) ( mockApplicationKeeper.EXPECT(). SetApplication(gomock.Any(), gomock.Any()). AnyTimes() + mockApplicationKeeper.EXPECT(). + UnbondApplication(gomock.Any(), gomock.Any()). + Return(nil). + AnyTimes() // Mock the supplier keeper. mockSupplierKeeper := mocks.NewMockSupplierKeeper(ctrl) diff --git a/x/tokenomics/keeper/token_logic_modules_test.go b/x/tokenomics/keeper/token_logic_modules_test.go index d90691bd6..812090ae7 100644 --- a/x/tokenomics/keeper/token_logic_modules_test.go +++ b/x/tokenomics/keeper/token_logic_modules_test.go @@ -42,7 +42,7 @@ func init() { func TestProcessTokenLogicModules_TLMBurnEqualsMint_Valid(t *testing.T) { // Test Parameters - appInitialStake := math.NewInt(1000000) + appInitialStake := apptypes.DefaultMinStake.Amount.Mul(math.NewInt(2)) supplierInitialStake := math.NewInt(1000000) supplierRevShareRatios := []float32{12.5, 37.5, 50} globalComputeUnitsToTokensMultiplier := uint64(1) @@ -169,7 +169,7 @@ func TestProcessTokenLogicModules_TLMBurnEqualsMint_Valid(t *testing.T) { func TestProcessTokenLogicModules_TLMBurnEqualsMint_Invalid_SupplierExceedsMaxClaimableAmount(t *testing.T) { // Test Parameters globalComputeUnitsToTokensMultiplier := uint64(1) - serviceComputeUnitsPerRelay := uint64(1) + serviceComputeUnitsPerRelay := uint64(100) service := prepareTestService(serviceComputeUnitsPerRelay) numRelays := uint64(1000) // By a single supplier for application in this session supplierInitialStake := math.NewInt(1000000) @@ -314,7 +314,7 @@ func TestProcessTokenLogicModules_TLMBurnEqualsMint_Invalid_SupplierExceedsMaxCl func TestProcessTokenLogicModules_TLMGlobalMint_Valid_MintDistributionCorrect(t *testing.T) { // Test Parameters - appInitialStake := math.NewInt(1000000) + appInitialStake := apptypes.DefaultMinStake.Amount.Mul(math.NewInt(2)) supplierInitialStake := math.NewInt(1000000) supplierRevShareRatios := []float32{12.5, 37.5, 50} globalComputeUnitsToTokensMultiplier := uint64(1) From c14ad46b0b9d5f289fb51dda6d6e6aeb4ce90bf6 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Tue, 1 Oct 2024 15:21:16 +0200 Subject: [PATCH 060/139] chore: add TODOs & update comments --- tests/integration/application/min_stake_test.go | 4 ++-- x/application/keeper/msg_server_stake_application.go | 2 +- x/application/keeper/msg_server_unstake_application.go | 2 +- .../keeper/msg_server_unstake_application_test.go | 8 ++++---- x/application/keeper/unbond_applications.go | 2 +- x/tokenomics/keeper/token_logic_modules.go | 2 ++ 6 files changed, 11 insertions(+), 9 deletions(-) diff --git a/tests/integration/application/min_stake_test.go b/tests/integration/application/min_stake_test.go index 7b68e2a38..62e707118 100644 --- a/tests/integration/application/min_stake_test.go +++ b/tests/integration/application/min_stake_test.go @@ -181,7 +181,7 @@ func (s *applicationMinStakeTestSuite) stakeApp() { // stakeSupplier stakes a supplier for service 1. func (s *applicationMinStakeTestSuite) stakeSupplier() { - // TODO_NEXT(@bryanchriswhite, #612): Replace supplierStake with suppleirtypes.DefaultMinStake. + // TODO_UPNEXT(@bryanchriswhite, #612): Replace supplierStake with suppleirtypes.DefaultMinStake. supplierStake := cosmostypes.NewInt64Coin(volatile.DenomuPOKT, 1000000) // 1 POKT. s.keepers.SupplierKeeper.SetSupplier(s.ctx, sharedtypes.Supplier{ OwnerAddress: s.supplierBech32, @@ -236,7 +236,7 @@ func (s *applicationMinStakeTestSuite) getClaim( } } -// TODO_IN_THIS_COMMIT: godoc... +// getAppBalance returns the bank module balance for the application. func (s *applicationMinStakeTestSuite) getAppBalance() *cosmostypes.Coin { appBalRes, err := s.keepers.BankKeeper.Balance(s.ctx, &banktypes.QueryBalanceRequest{ Address: s.appBech32, Denom: volatile.DenomuPOKT, diff --git a/x/application/keeper/msg_server_stake_application.go b/x/application/keeper/msg_server_stake_application.go index 5991c0e4e..d25b338da 100644 --- a/x/application/keeper/msg_server_stake_application.go +++ b/x/application/keeper/msg_server_stake_application.go @@ -51,7 +51,7 @@ func (k msgServer) StakeApplication(ctx context.Context, msg *types.MsgStakeAppl logger.Info(fmt.Sprintf("Application is going to escrow an additional %+v coins", coinsToEscrow)) // If the application has initiated an unstake action, cancel it since it is staking again. - // TODO_NEXT:(@bryanchriswhite): assert on EventApplicationUnbondingCanceled + // TODO_UPNEXT:(@bryanchriswhite): assert that an EventApplicationUnbondingCanceled event was emitted. foundApp.UnstakeSessionEndHeight = types.ApplicationNotUnstaking } diff --git a/x/application/keeper/msg_server_unstake_application.go b/x/application/keeper/msg_server_unstake_application.go index 6617edf4e..e10f3914e 100644 --- a/x/application/keeper/msg_server_unstake_application.go +++ b/x/application/keeper/msg_server_unstake_application.go @@ -51,7 +51,7 @@ func (k msgServer) UnstakeApplication( foundApp.UnstakeSessionEndHeight = uint64(shared.GetSessionEndHeight(&sharedParams, currentHeight)) k.SetApplication(ctx, foundApp) - // TODO_NEXT:(@bryanchriswhite): emit a new EventApplicationUnbondingBegin + // TODO_UPNEXT:(@bryanchriswhite): emit a new EventApplicationUnbondingBegin event. isSuccessful = true return &types.MsgUnstakeApplicationResponse{}, nil diff --git a/x/application/keeper/msg_server_unstake_application_test.go b/x/application/keeper/msg_server_unstake_application_test.go index 784b2177a..e57a8b234 100644 --- a/x/application/keeper/msg_server_unstake_application_test.go +++ b/x/application/keeper/msg_server_unstake_application_test.go @@ -57,7 +57,7 @@ func TestMsgServer_UnstakeApplication_Success(t *testing.T) { _, err = srv.UnstakeApplication(ctx, unstakeMsg) require.NoError(t, err) - // TODO_NEXT:(@bryanchriswhite): assert on EventApplicationUnbondingBegin + // TODO_UPNEXT:(@bryanchriswhite): assert that an EventApplicationUnbondingBegin event was emitted. // Make sure the application entered the unbonding period foundApp, isAppFound = applicationModuleKeepers.GetApplication(ctx, unstakingAppAddr) @@ -72,7 +72,7 @@ func TestMsgServer_UnstakeApplication_Success(t *testing.T) { err = applicationModuleKeepers.EndBlockerUnbondApplications(ctx) require.NoError(t, err) - // TODO_NEXT:(@bryanchriswhite): assert on EventApplicationUnbondingEnd + // TODO_UPNEXT:(@bryanchriswhite): assert that an EventApplicationUnbondingEnd event was emitted. // Make sure the unstaking application is removed from the applications list when // the unbonding period is over. @@ -109,7 +109,7 @@ func TestMsgServer_UnstakeApplication_CancelUnbondingIfRestaked(t *testing.T) { _, err = srv.UnstakeApplication(ctx, unstakeMsg) require.NoError(t, err) - // TODO_NEXT:(@bryanchriswhite): assert on EventApplicationUnbondingBegin + // TODO_UPNEXT:(@bryanchriswhite): assert that an EventApplicationUnbondingBegin event was emitted. // Make sure the application entered the unbonding period foundApp, isAppFound = applicationModuleKeepers.GetApplication(ctx, appAddr) @@ -123,7 +123,7 @@ func TestMsgServer_UnstakeApplication_CancelUnbondingIfRestaked(t *testing.T) { _, err = srv.StakeApplication(ctx, stakeMsg) require.NoError(t, err) - // TODO_NEXT:(@bryanchriswhite): assert on EventApplicationUnbondingCancelled + // TODO_UPNEXT:(@bryanchriswhite): assert that an EventApplicationUnbondingCanceled event was emitted. // Make sure the application is no longer in the unbonding period foundApp, isAppFound = applicationModuleKeepers.GetApplication(ctx, appAddr) diff --git a/x/application/keeper/unbond_applications.go b/x/application/keeper/unbond_applications.go index 19324c525..028734e3f 100644 --- a/x/application/keeper/unbond_applications.go +++ b/x/application/keeper/unbond_applications.go @@ -42,7 +42,7 @@ func (k Keeper) EndBlockerUnbondApplications(ctx context.Context) error { return err } - // TODO_NEXT(@bryanchriswhite): emit a new EventApplicationUnbondingEnd. + // TODO_UPNEXT(@bryanchriswhite): emit a new EventApplicationUnbondingEnd event. } return nil diff --git a/x/tokenomics/keeper/token_logic_modules.go b/x/tokenomics/keeper/token_logic_modules.go index d7b8d2062..12e56959b 100644 --- a/x/tokenomics/keeper/token_logic_modules.go +++ b/x/tokenomics/keeper/token_logic_modules.go @@ -286,6 +286,8 @@ func (k Keeper) ProcessTokenLogicModules( if err := k.applicationKeeper.UnbondApplication(ctx, &application); err != nil { return err } + + // TODO_UPNEXT:(@bryanchriswhite): emit a new EventApplicationUnbondedBelowMinStake event. } else { // State mutation: update the application's on-chain record. k.applicationKeeper.SetApplication(ctx, application) From d0b418774ccaf3249bf2471111213ced43c4297f Mon Sep 17 00:00:00 2001 From: Bryan White Date: Tue, 1 Oct 2024 20:39:04 +0200 Subject: [PATCH 061/139] chore: add TODOs & update comments --- x/application/keeper/unbond_applications.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/x/application/keeper/unbond_applications.go b/x/application/keeper/unbond_applications.go index 028734e3f..ee164cb89 100644 --- a/x/application/keeper/unbond_applications.go +++ b/x/application/keeper/unbond_applications.go @@ -48,6 +48,8 @@ func (k Keeper) EndBlockerUnbondApplications(ctx context.Context) error { return nil } +// UnbondApplication transfers the application stake to the bank module balance for the +// corresponding account and removes the application from the application module state. func (k Keeper) UnbondApplication(ctx context.Context, app *apptypes.Application) error { logger := k.Logger().With("method", "UnbondApplication") From 891a858c4fb7d72e7caab9a5d765f6d1e034e81b Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 2 Oct 2024 08:53:47 +0200 Subject: [PATCH 062/139] chore: review feedback improvements Co-authored-by: Daniel Olshansky --- x/gateway/keeper/msg_server_stake_gateway.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/x/gateway/keeper/msg_server_stake_gateway.go b/x/gateway/keeper/msg_server_stake_gateway.go index 0abbe50af..aa55ce744 100644 --- a/x/gateway/keeper/msg_server_stake_gateway.go +++ b/x/gateway/keeper/msg_server_stake_gateway.go @@ -70,11 +70,11 @@ func (k msgServer) StakeGateway( // MUST ALWAYS stake or upstake (> 0 delta). if coinsToEscrow.IsZero() { - errFmt := "gateway %q must escrow more than 0 additional coins" - logger.Info(fmt.Sprintf(errFmt, msg.Address)) + errMsg := fmt.Sprintf("gateway %q must escrow more than 0 additional coins", msg.GetAddress()) + logger.Info(errMsg) return nil, status.Error( codes.InvalidArgument, - types.ErrGatewayInvalidStake.Wrapf(errFmt, msg.Address).Error(), + types.ErrGatewayInvalidStake.Wrap(errMsg).Error(), ) } From d98b22b47679934ace0b572482940839ca0bf9f9 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 2 Oct 2024 09:51:53 +0200 Subject: [PATCH 063/139] test: simplify --- .../integration/application/min_stake_test.go | 90 +++---------------- 1 file changed, 10 insertions(+), 80 deletions(-) diff --git a/tests/integration/application/min_stake_test.go b/tests/integration/application/min_stake_test.go index 62e707118..5e552ea8b 100644 --- a/tests/integration/application/min_stake_test.go +++ b/tests/integration/application/min_stake_test.go @@ -4,15 +4,8 @@ import ( "context" "testing" - "cosmossdk.io/depinject" cosmoslog "cosmossdk.io/log" "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/crypto/keyring" - "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" - "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" cosmostypes "github.com/cosmos/cosmos-sdk/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/stretchr/testify/require" @@ -20,14 +13,10 @@ import ( "github.com/pokt-network/poktroll/app/volatile" "github.com/pokt-network/poktroll/cmd/poktrolld/cmd" - "github.com/pokt-network/poktroll/pkg/crypto" - "github.com/pokt-network/poktroll/pkg/crypto/rings" - "github.com/pokt-network/poktroll/pkg/polylog" _ "github.com/pokt-network/poktroll/pkg/polylog/polyzero" "github.com/pokt-network/poktroll/testutil/keeper" + testproof "github.com/pokt-network/poktroll/testutil/proof" "github.com/pokt-network/poktroll/testutil/sample" - "github.com/pokt-network/poktroll/testutil/testkeyring" - "github.com/pokt-network/poktroll/testutil/testtree" apptypes "github.com/pokt-network/poktroll/x/application/types" prooftypes "github.com/pokt-network/poktroll/x/proof/types" sessiontypes "github.com/pokt-network/poktroll/x/session/types" @@ -37,15 +26,11 @@ import ( type applicationMinStakeTestSuite struct { suite.Suite - ctx context.Context - keepers keeper.TokenomicsModuleKeepers - keyRing keyring.Keyring - ringClient crypto.RingClient + ctx context.Context + keepers keeper.TokenomicsModuleKeepers serviceId, - appKeyUid, appBech32, - supplierKeyUid, supplierBech32 string appStake *cosmostypes.Coin @@ -61,21 +46,17 @@ func TestApplicationMinStakeTestSuite(t *testing.T) { } func (s *applicationMinStakeTestSuite) SetupTest() { - s.serviceId = "svc1" - s.appKeyUid = "app" - s.supplierKeyUid = "supplier" s.keepers, s.ctx = keeper.NewTokenomicsModuleKeepers(s.T(), cosmoslog.NewNopLogger()) - s.setupRingClient() - s.setupKeyring() - s.setupAccounts() - - // Set block height to 1. - s.ctx = cosmostypes.UnwrapSDKContext(s.ctx).WithBlockHeight(1) - + s.serviceId = "svc1" + s.appBech32 = sample.AccAddress() + s.supplierBech32 = sample.AccAddress() s.appStake = &apptypes.DefaultMinStake s.numRelays = 10 s.numComputeUnitsPerRelay = 1 + + // Set block height to 1. + s.ctx = cosmostypes.UnwrapSDKContext(s.ctx).WithBlockHeight(1) } func (s *applicationMinStakeTestSuite) TestAppCannotStakeLessThanMinStake() { @@ -118,49 +99,6 @@ func (s *applicationMinStakeTestSuite) TestAppIsUnbondedIfBelowMinStakeWhenSettl } -// setupRingClient initializes the suite's ring client. -func (s *applicationMinStakeTestSuite) setupRingClient() { - var err error - deps := depinject.Supply( - polylog.Ctx(s.ctx), - prooftypes.NewAppKeeperQueryClient(s.keepers.ApplicationKeeper), - prooftypes.NewAccountKeeperQueryClient(s.keepers.AccountKeeper), - prooftypes.NewSharedKeeperQueryClient(s.keepers.SharedKeeper, s.keepers.SessionKeeper), - ) - s.ringClient, err = rings.NewRingClient(deps) - require.NoError(s.T(), err) -} - -// setupKeyring initializes the suite's keyring. -func (s *applicationMinStakeTestSuite) setupKeyring() { - registry := codectypes.NewInterfaceRegistry() - registry.RegisterImplementations((*cryptotypes.PubKey)(nil), &secp256k1.PubKey{}, &ed25519.PubKey{}) - registry.RegisterImplementations((*cryptotypes.PrivKey)(nil), &secp256k1.PrivKey{}, &ed25519.PrivKey{}) - cdc := codec.NewProtoCodec(registry) - s.keyRing = keyring.NewInMemory(cdc) -} - -// setupAccounts uses pre-generated accounts to populate the necessary -// accounts in the keyring and account module state. It also populates -// the suite's addresses for the application and supplier. -func (s *applicationMinStakeTestSuite) setupAccounts() { - acctIterator := testkeyring.PreGeneratedAccounts() - s.appBech32 = testkeyring.CreateOnChainAccount( - s.ctx, s.T(), - s.appKeyUid, - s.keyRing, - s.keepers.AccountKeeper, - acctIterator, - ).String() - s.supplierBech32 = testkeyring.CreateOnChainAccount( - s.ctx, s.T(), - s.supplierKeyUid, - s.keyRing, - s.keepers.AccountKeeper, - acctIterator, - ).String() -} - // addService adds the test service to the service module state. func (s *applicationMinStakeTestSuite) addService() { s.keepers.ServiceKeeper.SetService(s.ctx, sharedtypes.Service{ @@ -219,15 +157,7 @@ func (s *applicationMinStakeTestSuite) getSessionHeader() *sessiontypes.SessionH func (s *applicationMinStakeTestSuite) getClaim( sessionHeader *sessiontypes.SessionHeader, ) *prooftypes.Claim { - sessionTree := testtree.NewFilledSessionTree( - s.ctx, s.T(), - s.numRelays, s.numComputeUnitsPerRelay, - s.supplierKeyUid, s.supplierBech32, - sessionHeader, sessionHeader, sessionHeader, - s.keyRing, s.ringClient, - ) - claimRoot, err := sessionTree.Flush() - require.NoError(s.T(), err) + claimRoot := testproof.SmstRootWithSumAndCount(s.numRelays*s.numComputeUnitsPerRelay, s.numRelays) return &prooftypes.Claim{ SupplierOperatorAddress: s.supplierBech32, From ccc3f53913dddfffc82f88dd82dce9ea477245cb Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 2 Oct 2024 10:08:37 +0200 Subject: [PATCH 064/139] fix: e2e test --- e2e/tests/parse_params_test.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/e2e/tests/parse_params_test.go b/e2e/tests/parse_params_test.go index 345fb4949..98ba813d6 100644 --- a/e2e/tests/parse_params_test.go +++ b/e2e/tests/parse_params_test.go @@ -95,8 +95,6 @@ func (s *suite) paramsMapToMsgUpdateParams(moduleName string, paramsMap paramsAn msgUpdateParams = s.newAppMsgUpdateParams(paramsMap) case servicetypes.ModuleName: msgUpdateParams = s.newServiceMsgUpdateParams(paramsMap) - case gatewaytypes.ModuleName: - msgUpdateParams = s.newGatewayMsgUpdateParams(paramsMap) // NB: supplier module currently has no parameters default: err := fmt.Errorf("ERROR: unexpected module name %q", moduleName) From ce5b69310dddfb2756986891417dcaffdf225b16 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 2 Oct 2024 10:29:15 +0200 Subject: [PATCH 065/139] chore: increase genesis app stakes so E2E tests don't burn them out --- config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config.yml b/config.yml index b8c9aed5c..57db72f1a 100644 --- a/config.yml +++ b/config.yml @@ -167,7 +167,7 @@ genesis: max_delegated_gateways: "7" min_stake: # TODO_MAINNET: Determine realistic amount for minimum application stake amount. - amount: "1000000" # 1 POKT + amount: "100000000" # 100 POKT denom: upokt applicationList: - address: pokt1mrqt5f7qh8uxs27cjm9t7v9e74a9vvdnq5jva4 @@ -179,7 +179,7 @@ genesis: stake: # NB: This value should be exactly 1upokt smaller than the value in # `supplier1_stake_config.yaml` so that the stake command causes a state change. - amount: "1000068" + amount: "100000068" # ~100 POKT denom: upokt - address: pokt1ad28jdap2zfanjd7hpkh984yveney6k9a42man delegatee_gateway_addresses: [] @@ -190,7 +190,7 @@ genesis: stake: # NB: This value should be exactly 1upokt smaller than the value in # `supplier1_stake_config.yaml` so that the stake command causes a state change. - amount: "1000068" + amount: "100000068" # ~100 POKT denom: upokt supplier: supplierList: From 2d2e8158ab2a568863d18f182525ecfa10721bf0 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 2 Oct 2024 11:24:31 +0200 Subject: [PATCH 066/139] scaffold: message update-param --module examplemod --signer authority name as_type --response params --- api/poktroll/supplier/tx.pulsar.go | 1458 +++++++++++++++-- api/poktroll/supplier/tx_grpc.pb.go | 38 + proto/poktroll/supplier/tx.proto | 39 +- x/supplier/keeper/msg_server_update_param.go | 18 + x/supplier/module/autocli.go | 8 +- x/supplier/module/simulation.go | 23 + x/supplier/simulation/update_param.go | 29 + x/supplier/types/codec.go | 3 + x/supplier/types/message_update_param.go | 26 + x/supplier/types/message_update_param_test.go | 40 + x/supplier/types/tx.pb.go | 551 ++++++- 11 files changed, 1999 insertions(+), 234 deletions(-) create mode 100644 x/supplier/keeper/msg_server_update_param.go create mode 100644 x/supplier/simulation/update_param.go create mode 100644 x/supplier/types/message_update_param.go create mode 100644 x/supplier/types/message_update_param_test.go diff --git a/api/poktroll/supplier/tx.pulsar.go b/api/poktroll/supplier/tx.pulsar.go index ec93f9704..40b60bec4 100644 --- a/api/poktroll/supplier/tx.pulsar.go +++ b/api/poktroll/supplier/tx.pulsar.go @@ -5,11 +5,11 @@ import ( _ "cosmossdk.io/api/amino" v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" _ "cosmossdk.io/api/cosmos/msg/v1" - shared "github.com/pokt-network/poktroll/api/poktroll/shared" fmt "fmt" _ "github.com/cosmos/cosmos-proto" runtime "github.com/cosmos/cosmos-proto/runtime" _ "github.com/cosmos/gogoproto/gogoproto" + shared "github.com/pokt-network/poktroll/api/poktroll/shared" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" @@ -2834,181 +2834,1149 @@ func (x *fastReflection_MsgUnstakeSupplierResponse) ProtoMethods() *protoiface.M } } -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.27.0 -// protoc (unknown) -// source: poktroll/supplier/tx.proto - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +var ( + md_MsgUpdateParam protoreflect.MessageDescriptor + fd_MsgUpdateParam_authority protoreflect.FieldDescriptor + fd_MsgUpdateParam_name protoreflect.FieldDescriptor + fd_MsgUpdateParam_asType protoreflect.FieldDescriptor ) -// MsgUpdateParams is the Msg/UpdateParams request type. -type MsgUpdateParams struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // authority is the address that controls the module (defaults to x/gov unless overwritten). - Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` - // params defines the x/supplier parameters to update. - // NOTE: All parameters must be supplied. - Params *Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty"` -} - -func (x *MsgUpdateParams) Reset() { - *x = MsgUpdateParams{} - if protoimpl.UnsafeEnabled { - mi := &file_poktroll_supplier_tx_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } +func init() { + file_poktroll_supplier_tx_proto_init() + md_MsgUpdateParam = File_poktroll_supplier_tx_proto.Messages().ByName("MsgUpdateParam") + fd_MsgUpdateParam_authority = md_MsgUpdateParam.Fields().ByName("authority") + fd_MsgUpdateParam_name = md_MsgUpdateParam.Fields().ByName("name") + fd_MsgUpdateParam_asType = md_MsgUpdateParam.Fields().ByName("asType") } -func (x *MsgUpdateParams) String() string { - return protoimpl.X.MessageStringOf(x) -} +var _ protoreflect.Message = (*fastReflection_MsgUpdateParam)(nil) -func (*MsgUpdateParams) ProtoMessage() {} +type fastReflection_MsgUpdateParam MsgUpdateParam -// Deprecated: Use MsgUpdateParams.ProtoReflect.Descriptor instead. -func (*MsgUpdateParams) Descriptor() ([]byte, []int) { - return file_poktroll_supplier_tx_proto_rawDescGZIP(), []int{0} +func (x *MsgUpdateParam) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUpdateParam)(x) } -func (x *MsgUpdateParams) GetAuthority() string { - if x != nil { - return x.Authority +func (x *MsgUpdateParam) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_supplier_tx_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms } - return "" + return mi.MessageOf(x) } -func (x *MsgUpdateParams) GetParams() *Params { - if x != nil { - return x.Params - } - return nil -} +var _fastReflection_MsgUpdateParam_messageType fastReflection_MsgUpdateParam_messageType +var _ protoreflect.MessageType = fastReflection_MsgUpdateParam_messageType{} -// MsgUpdateParamsResponse defines the response structure for executing a -// MsgUpdateParams message. -type MsgUpdateParamsResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} +type fastReflection_MsgUpdateParam_messageType struct{} -func (x *MsgUpdateParamsResponse) Reset() { - *x = MsgUpdateParamsResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_poktroll_supplier_tx_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } +func (x fastReflection_MsgUpdateParam_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUpdateParam)(nil) } - -func (x *MsgUpdateParamsResponse) String() string { - return protoimpl.X.MessageStringOf(x) +func (x fastReflection_MsgUpdateParam_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParam) } - -func (*MsgUpdateParamsResponse) ProtoMessage() {} - -// Deprecated: Use MsgUpdateParamsResponse.ProtoReflect.Descriptor instead. -func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { - return file_poktroll_supplier_tx_proto_rawDescGZIP(), []int{1} +func (x fastReflection_MsgUpdateParam_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParam } -type MsgStakeSupplier struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Signer string `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer,omitempty"` // The Bech32 address of the message signer (i.e. owner or operator) - OwnerAddress string `protobuf:"bytes,2,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address,omitempty"` // The Bech32 address of the owner (i.e. custodial, staker) - OperatorAddress string `protobuf:"bytes,3,opt,name=operator_address,json=operatorAddress,proto3" json:"operator_address,omitempty"` // The Bech32 address of the operator (i.e. provider, non-custodial) - Stake *v1beta1.Coin `protobuf:"bytes,4,opt,name=stake,proto3" json:"stake,omitempty"` // The total amount of uPOKT the supplier has staked. Must be ≥ to the current amount that the supplier has staked (if any) - Services []*shared.SupplierServiceConfig `protobuf:"bytes,5,rep,name=services,proto3" json:"services,omitempty"` // The list of services this supplier is staked to provide service for +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUpdateParam) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParam } -func (x *MsgStakeSupplier) Reset() { - *x = MsgStakeSupplier{} - if protoimpl.UnsafeEnabled { - mi := &file_poktroll_supplier_tx_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } +// 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 } -func (x *MsgStakeSupplier) String() string { - return protoimpl.X.MessageStringOf(x) +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUpdateParam) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParam) } -func (*MsgStakeSupplier) ProtoMessage() {} - -// Deprecated: Use MsgStakeSupplier.ProtoReflect.Descriptor instead. -func (*MsgStakeSupplier) Descriptor() ([]byte, []int) { - return file_poktroll_supplier_tx_proto_rawDescGZIP(), []int{2} +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUpdateParam) Interface() protoreflect.ProtoMessage { + return (*MsgUpdateParam)(x) } -func (x *MsgStakeSupplier) GetSigner() string { - if x != nil { - return x.Signer +// 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 != "" { + value := protoreflect.ValueOfString(x.AsType) + if !f(fd_MsgUpdateParam_asType, value) { + return + } } - return "" } -func (x *MsgStakeSupplier) GetOwnerAddress() string { - if x != nil { - return x.OwnerAddress +// 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.supplier.MsgUpdateParam.authority": + return x.Authority != "" + case "poktroll.supplier.MsgUpdateParam.name": + return x.Name != "" + case "poktroll.supplier.MsgUpdateParam.asType": + return x.AsType != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUpdateParam")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUpdateParam does not contain field %s", fd.FullName())) } - return "" } -func (x *MsgStakeSupplier) GetOperatorAddress() string { - if x != nil { - return x.OperatorAddress +// 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.supplier.MsgUpdateParam.authority": + x.Authority = "" + case "poktroll.supplier.MsgUpdateParam.name": + x.Name = "" + case "poktroll.supplier.MsgUpdateParam.asType": + x.AsType = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUpdateParam")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUpdateParam does not contain field %s", fd.FullName())) } - return "" } -func (x *MsgStakeSupplier) GetStake() *v1beta1.Coin { - if x != nil { - return x.Stake +// 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.supplier.MsgUpdateParam.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + case "poktroll.supplier.MsgUpdateParam.name": + value := x.Name + return protoreflect.ValueOfString(value) + case "poktroll.supplier.MsgUpdateParam.asType": + value := x.AsType + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUpdateParam")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUpdateParam does not contain field %s", descriptor.FullName())) } - return nil } -func (x *MsgStakeSupplier) GetServices() []*shared.SupplierServiceConfig { - if x != nil { - return x.Services +// 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.supplier.MsgUpdateParam.authority": + x.Authority = value.Interface().(string) + case "poktroll.supplier.MsgUpdateParam.name": + x.Name = value.Interface().(string) + case "poktroll.supplier.MsgUpdateParam.asType": + x.AsType = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUpdateParam")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUpdateParam does not contain field %s", fd.FullName())) } - return nil } -type MsgStakeSupplierResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields +// 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.supplier.MsgUpdateParam.authority": + panic(fmt.Errorf("field authority of message poktroll.supplier.MsgUpdateParam is not mutable")) + case "poktroll.supplier.MsgUpdateParam.name": + panic(fmt.Errorf("field name of message poktroll.supplier.MsgUpdateParam is not mutable")) + case "poktroll.supplier.MsgUpdateParam.asType": + panic(fmt.Errorf("field asType of message poktroll.supplier.MsgUpdateParam is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUpdateParam")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUpdateParam does not contain field %s", fd.FullName())) + } } -func (x *MsgStakeSupplierResponse) Reset() { - *x = MsgStakeSupplierResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_poktroll_supplier_tx_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) +// 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.supplier.MsgUpdateParam.authority": + return protoreflect.ValueOfString("") + case "poktroll.supplier.MsgUpdateParam.name": + return protoreflect.ValueOfString("") + case "poktroll.supplier.MsgUpdateParam.asType": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUpdateParam")) + } + panic(fmt.Errorf("message poktroll.supplier.MsgUpdateParam does not contain field %s", fd.FullName())) } } -func (x *MsgStakeSupplierResponse) String() string { - return protoimpl.X.MessageStringOf(x) +// 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() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.supplier.MsgUpdateParam", d.FullName())) + } + panic("unreachable") } -func (*MsgStakeSupplierResponse) ProtoMessage() {} +// 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)) + } + l = len(x.AsType) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*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) + } + if len(x.AsType) > 0 { + i -= len(x.AsType) + copy(dAtA[i:], x.AsType) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.AsType))) + i-- + dAtA[i] = 0x1a + } + 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 AsType", 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 = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgUpdateParamResponse protoreflect.MessageDescriptor + fd_MsgUpdateParamResponse_params protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_supplier_tx_proto_init() + md_MsgUpdateParamResponse = File_poktroll_supplier_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_supplier_tx_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_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 != "" { + value := protoreflect.ValueOfString(x.Params) + 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.supplier.MsgUpdateParamResponse.params": + return x.Params != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUpdateParamResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.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.supplier.MsgUpdateParamResponse.params": + x.Params = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUpdateParamResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.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.supplier.MsgUpdateParamResponse.params": + value := x.Params + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUpdateParamResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.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.supplier.MsgUpdateParamResponse.params": + x.Params = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUpdateParamResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.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.supplier.MsgUpdateParamResponse.params": + panic(fmt.Errorf("field params of message poktroll.supplier.MsgUpdateParamResponse is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUpdateParamResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.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.supplier.MsgUpdateParamResponse.params": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUpdateParamResponse")) + } + panic(fmt.Errorf("message poktroll.supplier.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.supplier.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 + l = len(x.Params) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*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 len(x.Params) > 0 { + i -= len(x.Params) + copy(dAtA[i:], x.Params) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Params))) + 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 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.Params = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/supplier/tx.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// MsgUpdateParams is the Msg/UpdateParams request type. +type MsgUpdateParams struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // authority is the address that controls the module (defaults to x/gov unless overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the x/supplier parameters to update. + // NOTE: All parameters must be supplied. + Params *Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty"` +} + +func (x *MsgUpdateParams) Reset() { + *x = MsgUpdateParams{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_supplier_tx_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUpdateParams) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUpdateParams) ProtoMessage() {} + +// Deprecated: Use MsgUpdateParams.ProtoReflect.Descriptor instead. +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return file_poktroll_supplier_tx_proto_rawDescGZIP(), []int{0} +} + +func (x *MsgUpdateParams) GetAuthority() string { + if x != nil { + return x.Authority + } + return "" +} + +func (x *MsgUpdateParams) GetParams() *Params { + if x != nil { + return x.Params + } + return nil +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +type MsgUpdateParamsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgUpdateParamsResponse) Reset() { + *x = MsgUpdateParamsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_supplier_tx_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUpdateParamsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUpdateParamsResponse) ProtoMessage() {} + +// Deprecated: Use MsgUpdateParamsResponse.ProtoReflect.Descriptor instead. +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return file_poktroll_supplier_tx_proto_rawDescGZIP(), []int{1} +} + +type MsgStakeSupplier struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Signer string `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer,omitempty"` // The Bech32 address of the message signer (i.e. owner or operator) + OwnerAddress string `protobuf:"bytes,2,opt,name=owner_address,json=ownerAddress,proto3" json:"owner_address,omitempty"` // The Bech32 address of the owner (i.e. custodial, staker) + OperatorAddress string `protobuf:"bytes,3,opt,name=operator_address,json=operatorAddress,proto3" json:"operator_address,omitempty"` // The Bech32 address of the operator (i.e. provider, non-custodial) + Stake *v1beta1.Coin `protobuf:"bytes,4,opt,name=stake,proto3" json:"stake,omitempty"` // The total amount of uPOKT the supplier has staked. Must be ≥ to the current amount that the supplier has staked (if any) + Services []*shared.SupplierServiceConfig `protobuf:"bytes,5,rep,name=services,proto3" json:"services,omitempty"` // The list of services this supplier is staked to provide service for +} + +func (x *MsgStakeSupplier) Reset() { + *x = MsgStakeSupplier{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_supplier_tx_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgStakeSupplier) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgStakeSupplier) ProtoMessage() {} + +// Deprecated: Use MsgStakeSupplier.ProtoReflect.Descriptor instead. +func (*MsgStakeSupplier) Descriptor() ([]byte, []int) { + return file_poktroll_supplier_tx_proto_rawDescGZIP(), []int{2} +} + +func (x *MsgStakeSupplier) GetSigner() string { + if x != nil { + return x.Signer + } + return "" +} + +func (x *MsgStakeSupplier) GetOwnerAddress() string { + if x != nil { + return x.OwnerAddress + } + return "" +} + +func (x *MsgStakeSupplier) GetOperatorAddress() string { + if x != nil { + return x.OperatorAddress + } + return "" +} + +func (x *MsgStakeSupplier) GetStake() *v1beta1.Coin { + if x != nil { + return x.Stake + } + return nil +} + +func (x *MsgStakeSupplier) GetServices() []*shared.SupplierServiceConfig { + if x != nil { + return x.Services + } + return nil +} + +type MsgStakeSupplierResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgStakeSupplierResponse) Reset() { + *x = MsgStakeSupplierResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_supplier_tx_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgStakeSupplierResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgStakeSupplierResponse) ProtoMessage() {} // Deprecated: Use MsgStakeSupplierResponse.ProtoReflect.Descriptor instead. func (*MsgStakeSupplierResponse) Descriptor() ([]byte, []int) { @@ -3084,6 +4052,92 @@ func (*MsgUnstakeSupplierResponse) Descriptor() ([]byte, []int) { return file_poktroll_supplier_tx_proto_rawDescGZIP(), []int{5} } +type MsgUpdateParam struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + AsType string `protobuf:"bytes,3,opt,name=asType,proto3" json:"asType,omitempty"` +} + +func (x *MsgUpdateParam) Reset() { + *x = MsgUpdateParam{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_supplier_tx_proto_msgTypes[6] + 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_supplier_tx_proto_rawDescGZIP(), []int{6} +} + +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() string { + if x != nil { + return x.AsType + } + return "" +} + +type MsgUpdateParamResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Params string `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` +} + +func (x *MsgUpdateParamResponse) Reset() { + *x = MsgUpdateParamResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_supplier_tx_proto_msgTypes[7] + 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_supplier_tx_proto_rawDescGZIP(), []int{7} +} + +func (x *MsgUpdateParamResponse) GetParams() string { + if x != nil { + return x.Params + } + return "" +} + var File_poktroll_supplier_tx_proto protoreflect.FileDescriptor var file_poktroll_supplier_tx_proto_rawDesc = []byte{ @@ -3149,38 +4203,54 @@ var file_poktroll_supplier_tx_proto_rawDesc = []byte{ 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x3a, 0x0b, 0x82, 0xe7, 0xb0, 0x2a, 0x06, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x22, 0x1c, 0x0a, 0x1a, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, - 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xb8, 0x02, 0x0a, 0x03, 0x4d, - 0x73, 0x67, 0x12, 0x5e, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x12, 0x22, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, - 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x2a, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x61, 0x0a, 0x0d, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, - 0x69, 0x65, 0x72, 0x12, 0x23, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, - 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, - 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x1a, 0x2b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, - 0x53, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x67, 0x0a, 0x0f, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, - 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x12, 0x25, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, - 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x1a, - 0x2d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, - 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, - 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, - 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xad, 0x01, 0xd8, 0xe2, 0x1e, 0x01, 0x0a, 0x15, 0x63, 0x6f, - 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, - 0x69, 0x65, 0x72, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x22, - 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, 0x75, 0x70, 0x70, 0x6c, 0x69, - 0x65, 0x72, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xca, 0x02, 0x11, 0x50, - 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, - 0xe2, 0x02, 0x1d, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x75, 0x70, 0x70, - 0x6c, 0x69, 0x65, 0x72, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0xea, 0x02, 0x12, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x75, 0x70, - 0x70, 0x6c, 0x69, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x6a, 0x0a, 0x0e, 0x4d, 0x73, + 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x1c, 0x0a, 0x09, + 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 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, 0x16, + 0x0a, 0x06, 0x61, 0x73, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, + 0x61, 0x73, 0x54, 0x79, 0x70, 0x65, 0x3a, 0x0e, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, + 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x22, 0x30, 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, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x32, 0x95, 0x03, 0x0a, 0x03, 0x4d, 0x73, 0x67, + 0x12, 0x5e, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x12, 0x22, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, + 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x2a, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, + 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x61, 0x0a, 0x0d, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, + 0x72, 0x12, 0x23, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, + 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, + 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x1a, 0x2b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x74, + 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x67, 0x0a, 0x0f, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, + 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x12, 0x25, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, + 0x73, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x1a, 0x2d, 0x2e, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, + 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, + 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5b, 0x0a, 0x0b, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x21, 0x2e, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, + 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x1a, 0x29, + 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, + 0x65, 0x72, 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, 0xad, 0x01, 0xd8, 0xe2, 0x1e, 0x01, 0x0a, 0x15, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x42, 0x07, + 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x22, 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, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xa2, 0x02, 0x03, + 0x50, 0x53, 0x58, 0xaa, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, + 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xca, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xe2, 0x02, 0x1d, 0x50, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5c, + 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x12, 0x50, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -3195,7 +4265,7 @@ func file_poktroll_supplier_tx_proto_rawDescGZIP() []byte { return file_poktroll_supplier_tx_proto_rawDescData } -var file_poktroll_supplier_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_poktroll_supplier_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_poktroll_supplier_tx_proto_goTypes = []interface{}{ (*MsgUpdateParams)(nil), // 0: poktroll.supplier.MsgUpdateParams (*MsgUpdateParamsResponse)(nil), // 1: poktroll.supplier.MsgUpdateParamsResponse @@ -3203,25 +4273,29 @@ var file_poktroll_supplier_tx_proto_goTypes = []interface{}{ (*MsgStakeSupplierResponse)(nil), // 3: poktroll.supplier.MsgStakeSupplierResponse (*MsgUnstakeSupplier)(nil), // 4: poktroll.supplier.MsgUnstakeSupplier (*MsgUnstakeSupplierResponse)(nil), // 5: poktroll.supplier.MsgUnstakeSupplierResponse - (*Params)(nil), // 6: poktroll.supplier.Params - (*v1beta1.Coin)(nil), // 7: cosmos.base.v1beta1.Coin - (*shared.SupplierServiceConfig)(nil), // 8: poktroll.shared.SupplierServiceConfig + (*MsgUpdateParam)(nil), // 6: poktroll.supplier.MsgUpdateParam + (*MsgUpdateParamResponse)(nil), // 7: poktroll.supplier.MsgUpdateParamResponse + (*Params)(nil), // 8: poktroll.supplier.Params + (*v1beta1.Coin)(nil), // 9: cosmos.base.v1beta1.Coin + (*shared.SupplierServiceConfig)(nil), // 10: poktroll.shared.SupplierServiceConfig } var file_poktroll_supplier_tx_proto_depIdxs = []int32{ - 6, // 0: poktroll.supplier.MsgUpdateParams.params:type_name -> poktroll.supplier.Params - 7, // 1: poktroll.supplier.MsgStakeSupplier.stake:type_name -> cosmos.base.v1beta1.Coin - 8, // 2: poktroll.supplier.MsgStakeSupplier.services:type_name -> poktroll.shared.SupplierServiceConfig - 0, // 3: poktroll.supplier.Msg.UpdateParams:input_type -> poktroll.supplier.MsgUpdateParams - 2, // 4: poktroll.supplier.Msg.StakeSupplier:input_type -> poktroll.supplier.MsgStakeSupplier - 4, // 5: poktroll.supplier.Msg.UnstakeSupplier:input_type -> poktroll.supplier.MsgUnstakeSupplier - 1, // 6: poktroll.supplier.Msg.UpdateParams:output_type -> poktroll.supplier.MsgUpdateParamsResponse - 3, // 7: poktroll.supplier.Msg.StakeSupplier:output_type -> poktroll.supplier.MsgStakeSupplierResponse - 5, // 8: poktroll.supplier.Msg.UnstakeSupplier:output_type -> poktroll.supplier.MsgUnstakeSupplierResponse - 6, // [6:9] is the sub-list for method output_type - 3, // [3:6] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name + 8, // 0: poktroll.supplier.MsgUpdateParams.params:type_name -> poktroll.supplier.Params + 9, // 1: poktroll.supplier.MsgStakeSupplier.stake:type_name -> cosmos.base.v1beta1.Coin + 10, // 2: poktroll.supplier.MsgStakeSupplier.services:type_name -> poktroll.shared.SupplierServiceConfig + 0, // 3: poktroll.supplier.Msg.UpdateParams:input_type -> poktroll.supplier.MsgUpdateParams + 2, // 4: poktroll.supplier.Msg.StakeSupplier:input_type -> poktroll.supplier.MsgStakeSupplier + 4, // 5: poktroll.supplier.Msg.UnstakeSupplier:input_type -> poktroll.supplier.MsgUnstakeSupplier + 6, // 6: poktroll.supplier.Msg.UpdateParam:input_type -> poktroll.supplier.MsgUpdateParam + 1, // 7: poktroll.supplier.Msg.UpdateParams:output_type -> poktroll.supplier.MsgUpdateParamsResponse + 3, // 8: poktroll.supplier.Msg.StakeSupplier:output_type -> poktroll.supplier.MsgStakeSupplierResponse + 5, // 9: poktroll.supplier.Msg.UnstakeSupplier:output_type -> poktroll.supplier.MsgUnstakeSupplierResponse + 7, // 10: poktroll.supplier.Msg.UpdateParam:output_type -> poktroll.supplier.MsgUpdateParamResponse + 7, // [7:11] is the sub-list for method output_type + 3, // [3:7] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name } func init() { file_poktroll_supplier_tx_proto_init() } @@ -3303,6 +4377,30 @@ func file_poktroll_supplier_tx_proto_init() { return nil } } + file_poktroll_supplier_tx_proto_msgTypes[6].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_supplier_tx_proto_msgTypes[7].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 + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -3310,7 +4408,7 @@ func file_poktroll_supplier_tx_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_poktroll_supplier_tx_proto_rawDesc, NumEnums: 0, - NumMessages: 6, + NumMessages: 8, NumExtensions: 0, NumServices: 1, }, diff --git a/api/poktroll/supplier/tx_grpc.pb.go b/api/poktroll/supplier/tx_grpc.pb.go index a95a976c9..1e175c012 100644 --- a/api/poktroll/supplier/tx_grpc.pb.go +++ b/api/poktroll/supplier/tx_grpc.pb.go @@ -22,6 +22,7 @@ const ( Msg_UpdateParams_FullMethodName = "/poktroll.supplier.Msg/UpdateParams" Msg_StakeSupplier_FullMethodName = "/poktroll.supplier.Msg/StakeSupplier" Msg_UnstakeSupplier_FullMethodName = "/poktroll.supplier.Msg/UnstakeSupplier" + Msg_UpdateParam_FullMethodName = "/poktroll.supplier.Msg/UpdateParam" ) // MsgClient is the client API for Msg service. @@ -35,6 +36,7 @@ type MsgClient interface { UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) StakeSupplier(ctx context.Context, in *MsgStakeSupplier, opts ...grpc.CallOption) (*MsgStakeSupplierResponse, error) UnstakeSupplier(ctx context.Context, in *MsgUnstakeSupplier, opts ...grpc.CallOption) (*MsgUnstakeSupplierResponse, error) + UpdateParam(ctx context.Context, in *MsgUpdateParam, opts ...grpc.CallOption) (*MsgUpdateParamResponse, error) } type msgClient struct { @@ -75,6 +77,16 @@ func (c *msgClient) UnstakeSupplier(ctx context.Context, in *MsgUnstakeSupplier, return out, nil } +func (c *msgClient) UpdateParam(ctx context.Context, in *MsgUpdateParam, opts ...grpc.CallOption) (*MsgUpdateParamResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(MsgUpdateParamResponse) + err := c.cc.Invoke(ctx, Msg_UpdateParam_FullMethodName, in, out, cOpts...) + 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 @@ -86,6 +98,7 @@ type MsgServer interface { UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) StakeSupplier(context.Context, *MsgStakeSupplier) (*MsgStakeSupplierResponse, error) UnstakeSupplier(context.Context, *MsgUnstakeSupplier) (*MsgUnstakeSupplierResponse, error) + UpdateParam(context.Context, *MsgUpdateParam) (*MsgUpdateParamResponse, error) mustEmbedUnimplementedMsgServer() } @@ -102,6 +115,9 @@ func (UnimplementedMsgServer) StakeSupplier(context.Context, *MsgStakeSupplier) func (UnimplementedMsgServer) UnstakeSupplier(context.Context, *MsgUnstakeSupplier) (*MsgUnstakeSupplierResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UnstakeSupplier 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. @@ -169,6 +185,24 @@ func _Msg_UnstakeSupplier_Handler(srv interface{}, ctx context.Context, dec func 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) @@ -188,6 +222,10 @@ var Msg_ServiceDesc = grpc.ServiceDesc{ MethodName: "UnstakeSupplier", Handler: _Msg_UnstakeSupplier_Handler, }, + { + MethodName: "UpdateParam", + Handler: _Msg_UpdateParam_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "poktroll/supplier/tx.proto", diff --git a/proto/poktroll/supplier/tx.proto b/proto/poktroll/supplier/tx.proto index 1e13c9d71..3ea465525 100644 --- a/proto/poktroll/supplier/tx.proto +++ b/proto/poktroll/supplier/tx.proto @@ -1,4 +1,5 @@ syntax = "proto3"; + package poktroll.supplier; option go_package = "github.com/pokt-network/poktroll/x/supplier/types"; @@ -9,33 +10,32 @@ import "cosmos/msg/v1/msg.proto"; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; import "cosmos/base/v1beta1/coin.proto"; - import "poktroll/supplier/params.proto"; import "poktroll/shared/service.proto"; - // 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 StakeSupplier (MsgStakeSupplier ) returns (MsgStakeSupplierResponse ); rpc UnstakeSupplier (MsgUnstakeSupplier) returns (MsgUnstakeSupplierResponse); + 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/supplier/MsgUpdateParams"; - + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "poktroll/x/supplier/MsgUpdateParams"; + // authority is the address that controls the module (defaults to x/gov unless overwritten). string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // TODO_IMPROVE(#322): The requirement to provide all params is adopted from the // latest Cosmos SDK version. We should look into either improving this ourselves // or seeing if it is on their roadmap. - + // params defines the x/supplier parameters to update. // NOTE: All parameters must be supplied. Params params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; @@ -47,22 +47,31 @@ message MsgUpdateParamsResponse {} message MsgStakeSupplier { option (cosmos.msg.v1.signer) = "signer"; // https://docs.cosmos.network/main/build/building-modules/messages-and-queries - - string signer = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the message signer (i.e. owner or operator) - string owner_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the owner (i.e. custodial, staker) - string operator_address = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the operator (i.e. provider, non-custodial) - cosmos.base.v1beta1.Coin stake = 4; // The total amount of uPOKT the supplier has staked. Must be ≥ to the current amount that the supplier has staked (if any) - repeated poktroll.shared.SupplierServiceConfig services = 5; // The list of services this supplier is staked to provide service for + string signer = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the message signer (i.e. owner or operator) + string owner_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the owner (i.e. custodial, staker) + string operator_address = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the operator (i.e. provider, non-custodial) + cosmos.base.v1beta1.Coin stake = 4; // The total amount of uPOKT the supplier has staked. Must be ≥ to the current amount that the supplier has staked (if any) + repeated poktroll.shared.SupplierServiceConfig services = 5; // The list of services this supplier is staked to provide service for } message MsgStakeSupplierResponse {} message MsgUnstakeSupplier { option (cosmos.msg.v1.signer) = "signer"; - - string signer = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the message signer (i.e. owner or operator) + string signer = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the message signer (i.e. owner or operator) string operator_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the operator (i.e. provider, non-custodial) } message MsgUnstakeSupplierResponse {} +message MsgUpdateParam { + option (cosmos.msg.v1.signer) = "authority"; + string authority = 1; + string name = 2; + string asType = 3; +} + +message MsgUpdateParamResponse { + string params = 1; +} + diff --git a/x/supplier/keeper/msg_server_update_param.go b/x/supplier/keeper/msg_server_update_param.go new file mode 100644 index 000000000..1cd4e9eb5 --- /dev/null +++ b/x/supplier/keeper/msg_server_update_param.go @@ -0,0 +1,18 @@ +package keeper + +import ( + "context" + + "github.com/pokt-network/poktroll/x/supplier/types" + sdk "github.com/cosmos/cosmos-sdk/types" +) + + +func (k msgServer) UpdateParam(goCtx context.Context, msg *types.MsgUpdateParam) (*types.MsgUpdateParamResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + // TODO: Handling the message + _ = ctx + + return &types.MsgUpdateParamResponse{}, nil +} diff --git a/x/supplier/module/autocli.go b/x/supplier/module/autocli.go index 6a3afe3a9..c85b4c516 100644 --- a/x/supplier/module/autocli.go +++ b/x/supplier/module/autocli.go @@ -34,7 +34,7 @@ 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{ + RpcCommandOptions: []*autocliv1.RpcCommandOptions{ //{ // RpcMethod: "UpdateParams", // Skip: true, // skipped because authority gated @@ -51,6 +51,12 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { // Short: "Send a unstake-supplier tx", // PositionalArgs: []*autocliv1.PositionalArgDescriptor{}, //}, + { + 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/supplier/module/simulation.go b/x/supplier/module/simulation.go index cf9e6236f..474034628 100644 --- a/x/supplier/module/simulation.go +++ b/x/supplier/module/simulation.go @@ -31,6 +31,10 @@ const ( // TODO: Determine the simulation weight value defaultWeightMsgUnstakeSupplier int = 100 + 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 ) @@ -81,6 +85,17 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp suppliersimulation.SimulateMsgUnstakeSupplier(am.accountKeeper, am.bankKeeper, am.supplierKeeper), )) + var weightMsgUpdateParam int + simState.AppParams.GetOrGenerate(opWeightMsgUpdateParam, &weightMsgUpdateParam, nil, + func(_ *rand.Rand) { + weightMsgUpdateParam = defaultWeightMsgUpdateParam + }, + ) + operations = append(operations, simulation.NewWeightedOperation( + weightMsgUpdateParam, + suppliersimulation.SimulateMsgUpdateParam(am.accountKeeper, am.bankKeeper, am.keeper), + )) + // this line is used by starport scaffolding # simapp/module/operation return operations @@ -105,6 +120,14 @@ func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.Wei return nil }, ), + simulation.NewWeightedProposalMsg( + opWeightMsgUpdateParam, + defaultWeightMsgUpdateParam, + func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { + suppliersimulation.SimulateMsgUpdateParam(am.accountKeeper, am.bankKeeper, am.keeper) + return nil + }, + ), // this line is used by starport scaffolding # simapp/module/OpMsg } } diff --git a/x/supplier/simulation/update_param.go b/x/supplier/simulation/update_param.go new file mode 100644 index 000000000..9a2bab9cd --- /dev/null +++ b/x/supplier/simulation/update_param.go @@ -0,0 +1,29 @@ +package simulation + +import ( + "math/rand" + + "github.com/pokt-network/poktroll/x/supplier/keeper" + "github.com/pokt-network/poktroll/x/supplier/types" + "github.com/cosmos/cosmos-sdk/baseapp" + sdk "github.com/cosmos/cosmos-sdk/types" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" +) + +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/supplier/types/codec.go b/x/supplier/types/codec.go index 9ecbe1202..185211e8a 100644 --- a/x/supplier/types/codec.go +++ b/x/supplier/types/codec.go @@ -14,6 +14,9 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { registry.RegisterImplementations((*sdk.Msg)(nil), &MsgUnstakeSupplier{}, ) + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgUpdateParam{}, + ) // this line is used by starport scaffolding # 3 registry.RegisterImplementations((*sdk.Msg)(nil), diff --git a/x/supplier/types/message_update_param.go b/x/supplier/types/message_update_param.go new file mode 100644 index 000000000..89d033fd5 --- /dev/null +++ b/x/supplier/types/message_update_param.go @@ -0,0 +1,26 @@ +package types + +import ( + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +var _ sdk.Msg = &MsgUpdateParam{} + +func NewMsgUpdateParam(authority string, name string, asType string) *MsgUpdateParam { + return &MsgUpdateParam{ + Authority: authority, + Name: name, + AsType: asType, + } +} + +func (msg *MsgUpdateParam) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.Authority) + if err != nil { + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid authority address (%s)", err) + } + return nil +} + diff --git a/x/supplier/types/message_update_param_test.go b/x/supplier/types/message_update_param_test.go new file mode 100644 index 000000000..406337ff2 --- /dev/null +++ b/x/supplier/types/message_update_param_test.go @@ -0,0 +1,40 @@ +package types + +import ( + "testing" + + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/stretchr/testify/require" + "github.com/pokt-network/poktroll/testutil/sample" +) + +func TestMsgUpdateParam_ValidateBasic(t *testing.T) { + tests := []struct { + name string + msg MsgUpdateParam + err error + }{ + { + name: "invalid address", + msg: MsgUpdateParam{ + Authority: "invalid_address", + }, + err: sdkerrors.ErrInvalidAddress, + }, { + name: "valid address", + msg: MsgUpdateParam{ + Authority: sample.AccAddress(), + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := tt.msg.ValidateBasic() + if tt.err != nil { + require.ErrorIs(t, err, tt.err) + return + } + require.NoError(t, err) + }) + } +} diff --git a/x/supplier/types/tx.pb.go b/x/supplier/types/tx.pb.go index d08f9199e..5ea894944 100644 --- a/x/supplier/types/tx.pb.go +++ b/x/supplier/types/tx.pb.go @@ -303,6 +303,102 @@ func (m *MsgUnstakeSupplierResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUnstakeSupplierResponse proto.InternalMessageInfo +type MsgUpdateParam struct { + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + AsType string `protobuf:"bytes,3,opt,name=asType,proto3" json:"asType,omitempty"` +} + +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_63b974929807ef57, []int{6} +} +func (m *MsgUpdateParam) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParam) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + 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 + +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) GetAsType() string { + if m != nil { + return m.AsType + } + return "" +} + +type MsgUpdateParamResponse struct { + Params string `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_63b974929807ef57, []int{7} +} +func (m *MsgUpdateParamResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParamResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + 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() string { + if m != nil { + return m.Params + } + return "" +} + func init() { proto.RegisterType((*MsgUpdateParams)(nil), "poktroll.supplier.MsgUpdateParams") proto.RegisterType((*MsgUpdateParamsResponse)(nil), "poktroll.supplier.MsgUpdateParamsResponse") @@ -310,49 +406,56 @@ func init() { proto.RegisterType((*MsgStakeSupplierResponse)(nil), "poktroll.supplier.MsgStakeSupplierResponse") proto.RegisterType((*MsgUnstakeSupplier)(nil), "poktroll.supplier.MsgUnstakeSupplier") proto.RegisterType((*MsgUnstakeSupplierResponse)(nil), "poktroll.supplier.MsgUnstakeSupplierResponse") + proto.RegisterType((*MsgUpdateParam)(nil), "poktroll.supplier.MsgUpdateParam") + proto.RegisterType((*MsgUpdateParamResponse)(nil), "poktroll.supplier.MsgUpdateParamResponse") } func init() { proto.RegisterFile("poktroll/supplier/tx.proto", fileDescriptor_63b974929807ef57) } var fileDescriptor_63b974929807ef57 = []byte{ - // 588 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0x31, 0x8f, 0x12, 0x41, - 0x18, 0x65, 0x41, 0x88, 0x0c, 0x77, 0xe1, 0x6e, 0x73, 0xc9, 0x2d, 0x1b, 0x5d, 0x09, 0x17, 0x0d, - 0xc1, 0xb0, 0x23, 0x98, 0x5c, 0x71, 0xd1, 0x42, 0xa8, 0x89, 0x06, 0x62, 0x63, 0xe1, 0x65, 0x80, - 0x71, 0xd8, 0x00, 0x3b, 0x9b, 0x99, 0x81, 0xbb, 0xeb, 0x8c, 0xa5, 0x95, 0xa5, 0x3f, 0xc1, 0x92, - 0xc2, 0xc2, 0xce, 0xf6, 0x62, 0x75, 0xb1, 0xba, 0xca, 0x18, 0x28, 0xf8, 0x1b, 0x66, 0x77, 0x67, - 0x40, 0x16, 0x94, 0x33, 0x36, 0xc0, 0xcc, 0x7b, 0xef, 0xfb, 0xde, 0xbc, 0xf9, 0x06, 0x60, 0x7a, - 0xb4, 0x2f, 0x18, 0x1d, 0x0c, 0x20, 0x1f, 0x79, 0xde, 0xc0, 0xc1, 0x0c, 0x8a, 0x73, 0xdb, 0x63, - 0x54, 0x50, 0x7d, 0x5f, 0x61, 0xb6, 0xc2, 0xcc, 0x7d, 0x34, 0x74, 0x5c, 0x0a, 0x83, 0xcf, 0x90, - 0x65, 0x1e, 0x76, 0x28, 0x1f, 0x52, 0x0e, 0x87, 0x9c, 0xc0, 0x71, 0xc5, 0xff, 0x92, 0x40, 0x2e, - 0x04, 0x4e, 0x83, 0x15, 0x0c, 0x17, 0x12, 0x3a, 0x20, 0x94, 0xd0, 0x70, 0xdf, 0xff, 0x25, 0x77, - 0x2d, 0x59, 0xa9, 0x8d, 0x38, 0x86, 0xe3, 0x4a, 0x1b, 0x0b, 0x54, 0x81, 0x1d, 0xea, 0xb8, 0x0a, - 0x5f, 0xf7, 0xea, 0x21, 0x86, 0x86, 0xaa, 0xea, 0xdd, 0x25, 0xde, 0x43, 0x0c, 0x77, 0x21, 0xc7, - 0x6c, 0xec, 0x74, 0x70, 0x08, 0x17, 0xbe, 0x6a, 0x20, 0xdb, 0xe0, 0xe4, 0xa5, 0xd7, 0x45, 0x02, - 0xbf, 0x08, 0x84, 0xfa, 0x31, 0x48, 0xa3, 0x91, 0xe8, 0x51, 0xe6, 0x88, 0x0b, 0x43, 0xcb, 0x6b, - 0xc5, 0x74, 0xcd, 0xf8, 0xfe, 0xb9, 0x7c, 0x20, 0xdd, 0x3e, 0xeb, 0x76, 0x19, 0xe6, 0xbc, 0x25, - 0x98, 0xe3, 0x92, 0xe6, 0x92, 0xaa, 0x3f, 0x01, 0xa9, 0xb0, 0xb5, 0x11, 0xcf, 0x6b, 0xc5, 0x4c, - 0x35, 0x67, 0xaf, 0x65, 0x65, 0x87, 0x2d, 0x6a, 0xe9, 0xcb, 0x1f, 0xf7, 0x62, 0x9f, 0xe6, 0x93, - 0x92, 0xd6, 0x94, 0x9a, 0x93, 0xe3, 0x77, 0xf3, 0x49, 0x69, 0x59, 0xed, 0xfd, 0x7c, 0x52, 0x3a, - 0x5a, 0x78, 0x3f, 0x5f, 0x9e, 0x2e, 0xe2, 0xb6, 0x90, 0x03, 0x87, 0x91, 0xad, 0x26, 0xe6, 0x1e, - 0x75, 0x39, 0x2e, 0x7c, 0x8b, 0x83, 0xbd, 0x06, 0x27, 0x2d, 0x81, 0xfa, 0xb8, 0x25, 0xf5, 0xfa, - 0x23, 0x90, 0xe2, 0x0e, 0x71, 0x31, 0xdb, 0x7a, 0x34, 0xc9, 0xd3, 0x9f, 0x82, 0x5d, 0x7a, 0xe6, - 0x62, 0x76, 0x8a, 0x42, 0x38, 0x38, 0xde, 0xdf, 0x84, 0x3b, 0x01, 0x5d, 0xee, 0xe9, 0x75, 0xb0, - 0x47, 0x3d, 0xcc, 0x90, 0xa0, 0xcb, 0x0a, 0x89, 0x2d, 0x15, 0xb2, 0x4a, 0xa1, 0x8a, 0x40, 0x90, - 0xe4, 0xfe, 0x31, 0x8c, 0x5b, 0x32, 0x5a, 0x29, 0xf3, 0xc7, 0xc2, 0x96, 0x63, 0x61, 0xd7, 0xa9, - 0xe3, 0x36, 0x43, 0x9e, 0x5e, 0x03, 0xb7, 0xe5, 0x4d, 0x73, 0x23, 0x99, 0x4f, 0x14, 0x33, 0xd5, - 0x07, 0xbf, 0x5d, 0x47, 0x30, 0x0a, 0xb6, 0xca, 0xa4, 0x15, 0x12, 0xeb, 0xd4, 0x7d, 0xe3, 0x90, - 0xe6, 0x42, 0x77, 0x92, 0xf1, 0xaf, 0x44, 0xa6, 0x50, 0x30, 0x81, 0x11, 0xcd, 0x72, 0x11, 0xf4, - 0x47, 0x0d, 0xe8, 0xfe, 0x25, 0xb8, 0xfc, 0x3f, 0xa3, 0xde, 0x94, 0x55, 0xfc, 0x1f, 0xb3, 0x5a, - 0xb5, 0x7d, 0x07, 0x98, 0xeb, 0xce, 0x94, 0xf1, 0xea, 0x97, 0x38, 0x48, 0x34, 0x38, 0xd1, 0x5f, - 0x83, 0x9d, 0x95, 0x27, 0x50, 0xd8, 0x30, 0xba, 0x91, 0x29, 0x33, 0x4b, 0xdb, 0x39, 0xaa, 0x8f, - 0x8e, 0xc0, 0xee, 0xea, 0x14, 0x1e, 0x6d, 0x16, 0xaf, 0x90, 0xcc, 0x87, 0x37, 0x20, 0x2d, 0x5a, - 0x10, 0x90, 0x8d, 0xe6, 0x7f, 0xff, 0x0f, 0x0e, 0x57, 0x69, 0x66, 0xf9, 0x46, 0x34, 0xd5, 0xc8, - 0x4c, 0xbe, 0xf5, 0xdf, 0x6d, 0xed, 0xf9, 0xe5, 0xd4, 0xd2, 0xae, 0xa6, 0x96, 0x76, 0x3d, 0xb5, - 0xb4, 0x9f, 0x53, 0x4b, 0xfb, 0x30, 0xb3, 0x62, 0x57, 0x33, 0x2b, 0x76, 0x3d, 0xb3, 0x62, 0xaf, - 0x2a, 0xc4, 0x11, 0xbd, 0x51, 0xdb, 0xee, 0xd0, 0x21, 0xf4, 0xab, 0x97, 0x5d, 0x2c, 0xce, 0x28, - 0xeb, 0xc3, 0x4d, 0x4f, 0x5a, 0x5c, 0x78, 0x98, 0xb7, 0x53, 0xc1, 0x3f, 0xd2, 0xe3, 0x5f, 0x01, - 0x00, 0x00, 0xff, 0xff, 0xb5, 0x70, 0x92, 0x1e, 0x7e, 0x05, 0x00, 0x00, + // 661 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0x3f, 0x6f, 0xd3, 0x4e, + 0x18, 0x8e, 0x9b, 0x36, 0xfa, 0xf5, 0xd2, 0xbf, 0xa7, 0xaa, 0x75, 0xad, 0xfe, 0x4c, 0x71, 0x05, + 0x2a, 0x41, 0xf5, 0x35, 0x45, 0xea, 0x50, 0xc1, 0x40, 0x3a, 0x57, 0x20, 0x07, 0x16, 0x90, 0xa8, + 0x2e, 0xc9, 0xe1, 0x9a, 0xd6, 0x3e, 0xeb, 0xee, 0xfa, 0x27, 0x1b, 0x62, 0x64, 0x62, 0x41, 0xe2, + 0x23, 0x30, 0x66, 0x60, 0x67, 0xad, 0x98, 0x2a, 0xa6, 0x4e, 0x08, 0x25, 0x43, 0xbe, 0x06, 0xb2, + 0xef, 0xec, 0xc4, 0x49, 0x20, 0x45, 0x2c, 0x89, 0xef, 0xde, 0xe7, 0x7d, 0xde, 0xe7, 0x9e, 0xf7, + 0xbd, 0x03, 0x46, 0x48, 0x8f, 0x05, 0xa3, 0x27, 0x27, 0x88, 0x9f, 0x86, 0xe1, 0x89, 0x47, 0x18, + 0x12, 0x17, 0x76, 0xc8, 0xa8, 0xa0, 0x70, 0x31, 0x89, 0xd9, 0x49, 0xcc, 0x58, 0xc4, 0xbe, 0x17, + 0x50, 0x14, 0xff, 0x4a, 0x94, 0xb1, 0x52, 0xa7, 0xdc, 0xa7, 0x1c, 0xf9, 0xdc, 0x45, 0x67, 0xe5, + 0xe8, 0x4f, 0x05, 0x56, 0x65, 0xe0, 0x30, 0x5e, 0x21, 0xb9, 0x50, 0xa1, 0x25, 0x97, 0xba, 0x54, + 0xee, 0x47, 0x5f, 0x6a, 0xd7, 0x54, 0x4c, 0x35, 0xcc, 0x09, 0x3a, 0x2b, 0xd7, 0x88, 0xc0, 0x65, + 0x54, 0xa7, 0x5e, 0x90, 0xc4, 0x87, 0xb5, 0x86, 0x98, 0x61, 0x3f, 0x61, 0xfd, 0xbf, 0x17, 0x3f, + 0xc2, 0x8c, 0x34, 0x10, 0x27, 0xec, 0xcc, 0xab, 0x13, 0x19, 0xb6, 0xbe, 0x6a, 0x60, 0xfe, 0x80, + 0xbb, 0xcf, 0xc3, 0x06, 0x16, 0xe4, 0x69, 0x9c, 0x08, 0x77, 0xc1, 0x34, 0x3e, 0x15, 0x47, 0x94, + 0x79, 0xa2, 0xa9, 0x6b, 0xeb, 0xda, 0xe6, 0x74, 0x45, 0xff, 0xfe, 0x65, 0x6b, 0x49, 0xa9, 0x7d, + 0xdc, 0x68, 0x30, 0xc2, 0x79, 0x55, 0x30, 0x2f, 0x70, 0x9d, 0x1e, 0x14, 0x3e, 0x04, 0x05, 0x59, + 0x5a, 0x9f, 0x58, 0xd7, 0x36, 0x8b, 0x3b, 0xab, 0xf6, 0x90, 0x57, 0xb6, 0x2c, 0x51, 0x99, 0xbe, + 0xfc, 0x71, 0x2b, 0xf7, 0xb9, 0xdb, 0x2a, 0x69, 0x8e, 0xca, 0xd9, 0xdb, 0x7d, 0xd7, 0x6d, 0x95, + 0x7a, 0x6c, 0xef, 0xbb, 0xad, 0xd2, 0x46, 0xaa, 0xfd, 0xa2, 0x77, 0xba, 0x01, 0xb5, 0xd6, 0x2a, + 0x58, 0x19, 0xd8, 0x72, 0x08, 0x0f, 0x69, 0xc0, 0x89, 0xf5, 0x6d, 0x02, 0x2c, 0x1c, 0x70, 0xb7, + 0x2a, 0xf0, 0x31, 0xa9, 0xaa, 0x7c, 0xb8, 0x0d, 0x0a, 0xdc, 0x73, 0x03, 0xc2, 0xc6, 0x1e, 0x4d, + 0xe1, 0xe0, 0x23, 0x30, 0x4b, 0xcf, 0x03, 0xc2, 0x0e, 0xb1, 0x0c, 0xc7, 0xc7, 0xfb, 0x53, 0xe2, + 0x4c, 0x0c, 0x57, 0x7b, 0x70, 0x1f, 0x2c, 0xd0, 0x90, 0x30, 0x2c, 0x68, 0x8f, 0x21, 0x3f, 0x86, + 0x61, 0x3e, 0xc9, 0x48, 0x48, 0x10, 0x98, 0xe2, 0xd1, 0x31, 0xf4, 0x49, 0x65, 0xad, 0x4a, 0x8b, + 0xc6, 0xc2, 0x56, 0x63, 0x61, 0xef, 0x53, 0x2f, 0x70, 0x24, 0x0e, 0x56, 0xc0, 0x7f, 0xaa, 0xd3, + 0x5c, 0x9f, 0x5a, 0xcf, 0x6f, 0x16, 0x77, 0xee, 0xf6, 0xb5, 0x23, 0x1e, 0x05, 0x3b, 0xf1, 0xa4, + 0x2a, 0x81, 0xfb, 0x34, 0x78, 0xed, 0xb9, 0x4e, 0x9a, 0xb7, 0x57, 0x8c, 0x5a, 0xa2, 0x5c, 0xb0, + 0x0c, 0xa0, 0x0f, 0x7a, 0x99, 0x1a, 0xfd, 0x49, 0x03, 0x30, 0x6a, 0x42, 0xc0, 0xff, 0xd1, 0xea, + 0x51, 0x5e, 0x4d, 0xfc, 0xa5, 0x57, 0x59, 0xd9, 0x6b, 0xc0, 0x18, 0x56, 0x96, 0x0a, 0x7f, 0x03, + 0xe6, 0xb2, 0xc3, 0x03, 0xd7, 0x86, 0x86, 0xbf, 0x7f, 0xc4, 0x21, 0x98, 0x0c, 0xb0, 0x4f, 0xa4, + 0x26, 0x27, 0xfe, 0x86, 0xcb, 0xa0, 0x80, 0xf9, 0xb3, 0x66, 0x48, 0x64, 0x57, 0x1d, 0xb5, 0xda, + 0x9b, 0xcb, 0x0e, 0xb4, 0xb5, 0x0d, 0x96, 0xb3, 0xb5, 0x12, 0x15, 0x11, 0x83, 0xba, 0x38, 0xb2, + 0xa0, 0x5a, 0xed, 0x7c, 0xcc, 0x83, 0xfc, 0x01, 0x77, 0xe1, 0x2b, 0x30, 0x93, 0xb9, 0xa0, 0xd6, + 0x88, 0x8b, 0x35, 0x70, 0x07, 0x8c, 0xd2, 0x78, 0x4c, 0x5a, 0x1f, 0x83, 0xd9, 0xec, 0x1d, 0xd9, + 0x18, 0x9d, 0x9c, 0x01, 0x19, 0xf7, 0x6f, 0x00, 0x4a, 0x4b, 0xb8, 0x60, 0x7e, 0x70, 0x3a, 0xee, + 0xfc, 0x46, 0x61, 0x16, 0x66, 0x6c, 0xdd, 0x08, 0x96, 0x16, 0x7a, 0x09, 0x8a, 0xfd, 0xed, 0xbc, + 0x3d, 0xd6, 0x06, 0xe3, 0xde, 0x58, 0x48, 0x42, 0x6e, 0x4c, 0xbd, 0x8d, 0x9e, 0xac, 0xca, 0x93, + 0xcb, 0xb6, 0xa9, 0x5d, 0xb5, 0x4d, 0xed, 0xba, 0x6d, 0x6a, 0x3f, 0xdb, 0xa6, 0xf6, 0xa1, 0x63, + 0xe6, 0xae, 0x3a, 0x66, 0xee, 0xba, 0x63, 0xe6, 0x5e, 0x94, 0x5d, 0x4f, 0x1c, 0x9d, 0xd6, 0xec, + 0x3a, 0xf5, 0x51, 0xc4, 0xbc, 0x15, 0x10, 0x71, 0x4e, 0xd9, 0x31, 0x1a, 0xf5, 0x9a, 0x89, 0x66, + 0x48, 0x78, 0xad, 0x10, 0x3f, 0xc6, 0x0f, 0x7e, 0x05, 0x00, 0x00, 0xff, 0xff, 0x00, 0xb0, 0x9b, + 0xb1, 0x79, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -372,6 +475,7 @@ type MsgClient interface { UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) StakeSupplier(ctx context.Context, in *MsgStakeSupplier, opts ...grpc.CallOption) (*MsgStakeSupplierResponse, error) UnstakeSupplier(ctx context.Context, in *MsgUnstakeSupplier, opts ...grpc.CallOption) (*MsgUnstakeSupplierResponse, error) + UpdateParam(ctx context.Context, in *MsgUpdateParam, opts ...grpc.CallOption) (*MsgUpdateParamResponse, error) } type msgClient struct { @@ -409,6 +513,15 @@ func (c *msgClient) UnstakeSupplier(ctx context.Context, in *MsgUnstakeSupplier, 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.supplier.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 @@ -416,6 +529,7 @@ type MsgServer interface { UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) StakeSupplier(context.Context, *MsgStakeSupplier) (*MsgStakeSupplierResponse, error) UnstakeSupplier(context.Context, *MsgUnstakeSupplier) (*MsgUnstakeSupplierResponse, error) + UpdateParam(context.Context, *MsgUpdateParam) (*MsgUpdateParamResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -431,6 +545,9 @@ func (*UnimplementedMsgServer) StakeSupplier(ctx context.Context, req *MsgStakeS func (*UnimplementedMsgServer) UnstakeSupplier(ctx context.Context, req *MsgUnstakeSupplier) (*MsgUnstakeSupplierResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UnstakeSupplier 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) @@ -490,6 +607,24 @@ func _Msg_UnstakeSupplier_Handler(srv interface{}, ctx context.Context, dec func 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.supplier.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.supplier.Msg", HandlerType: (*MsgServer)(nil), @@ -506,6 +641,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "UnstakeSupplier", Handler: _Msg_UnstakeSupplier_Handler, }, + { + MethodName: "UpdateParam", + Handler: _Msg_UpdateParam_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "poktroll/supplier/tx.proto", @@ -727,6 +866,80 @@ func (m *MsgUnstakeSupplierResponse) MarshalToSizedBuffer(dAtA []byte) (int, err 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 len(m.AsType) > 0 { + i -= len(m.AsType) + copy(dAtA[i:], m.AsType) + i = encodeVarintTx(dAtA, i, uint64(len(m.AsType))) + i-- + dAtA[i] = 0x1a + } + 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 *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 len(m.Params) > 0 { + i -= len(m.Params) + copy(dAtA[i:], m.Params) + i = encodeVarintTx(dAtA, i, uint64(len(m.Params))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -828,6 +1041,40 @@ func (m *MsgUnstakeSupplierResponse) 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)) + } + l = len(m.AsType) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgUpdateParamResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Params) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1429,6 +1676,234 @@ func (m *MsgUnstakeSupplierResponse) 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 AsType", 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 = string(dAtA[iNdEx:postIndex]) + 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 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.Params = string(dAtA[iNdEx:postIndex]) + 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 From bb0267d28eac828eccd2ddc0848bb46a80fd33f2 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 2 Oct 2024 11:29:56 +0200 Subject: [PATCH 067/139] chore: update MsgUpdateParam & MsgUpdateParamResponse field types --- api/poktroll/supplier/tx.pulsar.go | 336 +++++++++++++++++++---------- proto/poktroll/supplier/tx.proto | 12 +- x/supplier/types/tx.pb.go | 236 +++++++++++++------- 3 files changed, 385 insertions(+), 199 deletions(-) diff --git a/api/poktroll/supplier/tx.pulsar.go b/api/poktroll/supplier/tx.pulsar.go index 40b60bec4..7a709f7f0 100644 --- a/api/poktroll/supplier/tx.pulsar.go +++ b/api/poktroll/supplier/tx.pulsar.go @@ -2838,7 +2838,7 @@ var ( md_MsgUpdateParam protoreflect.MessageDescriptor fd_MsgUpdateParam_authority protoreflect.FieldDescriptor fd_MsgUpdateParam_name protoreflect.FieldDescriptor - fd_MsgUpdateParam_asType protoreflect.FieldDescriptor + fd_MsgUpdateParam_as_coin protoreflect.FieldDescriptor ) func init() { @@ -2846,7 +2846,7 @@ func init() { md_MsgUpdateParam = File_poktroll_supplier_tx_proto.Messages().ByName("MsgUpdateParam") fd_MsgUpdateParam_authority = md_MsgUpdateParam.Fields().ByName("authority") fd_MsgUpdateParam_name = md_MsgUpdateParam.Fields().ByName("name") - fd_MsgUpdateParam_asType = md_MsgUpdateParam.Fields().ByName("asType") + fd_MsgUpdateParam_as_coin = md_MsgUpdateParam.Fields().ByName("as_coin") } var _ protoreflect.Message = (*fastReflection_MsgUpdateParam)(nil) @@ -2926,10 +2926,14 @@ func (x *fastReflection_MsgUpdateParam) Range(f func(protoreflect.FieldDescripto return } } - if x.AsType != "" { - value := protoreflect.ValueOfString(x.AsType) - if !f(fd_MsgUpdateParam_asType, value) { - return + if x.AsType != nil { + switch o := x.AsType.(type) { + case *MsgUpdateParam_AsCoin: + v := o.AsCoin + value := protoreflect.ValueOfMessage(v.ProtoReflect()) + if !f(fd_MsgUpdateParam_as_coin, value) { + return + } } } } @@ -2951,8 +2955,14 @@ func (x *fastReflection_MsgUpdateParam) Has(fd protoreflect.FieldDescriptor) boo return x.Authority != "" case "poktroll.supplier.MsgUpdateParam.name": return x.Name != "" - case "poktroll.supplier.MsgUpdateParam.asType": - return x.AsType != "" + case "poktroll.supplier.MsgUpdateParam.as_coin": + if x.AsType == nil { + return false + } else if _, ok := x.AsType.(*MsgUpdateParam_AsCoin); ok { + return true + } else { + return false + } default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUpdateParam")) @@ -2973,8 +2983,8 @@ func (x *fastReflection_MsgUpdateParam) Clear(fd protoreflect.FieldDescriptor) { x.Authority = "" case "poktroll.supplier.MsgUpdateParam.name": x.Name = "" - case "poktroll.supplier.MsgUpdateParam.asType": - x.AsType = "" + case "poktroll.supplier.MsgUpdateParam.as_coin": + x.AsType = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUpdateParam")) @@ -2997,9 +3007,14 @@ func (x *fastReflection_MsgUpdateParam) Get(descriptor protoreflect.FieldDescrip case "poktroll.supplier.MsgUpdateParam.name": value := x.Name return protoreflect.ValueOfString(value) - case "poktroll.supplier.MsgUpdateParam.asType": - value := x.AsType - return protoreflect.ValueOfString(value) + case "poktroll.supplier.MsgUpdateParam.as_coin": + if x.AsType == nil { + return protoreflect.ValueOfMessage((*v1beta1.Coin)(nil).ProtoReflect()) + } else if v, ok := x.AsType.(*MsgUpdateParam_AsCoin); ok { + return protoreflect.ValueOfMessage(v.AsCoin.ProtoReflect()) + } else { + return protoreflect.ValueOfMessage((*v1beta1.Coin)(nil).ProtoReflect()) + } default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUpdateParam")) @@ -3024,8 +3039,9 @@ func (x *fastReflection_MsgUpdateParam) Set(fd protoreflect.FieldDescriptor, val x.Authority = value.Interface().(string) case "poktroll.supplier.MsgUpdateParam.name": x.Name = value.Interface().(string) - case "poktroll.supplier.MsgUpdateParam.asType": - x.AsType = value.Interface().(string) + case "poktroll.supplier.MsgUpdateParam.as_coin": + cv := value.Message().Interface().(*v1beta1.Coin) + x.AsType = &MsgUpdateParam_AsCoin{AsCoin: cv} default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUpdateParam")) @@ -3046,12 +3062,26 @@ func (x *fastReflection_MsgUpdateParam) Set(fd protoreflect.FieldDescriptor, val // 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.supplier.MsgUpdateParam.as_coin": + if x.AsType == nil { + value := &v1beta1.Coin{} + oneofValue := &MsgUpdateParam_AsCoin{AsCoin: value} + x.AsType = oneofValue + return protoreflect.ValueOfMessage(value.ProtoReflect()) + } + switch m := x.AsType.(type) { + case *MsgUpdateParam_AsCoin: + return protoreflect.ValueOfMessage(m.AsCoin.ProtoReflect()) + default: + value := &v1beta1.Coin{} + oneofValue := &MsgUpdateParam_AsCoin{AsCoin: value} + x.AsType = oneofValue + return protoreflect.ValueOfMessage(value.ProtoReflect()) + } case "poktroll.supplier.MsgUpdateParam.authority": panic(fmt.Errorf("field authority of message poktroll.supplier.MsgUpdateParam is not mutable")) case "poktroll.supplier.MsgUpdateParam.name": panic(fmt.Errorf("field name of message poktroll.supplier.MsgUpdateParam is not mutable")) - case "poktroll.supplier.MsgUpdateParam.asType": - panic(fmt.Errorf("field asType of message poktroll.supplier.MsgUpdateParam is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUpdateParam")) @@ -3069,8 +3099,9 @@ func (x *fastReflection_MsgUpdateParam) NewField(fd protoreflect.FieldDescriptor return protoreflect.ValueOfString("") case "poktroll.supplier.MsgUpdateParam.name": return protoreflect.ValueOfString("") - case "poktroll.supplier.MsgUpdateParam.asType": - return protoreflect.ValueOfString("") + case "poktroll.supplier.MsgUpdateParam.as_coin": + value := &v1beta1.Coin{} + return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUpdateParam")) @@ -3084,6 +3115,14 @@ func (x *fastReflection_MsgUpdateParam) NewField(fd protoreflect.FieldDescriptor // 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.supplier.MsgUpdateParam.asType": + if x.AsType == nil { + return nil + } + switch x.AsType.(type) { + case *MsgUpdateParam_AsCoin: + return x.Descriptor().Fields().ByName("as_coin") + } default: panic(fmt.Errorf("%s is not a oneof field in poktroll.supplier.MsgUpdateParam", d.FullName())) } @@ -3148,8 +3187,12 @@ func (x *fastReflection_MsgUpdateParam) ProtoMethods() *protoiface.Methods { if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } - l = len(x.AsType) - if l > 0 { + switch x := x.AsType.(type) { + case *MsgUpdateParam_AsCoin: + if x == nil { + break + } + l = options.Size(x.AsCoin) n += 1 + l + runtime.Sov(uint64(l)) } if x.unknownFields != nil { @@ -3181,10 +3224,18 @@ func (x *fastReflection_MsgUpdateParam) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if len(x.AsType) > 0 { - i -= len(x.AsType) - copy(dAtA[i:], x.AsType) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.AsType))) + switch x := x.AsType.(type) { + case *MsgUpdateParam_AsCoin: + encoded, err := options.Marshal(x.AsCoin) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) i-- dAtA[i] = 0x1a } @@ -3317,9 +3368,9 @@ func (x *fastReflection_MsgUpdateParam) ProtoMethods() *protoiface.Methods { iNdEx = postIndex case 3: if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AsType", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AsCoin", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -3329,23 +3380,26 @@ func (x *fastReflection_MsgUpdateParam) ProtoMethods() *protoiface.Methods { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.AsType = string(dAtA[iNdEx:postIndex]) + v := &v1beta1.Coin{} + if err := options.Unmarshal(dAtA[iNdEx:postIndex], v); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + x.AsType = &MsgUpdateParam_AsCoin{v} iNdEx = postIndex default: iNdEx = preIndex @@ -3458,8 +3512,8 @@ func (x *fastReflection_MsgUpdateParamResponse) Interface() protoreflect.ProtoMe // 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 != "" { - value := protoreflect.ValueOfString(x.Params) + if x.Params != nil { + value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) if !f(fd_MsgUpdateParamResponse_params, value) { return } @@ -3480,7 +3534,7 @@ func (x *fastReflection_MsgUpdateParamResponse) Range(f func(protoreflect.FieldD func (x *fastReflection_MsgUpdateParamResponse) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { case "poktroll.supplier.MsgUpdateParamResponse.params": - return x.Params != "" + return x.Params != nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUpdateParamResponse")) @@ -3498,7 +3552,7 @@ func (x *fastReflection_MsgUpdateParamResponse) Has(fd protoreflect.FieldDescrip func (x *fastReflection_MsgUpdateParamResponse) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { case "poktroll.supplier.MsgUpdateParamResponse.params": - x.Params = "" + x.Params = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUpdateParamResponse")) @@ -3517,7 +3571,7 @@ func (x *fastReflection_MsgUpdateParamResponse) Get(descriptor protoreflect.Fiel switch descriptor.FullName() { case "poktroll.supplier.MsgUpdateParamResponse.params": value := x.Params - return protoreflect.ValueOfString(value) + return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUpdateParamResponse")) @@ -3539,7 +3593,7 @@ func (x *fastReflection_MsgUpdateParamResponse) Get(descriptor protoreflect.Fiel func (x *fastReflection_MsgUpdateParamResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { case "poktroll.supplier.MsgUpdateParamResponse.params": - x.Params = value.Interface().(string) + x.Params = value.Message().Interface().(*Params) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUpdateParamResponse")) @@ -3561,7 +3615,10 @@ func (x *fastReflection_MsgUpdateParamResponse) Set(fd protoreflect.FieldDescrip func (x *fastReflection_MsgUpdateParamResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { case "poktroll.supplier.MsgUpdateParamResponse.params": - panic(fmt.Errorf("field params of message poktroll.supplier.MsgUpdateParamResponse is not mutable")) + 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.supplier.MsgUpdateParamResponse")) @@ -3576,7 +3633,8 @@ func (x *fastReflection_MsgUpdateParamResponse) Mutable(fd protoreflect.FieldDes func (x *fastReflection_MsgUpdateParamResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { case "poktroll.supplier.MsgUpdateParamResponse.params": - return protoreflect.ValueOfString("") + m := new(Params) + return protoreflect.ValueOfMessage(m.ProtoReflect()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.MsgUpdateParamResponse")) @@ -3646,8 +3704,8 @@ func (x *fastReflection_MsgUpdateParamResponse) ProtoMethods() *protoiface.Metho var n int var l int _ = l - l = len(x.Params) - if l > 0 { + if x.Params != nil { + l = options.Size(x.Params) n += 1 + l + runtime.Sov(uint64(l)) } if x.unknownFields != nil { @@ -3679,10 +3737,17 @@ func (x *fastReflection_MsgUpdateParamResponse) ProtoMethods() *protoiface.Metho i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if len(x.Params) > 0 { - i -= len(x.Params) - copy(dAtA[i:], x.Params) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Params))) + 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 } @@ -3739,7 +3804,7 @@ func (x *fastReflection_MsgUpdateParamResponse) ProtoMethods() *protoiface.Metho if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -3749,23 +3814,27 @@ func (x *fastReflection_MsgUpdateParamResponse) ProtoMethods() *protoiface.Metho } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.Params = string(dAtA[iNdEx:postIndex]) + 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 @@ -4052,14 +4121,19 @@ func (*MsgUnstakeSupplierResponse) Descriptor() ([]byte, []int) { return file_poktroll_supplier_tx_proto_rawDescGZIP(), []int{5} } +// 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"` - AsType string `protobuf:"bytes,3,opt,name=asType,proto3" json:"asType,omitempty"` + // Types that are assignable to AsType: + // + // *MsgUpdateParam_AsCoin + AsType isMsgUpdateParam_AsType `protobuf_oneof:"asType"` } func (x *MsgUpdateParam) Reset() { @@ -4096,19 +4170,36 @@ func (x *MsgUpdateParam) GetName() string { return "" } -func (x *MsgUpdateParam) GetAsType() string { +func (x *MsgUpdateParam) GetAsType() isMsgUpdateParam_AsType { if x != nil { return x.AsType } - return "" + return nil +} + +func (x *MsgUpdateParam) GetAsCoin() *v1beta1.Coin { + if x, ok := x.GetAsType().(*MsgUpdateParam_AsCoin); ok { + return x.AsCoin + } + return nil } +type isMsgUpdateParam_AsType interface { + isMsgUpdateParam_AsType() +} + +type MsgUpdateParam_AsCoin struct { + AsCoin *v1beta1.Coin `protobuf:"bytes,3,opt,name=as_coin,json=asCoin,proto3,oneof"` +} + +func (*MsgUpdateParam_AsCoin) isMsgUpdateParam_AsType() {} + type MsgUpdateParamResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Params string `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` } func (x *MsgUpdateParamResponse) Reset() { @@ -4131,11 +4222,11 @@ func (*MsgUpdateParamResponse) Descriptor() ([]byte, []int) { return file_poktroll_supplier_tx_proto_rawDescGZIP(), []int{7} } -func (x *MsgUpdateParamResponse) GetParams() string { +func (x *MsgUpdateParamResponse) GetParams() *Params { if x != nil { return x.Params } - return "" + return nil } var File_poktroll_supplier_tx_proto protoreflect.FileDescriptor @@ -4203,54 +4294,60 @@ var file_poktroll_supplier_tx_proto_rawDesc = []byte{ 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x3a, 0x0b, 0x82, 0xe7, 0xb0, 0x2a, 0x06, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x22, 0x1c, 0x0a, 0x1a, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, - 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x6a, 0x0a, 0x0e, 0x4d, 0x73, - 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x1c, 0x0a, 0x09, - 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 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, 0x16, - 0x0a, 0x06, 0x61, 0x73, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, - 0x61, 0x73, 0x54, 0x79, 0x70, 0x65, 0x3a, 0x0e, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, - 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x22, 0x30, 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, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x32, 0x95, 0x03, 0x0a, 0x03, 0x4d, 0x73, 0x67, - 0x12, 0x5e, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, - 0x12, 0x22, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, - 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, - 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x2a, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, - 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x61, 0x0a, 0x0d, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, - 0x72, 0x12, 0x23, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, - 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, - 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x1a, 0x2b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x74, - 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x67, 0x0a, 0x0f, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, - 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x12, 0x25, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, - 0x73, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x1a, 0x2d, 0x2e, - 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, - 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, - 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5b, 0x0a, 0x0b, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x21, 0x2e, 0x70, 0x6f, - 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, - 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x1a, 0x29, + 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xac, 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, 0x34, 0x0a, 0x07, 0x61, 0x73, 0x5f, + 0x63, 0x6f, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x48, 0x00, 0x52, 0x06, 0x61, 0x73, 0x43, 0x6f, 0x69, 0x6e, 0x3a, + 0x0e, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x42, + 0x08, 0x0a, 0x06, 0x61, 0x73, 0x54, 0x79, 0x70, 0x65, 0x22, 0x4b, 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, 0x31, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, + 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x06, + 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x32, 0x95, 0x03, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x5e, + 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x22, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 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, 0xad, 0x01, 0xd8, 0xe2, 0x1e, 0x01, 0x0a, 0x15, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x42, 0x07, - 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x22, 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, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xa2, 0x02, 0x03, - 0x50, 0x53, 0x58, 0xaa, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, - 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xca, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, - 0x6c, 0x6c, 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xe2, 0x02, 0x1d, 0x50, 0x6f, - 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5c, - 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x12, 0x50, 0x6f, - 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6d, 0x73, 0x1a, 0x2a, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, + 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x61, + 0x0a, 0x0d, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x12, + 0x23, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, + 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, + 0x6c, 0x69, 0x65, 0x72, 0x1a, 0x2b, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, + 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, + 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x67, 0x0a, 0x0f, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, + 0x6c, 0x69, 0x65, 0x72, 0x12, 0x25, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, + 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, + 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x1a, 0x2d, 0x2e, 0x70, 0x6f, + 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, + 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, + 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5b, 0x0a, 0x0b, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x21, 0x2e, 0x70, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x2e, 0x4d, 0x73, + 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x1a, 0x29, 0x2e, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, + 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, 0xad, + 0x01, 0xd8, 0xe2, 0x1e, 0x01, 0x0a, 0x15, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x42, 0x07, 0x54, 0x78, + 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x22, 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, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xa2, 0x02, 0x03, 0x50, 0x53, + 0x58, 0xaa, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x75, 0x70, + 0x70, 0x6c, 0x69, 0x65, 0x72, 0xca, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xe2, 0x02, 0x1d, 0x50, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5c, 0x47, 0x50, + 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x12, 0x50, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -4283,19 +4380,21 @@ var file_poktroll_supplier_tx_proto_depIdxs = []int32{ 8, // 0: poktroll.supplier.MsgUpdateParams.params:type_name -> poktroll.supplier.Params 9, // 1: poktroll.supplier.MsgStakeSupplier.stake:type_name -> cosmos.base.v1beta1.Coin 10, // 2: poktroll.supplier.MsgStakeSupplier.services:type_name -> poktroll.shared.SupplierServiceConfig - 0, // 3: poktroll.supplier.Msg.UpdateParams:input_type -> poktroll.supplier.MsgUpdateParams - 2, // 4: poktroll.supplier.Msg.StakeSupplier:input_type -> poktroll.supplier.MsgStakeSupplier - 4, // 5: poktroll.supplier.Msg.UnstakeSupplier:input_type -> poktroll.supplier.MsgUnstakeSupplier - 6, // 6: poktroll.supplier.Msg.UpdateParam:input_type -> poktroll.supplier.MsgUpdateParam - 1, // 7: poktroll.supplier.Msg.UpdateParams:output_type -> poktroll.supplier.MsgUpdateParamsResponse - 3, // 8: poktroll.supplier.Msg.StakeSupplier:output_type -> poktroll.supplier.MsgStakeSupplierResponse - 5, // 9: poktroll.supplier.Msg.UnstakeSupplier:output_type -> poktroll.supplier.MsgUnstakeSupplierResponse - 7, // 10: poktroll.supplier.Msg.UpdateParam:output_type -> poktroll.supplier.MsgUpdateParamResponse - 7, // [7:11] is the sub-list for method output_type - 3, // [3:7] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name + 9, // 3: poktroll.supplier.MsgUpdateParam.as_coin:type_name -> cosmos.base.v1beta1.Coin + 8, // 4: poktroll.supplier.MsgUpdateParamResponse.params:type_name -> poktroll.supplier.Params + 0, // 5: poktroll.supplier.Msg.UpdateParams:input_type -> poktroll.supplier.MsgUpdateParams + 2, // 6: poktroll.supplier.Msg.StakeSupplier:input_type -> poktroll.supplier.MsgStakeSupplier + 4, // 7: poktroll.supplier.Msg.UnstakeSupplier:input_type -> poktroll.supplier.MsgUnstakeSupplier + 6, // 8: poktroll.supplier.Msg.UpdateParam:input_type -> poktroll.supplier.MsgUpdateParam + 1, // 9: poktroll.supplier.Msg.UpdateParams:output_type -> poktroll.supplier.MsgUpdateParamsResponse + 3, // 10: poktroll.supplier.Msg.StakeSupplier:output_type -> poktroll.supplier.MsgStakeSupplierResponse + 5, // 11: poktroll.supplier.Msg.UnstakeSupplier:output_type -> poktroll.supplier.MsgUnstakeSupplierResponse + 7, // 12: poktroll.supplier.Msg.UpdateParam:output_type -> poktroll.supplier.MsgUpdateParamResponse + 9, // [9:13] is the sub-list for method output_type + 5, // [5:9] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name } func init() { file_poktroll_supplier_tx_proto_init() } @@ -4402,6 +4501,9 @@ func file_poktroll_supplier_tx_proto_init() { } } } + file_poktroll_supplier_tx_proto_msgTypes[6].OneofWrappers = []interface{}{ + (*MsgUpdateParam_AsCoin)(nil), + } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/proto/poktroll/supplier/tx.proto b/proto/poktroll/supplier/tx.proto index 3ea465525..b1f862081 100644 --- a/proto/poktroll/supplier/tx.proto +++ b/proto/poktroll/supplier/tx.proto @@ -64,14 +64,20 @@ message MsgUnstakeSupplier { message MsgUnstakeSupplierResponse {} +// MsgUpdateParam is the Msg/UpdateParam request type to update a single param. message MsgUpdateParam { option (cosmos.msg.v1.signer) = "authority"; - string authority = 1; + + // 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; - string asType = 3; + oneof asType { + cosmos.base.v1beta1.Coin as_coin = 3; + } } message MsgUpdateParamResponse { - string params = 1; + Params params = 1; } diff --git a/x/supplier/types/tx.pb.go b/x/supplier/types/tx.pb.go index 5ea894944..0c48ba0c3 100644 --- a/x/supplier/types/tx.pb.go +++ b/x/supplier/types/tx.pb.go @@ -303,10 +303,15 @@ func (m *MsgUnstakeSupplierResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUnstakeSupplierResponse 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"` - AsType string `protobuf:"bytes,3,opt,name=asType,proto3" json:"asType,omitempty"` + // Types that are valid to be assigned to AsType: + // + // *MsgUpdateParam_AsCoin + AsType isMsgUpdateParam_AsType `protobuf_oneof:"asType"` } func (m *MsgUpdateParam) Reset() { *m = MsgUpdateParam{} } @@ -338,6 +343,25 @@ func (m *MsgUpdateParam) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateParam proto.InternalMessageInfo +type isMsgUpdateParam_AsType interface { + isMsgUpdateParam_AsType() + MarshalTo([]byte) (int, error) + Size() int +} + +type MsgUpdateParam_AsCoin struct { + AsCoin *types.Coin `protobuf:"bytes,3,opt,name=as_coin,json=asCoin,proto3,oneof" json:"as_coin,omitempty"` +} + +func (*MsgUpdateParam_AsCoin) 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 @@ -352,15 +376,22 @@ func (m *MsgUpdateParam) GetName() string { return "" } -func (m *MsgUpdateParam) GetAsType() string { - if m != nil { - return m.AsType +func (m *MsgUpdateParam) GetAsCoin() *types.Coin { + if x, ok := m.GetAsType().(*MsgUpdateParam_AsCoin); ok { + return x.AsCoin + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*MsgUpdateParam) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*MsgUpdateParam_AsCoin)(nil), } - return "" } type MsgUpdateParamResponse struct { - Params string `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` } func (m *MsgUpdateParamResponse) Reset() { *m = MsgUpdateParamResponse{} } @@ -392,11 +423,11 @@ func (m *MsgUpdateParamResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateParamResponse proto.InternalMessageInfo -func (m *MsgUpdateParamResponse) GetParams() string { +func (m *MsgUpdateParamResponse) GetParams() *Params { if m != nil { return m.Params } - return "" + return nil } func init() { @@ -413,49 +444,50 @@ func init() { func init() { proto.RegisterFile("poktroll/supplier/tx.proto", fileDescriptor_63b974929807ef57) } var fileDescriptor_63b974929807ef57 = []byte{ - // 661 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0x3f, 0x6f, 0xd3, 0x4e, - 0x18, 0x8e, 0x9b, 0x36, 0xfa, 0xf5, 0xd2, 0xbf, 0xa7, 0xaa, 0x75, 0xad, 0xfe, 0x4c, 0x71, 0x05, - 0x2a, 0x41, 0xf5, 0x35, 0x45, 0xea, 0x50, 0xc1, 0x40, 0x3a, 0x57, 0x20, 0x07, 0x16, 0x90, 0xa8, - 0x2e, 0xc9, 0xe1, 0x9a, 0xd6, 0x3e, 0xeb, 0xee, 0xfa, 0x27, 0x1b, 0x62, 0x64, 0x62, 0x41, 0xe2, - 0x23, 0x30, 0x66, 0x60, 0x67, 0xad, 0x98, 0x2a, 0xa6, 0x4e, 0x08, 0x25, 0x43, 0xbe, 0x06, 0xb2, - 0xef, 0xec, 0xc4, 0x49, 0x20, 0x45, 0x2c, 0x89, 0xef, 0xde, 0xe7, 0x7d, 0xde, 0xe7, 0x9e, 0xf7, - 0xbd, 0x03, 0x46, 0x48, 0x8f, 0x05, 0xa3, 0x27, 0x27, 0x88, 0x9f, 0x86, 0xe1, 0x89, 0x47, 0x18, - 0x12, 0x17, 0x76, 0xc8, 0xa8, 0xa0, 0x70, 0x31, 0x89, 0xd9, 0x49, 0xcc, 0x58, 0xc4, 0xbe, 0x17, - 0x50, 0x14, 0xff, 0x4a, 0x94, 0xb1, 0x52, 0xa7, 0xdc, 0xa7, 0x1c, 0xf9, 0xdc, 0x45, 0x67, 0xe5, - 0xe8, 0x4f, 0x05, 0x56, 0x65, 0xe0, 0x30, 0x5e, 0x21, 0xb9, 0x50, 0xa1, 0x25, 0x97, 0xba, 0x54, - 0xee, 0x47, 0x5f, 0x6a, 0xd7, 0x54, 0x4c, 0x35, 0xcc, 0x09, 0x3a, 0x2b, 0xd7, 0x88, 0xc0, 0x65, - 0x54, 0xa7, 0x5e, 0x90, 0xc4, 0x87, 0xb5, 0x86, 0x98, 0x61, 0x3f, 0x61, 0xfd, 0xbf, 0x17, 0x3f, - 0xc2, 0x8c, 0x34, 0x10, 0x27, 0xec, 0xcc, 0xab, 0x13, 0x19, 0xb6, 0xbe, 0x6a, 0x60, 0xfe, 0x80, - 0xbb, 0xcf, 0xc3, 0x06, 0x16, 0xe4, 0x69, 0x9c, 0x08, 0x77, 0xc1, 0x34, 0x3e, 0x15, 0x47, 0x94, - 0x79, 0xa2, 0xa9, 0x6b, 0xeb, 0xda, 0xe6, 0x74, 0x45, 0xff, 0xfe, 0x65, 0x6b, 0x49, 0xa9, 0x7d, - 0xdc, 0x68, 0x30, 0xc2, 0x79, 0x55, 0x30, 0x2f, 0x70, 0x9d, 0x1e, 0x14, 0x3e, 0x04, 0x05, 0x59, - 0x5a, 0x9f, 0x58, 0xd7, 0x36, 0x8b, 0x3b, 0xab, 0xf6, 0x90, 0x57, 0xb6, 0x2c, 0x51, 0x99, 0xbe, - 0xfc, 0x71, 0x2b, 0xf7, 0xb9, 0xdb, 0x2a, 0x69, 0x8e, 0xca, 0xd9, 0xdb, 0x7d, 0xd7, 0x6d, 0x95, - 0x7a, 0x6c, 0xef, 0xbb, 0xad, 0xd2, 0x46, 0xaa, 0xfd, 0xa2, 0x77, 0xba, 0x01, 0xb5, 0xd6, 0x2a, - 0x58, 0x19, 0xd8, 0x72, 0x08, 0x0f, 0x69, 0xc0, 0x89, 0xf5, 0x6d, 0x02, 0x2c, 0x1c, 0x70, 0xb7, - 0x2a, 0xf0, 0x31, 0xa9, 0xaa, 0x7c, 0xb8, 0x0d, 0x0a, 0xdc, 0x73, 0x03, 0xc2, 0xc6, 0x1e, 0x4d, - 0xe1, 0xe0, 0x23, 0x30, 0x4b, 0xcf, 0x03, 0xc2, 0x0e, 0xb1, 0x0c, 0xc7, 0xc7, 0xfb, 0x53, 0xe2, - 0x4c, 0x0c, 0x57, 0x7b, 0x70, 0x1f, 0x2c, 0xd0, 0x90, 0x30, 0x2c, 0x68, 0x8f, 0x21, 0x3f, 0x86, - 0x61, 0x3e, 0xc9, 0x48, 0x48, 0x10, 0x98, 0xe2, 0xd1, 0x31, 0xf4, 0x49, 0x65, 0xad, 0x4a, 0x8b, - 0xc6, 0xc2, 0x56, 0x63, 0x61, 0xef, 0x53, 0x2f, 0x70, 0x24, 0x0e, 0x56, 0xc0, 0x7f, 0xaa, 0xd3, - 0x5c, 0x9f, 0x5a, 0xcf, 0x6f, 0x16, 0x77, 0xee, 0xf6, 0xb5, 0x23, 0x1e, 0x05, 0x3b, 0xf1, 0xa4, - 0x2a, 0x81, 0xfb, 0x34, 0x78, 0xed, 0xb9, 0x4e, 0x9a, 0xb7, 0x57, 0x8c, 0x5a, 0xa2, 0x5c, 0xb0, - 0x0c, 0xa0, 0x0f, 0x7a, 0x99, 0x1a, 0xfd, 0x49, 0x03, 0x30, 0x6a, 0x42, 0xc0, 0xff, 0xd1, 0xea, - 0x51, 0x5e, 0x4d, 0xfc, 0xa5, 0x57, 0x59, 0xd9, 0x6b, 0xc0, 0x18, 0x56, 0x96, 0x0a, 0x7f, 0x03, - 0xe6, 0xb2, 0xc3, 0x03, 0xd7, 0x86, 0x86, 0xbf, 0x7f, 0xc4, 0x21, 0x98, 0x0c, 0xb0, 0x4f, 0xa4, - 0x26, 0x27, 0xfe, 0x86, 0xcb, 0xa0, 0x80, 0xf9, 0xb3, 0x66, 0x48, 0x64, 0x57, 0x1d, 0xb5, 0xda, - 0x9b, 0xcb, 0x0e, 0xb4, 0xb5, 0x0d, 0x96, 0xb3, 0xb5, 0x12, 0x15, 0x11, 0x83, 0xba, 0x38, 0xb2, - 0xa0, 0x5a, 0xed, 0x7c, 0xcc, 0x83, 0xfc, 0x01, 0x77, 0xe1, 0x2b, 0x30, 0x93, 0xb9, 0xa0, 0xd6, - 0x88, 0x8b, 0x35, 0x70, 0x07, 0x8c, 0xd2, 0x78, 0x4c, 0x5a, 0x1f, 0x83, 0xd9, 0xec, 0x1d, 0xd9, - 0x18, 0x9d, 0x9c, 0x01, 0x19, 0xf7, 0x6f, 0x00, 0x4a, 0x4b, 0xb8, 0x60, 0x7e, 0x70, 0x3a, 0xee, - 0xfc, 0x46, 0x61, 0x16, 0x66, 0x6c, 0xdd, 0x08, 0x96, 0x16, 0x7a, 0x09, 0x8a, 0xfd, 0xed, 0xbc, - 0x3d, 0xd6, 0x06, 0xe3, 0xde, 0x58, 0x48, 0x42, 0x6e, 0x4c, 0xbd, 0x8d, 0x9e, 0xac, 0xca, 0x93, - 0xcb, 0xb6, 0xa9, 0x5d, 0xb5, 0x4d, 0xed, 0xba, 0x6d, 0x6a, 0x3f, 0xdb, 0xa6, 0xf6, 0xa1, 0x63, - 0xe6, 0xae, 0x3a, 0x66, 0xee, 0xba, 0x63, 0xe6, 0x5e, 0x94, 0x5d, 0x4f, 0x1c, 0x9d, 0xd6, 0xec, - 0x3a, 0xf5, 0x51, 0xc4, 0xbc, 0x15, 0x10, 0x71, 0x4e, 0xd9, 0x31, 0x1a, 0xf5, 0x9a, 0x89, 0x66, - 0x48, 0x78, 0xad, 0x10, 0x3f, 0xc6, 0x0f, 0x7e, 0x05, 0x00, 0x00, 0xff, 0xff, 0x00, 0xb0, 0x9b, - 0xb1, 0x79, 0x06, 0x00, 0x00, + // 678 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0xbf, 0x6f, 0xd3, 0x4e, + 0x14, 0xcf, 0x35, 0x6d, 0xbe, 0xed, 0x4b, 0x7f, 0x9e, 0xaa, 0x6f, 0x53, 0x0b, 0x4c, 0x49, 0x05, + 0x2a, 0x41, 0xf5, 0x91, 0x82, 0x3a, 0x54, 0x30, 0x90, 0x2e, 0x48, 0xa8, 0x02, 0x39, 0xb0, 0x80, + 0x44, 0x75, 0x49, 0x0e, 0xd7, 0x6a, 0xe3, 0xb3, 0xee, 0xae, 0xbf, 0x36, 0xc4, 0xc8, 0xc4, 0x82, + 0xc4, 0x9f, 0xc0, 0xc0, 0xd0, 0x81, 0x9d, 0xb5, 0x62, 0xaa, 0x98, 0x3a, 0x21, 0x94, 0x0e, 0xfd, + 0x37, 0x90, 0xed, 0xb3, 0x53, 0xa7, 0xa1, 0x2e, 0xb0, 0x24, 0xe7, 0x7b, 0x9f, 0xcf, 0xbb, 0xcf, + 0x7d, 0xde, 0x7b, 0x07, 0x86, 0xcf, 0x37, 0x95, 0xe0, 0x5b, 0x5b, 0x44, 0x6e, 0xfb, 0xfe, 0x96, + 0xcb, 0x04, 0x51, 0x7b, 0x96, 0x2f, 0xb8, 0xe2, 0x78, 0x2a, 0x8e, 0x59, 0x71, 0xcc, 0x98, 0xa2, + 0x6d, 0xd7, 0xe3, 0x24, 0xfc, 0x8d, 0x50, 0xc6, 0x4c, 0x93, 0xcb, 0x36, 0x97, 0xa4, 0x2d, 0x1d, + 0xb2, 0x53, 0x0d, 0xfe, 0x74, 0x60, 0x36, 0x0a, 0xac, 0x87, 0x5f, 0x24, 0xfa, 0xd0, 0xa1, 0x69, + 0x87, 0x3b, 0x3c, 0xda, 0x0f, 0x56, 0x7a, 0xd7, 0xd4, 0x99, 0x1a, 0x54, 0x32, 0xb2, 0x53, 0x6d, + 0x30, 0x45, 0xab, 0xa4, 0xc9, 0x5d, 0x2f, 0x8e, 0x9f, 0xd7, 0xea, 0x53, 0x41, 0xdb, 0x71, 0xd6, + 0xab, 0xdd, 0xf8, 0x06, 0x15, 0xac, 0x45, 0x24, 0x13, 0x3b, 0x6e, 0x93, 0x45, 0xe1, 0xf2, 0x57, + 0x04, 0x13, 0x6b, 0xd2, 0x79, 0xee, 0xb7, 0xa8, 0x62, 0x4f, 0x43, 0x22, 0x5e, 0x86, 0x11, 0xba, + 0xad, 0x36, 0xb8, 0x70, 0xd5, 0x7e, 0x09, 0xcd, 0xa1, 0x85, 0x91, 0x5a, 0xe9, 0xfb, 0x97, 0xc5, + 0x69, 0xad, 0xf6, 0x61, 0xab, 0x25, 0x98, 0x94, 0x75, 0x25, 0x5c, 0xcf, 0xb1, 0xbb, 0x50, 0x7c, + 0x1f, 0x0a, 0xd1, 0xd1, 0xa5, 0x81, 0x39, 0xb4, 0x50, 0x5c, 0x9a, 0xb5, 0xce, 0x79, 0x65, 0x45, + 0x47, 0xd4, 0x46, 0x0e, 0x7f, 0x5c, 0xcb, 0x7d, 0x3a, 0x3d, 0xa8, 0x20, 0x5b, 0x73, 0x56, 0x96, + 0xdf, 0x9e, 0x1e, 0x54, 0xba, 0xd9, 0xde, 0x9d, 0x1e, 0x54, 0xe6, 0x13, 0xed, 0x7b, 0xdd, 0xdb, + 0xf5, 0xa8, 0x2d, 0xcf, 0xc2, 0x4c, 0xcf, 0x96, 0xcd, 0xa4, 0xcf, 0x3d, 0xc9, 0xca, 0xdf, 0x06, + 0x60, 0x72, 0x4d, 0x3a, 0x75, 0x45, 0x37, 0x59, 0x5d, 0xf3, 0xf1, 0x1d, 0x28, 0x48, 0xd7, 0xf1, + 0x98, 0xc8, 0xbc, 0x9a, 0xc6, 0xe1, 0x07, 0x30, 0xc6, 0x77, 0x3d, 0x26, 0xd6, 0x69, 0x14, 0x0e, + 0xaf, 0x77, 0x11, 0x71, 0x34, 0x84, 0xeb, 0x3d, 0xbc, 0x0a, 0x93, 0xdc, 0x67, 0x82, 0x2a, 0xde, + 0xcd, 0x90, 0xcf, 0xc8, 0x30, 0x11, 0x33, 0xe2, 0x24, 0x04, 0x86, 0x64, 0x70, 0x8d, 0xd2, 0xa0, + 0xb6, 0x56, 0xd3, 0x82, 0xb6, 0xb0, 0x74, 0x5b, 0x58, 0xab, 0xdc, 0xf5, 0xec, 0x08, 0x87, 0x6b, + 0x30, 0xac, 0x2b, 0x2d, 0x4b, 0x43, 0x73, 0xf9, 0x85, 0xe2, 0xd2, 0xcd, 0x33, 0xe5, 0x08, 0x5b, + 0xc1, 0x8a, 0x3d, 0xa9, 0x47, 0xc0, 0x55, 0xee, 0xbd, 0x76, 0x1d, 0x3b, 0xe1, 0xad, 0x14, 0x83, + 0x92, 0x68, 0x17, 0xca, 0x06, 0x94, 0x7a, 0xbd, 0x4c, 0x8c, 0xfe, 0x88, 0x00, 0x07, 0x45, 0xf0, + 0xe4, 0x3f, 0x5a, 0xdd, 0xcf, 0xab, 0x81, 0x3f, 0xf4, 0x2a, 0x2d, 0xfb, 0x0a, 0x18, 0xe7, 0x95, + 0x25, 0xc2, 0x3f, 0x23, 0x18, 0x4f, 0x77, 0xcf, 0x5f, 0x77, 0x3f, 0x86, 0x41, 0x8f, 0xb6, 0x59, + 0x24, 0xd7, 0x0e, 0xd7, 0xf8, 0x1e, 0xfc, 0x47, 0xe5, 0x7a, 0x30, 0xad, 0x61, 0xc5, 0x2f, 0xaa, + 0xdb, 0xa3, 0x9c, 0x5d, 0xa0, 0x32, 0x58, 0xad, 0x8c, 0xa7, 0x27, 0xa1, 0x36, 0x0c, 0x05, 0x2a, + 0x9f, 0xed, 0xfb, 0xac, 0xfc, 0x18, 0xfe, 0x4f, 0xab, 0x8d, 0x2f, 0x82, 0xab, 0xc9, 0xec, 0xa1, + 0x8c, 0xd9, 0x8b, 0x07, 0x6e, 0xe9, 0x43, 0x1e, 0xf2, 0x6b, 0xd2, 0xc1, 0xaf, 0x60, 0x34, 0x35, + 0xfe, 0xe5, 0x3e, 0xd4, 0x9e, 0x09, 0x33, 0x2a, 0xd9, 0x98, 0x44, 0x1a, 0x85, 0xb1, 0xf4, 0x04, + 0xce, 0xf7, 0x27, 0xa7, 0x40, 0xc6, 0xed, 0x4b, 0x80, 0x92, 0x23, 0x1c, 0x98, 0xe8, 0xed, 0xbd, + 0x1b, 0xbf, 0x51, 0x98, 0x86, 0x19, 0x8b, 0x97, 0x82, 0x25, 0x07, 0xbd, 0x84, 0xe2, 0xd9, 0x5e, + 0xb9, 0x9e, 0x69, 0x83, 0x71, 0x2b, 0x13, 0x12, 0x27, 0x37, 0x86, 0xde, 0x04, 0x0f, 0x62, 0xed, + 0xc9, 0x61, 0xc7, 0x44, 0x47, 0x1d, 0x13, 0x1d, 0x77, 0x4c, 0xf4, 0xb3, 0x63, 0xa2, 0xf7, 0x27, + 0x66, 0xee, 0xe8, 0xc4, 0xcc, 0x1d, 0x9f, 0x98, 0xb9, 0x17, 0x55, 0xc7, 0x55, 0x1b, 0xdb, 0x0d, + 0xab, 0xc9, 0xdb, 0x24, 0xc8, 0xbc, 0xe8, 0x31, 0xb5, 0xcb, 0xc5, 0x26, 0xe9, 0xf7, 0x56, 0xaa, + 0x7d, 0x9f, 0xc9, 0x46, 0x21, 0x7c, 0xea, 0xef, 0xfe, 0x0a, 0x00, 0x00, 0xff, 0xff, 0x0d, 0x63, + 0xdc, 0x7f, 0xd7, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -886,12 +918,14 @@ func (m *MsgUpdateParam) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.AsType) > 0 { - i -= len(m.AsType) - copy(dAtA[i:], m.AsType) - i = encodeVarintTx(dAtA, i, uint64(len(m.AsType))) - i-- - dAtA[i] = 0x1a + 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) @@ -910,6 +944,27 @@ func (m *MsgUpdateParam) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *MsgUpdateParam_AsCoin) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParam_AsCoin) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.AsCoin != nil { + { + size, err := m.AsCoin.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + return len(dAtA) - i, nil +} func (m *MsgUpdateParamResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -930,10 +985,15 @@ func (m *MsgUpdateParamResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) _ = i var l int _ = l - if len(m.Params) > 0 { - i -= len(m.Params) - copy(dAtA[i:], m.Params) - i = encodeVarintTx(dAtA, i, uint64(len(m.Params))) + 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 } @@ -1055,21 +1115,32 @@ func (m *MsgUpdateParam) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.AsType) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) + if m.AsType != nil { + n += m.AsType.Size() } return n } +func (m *MsgUpdateParam_AsCoin) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.AsCoin != nil { + l = m.AsCoin.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n +} func (m *MsgUpdateParamResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.Params) - if l > 0 { + if m.Params != nil { + l = m.Params.Size() n += 1 + l + sovTx(uint64(l)) } return n @@ -1771,9 +1842,9 @@ func (m *MsgUpdateParam) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AsType", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field AsCoin", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1783,23 +1854,26 @@ func (m *MsgUpdateParam) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.AsType = string(dAtA[iNdEx:postIndex]) + v := &types.Coin{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.AsType = &MsgUpdateParam_AsCoin{v} iNdEx = postIndex default: iNdEx = preIndex @@ -1855,7 +1929,7 @@ func (m *MsgUpdateParamResponse) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1865,23 +1939,27 @@ func (m *MsgUpdateParamResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.Params = string(dAtA[iNdEx:postIndex]) + if m.Params == nil { + m.Params = &Params{} + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex From 83b7311b93edbd948dec0a850e3a3f0539728e68 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 2 Oct 2024 11:31:59 +0200 Subject: [PATCH 068/139] chore: comment out autoCLI --- x/supplier/module/autocli.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/x/supplier/module/autocli.go b/x/supplier/module/autocli.go index c85b4c516..716e3774f 100644 --- a/x/supplier/module/autocli.go +++ b/x/supplier/module/autocli.go @@ -34,7 +34,7 @@ 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{ + RpcCommandOptions: []*autocliv1.RpcCommandOptions{ //{ // RpcMethod: "UpdateParams", // Skip: true, // skipped because authority gated @@ -51,12 +51,12 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { // Short: "Send a unstake-supplier tx", // PositionalArgs: []*autocliv1.PositionalArgDescriptor{}, //}, - { - RpcMethod: "UpdateParam", - Use: "update-param [name] [as-type]", - Short: "Send a update-param tx", - PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "name"}, {ProtoField: "asType"}}, - }, + //{ + // 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 }, }, From fd42c5ed8197dafad7822567416a7549d958265c Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 2 Oct 2024 11:32:25 +0200 Subject: [PATCH 069/139] chore: add supplier MsgUpdateParam to DAO genesis authorizations --- tools/scripts/authz/dao_genesis_authorizations.json | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tools/scripts/authz/dao_genesis_authorizations.json b/tools/scripts/authz/dao_genesis_authorizations.json index 6f257a438..1dd6992f5 100644 --- a/tools/scripts/authz/dao_genesis_authorizations.json +++ b/tools/scripts/authz/dao_genesis_authorizations.json @@ -161,6 +161,15 @@ }, "expiration": "2500-01-01T00:00:00Z" }, + { + "granter": "pokt10d07y265gmmuvt4z0w9aw880jnsr700j8yv32t", + "grantee": "pokt1eeeksh2tvkh7wzmfrljnhw4wrhs55lcuvmekkw", + "authorization": { + "@type": "\/cosmos.authz.v1beta1.GenericAuthorization", + "msg": "\/poktroll.supplier.MsgUpdateParam" + }, + "expiration": "2500-01-01T00:00:00Z" + }, { "granter": "pokt10d07y265gmmuvt4z0w9aw880jnsr700j8yv32t", "grantee": "pokt1eeeksh2tvkh7wzmfrljnhw4wrhs55lcuvmekkw", From 63bc125714397bbd02bd106ba6b60bbe74689145 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 2 Oct 2024 11:45:38 +0200 Subject: [PATCH 070/139] chore: add supplier param invalid error --- x/supplier/types/errors.go | 1 + 1 file changed, 1 insertion(+) diff --git a/x/supplier/types/errors.go b/x/supplier/types/errors.go index 622d7ed00..0759a9db6 100644 --- a/x/supplier/types/errors.go +++ b/x/supplier/types/errors.go @@ -18,4 +18,5 @@ var ( ErrSupplierIsUnstaking = sdkerrors.Register(ModuleName, 1109, "supplier is in unbonding period") ErrSupplierParamsInvalid = sdkerrors.Register(ModuleName, 1110, "invalid supplier params") ErrSupplierServiceNotFound = sdkerrors.Register(ModuleName, 1111, "service not found") + ErrSupplierParamInvalid = sdkerrors.Register(ModuleName, 1112, "the provided param is invalid") ) From f3bb3e0b598202adbda294aed95228d4f3ff5fa3 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 2 Oct 2024 11:47:21 +0200 Subject: [PATCH 071/139] chore: update NewMsgUpdateParam() & MsgUpdateParam#ValidateBasic() --- x/supplier/types/message_update_param.go | 46 +++++++++++++++++------- 1 file changed, 34 insertions(+), 12 deletions(-) diff --git a/x/supplier/types/message_update_param.go b/x/supplier/types/message_update_param.go index 89d033fd5..6e9091935 100644 --- a/x/supplier/types/message_update_param.go +++ b/x/supplier/types/message_update_param.go @@ -1,26 +1,48 @@ package types import ( + "fmt" + errorsmod "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" + cosmostypes "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) -var _ sdk.Msg = &MsgUpdateParam{} +var _ cosmostypes.Msg = &MsgUpdateParam{} + +func NewMsgUpdateParam(authority string, name string, asType any) *MsgUpdateParam { + var asTypeIface isMsgUpdateParam_AsType + + switch t := asType.(type) { + case *cosmostypes.Coin: + asTypeIface = &MsgUpdateParam_AsCoin{AsCoin: t} + default: + panic(fmt.Sprintf("unexpected param value type: %T", asType)) + } -func NewMsgUpdateParam(authority string, name string, asType string) *MsgUpdateParam { - return &MsgUpdateParam{ + return &MsgUpdateParam{ Authority: authority, - Name: name, - AsType: asType, + Name: name, + AsType: asTypeIface, } } func (msg *MsgUpdateParam) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(msg.Authority) - if err != nil { - return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid authority address (%s)", err) - } - return nil -} + _, err := cosmostypes.AccAddressFromBech32(msg.Authority) + if err != nil { + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid authority address (%s)", err) + } + // Parameter value MUST NOT be nil. + if msg.AsType == nil { + return ErrSupplierParamInvalid.Wrap("missing param AsType") + } + + // Parameter name MUST be supported by this module. + switch msg.Name { + default: + return ErrSupplierParamInvalid.Wrapf("unsupported param %q", msg.Name) + } + + return nil +} From acb662201aaed0751acc0e5591a0c3f54cb5b207 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 2 Oct 2024 11:47:35 +0200 Subject: [PATCH 072/139] chore: update msgServer#UpdateParam() --- x/supplier/keeper/msg_server_update_param.go | 31 +++++++++++++++----- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/x/supplier/keeper/msg_server_update_param.go b/x/supplier/keeper/msg_server_update_param.go index 1cd4e9eb5..4e32c3dfc 100644 --- a/x/supplier/keeper/msg_server_update_param.go +++ b/x/supplier/keeper/msg_server_update_param.go @@ -3,16 +3,33 @@ package keeper import ( "context" - "github.com/pokt-network/poktroll/x/supplier/types" - sdk "github.com/cosmos/cosmos-sdk/types" + suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" ) +// UpdateParam updates a single parameter in the proof module and returns +// all active parameters. +func (k msgServer) UpdateParam(ctx context.Context, msg *suppliertypes.MsgUpdateParam) (*suppliertypes.MsgUpdateParamResponse, error) { + if err := msg.ValidateBasic(); err != nil { + return nil, err + } -func (k msgServer) UpdateParam(goCtx context.Context, msg *types.MsgUpdateParam) (*types.MsgUpdateParamResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) + if k.GetAuthority() != msg.Authority { + return nil, suppliertypes.ErrSupplierInvalidSigner.Wrapf("invalid authority; expected %s, got %s", k.GetAuthority(), msg.Authority) + } - // TODO: Handling the message - _ = ctx + params := k.GetParams(ctx) - return &types.MsgUpdateParamResponse{}, nil + switch msg.Name { + default: + return nil, suppliertypes.ErrSupplierParamInvalid.Wrapf("unsupported param %q", msg.Name) + } + + if err := k.SetParams(ctx, params); err != nil { + return nil, err + } + + updatedParams := k.GetParams(ctx) + return &suppliertypes.MsgUpdateParamResponse{ + Params: &updatedParams, + }, nil } From 935a40f099c65b324b3436c1cce194d50ea7632b Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 2 Oct 2024 11:49:17 +0200 Subject: [PATCH 073/139] chore: update param update test module param config --- testutil/integration/suites/param_configs.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/testutil/integration/suites/param_configs.go b/testutil/integration/suites/param_configs.go index 62950c0fa..9317d64df 100644 --- a/testutil/integration/suites/param_configs.go +++ b/testutil/integration/suites/param_configs.go @@ -178,6 +178,8 @@ var ( ParamsMsgs: ModuleParamsMessages{ MsgUpdateParams: suppliertypes.MsgUpdateParams{}, MsgUpdateParamsResponse: suppliertypes.MsgUpdateParamsResponse{}, + MsgUpdateParam: suppliertypes.MsgUpdateParam{}, + MsgUpdateParamResponse: suppliertypes.MsgUpdateParamResponse{}, QueryParamsRequest: suppliertypes.QueryParamsRequest{}, QueryParamsResponse: suppliertypes.QueryParamsResponse{}, }, From b29843e356bbdd665dfa81ad5dd0d305f4fc7d30 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 2 Oct 2024 12:28:10 +0200 Subject: [PATCH 074/139] Empty commit From 8c2506113e1518356904946c5a7279123a5d5234 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 2 Oct 2024 12:29:44 +0200 Subject: [PATCH 075/139] Empty commit From ce328bbd1eec9058944821ecd501542233bb4008 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 2 Oct 2024 14:40:37 +0200 Subject: [PATCH 076/139] fix: linter errors --- x/supplier/keeper/msg_server_update_param.go | 20 ++++++++++--------- x/supplier/module/simulation.go | 4 ++-- x/supplier/simulation/update_param.go | 5 +++-- x/supplier/types/message_update_param.go | 2 -- x/supplier/types/message_update_param_test.go | 1 + 5 files changed, 17 insertions(+), 15 deletions(-) diff --git a/x/supplier/keeper/msg_server_update_param.go b/x/supplier/keeper/msg_server_update_param.go index 4e32c3dfc..35efa6581 100644 --- a/x/supplier/keeper/msg_server_update_param.go +++ b/x/supplier/keeper/msg_server_update_param.go @@ -17,19 +17,21 @@ func (k msgServer) UpdateParam(ctx context.Context, msg *suppliertypes.MsgUpdate return nil, suppliertypes.ErrSupplierInvalidSigner.Wrapf("invalid authority; expected %s, got %s", k.GetAuthority(), msg.Authority) } - params := k.GetParams(ctx) + // TODO_UPNEXT(@bryanchriswhite, #612): uncomment & add a min_stake case. + + //params := k.GetParams(ctx) switch msg.Name { default: return nil, suppliertypes.ErrSupplierParamInvalid.Wrapf("unsupported param %q", msg.Name) } - if err := k.SetParams(ctx, params); err != nil { - return nil, err - } - - updatedParams := k.GetParams(ctx) - return &suppliertypes.MsgUpdateParamResponse{ - Params: &updatedParams, - }, nil + //if err := k.SetParams(ctx, params); err != nil { + // return nil, err + //} + // + //updatedParams := k.GetParams(ctx) + //return &suppliertypes.MsgUpdateParamResponse{ + // Params: &updatedParams, + //}, nil } diff --git a/x/supplier/module/simulation.go b/x/supplier/module/simulation.go index 474034628..3f0c913e2 100644 --- a/x/supplier/module/simulation.go +++ b/x/supplier/module/simulation.go @@ -93,7 +93,7 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp ) operations = append(operations, simulation.NewWeightedOperation( weightMsgUpdateParam, - suppliersimulation.SimulateMsgUpdateParam(am.accountKeeper, am.bankKeeper, am.keeper), + suppliersimulation.SimulateMsgUpdateParam(am.accountKeeper, am.bankKeeper, am.supplierKeeper), )) // this line is used by starport scaffolding # simapp/module/operation @@ -124,7 +124,7 @@ func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.Wei opWeightMsgUpdateParam, defaultWeightMsgUpdateParam, func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { - suppliersimulation.SimulateMsgUpdateParam(am.accountKeeper, am.bankKeeper, am.keeper) + suppliersimulation.SimulateMsgUpdateParam(am.accountKeeper, am.bankKeeper, am.supplierKeeper) return nil }, ), diff --git a/x/supplier/simulation/update_param.go b/x/supplier/simulation/update_param.go index 9a2bab9cd..cf9b8aa8e 100644 --- a/x/supplier/simulation/update_param.go +++ b/x/supplier/simulation/update_param.go @@ -3,11 +3,12 @@ package simulation import ( "math/rand" - "github.com/pokt-network/poktroll/x/supplier/keeper" - "github.com/pokt-network/poktroll/x/supplier/types" "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/supplier/keeper" + "github.com/pokt-network/poktroll/x/supplier/types" ) func SimulateMsgUpdateParam( diff --git a/x/supplier/types/message_update_param.go b/x/supplier/types/message_update_param.go index 6e9091935..76746e804 100644 --- a/x/supplier/types/message_update_param.go +++ b/x/supplier/types/message_update_param.go @@ -43,6 +43,4 @@ func (msg *MsgUpdateParam) ValidateBasic() error { default: return ErrSupplierParamInvalid.Wrapf("unsupported param %q", msg.Name) } - - return nil } diff --git a/x/supplier/types/message_update_param_test.go b/x/supplier/types/message_update_param_test.go index 406337ff2..b72a6147b 100644 --- a/x/supplier/types/message_update_param_test.go +++ b/x/supplier/types/message_update_param_test.go @@ -5,6 +5,7 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" + "github.com/pokt-network/poktroll/testutil/sample" ) From 17b6420032f3a14abe411ee0b4a97e28da26d184 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 2 Oct 2024 15:08:43 +0200 Subject: [PATCH 077/139] fix: failing tests & add TODO_UPNEXT comments --- x/supplier/types/message_update_param.go | 3 +++ x/supplier/types/message_update_param_test.go | 18 ++++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/x/supplier/types/message_update_param.go b/x/supplier/types/message_update_param.go index 76746e804..843e69aaf 100644 --- a/x/supplier/types/message_update_param.go +++ b/x/supplier/types/message_update_param.go @@ -40,6 +40,9 @@ func (msg *MsgUpdateParam) ValidateBasic() error { // Parameter name MUST be supported by this module. switch msg.Name { + // TODO_UPNEXT(@bryanchriswhite, #612): replace with min_stake param name and call validation function. + case "": + return nil default: return ErrSupplierParamInvalid.Wrapf("unsupported param %q", msg.Name) } diff --git a/x/supplier/types/message_update_param_test.go b/x/supplier/types/message_update_param_test.go index b72a6147b..96136ded1 100644 --- a/x/supplier/types/message_update_param_test.go +++ b/x/supplier/types/message_update_param_test.go @@ -16,15 +16,29 @@ func TestMsgUpdateParam_ValidateBasic(t *testing.T) { err error }{ { - name: "invalid address", + name: "invalid: authority address invalid", msg: MsgUpdateParam{ Authority: "invalid_address", + Name: "", // Doesn't matter for this test + AsType: &MsgUpdateParam_AsCoin{AsCoin: nil}, }, err: sdkerrors.ErrInvalidAddress, }, { - name: "valid address", + name: "invalid: param name incorrect (non-existent)", msg: MsgUpdateParam{ Authority: sample.AccAddress(), + Name: "non_existent", + // TODO_UPNEXT(@bryanchriswhite, #612): replace with default min_stake. + AsType: &MsgUpdateParam_AsCoin{AsCoin: nil}, + }, + err: ErrSupplierParamInvalid, + }, { + name: "valid: correct address, param name, and type", + msg: MsgUpdateParam{ + Authority: sample.AccAddress(), + Name: "", + // TODO_UPNEXT(@bryanchriswhite, #612): replace with default min_stake. + AsType: &MsgUpdateParam_AsCoin{AsCoin: nil}, }, }, } From 4583b7577caf33ec51e0cea595daf5aa162e6871 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 2 Oct 2024 12:18:03 +0200 Subject: [PATCH 078/139] chore: add min_stake param to supplier module --- api/poktroll/supplier/params.pulsar.go | 147 +++++++++++++++++++++---- proto/poktroll/supplier/params.proto | 5 + x/supplier/types/params.pb.go | 90 +++++++++++++-- 3 files changed, 210 insertions(+), 32 deletions(-) diff --git a/api/poktroll/supplier/params.pulsar.go b/api/poktroll/supplier/params.pulsar.go index da1387d1d..e38778848 100644 --- a/api/poktroll/supplier/params.pulsar.go +++ b/api/poktroll/supplier/params.pulsar.go @@ -3,6 +3,7 @@ package supplier import ( _ "cosmossdk.io/api/amino" + v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" fmt "fmt" runtime "github.com/cosmos/cosmos-proto/runtime" _ "github.com/cosmos/gogoproto/gogoproto" @@ -15,12 +16,14 @@ import ( ) var ( - md_Params protoreflect.MessageDescriptor + md_Params protoreflect.MessageDescriptor + fd_Params_min_stake protoreflect.FieldDescriptor ) func init() { file_poktroll_supplier_params_proto_init() md_Params = File_poktroll_supplier_params_proto.Messages().ByName("Params") + fd_Params_min_stake = md_Params.Fields().ByName("min_stake") } var _ protoreflect.Message = (*fastReflection_Params)(nil) @@ -88,6 +91,12 @@ func (x *fastReflection_Params) Interface() protoreflect.ProtoMessage { // While iterating, mutating operations may only be performed // on the current field descriptor. func (x *fastReflection_Params) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.MinStake != nil { + value := protoreflect.ValueOfMessage(x.MinStake.ProtoReflect()) + if !f(fd_Params_min_stake, value) { + return + } + } } // Has reports whether a field is populated. @@ -103,6 +112,8 @@ func (x *fastReflection_Params) Range(f func(protoreflect.FieldDescriptor, proto // a repeated field is populated if it is non-empty. func (x *fastReflection_Params) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { + case "poktroll.supplier.Params.min_stake": + return x.MinStake != nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.Params")) @@ -119,6 +130,8 @@ func (x *fastReflection_Params) Has(fd protoreflect.FieldDescriptor) bool { // Clear is a mutating operation and unsafe for concurrent use. func (x *fastReflection_Params) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { + case "poktroll.supplier.Params.min_stake": + x.MinStake = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.Params")) @@ -135,6 +148,9 @@ func (x *fastReflection_Params) Clear(fd protoreflect.FieldDescriptor) { // of the value; to obtain a mutable reference, use Mutable. func (x *fastReflection_Params) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { + case "poktroll.supplier.Params.min_stake": + value := x.MinStake + return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.Params")) @@ -155,6 +171,8 @@ func (x *fastReflection_Params) Get(descriptor protoreflect.FieldDescriptor) pro // Set is a mutating operation and unsafe for concurrent use. func (x *fastReflection_Params) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { + case "poktroll.supplier.Params.min_stake": + x.MinStake = value.Message().Interface().(*v1beta1.Coin) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.Params")) @@ -175,6 +193,11 @@ func (x *fastReflection_Params) Set(fd protoreflect.FieldDescriptor, value proto // Mutable is a mutating operation and unsafe for concurrent use. func (x *fastReflection_Params) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { + case "poktroll.supplier.Params.min_stake": + if x.MinStake == nil { + x.MinStake = new(v1beta1.Coin) + } + return protoreflect.ValueOfMessage(x.MinStake.ProtoReflect()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.Params")) @@ -188,6 +211,9 @@ func (x *fastReflection_Params) Mutable(fd protoreflect.FieldDescriptor) protore // For lists, maps, and messages, this returns a new, empty, mutable value. func (x *fastReflection_Params) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { + case "poktroll.supplier.Params.min_stake": + m := new(v1beta1.Coin) + return protoreflect.ValueOfMessage(m.ProtoReflect()) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.supplier.Params")) @@ -257,6 +283,10 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { var n int var l int _ = l + if x.MinStake != nil { + l = options.Size(x.MinStake) + n += 1 + l + runtime.Sov(uint64(l)) + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -286,6 +316,20 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if x.MinStake != nil { + encoded, err := options.Marshal(x.MinStake) + 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 { @@ -335,6 +379,42 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Params: 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 MinStake", 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.MinStake == nil { + x.MinStake = &v1beta1.Coin{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.MinStake); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -388,6 +468,10 @@ type Params struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + // min_stake is the minimum amount of uPOKT that a supplier must stake to be + // included in network sessions. + MinStake *v1beta1.Coin `protobuf:"bytes,1,opt,name=min_stake,json=minStake,proto3" json:"min_stake,omitempty"` } func (x *Params) Reset() { @@ -410,6 +494,13 @@ func (*Params) Descriptor() ([]byte, []int) { return file_poktroll_supplier_params_proto_rawDescGZIP(), []int{0} } +func (x *Params) GetMinStake() *v1beta1.Coin { + if x != nil { + return x.MinStake + } + return nil +} + var File_poktroll_supplier_params_proto protoreflect.FileDescriptor var file_poktroll_supplier_params_proto_rawDesc = []byte{ @@ -418,22 +509,30 @@ var file_poktroll_supplier_params_proto_rawDesc = []byte{ 0x12, 0x11, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2d, 0x0a, 0x06, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3a, 0x23, 0xe8, 0xa0, 0x1f, 0x01, 0x8a, 0xe7, 0xb0, 0x2a, - 0x1a, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x78, 0x2f, 0x73, 0x75, 0x70, 0x70, - 0x6c, 0x69, 0x65, 0x72, 0x2f, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0xb1, 0x01, 0xd8, 0xe2, - 0x1e, 0x01, 0x0a, 0x15, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x2e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x42, 0x0b, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x22, 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, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xa2, 0x02, 0x03, 0x50, - 0x53, 0x58, 0xaa, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x75, - 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xca, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xe2, 0x02, 0x1d, 0x50, 0x6f, 0x6b, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5c, 0x47, - 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x12, 0x50, 0x6f, 0x6b, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x3a, 0x3a, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x88, 0x01, 0x0a, + 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x59, 0x0a, 0x09, 0x6d, 0x69, 0x6e, 0x5f, 0x73, + 0x74, 0x61, 0x6b, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x21, 0xea, 0xde, 0x1f, 0x09, 0x6d, 0x69, 0x6e, 0x5f, 0x73, + 0x74, 0x61, 0x6b, 0x65, 0xf2, 0xde, 0x1f, 0x10, 0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x6d, 0x69, + 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x22, 0x52, 0x08, 0x6d, 0x69, 0x6e, 0x53, 0x74, 0x61, + 0x6b, 0x65, 0x3a, 0x23, 0xe8, 0xa0, 0x1f, 0x01, 0x8a, 0xe7, 0xb0, 0x2a, 0x1a, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x78, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, + 0x2f, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0xb1, 0x01, 0xd8, 0xe2, 0x1e, 0x01, 0x0a, 0x15, + 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x73, 0x75, 0x70, + 0x70, 0x6c, 0x69, 0x65, 0x72, 0x42, 0x0b, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x22, 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, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xa2, 0x02, 0x03, 0x50, 0x53, 0x58, 0xaa, 0x02, + 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, + 0x65, 0x72, 0xca, 0x02, 0x11, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x53, 0x75, + 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0xe2, 0x02, 0x1d, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x5c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x12, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x3a, 0x3a, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( @@ -450,14 +549,16 @@ func file_poktroll_supplier_params_proto_rawDescGZIP() []byte { var file_poktroll_supplier_params_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_poktroll_supplier_params_proto_goTypes = []interface{}{ - (*Params)(nil), // 0: poktroll.supplier.Params + (*Params)(nil), // 0: poktroll.supplier.Params + (*v1beta1.Coin)(nil), // 1: cosmos.base.v1beta1.Coin } var file_poktroll_supplier_params_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name + 1, // 0: poktroll.supplier.Params.min_stake:type_name -> cosmos.base.v1beta1.Coin + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name } func init() { file_poktroll_supplier_params_proto_init() } diff --git a/proto/poktroll/supplier/params.proto b/proto/poktroll/supplier/params.proto index ea532e61c..e95983a95 100644 --- a/proto/poktroll/supplier/params.proto +++ b/proto/poktroll/supplier/params.proto @@ -6,9 +6,14 @@ option (gogoproto.stable_marshaler_all) = true; import "amino/amino.proto"; import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; // Params defines the parameters for the module. message Params { option (amino.name) = "poktroll/x/supplier/Params"; option (gogoproto.equal) = true; + + // min_stake is the minimum amount of uPOKT that a supplier must stake to be + // included in network sessions. + cosmos.base.v1beta1.Coin min_stake = 1 [(gogoproto.jsontag) = "min_stake", (gogoproto.moretags) = "yaml:\"min_stake\""]; } diff --git a/x/supplier/types/params.pb.go b/x/supplier/types/params.pb.go index 4400a9ef5..e2390cfd2 100644 --- a/x/supplier/types/params.pb.go +++ b/x/supplier/types/params.pb.go @@ -5,6 +5,7 @@ package types import ( fmt "fmt" + types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" @@ -26,6 +27,9 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Params defines the parameters for the module. type Params struct { + // min_stake is the minimum amount of uPOKT that a supplier must stake to be + // included in network sessions. + MinStake *types.Coin `protobuf:"bytes,1,opt,name=min_stake,json=minStake,proto3" json:"min_stake" yaml:"min_stake"` } func (m *Params) Reset() { *m = Params{} } @@ -57,6 +61,13 @@ func (m *Params) XXX_DiscardUnknown() { var xxx_messageInfo_Params proto.InternalMessageInfo +func (m *Params) GetMinStake() *types.Coin { + if m != nil { + return m.MinStake + } + return nil +} + func init() { proto.RegisterType((*Params)(nil), "poktroll.supplier.Params") } @@ -64,19 +75,25 @@ func init() { func init() { proto.RegisterFile("poktroll/supplier/params.proto", fileDescriptor_60f7a8031a8c22d5) } var fileDescriptor_60f7a8031a8c22d5 = []byte{ - // 181 bytes of a gzipped FileDescriptorProto + // 273 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2b, 0xc8, 0xcf, 0x2e, 0x29, 0xca, 0xcf, 0xc9, 0xd1, 0x2f, 0x2e, 0x2d, 0x28, 0xc8, 0xc9, 0x4c, 0x2d, 0xd2, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x84, 0xc9, 0xeb, 0xc1, 0xe4, 0xa5, 0x04, 0x13, 0x73, 0x33, 0xf3, 0xf2, 0xf5, 0xc1, 0x24, 0x44, 0x95, 0x94, 0x48, 0x7a, - 0x7e, 0x7a, 0x3e, 0x98, 0xa9, 0x0f, 0x62, 0x41, 0x44, 0x95, 0x74, 0xb9, 0xd8, 0x02, 0xc0, 0x66, - 0x59, 0x29, 0xbf, 0x58, 0x20, 0xcf, 0xd8, 0xf5, 0x7c, 0x83, 0x96, 0x14, 0xdc, 0xba, 0x0a, 0x84, - 0x85, 0x10, 0x45, 0x4e, 0xfe, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0x78, 0xe3, 0x91, - 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, - 0xb1, 0x1c, 0x43, 0x94, 0x61, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x3e, - 0xc8, 0x10, 0xdd, 0xbc, 0xd4, 0x92, 0xf2, 0xfc, 0xa2, 0x6c, 0x7d, 0x6c, 0x26, 0x96, 0x54, 0x16, - 0xa4, 0x16, 0x27, 0xb1, 0x81, 0x9d, 0x61, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x2d, 0x7e, 0xc4, - 0x71, 0xe4, 0x00, 0x00, 0x00, + 0x7e, 0x7a, 0x3e, 0x98, 0xa9, 0x0f, 0x62, 0x41, 0x45, 0xe5, 0x92, 0xf3, 0x8b, 0x73, 0xf3, 0x8b, + 0xf5, 0x93, 0x12, 0x8b, 0x53, 0xf5, 0xcb, 0x0c, 0x93, 0x52, 0x4b, 0x12, 0x0d, 0xf5, 0x93, 0xf3, + 0x33, 0xf3, 0x20, 0xf2, 0x4a, 0x1d, 0x8c, 0x5c, 0x6c, 0x01, 0x60, 0xcb, 0x84, 0x22, 0xb9, 0x38, + 0x73, 0x33, 0xf3, 0xe2, 0x8b, 0x4b, 0x12, 0xb3, 0x53, 0x25, 0x18, 0x15, 0x18, 0x35, 0xb8, 0x8d, + 0x24, 0xf5, 0x20, 0xda, 0xf5, 0x40, 0xda, 0xf5, 0xa0, 0xda, 0xf5, 0x9c, 0xf3, 0x33, 0xf3, 0x9c, + 0x14, 0x5f, 0xdd, 0x93, 0x47, 0xa8, 0xff, 0x74, 0x4f, 0x5e, 0xa0, 0x32, 0x31, 0x37, 0xc7, 0x4a, + 0x09, 0x2e, 0xa4, 0x14, 0xc4, 0x91, 0x9b, 0x99, 0x17, 0x0c, 0x62, 0x5a, 0x29, 0xbf, 0x58, 0x20, + 0xcf, 0xd8, 0xf5, 0x7c, 0x83, 0x96, 0x14, 0xdc, 0xab, 0x15, 0x08, 0xcf, 0x42, 0xec, 0x77, 0xf2, + 0x3f, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x1b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, + 0x63, 0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, 0xa2, 0x0c, + 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0x41, 0x86, 0xe8, 0xe6, 0xa5, + 0x96, 0x94, 0xe7, 0x17, 0x65, 0xeb, 0x63, 0x33, 0xb1, 0xa4, 0xb2, 0x20, 0xb5, 0x38, 0x89, 0x0d, + 0xec, 0x45, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc3, 0x4d, 0x0e, 0x37, 0x60, 0x01, 0x00, + 0x00, } func (this *Params) Equal(that interface{}) bool { @@ -98,6 +115,9 @@ func (this *Params) Equal(that interface{}) bool { } else if this == nil { return false } + if !this.MinStake.Equal(that1.MinStake) { + return false + } return true } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -120,6 +140,18 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.MinStake != nil { + { + size, err := m.MinStake.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } return len(dAtA) - i, nil } @@ -140,6 +172,10 @@ func (m *Params) Size() (n int) { } var l int _ = l + if m.MinStake != nil { + l = m.MinStake.Size() + n += 1 + l + sovParams(uint64(l)) + } return n } @@ -178,6 +214,42 @@ func (m *Params) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinStake", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MinStake == nil { + m.MinStake = &types.Coin{} + } + if err := m.MinStake.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipParams(dAtA[iNdEx:]) From e84643de9f0f922cd984421598c42aa4595e40a7 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 2 Oct 2024 12:18:29 +0200 Subject: [PATCH 079/139] test: add min_stake to supplier ModuleParamConfig --- testutil/integration/suites/param_configs.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/testutil/integration/suites/param_configs.go b/testutil/integration/suites/param_configs.go index 9317d64df..00621e8ae 100644 --- a/testutil/integration/suites/param_configs.go +++ b/testutil/integration/suites/param_configs.go @@ -183,7 +183,12 @@ var ( QueryParamsRequest: suppliertypes.QueryParamsRequest{}, QueryParamsResponse: suppliertypes.QueryParamsResponse{}, }, - ValidParams: suppliertypes.Params{}, + ValidParams: suppliertypes.Params{ + MinStake: &ValidActorMinStake, + }, + ParamTypes: map[ParamType]any{ + ParamTypeCoin: suppliertypes.MsgUpdateParam_AsCoin{}, + }, DefaultParams: suppliertypes.DefaultParams(), NewParamClientFn: suppliertypes.NewQueryClient, } From f694bad07f70d2b690f2d6faf0460df54ec6c167 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 2 Oct 2024 16:42:05 +0200 Subject: [PATCH 080/139] chore: add min_stake genesis param to config.yml --- config.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/config.yml b/config.yml index 57db72f1a..5ce114e81 100644 --- a/config.yml +++ b/config.yml @@ -193,6 +193,11 @@ genesis: amount: "100000068" # ~100 POKT denom: upokt supplier: + params: + # TODO_MAINNET: Determine realistic amount for minimum gateway stake amount. + min_stake: + amount: "1000000" # 1 POKT + denom: upokt supplierList: - owner_address: pokt19a3t4yunp0dlpfjrp7qwnzwlrzd5fzs2gjaaaj operator_address: pokt19a3t4yunp0dlpfjrp7qwnzwlrzd5fzs2gjaaaj From 000c3304fd5225ba46318cd418aed6bde0102dac Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 2 Oct 2024 16:42:25 +0200 Subject: [PATCH 081/139] chore: add min_stake defaults and validation --- x/supplier/types/message_update_param.go | 24 ++++++++-- x/supplier/types/params.go | 61 +++++++++++++++++++++--- 2 files changed, 76 insertions(+), 9 deletions(-) diff --git a/x/supplier/types/message_update_param.go b/x/supplier/types/message_update_param.go index 843e69aaf..2e3614d78 100644 --- a/x/supplier/types/message_update_param.go +++ b/x/supplier/types/message_update_param.go @@ -27,6 +27,10 @@ func NewMsgUpdateParam(authority string, name string, asType any) *MsgUpdatePara } } +// ValidateBasic performs a basic validation of the MsgUpdateParam fields. It ensures: +// 1. The parameter name is supported. +// 2. The parameter type matches the expected type for a given parameter name. +// 3. The parameter value is valid (according to its respective validation function). func (msg *MsgUpdateParam) ValidateBasic() error { _, err := cosmostypes.AccAddressFromBech32(msg.Authority) if err != nil { @@ -40,10 +44,24 @@ func (msg *MsgUpdateParam) ValidateBasic() error { // Parameter name MUST be supported by this module. switch msg.Name { - // TODO_UPNEXT(@bryanchriswhite, #612): replace with min_stake param name and call validation function. - case "": - return nil + case ParamMinStake: + if err := msg.paramTypeIsCoin(); err != nil { + return err + } + return ValidateMinStake(msg.GetAsCoin()) default: return ErrSupplierParamInvalid.Wrapf("unsupported param %q", msg.Name) } } + +// paramTypeIsCoin checks if the parameter type is a Coin, returning an error if not. +func (msg *MsgUpdateParam) paramTypeIsCoin() error { + if _, ok := msg.AsType.(*MsgUpdateParam_AsCoin); !ok { + return ErrSupplierParamInvalid.Wrapf( + "invalid type for param %q expected %T, got %T", + msg.Name, &MsgUpdateParam_AsCoin{}, + msg.AsType, + ) + } + return nil +} diff --git a/x/supplier/types/params.go b/x/supplier/types/params.go index 95b0cf8a2..1f959e178 100644 --- a/x/supplier/types/params.go +++ b/x/supplier/types/params.go @@ -1,8 +1,20 @@ package types -import paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" +import ( + cosmostypes "github.com/cosmos/cosmos-sdk/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" -var _ paramtypes.ParamSet = (*Params)(nil) + "github.com/pokt-network/poktroll/app/volatile" +) + +var ( + _ paramtypes.ParamSet = (*Params)(nil) + + KeyMinStake = []byte("MinStake") + ParamMinStake = "min_stake" + // TODO_MAINNET: Determine the default value. + DefaultMinStake = cosmostypes.NewInt64Coin("upokt", 1000000) // 1 POKT +) // ParamKeyTable the param key table for launch module func ParamKeyTable() paramtypes.KeyTable { @@ -10,21 +22,58 @@ func ParamKeyTable() paramtypes.KeyTable { } // NewParams creates a new Params instance -func NewParams() Params { - return Params{} +func NewParams(minStake *cosmostypes.Coin) Params { + return Params{ + MinStake: minStake, + } } // DefaultParams returns a default set of parameters func DefaultParams() Params { - return NewParams() + return NewParams(&DefaultMinStake) } // ParamSetPairs get the params.ParamSet func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { - return paramtypes.ParamSetPairs{} + return paramtypes.ParamSetPairs{ + paramtypes.NewParamSetPair( + KeyMinStake, + &p.MinStake, + ValidateMinStake, + ), + } } // Validate validates the set of params func (p Params) Validate() error { + if err := ValidateMinStake(p.MinStake); err != nil { + return err + } + + return nil +} + +// ValidateMinStake validates the MinStake param. +func ValidateMinStake(minStakeAny any) error { + minStakeCoin, ok := minStakeAny.(*cosmostypes.Coin) + if !ok { + return ErrSupplierParamInvalid.Wrapf("invalid param type: %T", minStakeAny) + } + + if minStakeCoin == nil { + return ErrSupplierParamInvalid.Wrapf("missing min_stake") + } + + if minStakeCoin.Denom != volatile.DenomuPOKT { + return ErrSupplierParamInvalid.Wrapf( + "invalid min_stake denom %q; expected %q", + minStakeCoin.Denom, volatile.DenomuPOKT, + ) + } + + if minStakeCoin.IsZero() || minStakeCoin.IsNegative() { + return ErrSupplierParamInvalid.Wrapf("invalid min_stake amount: %s <= 0", minStakeCoin) + } + return nil } From 5e72e47f398cbbb45d66a0950f976301ea393489 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 2 Oct 2024 17:08:19 +0200 Subject: [PATCH 082/139] chore: add min_stake case to MsgUpdateParam handler --- x/supplier/keeper/msg_server_update_param.go | 22 ++++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/x/supplier/keeper/msg_server_update_param.go b/x/supplier/keeper/msg_server_update_param.go index 35efa6581..2e32e7e84 100644 --- a/x/supplier/keeper/msg_server_update_param.go +++ b/x/supplier/keeper/msg_server_update_param.go @@ -17,21 +17,21 @@ func (k msgServer) UpdateParam(ctx context.Context, msg *suppliertypes.MsgUpdate return nil, suppliertypes.ErrSupplierInvalidSigner.Wrapf("invalid authority; expected %s, got %s", k.GetAuthority(), msg.Authority) } - // TODO_UPNEXT(@bryanchriswhite, #612): uncomment & add a min_stake case. - - //params := k.GetParams(ctx) + params := k.GetParams(ctx) switch msg.Name { + case suppliertypes.ParamMinStake: + params.MinStake = msg.GetAsCoin() default: return nil, suppliertypes.ErrSupplierParamInvalid.Wrapf("unsupported param %q", msg.Name) } - //if err := k.SetParams(ctx, params); err != nil { - // return nil, err - //} - // - //updatedParams := k.GetParams(ctx) - //return &suppliertypes.MsgUpdateParamResponse{ - // Params: &updatedParams, - //}, nil + if err := k.SetParams(ctx, params); err != nil { + return nil, err + } + + updatedParams := k.GetParams(ctx) + return &suppliertypes.MsgUpdateParamResponse{ + Params: &updatedParams, + }, nil } From c5ede9d9fb77db4ccc52685d0ca659c8d5cf7c75 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 2 Oct 2024 17:21:00 +0200 Subject: [PATCH 083/139] chore: update MsgUpdateParams, MsgUpdateParam, & Params unit tests --- .../keeper/msg_server_update_param_test.go | 41 +++++++++++++++++ x/supplier/keeper/msg_update_params_test.go | 26 +++++++---- x/supplier/keeper/params_test.go | 46 ++++++++++++++++++- x/supplier/types/message_update_param_test.go | 8 ++-- 4 files changed, 106 insertions(+), 15 deletions(-) create mode 100644 x/supplier/keeper/msg_server_update_param_test.go diff --git a/x/supplier/keeper/msg_server_update_param_test.go b/x/supplier/keeper/msg_server_update_param_test.go new file mode 100644 index 000000000..b6672646a --- /dev/null +++ b/x/supplier/keeper/msg_server_update_param_test.go @@ -0,0 +1,41 @@ +package keeper_test + +import ( + "testing" + + cosmostypes "github.com/cosmos/cosmos-sdk/types" + 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/app/volatile" + testkeeper "github.com/pokt-network/poktroll/testutil/keeper" + suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" +) + +func TestMsgUpdateParam_UpdateMinStakeOnly(t *testing.T) { + expectedMinStake := cosmostypes.NewInt64Coin(volatile.DenomuPOKT, 420) + + // Set the parameters to their default values + k, msgSrv, ctx := setupMsgServer(t) + defaultParams := suppliertypes.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, expectedMinStake, defaultParams.MinStake) + + // Update the min relay difficulty bits + updateParamMsg := &suppliertypes.MsgUpdateParam{ + Authority: authtypes.NewModuleAddress(govtypes.ModuleName).String(), + Name: suppliertypes.ParamMinStake, + AsType: &suppliertypes.MsgUpdateParam_AsCoin{AsCoin: &expectedMinStake}, + } + res, err := msgSrv.UpdateParam(ctx, updateParamMsg) + require.NoError(t, err) + + require.NotEqual(t, defaultParams.MinStake, res.Params.MinStake) + require.Equal(t, expectedMinStake.Amount, res.Params.MinStake.Amount) + + // Ensure the other parameters are unchanged + testkeeper.AssertDefaultParamsEqualExceptFields(t, &defaultParams, res.Params, suppliertypes.ParamMinStake) +} diff --git a/x/supplier/keeper/msg_update_params_test.go b/x/supplier/keeper/msg_update_params_test.go index 9efd6db7d..5a0019a64 100644 --- a/x/supplier/keeper/msg_update_params_test.go +++ b/x/supplier/keeper/msg_update_params_test.go @@ -5,24 +5,24 @@ import ( "github.com/stretchr/testify/require" - "github.com/pokt-network/poktroll/x/supplier/types" + suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" ) func TestMsgUpdateParams(t *testing.T) { k, ms, ctx := setupMsgServer(t) - params := types.DefaultParams() + params := suppliertypes.DefaultParams() require.NoError(t, k.SetParams(ctx, params)) // default params tests := []struct { desc string - params *types.MsgUpdateParams + params *suppliertypes.MsgUpdateParams shouldError bool expectedErrMsg string }{ { desc: "invalid: authority address invalid", - params: &types.MsgUpdateParams{ + params: &suppliertypes.MsgUpdateParams{ Authority: "invalid", Params: params, }, @@ -30,16 +30,26 @@ func TestMsgUpdateParams(t *testing.T) { expectedErrMsg: "invalid authority", }, { - desc: "send empty params", - params: &types.MsgUpdateParams{ + desc: "invalid: send empty params", + params: &suppliertypes.MsgUpdateParams{ Authority: k.GetAuthority(), - Params: types.Params{}, + Params: suppliertypes.Params{}, + }, + shouldError: true, + }, + { + desc: "valid: send minimal params", + params: &suppliertypes.MsgUpdateParams{ + Authority: k.GetAuthority(), + Params: suppliertypes.Params{ + MinStake: &suppliertypes.DefaultMinStake, + }, }, shouldError: false, }, { desc: "valid: send default params", - params: &types.MsgUpdateParams{ + params: &suppliertypes.MsgUpdateParams{ Authority: k.GetAuthority(), Params: params, }, diff --git a/x/supplier/keeper/params_test.go b/x/supplier/keeper/params_test.go index a2e5fefc5..00311d9e4 100644 --- a/x/supplier/keeper/params_test.go +++ b/x/supplier/keeper/params_test.go @@ -3,16 +3,58 @@ package keeper_test import ( "testing" + "cosmossdk.io/math" + cosmostypes "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" + "github.com/pokt-network/poktroll/app/volatile" keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/x/supplier/types" + gatewaytypes "github.com/pokt-network/poktroll/x/gateway/types" + suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" ) func TestGetParams(t *testing.T) { supplierModuleKeepers, ctx := keepertest.SupplierKeeper(t) - params := types.DefaultParams() + params := suppliertypes.DefaultParams() require.NoError(t, supplierModuleKeepers.SetParams(ctx, params)) require.EqualValues(t, params, supplierModuleKeepers.Keeper.GetParams(ctx)) } + +func TestParams_ValidateMinStake(t *testing.T) { + tests := []struct { + desc string + minStake any + expectedErr error + }{ + { + desc: "invalid type", + minStake: "420", + expectedErr: suppliertypes.ErrSupplierParamInvalid.Wrapf("invalid parameter type: string"), + }, + { + desc: "MinStake less than zero", + minStake: &cosmostypes.Coin{ + Denom: volatile.DenomuPOKT, + Amount: math.NewInt(-1), + }, + expectedErr: gatewaytypes.ErrGatewayParamInvalid.Wrapf("min stake amount must be greater than zero: -1%s", volatile.DenomuPOKT), + }, + { + desc: "valid MinStake", + minStake: int64(420), + }, + } + + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + err := suppliertypes.ValidateMinStake(test.minStake) + if test.expectedErr != nil { + require.Error(t, err) + require.Contains(t, err.Error(), test.expectedErr.Error()) + } else { + require.NoError(t, err) + } + }) + } +} diff --git a/x/supplier/types/message_update_param_test.go b/x/supplier/types/message_update_param_test.go index 96136ded1..b259020b7 100644 --- a/x/supplier/types/message_update_param_test.go +++ b/x/supplier/types/message_update_param_test.go @@ -28,17 +28,15 @@ func TestMsgUpdateParam_ValidateBasic(t *testing.T) { msg: MsgUpdateParam{ Authority: sample.AccAddress(), Name: "non_existent", - // TODO_UPNEXT(@bryanchriswhite, #612): replace with default min_stake. - AsType: &MsgUpdateParam_AsCoin{AsCoin: nil}, + AsType: &MsgUpdateParam_AsCoin{AsCoin: &DefaultMinStake}, }, err: ErrSupplierParamInvalid, }, { name: "valid: correct address, param name, and type", msg: MsgUpdateParam{ Authority: sample.AccAddress(), - Name: "", - // TODO_UPNEXT(@bryanchriswhite, #612): replace with default min_stake. - AsType: &MsgUpdateParam_AsCoin{AsCoin: nil}, + Name: ParamMinStake, + AsType: &MsgUpdateParam_AsCoin{AsCoin: &DefaultMinStake}, }, }, } From 698712be36b003a454768728c99218f4318f4310 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 2 Oct 2024 17:26:23 +0200 Subject: [PATCH 084/139] chore: add make targets and JSON files --- makefiles/params.mk | 15 ++++++++++++++- tools/scripts/params/supplier_all.json | 16 ++++++++++++++++ tools/scripts/params/supplier_min_stake.json | 15 +++++++++++++++ 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 tools/scripts/params/supplier_all.json create mode 100644 tools/scripts/params/supplier_min_stake.json diff --git a/makefiles/params.mk b/makefiles/params.mk index a822b5cfc..6b0772a7f 100644 --- a/makefiles/params.mk +++ b/makefiles/params.mk @@ -103,7 +103,7 @@ params_get_gateway: ## Get the gateway module params poktrolld query gateway params --node $(POCKET_NODE) .PHONY: params_update_gateway_all -params_update_gateway_all: ## Update the session module params +params_update_gateway_all: ## Update the gateway module params poktrolld tx authz exec ./tools/scripts/params/gateway_all.json $(PARAM_FLAGS) .PHONY: params_update_gateway_min_stake @@ -127,6 +127,19 @@ params_update_application_max_delegated_gateways: ## Update the application modu params_update_application_min_stake: ## Update the application module min_stake param poktrolld tx authz exec ./tools/scripts/params/application_min_stake.json $(PARAM_FLAGS) +### Gateway Module Params ### +.PHONY: params_get_supplier +params_get_supplier: ## Get the supplier module params + poktrolld query supplier params --node $(POCKET_NODE) + +.PHONY: params_update_supplier_all +params_update_supplier_all: ## Update the supplier module params + poktrolld tx authz exec ./tools/scripts/params/supplier_all.json $(PARAM_FLAGS) + +.PHONY: params_update_supplier_min_stake +params_update_supplier_min_stake: ## Update the supplier module min_stake param + poktrolld tx authz exec ./tools/scripts/params/supplier_min_stake.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/tools/scripts/params/supplier_all.json b/tools/scripts/params/supplier_all.json new file mode 100644 index 000000000..cded3172f --- /dev/null +++ b/tools/scripts/params/supplier_all.json @@ -0,0 +1,16 @@ +{ + "body": { + "messages": [ + { + "@type": "/poktroll.supplier.MsgUpdateParams", + "authority": "pokt10d07y265gmmuvt4z0w9aw880jnsr700j8yv32t", + "params": { + "min_stake": { + "amount": "1000000", + "denom": "upokt" + } + } + } + ] + } +} \ No newline at end of file diff --git a/tools/scripts/params/supplier_min_stake.json b/tools/scripts/params/supplier_min_stake.json new file mode 100644 index 000000000..fa96d860c --- /dev/null +++ b/tools/scripts/params/supplier_min_stake.json @@ -0,0 +1,15 @@ +{ + "body": { + "messages": [ + { + "@type": "/poktroll.supplier.MsgUpdateParam", + "authority": "pokt10d07y265gmmuvt4z0w9aw880jnsr700j8yv32t", + "name": "min_stake", + "as_coin": { + "amount": "1000000", + "denom": "upokt" + } + } + ] + } +} From b94cd63c14dc61e6221a5242ffc5bc527e53d14c Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 2 Oct 2024 18:18:06 +0200 Subject: [PATCH 085/139] fix: unit tests --- x/supplier/keeper/msg_server_update_param_test.go | 2 +- x/supplier/keeper/params_test.go | 8 +++++--- x/supplier/types/params.go | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/x/supplier/keeper/msg_server_update_param_test.go b/x/supplier/keeper/msg_server_update_param_test.go index b6672646a..39795eb82 100644 --- a/x/supplier/keeper/msg_server_update_param_test.go +++ b/x/supplier/keeper/msg_server_update_param_test.go @@ -37,5 +37,5 @@ func TestMsgUpdateParam_UpdateMinStakeOnly(t *testing.T) { require.Equal(t, expectedMinStake.Amount, res.Params.MinStake.Amount) // Ensure the other parameters are unchanged - testkeeper.AssertDefaultParamsEqualExceptFields(t, &defaultParams, res.Params, suppliertypes.ParamMinStake) + testkeeper.AssertDefaultParamsEqualExceptFields(t, &defaultParams, res.Params, string(suppliertypes.KeyMinStake)) } diff --git a/x/supplier/keeper/params_test.go b/x/supplier/keeper/params_test.go index 00311d9e4..3d74b7813 100644 --- a/x/supplier/keeper/params_test.go +++ b/x/supplier/keeper/params_test.go @@ -9,7 +9,6 @@ import ( "github.com/pokt-network/poktroll/app/volatile" keepertest "github.com/pokt-network/poktroll/testutil/keeper" - gatewaytypes "github.com/pokt-network/poktroll/x/gateway/types" suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" ) @@ -38,11 +37,14 @@ func TestParams_ValidateMinStake(t *testing.T) { Denom: volatile.DenomuPOKT, Amount: math.NewInt(-1), }, - expectedErr: gatewaytypes.ErrGatewayParamInvalid.Wrapf("min stake amount must be greater than zero: -1%s", volatile.DenomuPOKT), + expectedErr: suppliertypes.ErrSupplierParamInvalid.Wrapf( + "min_stake amount must be greater than 0: got -1%s", + volatile.DenomuPOKT, + ), }, { desc: "valid MinStake", - minStake: int64(420), + minStake: &suppliertypes.DefaultMinStake, }, } diff --git a/x/supplier/types/params.go b/x/supplier/types/params.go index 1f959e178..48a90f97d 100644 --- a/x/supplier/types/params.go +++ b/x/supplier/types/params.go @@ -57,7 +57,7 @@ func (p Params) Validate() error { func ValidateMinStake(minStakeAny any) error { minStakeCoin, ok := minStakeAny.(*cosmostypes.Coin) if !ok { - return ErrSupplierParamInvalid.Wrapf("invalid param type: %T", minStakeAny) + return ErrSupplierParamInvalid.Wrapf("invalid parameter type: %T", minStakeAny) } if minStakeCoin == nil { @@ -72,7 +72,7 @@ func ValidateMinStake(minStakeAny any) error { } if minStakeCoin.IsZero() || minStakeCoin.IsNegative() { - return ErrSupplierParamInvalid.Wrapf("invalid min_stake amount: %s <= 0", minStakeCoin) + return ErrSupplierParamInvalid.Wrapf("min_stake amount must be greater than 0: got %s", minStakeCoin) } return nil From fcc18c60dcb9e7d97de94649321b6eb0e61bc2f0 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 2 Oct 2024 18:18:23 +0200 Subject: [PATCH 086/139] chore: return gRPC status errors from msgServer methods --- x/supplier/keeper/msg_server_update_param.go | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/x/supplier/keeper/msg_server_update_param.go b/x/supplier/keeper/msg_server_update_param.go index 2e32e7e84..6a1a305a4 100644 --- a/x/supplier/keeper/msg_server_update_param.go +++ b/x/supplier/keeper/msg_server_update_param.go @@ -3,6 +3,9 @@ package keeper import ( "context" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" ) @@ -10,11 +13,17 @@ import ( // all active parameters. func (k msgServer) UpdateParam(ctx context.Context, msg *suppliertypes.MsgUpdateParam) (*suppliertypes.MsgUpdateParamResponse, error) { if err := msg.ValidateBasic(); err != nil { - return nil, err + return nil, status.Error(codes.InvalidArgument, err.Error()) } if k.GetAuthority() != msg.Authority { - return nil, suppliertypes.ErrSupplierInvalidSigner.Wrapf("invalid authority; expected %s, got %s", k.GetAuthority(), msg.Authority) + return nil, status.Error( + codes.InvalidArgument, + suppliertypes.ErrSupplierInvalidSigner.Wrapf( + "invalid authority; expected %s, got %s", + k.GetAuthority(), msg.Authority, + ).Error(), + ) } params := k.GetParams(ctx) @@ -23,11 +32,14 @@ func (k msgServer) UpdateParam(ctx context.Context, msg *suppliertypes.MsgUpdate case suppliertypes.ParamMinStake: params.MinStake = msg.GetAsCoin() default: - return nil, suppliertypes.ErrSupplierParamInvalid.Wrapf("unsupported param %q", msg.Name) + return nil, status.Error( + codes.InvalidArgument, + suppliertypes.ErrSupplierParamInvalid.Wrapf("unsupported param %q", msg.Name).Error(), + ) } if err := k.SetParams(ctx, params); err != nil { - return nil, err + return nil, status.Error(codes.InvalidArgument, err.Error()) } updatedParams := k.GetParams(ctx) From 6c18b75852fe35ab25f34ad7cb33edb58b8b042f Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 2 Oct 2024 19:31:58 +0200 Subject: [PATCH 087/139] fix: genesis test --- x/supplier/types/genesis_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/x/supplier/types/genesis_test.go b/x/supplier/types/genesis_test.go index 0e4301e3e..2b960fbb1 100644 --- a/x/supplier/types/genesis_test.go +++ b/x/supplier/types/genesis_test.go @@ -66,6 +66,7 @@ func TestGenesisState_Validate(t *testing.T) { { desc: "valid genesis state", genState: &types.GenesisState{ + Params: types.DefaultParams(), SupplierList: []sharedtypes.Supplier{ { OwnerAddress: addr1, @@ -87,6 +88,7 @@ func TestGenesisState_Validate(t *testing.T) { { desc: "invalid - zero supplier stake", genState: &types.GenesisState{ + Params: types.DefaultParams(), SupplierList: []sharedtypes.Supplier{ { OwnerAddress: addr1, @@ -107,6 +109,7 @@ func TestGenesisState_Validate(t *testing.T) { { desc: "invalid - negative supplier stake", genState: &types.GenesisState{ + Params: types.DefaultParams(), SupplierList: []sharedtypes.Supplier{ { OwnerAddress: addr1, @@ -127,6 +130,7 @@ func TestGenesisState_Validate(t *testing.T) { { desc: "invalid - wrong stake denom", genState: &types.GenesisState{ + Params: types.DefaultParams(), SupplierList: []sharedtypes.Supplier{ { OwnerAddress: addr1, @@ -147,6 +151,7 @@ func TestGenesisState_Validate(t *testing.T) { { desc: "invalid - missing denom", genState: &types.GenesisState{ + Params: types.DefaultParams(), SupplierList: []sharedtypes.Supplier{ { OwnerAddress: addr1, @@ -167,6 +172,7 @@ func TestGenesisState_Validate(t *testing.T) { { desc: "invalid - due to duplicated supplier operator address", genState: &types.GenesisState{ + Params: types.DefaultParams(), SupplierList: []sharedtypes.Supplier{ { OwnerAddress: addr1, @@ -187,6 +193,7 @@ func TestGenesisState_Validate(t *testing.T) { { desc: "invalid - due to nil supplier stake", genState: &types.GenesisState{ + Params: types.DefaultParams(), SupplierList: []sharedtypes.Supplier{ { OwnerAddress: addr1, @@ -207,6 +214,7 @@ func TestGenesisState_Validate(t *testing.T) { { desc: "invalid - due to missing supplier stake", genState: &types.GenesisState{ + Params: types.DefaultParams(), SupplierList: []sharedtypes.Supplier{ { OwnerAddress: addr1, @@ -227,6 +235,7 @@ func TestGenesisState_Validate(t *testing.T) { { desc: "invalid - missing services list", genState: &types.GenesisState{ + Params: types.DefaultParams(), SupplierList: []sharedtypes.Supplier{ { OwnerAddress: addr1, @@ -247,6 +256,7 @@ func TestGenesisState_Validate(t *testing.T) { { desc: "invalid - empty services list", genState: &types.GenesisState{ + Params: types.DefaultParams(), SupplierList: []sharedtypes.Supplier{ { OwnerAddress: addr1, @@ -267,6 +277,7 @@ func TestGenesisState_Validate(t *testing.T) { { desc: "invalid - invalid URL", genState: &types.GenesisState{ + Params: types.DefaultParams(), SupplierList: []sharedtypes.Supplier{ { OwnerAddress: addr1, @@ -304,6 +315,7 @@ func TestGenesisState_Validate(t *testing.T) { { desc: "invalid - invalid RPC Type", genState: &types.GenesisState{ + Params: types.DefaultParams(), SupplierList: []sharedtypes.Supplier{ { OwnerAddress: addr1, From 4e259c98ce93f7d3998b65b14f81a83f2cba059e Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 2 Oct 2024 19:49:57 +0200 Subject: [PATCH 088/139] chore: apply improvements --- x/gateway/keeper/msg_server_update_param.go | 9 +++------ x/gateway/keeper/msg_server_update_param_test.go | 2 +- x/gateway/types/message_update_param.go | 5 ++++- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/x/gateway/keeper/msg_server_update_param.go b/x/gateway/keeper/msg_server_update_param.go index 835d0701d..97f94b2c0 100644 --- a/x/gateway/keeper/msg_server_update_param.go +++ b/x/gateway/keeper/msg_server_update_param.go @@ -6,6 +6,8 @@ import ( "github.com/pokt-network/poktroll/x/gateway/types" ) +// UpdateParam updates a single parameter in the proof module and returns +// all active parameters. func (k msgServer) UpdateParam(ctx context.Context, msg *types.MsgUpdateParam) (*types.MsgUpdateParamResponse, error) { if err := msg.ValidateBasic(); err != nil { return nil, err @@ -19,12 +21,7 @@ func (k msgServer) UpdateParam(ctx context.Context, msg *types.MsgUpdateParam) ( switch msg.Name { case types.ParamMinStake: - value, ok := msg.AsType.(*types.MsgUpdateParam_AsCoin) - if !ok { - return nil, types.ErrGatewayParamInvalid.Wrapf("unsupported value type for %s param: %T", msg.Name, msg.AsType) - } - - params.MinStake = value.AsCoin + params.MinStake = msg.GetAsCoin() default: return nil, types.ErrGatewayParamInvalid.Wrapf("unsupported param %q", msg.Name) } diff --git a/x/gateway/keeper/msg_server_update_param_test.go b/x/gateway/keeper/msg_server_update_param_test.go index 001d80cb6..84f61086c 100644 --- a/x/gateway/keeper/msg_server_update_param_test.go +++ b/x/gateway/keeper/msg_server_update_param_test.go @@ -37,5 +37,5 @@ func TestMsgUpdateParam_UpdateMinStakeOnly(t *testing.T) { require.Equal(t, expectedMinStake.Amount, res.Params.MinStake.Amount) // Ensure the other parameters are unchanged - testkeeper.AssertDefaultParamsEqualExceptFields(t, &defaultParams, res.Params, "MinStake") + testkeeper.AssertDefaultParamsEqualExceptFields(t, &defaultParams, res.Params, string(gatewaytypes.KeyMinStake)) } diff --git a/x/gateway/types/message_update_param.go b/x/gateway/types/message_update_param.go index f09a7758e..9e7ff407e 100644 --- a/x/gateway/types/message_update_param.go +++ b/x/gateway/types/message_update_param.go @@ -41,7 +41,10 @@ func (msg *MsgUpdateParam) ValidateBasic() error { // Parameter name must be supported by this module. switch msg.Name { case ParamMinStake: - return msg.paramTypeIsCoin() + if err := msg.paramTypeIsCoin(); err != nil { + return err + } + return ValidateMinStake(msg.GetAsCoin()) default: return ErrGatewayParamInvalid.Wrapf("unsupported param %q", msg.Name) } From 280892542fbb3764746708c78e2660e81be19c5b Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 2 Oct 2024 19:56:18 +0200 Subject: [PATCH 089/139] chore: add godoc style comment to min_stake params field --- api/poktroll/gateway/params.pulsar.go | 1 + proto/poktroll/gateway/params.proto | 1 + x/gateway/types/params.pb.go | 1 + 3 files changed, 3 insertions(+) diff --git a/api/poktroll/gateway/params.pulsar.go b/api/poktroll/gateway/params.pulsar.go index 2c7aea466..354bf132c 100644 --- a/api/poktroll/gateway/params.pulsar.go +++ b/api/poktroll/gateway/params.pulsar.go @@ -469,6 +469,7 @@ type Params struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + // min_stake is the minimum amount of uPOKT that a gateway must stake. MinStake *v1beta1.Coin `protobuf:"bytes,1,opt,name=min_stake,json=minStake,proto3" json:"min_stake,omitempty"` } diff --git a/proto/poktroll/gateway/params.proto b/proto/poktroll/gateway/params.proto index 49ece5ac3..2a8290d4c 100644 --- a/proto/poktroll/gateway/params.proto +++ b/proto/poktroll/gateway/params.proto @@ -13,5 +13,6 @@ message Params { option (amino.name) = "poktroll/x/gateway/Params"; option (gogoproto.equal) = true; + // min_stake is the minimum amount of uPOKT that a gateway must stake. cosmos.base.v1beta1.Coin min_stake = 1 [(gogoproto.jsontag) = "min_stake"]; } diff --git a/x/gateway/types/params.pb.go b/x/gateway/types/params.pb.go index d89d0ba7a..c930a8322 100644 --- a/x/gateway/types/params.pb.go +++ b/x/gateway/types/params.pb.go @@ -27,6 +27,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Params defines the parameters for the module. type Params struct { + // min_stake is the minimum amount of uPOKT that a gateway must stake. MinStake *types.Coin `protobuf:"bytes,1,opt,name=min_stake,json=minStake,proto3" json:"min_stake"` } From 197af047d4f31224105640c7fabe7095b9452224 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 2 Oct 2024 20:49:07 +0200 Subject: [PATCH 090/139] chore: add godoc style comment to min_stake params field --- api/poktroll/application/params.pulsar.go | 5 +++-- proto/poktroll/application/params.proto | 3 +++ x/application/types/params.pb.go | 5 +++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/api/poktroll/application/params.pulsar.go b/api/poktroll/application/params.pulsar.go index 8647c2f13..10688a83b 100644 --- a/api/poktroll/application/params.pulsar.go +++ b/api/poktroll/application/params.pulsar.go @@ -520,8 +520,9 @@ type Params struct { // max_delegated_gateways defines the maximum number of gateways that a single // application can delegate to. This is used to prevent performance issues // in case the relay ring signature becomes too large. - MaxDelegatedGateways uint64 `protobuf:"varint,1,opt,name=max_delegated_gateways,json=maxDelegatedGateways,proto3" json:"max_delegated_gateways,omitempty"` - MinStake *v1beta1.Coin `protobuf:"bytes,2,opt,name=min_stake,json=minStake,proto3" json:"min_stake,omitempty"` + MaxDelegatedGateways uint64 `protobuf:"varint,1,opt,name=max_delegated_gateways,json=maxDelegatedGateways,proto3" json:"max_delegated_gateways,omitempty"` + // min_stake is the minimum stake in upokt that an application must have to remain staked. + MinStake *v1beta1.Coin `protobuf:"bytes,2,opt,name=min_stake,json=minStake,proto3" json:"min_stake,omitempty"` } func (x *Params) Reset() { diff --git a/proto/poktroll/application/params.proto b/proto/poktroll/application/params.proto index fad719cea..08c85159a 100644 --- a/proto/poktroll/application/params.proto +++ b/proto/poktroll/application/params.proto @@ -12,9 +12,12 @@ import "cosmos/base/v1beta1/coin.proto"; message Params { option (amino.name) = "poktroll/x/application/Params"; option (gogoproto.equal) = true; + // max_delegated_gateways defines the maximum number of gateways that a single // application can delegate to. This is used to prevent performance issues // in case the relay ring signature becomes too large. uint64 max_delegated_gateways = 1 [(gogoproto.jsontag) = "max_delegated_gateways", (gogoproto.moretags) = "yaml:\"max_delegated_gateways\""]; + + // min_stake is the minimum stake in upokt that an application must have to remain staked. cosmos.base.v1beta1.Coin min_stake = 2 [(gogoproto.jsontag) = "min_stake", (gogoproto.moretags) = "yaml:\"min_stake\""]; } diff --git a/x/application/types/params.pb.go b/x/application/types/params.pb.go index 7723e6004..c1296fd8b 100644 --- a/x/application/types/params.pb.go +++ b/x/application/types/params.pb.go @@ -30,8 +30,9 @@ type Params struct { // max_delegated_gateways defines the maximum number of gateways that a single // application can delegate to. This is used to prevent performance issues // in case the relay ring signature becomes too large. - MaxDelegatedGateways uint64 `protobuf:"varint,1,opt,name=max_delegated_gateways,json=maxDelegatedGateways,proto3" json:"max_delegated_gateways" yaml:"max_delegated_gateways"` - MinStake *types.Coin `protobuf:"bytes,2,opt,name=min_stake,json=minStake,proto3" json:"min_stake" yaml:"min_stake"` + MaxDelegatedGateways uint64 `protobuf:"varint,1,opt,name=max_delegated_gateways,json=maxDelegatedGateways,proto3" json:"max_delegated_gateways" yaml:"max_delegated_gateways"` + // min_stake is the minimum stake in upokt that an application must have to remain staked. + MinStake *types.Coin `protobuf:"bytes,2,opt,name=min_stake,json=minStake,proto3" json:"min_stake" yaml:"min_stake"` } func (m *Params) Reset() { *m = Params{} } From 2a331272cacd424f8d5f5883e618f9a74ecab16f Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 4 Oct 2024 10:14:53 +0200 Subject: [PATCH 091/139] chore: improvements: - Ensure gRPC status error returns from application module UpdateParam handler - Push validation down into MsgUpdateParam#ValidateBasic() - Validate params before setting when handling MsgUpdateParam - Fix param name argument in MsgUpdateParam test --- .../keeper/msg_server_update_param.go | 43 ++++++++++--------- .../keeper/msg_server_update_param_test.go | 4 +- x/application/types/message_update_param.go | 10 ++++- 3 files changed, 33 insertions(+), 24 deletions(-) diff --git a/x/application/keeper/msg_server_update_param.go b/x/application/keeper/msg_server_update_param.go index 9f8ab8918..dcb809d90 100644 --- a/x/application/keeper/msg_server_update_param.go +++ b/x/application/keeper/msg_server_update_param.go @@ -3,6 +3,9 @@ package keeper import ( "context" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + apptypes "github.com/pokt-network/poktroll/x/application/types" ) @@ -12,7 +15,13 @@ func (k msgServer) UpdateParam(ctx context.Context, msg *apptypes.MsgUpdateParam } if k.GetAuthority() != msg.Authority { - return nil, apptypes.ErrAppInvalidSigner.Wrapf("invalid authority; expected %s, got %s", k.GetAuthority(), msg.Authority) + return nil, status.Error( + codes.InvalidArgument, + apptypes.ErrAppInvalidSigner.Wrapf( + "invalid authority; expected %s, got %s", + k.GetAuthority(), msg.Authority, + ).Error(), + ) } params := k.GetParams(ctx) @@ -20,27 +29,21 @@ func (k msgServer) UpdateParam(ctx context.Context, msg *apptypes.MsgUpdateParam switch msg.Name { // TODO_IMPROVE: Add a Uint64 asType instead of using int64 for uint64 params. case apptypes.ParamMaxDelegatedGateways: - if _, ok := msg.AsType.(*apptypes.MsgUpdateParam_AsInt64); !ok { - return nil, apptypes.ErrAppParamInvalid.Wrapf("unsupported value type for %s param: %T", msg.Name, msg.AsType) - } - maxDelegatedGateways := uint64(msg.GetAsInt64()) - - if err := apptypes.ValidateMaxDelegatedGateways(maxDelegatedGateways); err != nil { - return nil, apptypes.ErrAppParamInvalid.Wrapf("maxdelegegated_gateways (%d): %v", maxDelegatedGateways, err) - } - params.MaxDelegatedGateways = maxDelegatedGateways + params.MaxDelegatedGateways = uint64(msg.GetAsInt64()) case apptypes.ParamMinStake: - if _, ok := msg.AsType.(*apptypes.MsgUpdateParam_AsCoin); !ok { - return nil, apptypes.ErrAppParamInvalid.Wrapf("unsupported value type for %s param: %T", msg.Name, msg.AsType) - } - minStake := msg.GetAsCoin() - - if err := apptypes.ValidateMinStake(minStake); err != nil { - return nil, err - } - params.MinStake = minStake + params.MinStake = msg.GetAsCoin() default: - return nil, apptypes.ErrAppParamInvalid.Wrapf("unsupported param %q", msg.Name) + return nil, status.Error( + codes.InvalidArgument, + apptypes.ErrAppParamInvalid.Wrapf("unsupported param %q", msg.Name).Error(), + ) + } + + // Perform a global validation on all params, which includes the updated param. + // This is needed to ensure that the updated param is valid in the context of all other params. + if err := params.Validate(); err != nil { + return nil, status.Error(codes.InvalidArgument, err.Error()) + } if err := k.SetParams(ctx, params); err != nil { diff --git a/x/application/keeper/msg_server_update_param_test.go b/x/application/keeper/msg_server_update_param_test.go index 0066722d2..8f8b5ab03 100644 --- a/x/application/keeper/msg_server_update_param_test.go +++ b/x/application/keeper/msg_server_update_param_test.go @@ -37,7 +37,7 @@ func TestMsgUpdateParam_UpdateMaxDelegatedGatewaysOnly(t *testing.T) { require.Equal(t, expectedMaxDelegatedGateways, res.Params.MaxDelegatedGateways) // Ensure the other parameters are unchanged - testkeeper.AssertDefaultParamsEqualExceptFields(t, &defaultParams, res.Params, "MaxDelegatedGateways") + testkeeper.AssertDefaultParamsEqualExceptFields(t, &defaultParams, res.Params, string(apptypes.KeyMaxDelegatedGateways)) } func TestMsgUpdateParam_UpdateMinStakeOnly(t *testing.T) { @@ -64,5 +64,5 @@ func TestMsgUpdateParam_UpdateMinStakeOnly(t *testing.T) { require.Equal(t, expectedMinStake.Amount, res.Params.MinStake.Amount) // Ensure the other parameters are unchanged - testkeeper.AssertDefaultParamsEqualExceptFields(t, &defaultParams, res.Params, "MinStake") + testkeeper.AssertDefaultParamsEqualExceptFields(t, &defaultParams, res.Params, string(apptypes.KeyMinStake)) } diff --git a/x/application/types/message_update_param.go b/x/application/types/message_update_param.go index 7cbac5b8a..6836425a8 100644 --- a/x/application/types/message_update_param.go +++ b/x/application/types/message_update_param.go @@ -43,9 +43,15 @@ func (msg *MsgUpdateParam) ValidateBasic() error { // Parameter name MUST be supported by this module. switch msg.Name { case ParamMaxDelegatedGateways: - return msg.paramTypeIsUint64() + if err := msg.paramTypeIsUint64(); err != nil { + return err + } + return ValidateMaxDelegatedGateways(uint64(msg.GetAsInt64())) case ParamMinStake: - return msg.paramTypeIsCoin() + if err := msg.paramTypeIsCoin(); err != nil { + return err + } + return ValidateMinStake(msg.GetAsCoin()) default: return ErrAppParamInvalid.Wrapf("unsupported param %q", msg.Name) } From 3280142714a82e6070ac568955f2b435700ee48a Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 4 Oct 2024 10:33:17 +0200 Subject: [PATCH 092/139] chore: improve logging & ensure gRPC status error returns --- x/gateway/keeper/msg_server_update_param.go | 31 +++++++++++++++++---- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/x/gateway/keeper/msg_server_update_param.go b/x/gateway/keeper/msg_server_update_param.go index 97f94b2c0..f1cf6fbe7 100644 --- a/x/gateway/keeper/msg_server_update_param.go +++ b/x/gateway/keeper/msg_server_update_param.go @@ -2,6 +2,10 @@ package keeper import ( "context" + "fmt" + + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" "github.com/pokt-network/poktroll/x/gateway/types" ) @@ -9,31 +13,48 @@ import ( // UpdateParam updates a single parameter in the proof module and returns // all active parameters. func (k msgServer) UpdateParam(ctx context.Context, msg *types.MsgUpdateParam) (*types.MsgUpdateParamResponse, error) { + logger := k.logger.With( + "method", "UpdateParam", + "param_name", msg.Name, + ) + if err := msg.ValidateBasic(); err != nil { - return nil, err + return nil, status.Error(codes.InvalidArgument, err.Error()) } if k.GetAuthority() != msg.Authority { - return nil, types.ErrGatewayInvalidSigner.Wrapf("invalid authority; expected %s, got %s", k.GetAuthority(), msg.Authority) + return nil, status.Error( + codes.InvalidArgument, + types.ErrGatewayInvalidSigner.Wrapf( + "invalid authority; expected %s, got %s", + k.GetAuthority(), msg.Authority, + ).Error(), + ) } params := k.GetParams(ctx) switch msg.Name { case types.ParamMinStake: + logger = logger.With("param_value", msg.GetAsCoin()) params.MinStake = msg.GetAsCoin() default: - return nil, types.ErrGatewayParamInvalid.Wrapf("unsupported param %q", msg.Name) + return nil, status.Error( + codes.InvalidArgument, + types.ErrGatewayParamInvalid.Wrapf("unsupported param %q", msg.Name).Error(), + ) } // Perform a global validation on all params, which includes the updated param. // This is needed to ensure that the updated param is valid in the context of all other params. if err := params.Validate(); err != nil { - return nil, err + return nil, status.Error(codes.InvalidArgument, err.Error()) } if err := k.SetParams(ctx, params); err != nil { - return nil, err + err = fmt.Errorf("unable to set params: %w", err) + logger.Error(err.Error()) + return nil, status.Error(codes.Internal, err.Error()) } updatedParams := k.GetParams(ctx) From 98d1c96249916f9b196da332d72a8f8ea93bf91e Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 4 Oct 2024 10:39:11 +0200 Subject: [PATCH 093/139] chore: improve logging & ensure gRPC status error returns --- x/application/keeper/msg_server_update_param.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/x/application/keeper/msg_server_update_param.go b/x/application/keeper/msg_server_update_param.go index dcb809d90..1968b774f 100644 --- a/x/application/keeper/msg_server_update_param.go +++ b/x/application/keeper/msg_server_update_param.go @@ -2,6 +2,7 @@ package keeper import ( "context" + "fmt" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -10,6 +11,11 @@ import ( ) func (k msgServer) UpdateParam(ctx context.Context, msg *apptypes.MsgUpdateParam) (*apptypes.MsgUpdateParamResponse, error) { + logger := k.logger.With( + "method", "UpdateParam", + "param_name", msg.Name, + ) + if err := msg.ValidateBasic(); err != nil { return nil, err } @@ -29,8 +35,10 @@ func (k msgServer) UpdateParam(ctx context.Context, msg *apptypes.MsgUpdateParam switch msg.Name { // TODO_IMPROVE: Add a Uint64 asType instead of using int64 for uint64 params. case apptypes.ParamMaxDelegatedGateways: + logger = logger.With("param_value", msg.GetAsInt64()) params.MaxDelegatedGateways = uint64(msg.GetAsInt64()) case apptypes.ParamMinStake: + logger = logger.With("param_value", msg.GetAsCoin()) params.MinStake = msg.GetAsCoin() default: return nil, status.Error( @@ -47,10 +55,13 @@ func (k msgServer) UpdateParam(ctx context.Context, msg *apptypes.MsgUpdateParam } if err := k.SetParams(ctx, params); err != nil { - return nil, err + err = fmt.Errorf("unable to set params: %w", err) + logger.Error(err.Error()) + return nil, status.Error(codes.Internal, err.Error()) } updatedParams := k.GetParams(ctx) + return &apptypes.MsgUpdateParamResponse{ Params: &updatedParams, }, nil From 955b28fb38d9c5e606107705ac618b837dd612d2 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 4 Oct 2024 10:42:48 +0200 Subject: [PATCH 094/139] chore: improve logging, validate params in MsgUpdateParam handler, & ensure gRPC status error returns --- x/supplier/keeper/msg_server_update_param.go | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/x/supplier/keeper/msg_server_update_param.go b/x/supplier/keeper/msg_server_update_param.go index 6a1a305a4..47e96f528 100644 --- a/x/supplier/keeper/msg_server_update_param.go +++ b/x/supplier/keeper/msg_server_update_param.go @@ -2,6 +2,7 @@ package keeper import ( "context" + "fmt" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -12,6 +13,11 @@ import ( // UpdateParam updates a single parameter in the proof module and returns // all active parameters. func (k msgServer) UpdateParam(ctx context.Context, msg *suppliertypes.MsgUpdateParam) (*suppliertypes.MsgUpdateParamResponse, error) { + logger := k.logger.With( + "method", "UpdateParam", + "param_name", msg.Name, + ) + if err := msg.ValidateBasic(); err != nil { return nil, status.Error(codes.InvalidArgument, err.Error()) } @@ -30,6 +36,7 @@ func (k msgServer) UpdateParam(ctx context.Context, msg *suppliertypes.MsgUpdate switch msg.Name { case suppliertypes.ParamMinStake: + logger = logger.With("min_stake", msg.GetAsCoin()) params.MinStake = msg.GetAsCoin() default: return nil, status.Error( @@ -38,11 +45,20 @@ func (k msgServer) UpdateParam(ctx context.Context, msg *suppliertypes.MsgUpdate ) } - if err := k.SetParams(ctx, params); err != nil { + // Perform a global validation on all params, which includes the updated param. + // This is needed to ensure that the updated param is valid in the context of all other params. + if err := params.Validate(); err != nil { return nil, status.Error(codes.InvalidArgument, err.Error()) } + if err := k.SetParams(ctx, params); err != nil { + err = fmt.Errorf("unable to set params: %v", err) + logger.Error(err.Error()) + return nil, status.Error(codes.Internal, err.Error()) + } + updatedParams := k.GetParams(ctx) + return &suppliertypes.MsgUpdateParamResponse{ Params: &updatedParams, }, nil From c256eaeeb0362cf5208d831c4906ac0f795433b1 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 4 Oct 2024 11:04:09 +0200 Subject: [PATCH 095/139] chore: review feedback improvements Co-authored-by: red-0ne --- testutil/integration/suites/param_configs.go | 2 +- x/gateway/types/params.go | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/testutil/integration/suites/param_configs.go b/testutil/integration/suites/param_configs.go index 13c8b8330..5141554d2 100644 --- a/testutil/integration/suites/param_configs.go +++ b/testutil/integration/suites/param_configs.go @@ -40,7 +40,7 @@ type ModuleParamConfig struct { // type which the module supports should be included in this map. ParamTypes map[ParamType]any // ValidParams is a set of parameters which are expected to be valid when used - // together AND when used individually, where the reamining parameters are set + // together AND when used individually, where the renaming parameters are set // to their default values. ValidParams any DefaultParams any diff --git a/x/gateway/types/params.go b/x/gateway/types/params.go index 14817db64..60e7c43dc 100644 --- a/x/gateway/types/params.go +++ b/x/gateway/types/params.go @@ -71,9 +71,6 @@ func ValidateMinStake(minStakeAny any) error { if minStakeCoin.IsZero() || minStakeCoin.IsNegative() { return ErrGatewayParamInvalid.Wrapf("invalid min stake amount must be greater than zero: %s", minStakeCoin) } - if minStakeCoin.Denom != volatile.DenomuPOKT { - return ErrGatewayParamInvalid.Wrapf("invalid min_stake amount denom %s", minStakeCoin) - } return nil } From 30b48f4444a66047930bf393877ae078597684be Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 4 Oct 2024 12:28:05 +0200 Subject: [PATCH 096/139] test: simplify coin equality assertions Co-authored-by: red-0ne --- .../msg_server_stake_application_test.go | 30 ++++++------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/x/application/keeper/msg_server_stake_application_test.go b/x/application/keeper/msg_server_stake_application_test.go index 6ed4316ff..a90ab1006 100644 --- a/x/application/keeper/msg_server_stake_application_test.go +++ b/x/application/keeper/msg_server_stake_application_test.go @@ -27,10 +27,10 @@ func TestMsgServer_StakeApplication_SuccessfulCreateAndUpdate(t *testing.T) { require.False(t, isAppFound) // Prepare the application - initialStake := apptypes.DefaultMinStake + initialStake := &apptypes.DefaultMinStake stakeMsg := &apptypes.MsgStakeApplication{ Address: appAddr, - Stake: &initialStake, + Stake: initialStake, Services: []*sharedtypes.ApplicationServiceConfig{ {ServiceId: "svc1"}, }, @@ -44,11 +44,7 @@ func TestMsgServer_StakeApplication_SuccessfulCreateAndUpdate(t *testing.T) { foundApp, isAppFound := k.GetApplication(ctx, appAddr) require.True(t, isAppFound) require.Equal(t, appAddr, foundApp.Address) - require.Truef(t, - initialStake.Amount.Equal(foundApp.Stake.Amount), - "expected %d, got %d", - initialStake.Amount.Int64(), foundApp.Stake.Amount.Int64(), - ) + require.Equal(t, initialStake, foundApp.Stake) require.Len(t, foundApp.ServiceConfigs, 1) require.Equal(t, "svc1", foundApp.ServiceConfigs[0].ServiceId) @@ -68,11 +64,7 @@ func TestMsgServer_StakeApplication_SuccessfulCreateAndUpdate(t *testing.T) { require.NoError(t, err) foundApp, isAppFound = k.GetApplication(ctx, appAddr) require.True(t, isAppFound) - require.Truef(t, - upStake.Amount.Equal(foundApp.Stake.Amount), - "expected %d, got %d", - upStake.Amount.Int64(), foundApp.Stake.Amount.Int64(), - ) + require.Equal(t, &upStake, foundApp.Stake) require.Len(t, foundApp.ServiceConfigs, 2) require.Equal(t, "svc1", foundApp.ServiceConfigs[0].ServiceId) require.Equal(t, "svc2", foundApp.ServiceConfigs[1].ServiceId) @@ -85,10 +77,10 @@ func TestMsgServer_StakeApplication_FailRestakingDueToInvalidServices(t *testing appAddr := sample.AccAddress() // Prepare the application stake message - initialStake := apptypes.DefaultMinStake + initialStake := &apptypes.DefaultMinStake stakeMsg := &apptypes.MsgStakeApplication{ Address: appAddr, - Stake: &initialStake, + Stake: initialStake, Services: []*sharedtypes.ApplicationServiceConfig{ {ServiceId: "svc1"}, }, @@ -143,11 +135,11 @@ func TestMsgServer_StakeApplication_FailLoweringStake(t *testing.T) { srv := keeper.NewMsgServerImpl(k) // Prepare the application - initialStake := apptypes.DefaultMinStake + initialStake := &apptypes.DefaultMinStake appAddr := sample.AccAddress() stakeMsg := &apptypes.MsgStakeApplication{ Address: appAddr, - Stake: &initialStake, + Stake: initialStake, Services: []*sharedtypes.ApplicationServiceConfig{ {ServiceId: "svc1"}, }, @@ -176,11 +168,7 @@ func TestMsgServer_StakeApplication_FailLoweringStake(t *testing.T) { // Verify that the application stake is unchanged foundApp, isAppFound := k.GetApplication(ctx, appAddr) require.True(t, isAppFound) - require.Truef(t, - initialStake.Amount.Equal(foundApp.Stake.Amount), - "expected %d, got %d", - initialStake.Amount.Int64(), foundApp.Stake.Amount.Int64(), - ) + require.Equal(t, initialStake, foundApp.Stake) } func TestMsgServer_StakeApplication_FailBelowMinStake(t *testing.T) { From 1c309b81eff0ab53e6ee624edd34832e89840228 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 4 Oct 2024 13:23:48 +0200 Subject: [PATCH 097/139] Empty commit From 0f4a82db9071fc369bf6cf9dd73c219fcb190946 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 4 Oct 2024 14:58:03 +0200 Subject: [PATCH 098/139] chore: add review feedback TODOs Co-authored-by: red-0ne --- x/shared/types/params.go | 3 +++ x/tokenomics/keeper/settle_pending_claims.go | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/x/shared/types/params.go b/x/shared/types/params.go index d5921f62d..17bc7b964 100644 --- a/x/shared/types/params.go +++ b/x/shared/types/params.go @@ -168,6 +168,9 @@ func (params *Params) ValidateBasic() error { return err } + // TODO_MAINNET(@bryanchriswhite): Add validation which ensures that + // SessionEndToProofWindowCloseBlocks is a multiple of NumBlocksPerSession. + return nil } diff --git a/x/tokenomics/keeper/settle_pending_claims.go b/x/tokenomics/keeper/settle_pending_claims.go index 321196f1d..712be5017 100644 --- a/x/tokenomics/keeper/settle_pending_claims.go +++ b/x/tokenomics/keeper/settle_pending_claims.go @@ -222,6 +222,11 @@ func (k Keeper) SettlePendingClaims(ctx sdk.Context) ( // If the proof window closes and a proof IS NOT required -> settle the claim. // If the proof window closes and a proof IS required -> only settle it if a proof is available. func (k Keeper) getExpiringClaims(ctx sdk.Context) (expiringClaims []prooftypes.Claim, err error) { + // TODO_IMPROVE(@bryanchriswhite): + // 1. Move height logic up to SettlePendingClaims. + // 2. Ensure that claims are only settled or expired on a session end height. + // 2a. This likely also requires adding validation to the shared module params. + blockHeight := ctx.BlockHeight() // NB: This error can be safely ignored as on-chain SharedQueryClient implementation cannot return an error. From ef4e0ade22c4be43d47e3b1a2b92796e376113aa Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 4 Oct 2024 15:11:33 +0200 Subject: [PATCH 099/139] chore: reconcile PreGeneratedAccountIterator#MustNext() --- testutil/testkeyring/accounts.go | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/testutil/testkeyring/accounts.go b/testutil/testkeyring/accounts.go index 2b26521db..c28a1f4d5 100644 --- a/testutil/testkeyring/accounts.go +++ b/testutil/testkeyring/accounts.go @@ -101,16 +101,6 @@ func NewPreGeneratedAccountIterator(accounts ...*PreGeneratedAccount) *PreGenera } } -// MustNext returns the next account in the iterator. It panics if the iterator -// is out of accounts; see testutil/testkeyring/gen_accounts. -func (iter *PreGeneratedAccountIterator) MustNext() *PreGeneratedAccount { - account, ok := iter.Next() - if !ok { - panic("pre-generated account iterator out of accounts; see testutil/testkeyring/gen_accounts") - } - return account -} - // Next returns the next account in the iterator. It is safe to call // concurrently and is guaranteed to return a unique account on each call. // If the iterator index goes out of range, it returns nil and false. @@ -127,10 +117,12 @@ func (iter *PreGeneratedAccountIterator) Next() (_ *PreGeneratedAccount, ok bool return iter.accounts[currentIndex], true } +// MustNext returns the next account in the iterator. It panics if the iterator +// is out of accounts; see testutil/testkeyring/gen_accounts. func (iter *PreGeneratedAccountIterator) MustNext() *PreGeneratedAccount { account, ok := iter.Next() if !ok { - panic("insufficient number of pre-generated accounts") + panic("insufficient number of pre-generated accounts; see testutil/testkeyring/gen_accounts") } return account } From 4d2c2d96363366167dd96aa18571a7e81858af0f Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 4 Oct 2024 15:26:58 +0200 Subject: [PATCH 100/139] chore: review feedback improvements --- x/gateway/keeper/msg_server_stake_gateway.go | 24 ++++++++------------ 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/x/gateway/keeper/msg_server_stake_gateway.go b/x/gateway/keeper/msg_server_stake_gateway.go index a1e776fdb..22db5c0b0 100644 --- a/x/gateway/keeper/msg_server_stake_gateway.go +++ b/x/gateway/keeper/msg_server_stake_gateway.go @@ -37,7 +37,7 @@ func (k msgServer) StakeGateway( // NB: This SHOULD NEVER happen because msg.ValidateBasic() validates the address as bech32. if err != nil { // TODO_TECHDEBT(#384): determine whether to continue using cosmos logger for debug level. - logger.Info(fmt.Sprintf("could not parse address %q", msg.Address)) + logger.Info(fmt.Sprintf("ERROR: could not parse address %q", msg.Address)) return nil, status.Error(codes.InvalidArgument, err.Error()) } @@ -45,11 +45,11 @@ func (k msgServer) StakeGateway( var coinsToEscrow sdk.Coin gateway, isGatewayFound := k.GetGateway(ctx, msg.Address) if !isGatewayFound { - logger.Info(fmt.Sprintf("gateway not found. Creating new gateway for address %q", msg.Address)) + logger.Info(fmt.Sprintf("gateway not found; creating new gateway for address %q", msg.Address)) gateway = k.createGateway(ctx, msg) coinsToEscrow = *msg.Stake } else { - logger.Info(fmt.Sprintf("gateway found. About to try and update gateway for address %q", msg.Address)) + logger.Info(fmt.Sprintf("gateway found; about to try and update gateway for address %q", msg.Address)) currGatewayStake := *gateway.Stake if err = k.updateGateway(ctx, &gateway, msg); err != nil { logger.Error(fmt.Sprintf("could not update gateway for address %q due to error %v", msg.Address, err)) @@ -70,23 +70,17 @@ func (k msgServer) StakeGateway( // MUST ALWAYS stake or upstake (> 0 delta). if coinsToEscrow.IsZero() { - errMsg := fmt.Sprintf("gateway %q must escrow more than 0 additional coins", msg.GetAddress()) - logger.Info(errMsg) - return nil, status.Error( - codes.InvalidArgument, - types.ErrGatewayInvalidStake.Wrap(errMsg).Error(), - ) + err := types.ErrGatewayInvalidStake.Wrap("gateway %q must escrow more than 0 additional coins", msg.GetAddress()) + logger.Info(fmt.Sprintf("ERROR: %s", err) + return nil, status.Error(codes.InvalidArgument, err.Error()) } // MUST ALWAYS have at least minimum stake. minStake := k.GetParams(ctx).MinStake if msg.Stake.Amount.LT(minStake.Amount) { - errFmt := "gateway %q must stake at least %s" - logger.Info(fmt.Sprintf(errFmt, msg.Address, minStake)) - return nil, status.Error( - codes.InvalidArgument, - types.ErrGatewayInvalidStake.Wrapf(errFmt, msg.Address, minStake).Error(), - ) + err := types.ErrGatewayInvalidStake.Wrapf("gateway %q must stake at least %s", msg.Address, minStake) + logger.Info(fmt.Sprintf("ERROR: %s", err)) + return nil, status.Error(codes.InvalidArgument, err.Error()) } // Send the coins from the gateway to the staked gateway pool From 5ba2a48ce2d71a423587b3d9fc3b7369eb865a24 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 4 Oct 2024 15:30:10 +0200 Subject: [PATCH 101/139] fix: typo --- x/gateway/keeper/msg_server_stake_gateway.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x/gateway/keeper/msg_server_stake_gateway.go b/x/gateway/keeper/msg_server_stake_gateway.go index 22db5c0b0..5978cefa8 100644 --- a/x/gateway/keeper/msg_server_stake_gateway.go +++ b/x/gateway/keeper/msg_server_stake_gateway.go @@ -70,8 +70,8 @@ func (k msgServer) StakeGateway( // MUST ALWAYS stake or upstake (> 0 delta). if coinsToEscrow.IsZero() { - err := types.ErrGatewayInvalidStake.Wrap("gateway %q must escrow more than 0 additional coins", msg.GetAddress()) - logger.Info(fmt.Sprintf("ERROR: %s", err) + err := types.ErrGatewayInvalidStake.Wrapf("gateway %q must escrow more than 0 additional coins", msg.GetAddress()) + logger.Info(fmt.Sprintf("ERROR: %s", err)) return nil, status.Error(codes.InvalidArgument, err.Error()) } From aef377317bdd508c603e87d4d376ef95c3dc210e Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 4 Oct 2024 15:36:00 +0200 Subject: [PATCH 102/139] chore: ensure gRPC status error returns from supplier stake handler --- .../keeper/msg_server_stake_supplier.go | 58 +++++++++++-------- 1 file changed, 33 insertions(+), 25 deletions(-) diff --git a/x/supplier/keeper/msg_server_stake_supplier.go b/x/supplier/keeper/msg_server_stake_supplier.go index d3478cab7..f750b99ff 100644 --- a/x/supplier/keeper/msg_server_stake_supplier.go +++ b/x/supplier/keeper/msg_server_stake_supplier.go @@ -5,6 +5,8 @@ import ( "fmt" sdk "github.com/cosmos/cosmos-sdk/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" "github.com/pokt-network/poktroll/telemetry" "github.com/pokt-network/poktroll/x/shared" @@ -25,15 +27,18 @@ func (k msgServer) StakeSupplier(ctx context.Context, msg *types.MsgStakeSupplie // ValidateBasic also validates that the msg signer is the owner or operator of the supplier if err := msg.ValidateBasic(); err != nil { - logger.Error(fmt.Sprintf("invalid MsgStakeSupplier: %v", msg)) - return nil, err + logger.Info(fmt.Sprintf("invalid MsgStakeSupplier: %v", msg)) + return nil, status.Error(codes.InvalidArgument, err.Error()) } // Check if the services the supplier is staking for exist for _, serviceConfig := range msg.Services { if _, serviceFound := k.serviceKeeper.GetService(ctx, serviceConfig.ServiceId); !serviceFound { - logger.Error(fmt.Sprintf("service %q does not exist", serviceConfig.ServiceId)) - return nil, types.ErrSupplierServiceNotFound.Wrapf("service %q does not exist", serviceConfig.ServiceId) + logger.Info(fmt.Sprintf("service %q does not exist", serviceConfig.ServiceId)) + return nil, status.Error( + codes.InvalidArgument, + types.ErrSupplierServiceNotFound.Wrapf("service %q does not exist", serviceConfig.ServiceId).Error(), + ) } } @@ -52,40 +57,42 @@ func (k msgServer) StakeSupplier(ctx context.Context, msg *types.MsgStakeSupplie // Ensure the signer is either the owner or the operator of the supplier. if !msg.IsSigner(supplier.OwnerAddress) && !msg.IsSigner(supplier.OperatorAddress) { - return nil, sharedtypes.ErrSharedUnauthorizedSupplierUpdate.Wrapf( - "signer address %s does not match owner address %s or supplier operator address %s", - msg.Signer, - msg.OwnerAddress, - msg.OperatorAddress, + return nil, status.Error( + codes.InvalidArgument, + sharedtypes.ErrSharedUnauthorizedSupplierUpdate.Wrapf( + "signer address %s does not match owner address %s or supplier operator address %s", + msg.Signer, msg.OwnerAddress, msg.OperatorAddress, + ).Error(), ) } // Ensure that only the owner can change the OwnerAddress. // (i.e. fail if owner address changed and the owner is not the msg signer) if !supplier.HasOwner(msg.OwnerAddress) && !msg.IsSigner(supplier.OwnerAddress) { - logger.Error("only the supplier owner is allowed to update the owner address") - - return nil, sharedtypes.ErrSharedUnauthorizedSupplierUpdate.Wrapf( + err = sharedtypes.ErrSharedUnauthorizedSupplierUpdate.Wrapf( "signer %q is not allowed to update the owner address %q", - msg.Signer, - supplier.OwnerAddress, + msg.Signer, supplier.OwnerAddress, ) + logger.Info(fmt.Sprintf("ERROR: %s", err)) + + return nil, status.Error(codes.InvalidArgument, err.Error()) } // Ensure that the operator addresses cannot be changed. This is because changing // it mid-session invalidates the current session. if !supplier.HasOperator(msg.OperatorAddress) { - logger.Error("updating the supplier's operator address forbidden") - - return nil, sharedtypes.ErrSharedUnauthorizedSupplierUpdate.Wrap( + err = sharedtypes.ErrSharedUnauthorizedSupplierUpdate.Wrap( "updating the operator address is forbidden, unstake then re-stake with the updated operator address", ) + logger.Info(fmt.Sprintf("ERROR: %s", err)) + + return nil, status.Error(codes.InvalidArgument, err.Error()) } currSupplierStake := *supplier.Stake if err = k.updateSupplier(ctx, &supplier, msg); err != nil { - logger.Error(fmt.Sprintf("could not update supplier for address %q due to error %v", msg.OperatorAddress, err)) - return nil, err + logger.Info(fmt.Sprintf("ERROR: could not update supplier for address %q due to error %v", msg.OperatorAddress, err)) + return nil, status.Error(codes.InvalidArgument, err.Error()) } coinsToEscrow, err = (*msg.Stake).SafeSub(currSupplierStake) if err != nil { @@ -99,22 +106,23 @@ func (k msgServer) StakeSupplier(ctx context.Context, msg *types.MsgStakeSupplie // Must always stake or upstake (> 0 delta) if coinsToEscrow.IsZero() { - logger.Warn(fmt.Sprintf("Signer %q must escrow more than 0 additional coins", msg.Signer)) - return nil, types.ErrSupplierInvalidStake.Wrapf("Signer %q must escrow more than 0 additional coins", msg.Signer) + err = types.ErrSupplierInvalidStake.Wrapf("Signer %q must escrow more than 0 additional coins", msg.Signer) + logger.Info(fmt.Sprintf("WARN: %s", err)) + return nil, status.Error(codes.InvalidArgument, err.Error()) } // Retrieve the account address of the message signer msgSignerAddress, err := sdk.AccAddressFromBech32(msg.Signer) if err != nil { - logger.Error(fmt.Sprintf("could not parse address %q", msg.Signer)) - return nil, err + logger.Info(fmt.Sprintf("ERROR: could not parse address %q", msg.Signer)) + return nil, status.Error(codes.InvalidArgument, err.Error()) } // Send the coins from the message signer account to the staked supplier pool err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, msgSignerAddress, types.ModuleName, []sdk.Coin{coinsToEscrow}) if err != nil { - logger.Error(fmt.Sprintf("could not send %v coins from %q to %q module account due to %v", coinsToEscrow, msgSignerAddress, types.ModuleName, err)) - return nil, err + logger.Info(fmt.Sprintf("ERROR: could not send %v coins from %q to %q module account due to %v", coinsToEscrow, msgSignerAddress, types.ModuleName, err)) + return nil, status.Error(codes.InvalidArgument, err.Error()) } logger.Info(fmt.Sprintf("Successfully escrowed %v coins from %q to %q module account", coinsToEscrow, msgSignerAddress, types.ModuleName)) From fff062bd6319b0067b3197fce0885970c9f7ea3a Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 4 Oct 2024 15:40:21 +0200 Subject: [PATCH 103/139] chore: review improvements --- api/poktroll/supplier/params.pulsar.go | 2 +- makefiles/params.mk | 2 +- proto/poktroll/supplier/params.proto | 2 +- x/supplier/types/params.pb.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/api/poktroll/supplier/params.pulsar.go b/api/poktroll/supplier/params.pulsar.go index e38778848..bb3c96973 100644 --- a/api/poktroll/supplier/params.pulsar.go +++ b/api/poktroll/supplier/params.pulsar.go @@ -470,7 +470,7 @@ type Params struct { unknownFields protoimpl.UnknownFields // min_stake is the minimum amount of uPOKT that a supplier must stake to be - // included in network sessions. + // included in network sessions and remain staked. MinStake *v1beta1.Coin `protobuf:"bytes,1,opt,name=min_stake,json=minStake,proto3" json:"min_stake,omitempty"` } diff --git a/makefiles/params.mk b/makefiles/params.mk index 6b0772a7f..de0c659a8 100644 --- a/makefiles/params.mk +++ b/makefiles/params.mk @@ -127,7 +127,7 @@ params_update_application_max_delegated_gateways: ## Update the application modu params_update_application_min_stake: ## Update the application module min_stake param poktrolld tx authz exec ./tools/scripts/params/application_min_stake.json $(PARAM_FLAGS) -### Gateway Module Params ### +### Supplier Module Params ### .PHONY: params_get_supplier params_get_supplier: ## Get the supplier module params poktrolld query supplier params --node $(POCKET_NODE) diff --git a/proto/poktroll/supplier/params.proto b/proto/poktroll/supplier/params.proto index e95983a95..d4e8c77ec 100644 --- a/proto/poktroll/supplier/params.proto +++ b/proto/poktroll/supplier/params.proto @@ -14,6 +14,6 @@ message Params { option (gogoproto.equal) = true; // min_stake is the minimum amount of uPOKT that a supplier must stake to be - // included in network sessions. + // included in network sessions and remain staked. cosmos.base.v1beta1.Coin min_stake = 1 [(gogoproto.jsontag) = "min_stake", (gogoproto.moretags) = "yaml:\"min_stake\""]; } diff --git a/x/supplier/types/params.pb.go b/x/supplier/types/params.pb.go index e2390cfd2..8a79db314 100644 --- a/x/supplier/types/params.pb.go +++ b/x/supplier/types/params.pb.go @@ -28,7 +28,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Params defines the parameters for the module. type Params struct { // min_stake is the minimum amount of uPOKT that a supplier must stake to be - // included in network sessions. + // included in network sessions and remain staked. MinStake *types.Coin `protobuf:"bytes,1,opt,name=min_stake,json=minStake,proto3" json:"min_stake" yaml:"min_stake"` } From 3e4ef9e82e4b41cc47b1ea9e137d71b845effcd8 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 4 Oct 2024 15:41:45 +0200 Subject: [PATCH 104/139] fix: linter errors --- x/gateway/keeper/msg_server_stake_gateway.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x/gateway/keeper/msg_server_stake_gateway.go b/x/gateway/keeper/msg_server_stake_gateway.go index 5978cefa8..1ce257ecc 100644 --- a/x/gateway/keeper/msg_server_stake_gateway.go +++ b/x/gateway/keeper/msg_server_stake_gateway.go @@ -70,7 +70,7 @@ func (k msgServer) StakeGateway( // MUST ALWAYS stake or upstake (> 0 delta). if coinsToEscrow.IsZero() { - err := types.ErrGatewayInvalidStake.Wrapf("gateway %q must escrow more than 0 additional coins", msg.GetAddress()) + err = types.ErrGatewayInvalidStake.Wrapf("gateway %q must escrow more than 0 additional coins", msg.GetAddress()) logger.Info(fmt.Sprintf("ERROR: %s", err)) return nil, status.Error(codes.InvalidArgument, err.Error()) } @@ -78,7 +78,7 @@ func (k msgServer) StakeGateway( // MUST ALWAYS have at least minimum stake. minStake := k.GetParams(ctx).MinStake if msg.Stake.Amount.LT(minStake.Amount) { - err := types.ErrGatewayInvalidStake.Wrapf("gateway %q must stake at least %s", msg.Address, minStake) + err = types.ErrGatewayInvalidStake.Wrapf("gateway %q must stake at least %s", msg.Address, minStake) logger.Info(fmt.Sprintf("ERROR: %s", err)) return nil, status.Error(codes.InvalidArgument, err.Error()) } From 8c7eadf2bdc2b736f4a075ace3dcae8356014f65 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 4 Oct 2024 15:43:23 +0200 Subject: [PATCH 105/139] Empty commit From a28ff8852723b35992bfdff711633df2f232edb7 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 4 Oct 2024 15:43:37 +0200 Subject: [PATCH 106/139] Empty commit From cd5e420f065a7115bbf783ea42628af5d6651a5f Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 4 Oct 2024 16:28:34 +0200 Subject: [PATCH 107/139] chore: review feedback improvements Co-authored-by: Daniel Olshansky --- x/gateway/keeper/msg_server_stake_gateway.go | 1 + 1 file changed, 1 insertion(+) diff --git a/x/gateway/keeper/msg_server_stake_gateway.go b/x/gateway/keeper/msg_server_stake_gateway.go index 1ce257ecc..74c87e058 100644 --- a/x/gateway/keeper/msg_server_stake_gateway.go +++ b/x/gateway/keeper/msg_server_stake_gateway.go @@ -69,6 +69,7 @@ func (k msgServer) StakeGateway( } // MUST ALWAYS stake or upstake (> 0 delta). + // TODO_MAINNET(#853): Consider removing the requirement above. if coinsToEscrow.IsZero() { err = types.ErrGatewayInvalidStake.Wrapf("gateway %q must escrow more than 0 additional coins", msg.GetAddress()) logger.Info(fmt.Sprintf("ERROR: %s", err)) From 1c383725145cd6e43bbad3aac5c94ef6ddf5b5e8 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 4 Oct 2024 17:02:42 +0200 Subject: [PATCH 108/139] fix: failing test --- x/supplier/keeper/msg_server_stake_supplier_test.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/x/supplier/keeper/msg_server_stake_supplier_test.go b/x/supplier/keeper/msg_server_stake_supplier_test.go index 5c35f3625..a4c1b5815 100644 --- a/x/supplier/keeper/msg_server_stake_supplier_test.go +++ b/x/supplier/keeper/msg_server_stake_supplier_test.go @@ -157,7 +157,9 @@ func TestMsgServer_StakeSupplier_FailWithNonExistingService(t *testing.T) { // Stake the supplier & verify that it fails because the service does not exist. _, err := srv.StakeSupplier(ctx, stakeMsg) - require.ErrorIs(t, err, types.ErrSupplierServiceNotFound) + require.ErrorContains(t, err, types.ErrSupplierServiceNotFound.Wrapf( + "service %q does not exist", "newService", + ).Error()) } func TestMsgServer_StakeSupplier_OperatorAuthorizations(t *testing.T) { @@ -248,7 +250,10 @@ func TestMsgServer_StakeSupplier_OperatorAuthorizations(t *testing.T) { stakeMsgUpdateOwner.OwnerAddress = newOwnerAddress setStakeMsgSigner(stakeMsgUpdateOwner, operatorAddr) _, err = srv.StakeSupplier(ctx, stakeMsgUpdateOwner) - require.ErrorIs(t, err, sharedtypes.ErrSharedUnauthorizedSupplierUpdate) + require.ErrorContains(t, err, sharedtypes.ErrSharedUnauthorizedSupplierUpdate.Wrapf( + "signer %q is not allowed to update the owner address %q", + operatorAddr, ownerAddr, + ).Error()) // Update the supplier's owner address using the owner as a signer and verify that it succeeds. setStakeMsgSigner(stakeMsgUpdateOwner, ownerAddr) From 3774d660f5e43c34eb81035dd5b31d40473003bb Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 4 Oct 2024 16:01:45 +0200 Subject: [PATCH 109/139] feat: enforce supplier min stake when staking --- x/supplier/keeper/msg_server_stake_supplier.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/x/supplier/keeper/msg_server_stake_supplier.go b/x/supplier/keeper/msg_server_stake_supplier.go index f750b99ff..d767d9639 100644 --- a/x/supplier/keeper/msg_server_stake_supplier.go +++ b/x/supplier/keeper/msg_server_stake_supplier.go @@ -104,13 +104,24 @@ func (k msgServer) StakeSupplier(ctx context.Context, msg *types.MsgStakeSupplie supplier.UnstakeSessionEndHeight = sharedtypes.SupplierNotUnstaking } - // Must always stake or upstake (> 0 delta) + // MUST ALWAYS stake or upstake (> 0 delta) if coinsToEscrow.IsZero() { err = types.ErrSupplierInvalidStake.Wrapf("Signer %q must escrow more than 0 additional coins", msg.Signer) logger.Info(fmt.Sprintf("WARN: %s", err)) return nil, status.Error(codes.InvalidArgument, err.Error()) } + // MUST ALWAYS have at least minimum stake. + minStake := k.GetParams(ctx).MinStake + if msg.Stake.Amount.LT(minStake.Amount) { + err = types.ErrSupplierInvalidStake.Wrapf( + "supplier with owner %q must stake at least %s", + msg.GetOwnerAddress(), minStake, + ) + logger.Info(fmt.Sprintf("ERROR: %s", err)) + return nil, status.Error(codes.InvalidArgument, err.Error()) + } + // Retrieve the account address of the message signer msgSignerAddress, err := sdk.AccAddressFromBech32(msg.Signer) if err != nil { From 4c46084f9e7483f6af10bd79239fd666db17894b Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 4 Oct 2024 16:01:54 +0200 Subject: [PATCH 110/139] fix: unit tests --- .../keeper/msg_server_stake_supplier_test.go | 39 ++++++++++--------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/x/supplier/keeper/msg_server_stake_supplier_test.go b/x/supplier/keeper/msg_server_stake_supplier_test.go index a4c1b5815..58db830c9 100644 --- a/x/supplier/keeper/msg_server_stake_supplier_test.go +++ b/x/supplier/keeper/msg_server_stake_supplier_test.go @@ -6,6 +6,8 @@ import ( "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" "github.com/pokt-network/poktroll/app/volatile" keepertest "github.com/pokt-network/poktroll/testutil/keeper" @@ -28,7 +30,7 @@ func TestMsgServer_StakeSupplier_SuccessfulCreateAndUpdate(t *testing.T) { require.False(t, isSupplierFound) // Prepare the stakeMsg - stakeMsg := stakeSupplierForServicesMsg(ownerAddr, operatorAddr, 100, "svcId") + stakeMsg := stakeSupplierForServicesMsg(ownerAddr, operatorAddr, 1000000, "svcId") // Stake the supplier _, err := srv.StakeSupplier(ctx, stakeMsg) @@ -38,14 +40,14 @@ func TestMsgServer_StakeSupplier_SuccessfulCreateAndUpdate(t *testing.T) { foundSupplier, isSupplierFound := supplierModuleKeepers.GetSupplier(ctx, operatorAddr) require.True(t, isSupplierFound) require.Equal(t, operatorAddr, foundSupplier.OperatorAddress) - require.Equal(t, int64(100), foundSupplier.Stake.Amount.Int64()) + require.Equal(t, int64(1000000), foundSupplier.Stake.Amount.Int64()) require.Len(t, foundSupplier.Services, 1) require.Equal(t, "svcId", foundSupplier.Services[0].ServiceId) require.Len(t, foundSupplier.Services[0].Endpoints, 1) require.Equal(t, "http://localhost:8080", foundSupplier.Services[0].Endpoints[0].Url) // Prepare an updated supplier with a higher stake and a different URL for the service - updateMsg := stakeSupplierForServicesMsg(ownerAddr, operatorAddr, 200, "svcId2") + updateMsg := stakeSupplierForServicesMsg(ownerAddr, operatorAddr, 2000000, "svcId2") updateMsg.Services[0].Endpoints[0].Url = "http://localhost:8082" // Update the staked supplier @@ -54,7 +56,7 @@ func TestMsgServer_StakeSupplier_SuccessfulCreateAndUpdate(t *testing.T) { foundSupplier, isSupplierFound = supplierModuleKeepers.GetSupplier(ctx, operatorAddr) require.True(t, isSupplierFound) - require.Equal(t, int64(200), foundSupplier.Stake.Amount.Int64()) + require.Equal(t, int64(2000000), foundSupplier.Stake.Amount.Int64()) require.Len(t, foundSupplier.Services, 1) require.Equal(t, "svcId2", foundSupplier.Services[0].ServiceId) require.Len(t, foundSupplier.Services[0].Endpoints, 1) @@ -70,7 +72,7 @@ func TestMsgServer_StakeSupplier_FailRestakingDueToInvalidServices(t *testing.T) operatorAddr := sample.AccAddress() // Prepare the supplier stake message - stakeMsg := stakeSupplierForServicesMsg(ownerAddr, operatorAddr, 100, "svcId") + stakeMsg := stakeSupplierForServicesMsg(ownerAddr, operatorAddr, 1000000, "svcId") // Stake the supplier _, err := srv.StakeSupplier(ctx, stakeMsg) @@ -120,7 +122,7 @@ func TestMsgServer_StakeSupplier_FailLoweringStake(t *testing.T) { operatorAddr := sample.AccAddress() // Prepare the supplier stake message - stakeMsg := stakeSupplierForServicesMsg(ownerAddr, operatorAddr, 100, "svcId") + stakeMsg := stakeSupplierForServicesMsg(ownerAddr, operatorAddr, 1000000, "svcId") // Stake the supplier & verify that the supplier exists _, err := srv.StakeSupplier(ctx, stakeMsg) @@ -140,7 +142,7 @@ func TestMsgServer_StakeSupplier_FailLoweringStake(t *testing.T) { // Verify that the supplier stake is unchanged supplierFound, isSupplierFound := supplierModuleKeepers.GetSupplier(ctx, operatorAddr) require.True(t, isSupplierFound) - require.Equal(t, int64(100), supplierFound.Stake.Amount.Int64()) + require.Equal(t, int64(1000000), supplierFound.Stake.Amount.Int64()) require.Len(t, supplierFound.Services, 1) } @@ -153,10 +155,11 @@ func TestMsgServer_StakeSupplier_FailWithNonExistingService(t *testing.T) { operatorAddr := sample.AccAddress() // Prepare the supplier stake message with a non-existing service ID - stakeMsg := stakeSupplierForServicesMsg(ownerAddr, operatorAddr, 100, "newService") + stakeMsg := stakeSupplierForServicesMsg(ownerAddr, operatorAddr, 1000000, "newService") // Stake the supplier & verify that it fails because the service does not exist. _, err := srv.StakeSupplier(ctx, stakeMsg) + require.Equal(t, codes.InvalidArgument, status.Code(err)) require.ErrorContains(t, err, types.ErrSupplierServiceNotFound.Wrapf( "service %q does not exist", "newService", ).Error()) @@ -171,7 +174,7 @@ func TestMsgServer_StakeSupplier_OperatorAuthorizations(t *testing.T) { operatorAddr := sample.AccAddress() // Stake using the operator address as the signer and verify that it succeeds. - stakeMsg := stakeSupplierForServicesMsg(ownerAddr, operatorAddr, 100, "svcId") + stakeMsg := stakeSupplierForServicesMsg(ownerAddr, operatorAddr, 1000000, "svcId") setStakeMsgSigner(stakeMsg, operatorAddr) _, err := srv.StakeSupplier(ctx, stakeMsg) require.NoError(t, err) @@ -181,7 +184,7 @@ func TestMsgServer_StakeSupplier_OperatorAuthorizations(t *testing.T) { require.Equal(t, ownerAddr, supplier.OwnerAddress) // Update the supplier using the operator address as the signer and verify that it succeeds. - stakeMsgUpdateUrl := stakeSupplierForServicesMsg(ownerAddr, operatorAddr, 200, "svcId") + stakeMsgUpdateUrl := stakeSupplierForServicesMsg(ownerAddr, operatorAddr, 2000000, "svcId") operatorUpdatedServiceUrl := "http://localhost:8081" stakeMsgUpdateUrl.Services[0].Endpoints[0].Url = operatorUpdatedServiceUrl setStakeMsgSigner(stakeMsgUpdateUrl, operatorAddr) @@ -196,7 +199,7 @@ func TestMsgServer_StakeSupplier_OperatorAuthorizations(t *testing.T) { // Update the supplier URL by using the owner address as the singer and verify that it succeeds. ownerUpdaterServiceUrl := "http://localhost:8082" stakeMsgUpdateUrl.Services[0].Endpoints[0].Url = ownerUpdaterServiceUrl - stakeMsgUpdateUrl.Stake.Amount = math.NewInt(300) + stakeMsgUpdateUrl.Stake.Amount = math.NewInt(3000000) setStakeMsgSigner(stakeMsgUpdateUrl, ownerAddr) _, err = srv.StakeSupplier(ctx, stakeMsgUpdateUrl) require.NoError(t, err) @@ -209,7 +212,7 @@ func TestMsgServer_StakeSupplier_OperatorAuthorizations(t *testing.T) { // Try updating the supplier's operator address using the old operator as a signer // will create a new supplier. - stakeMsgUpdateOperator := stakeSupplierForServicesMsg(ownerAddr, operatorAddr, 300, "svcId") + stakeMsgUpdateOperator := stakeSupplierForServicesMsg(ownerAddr, operatorAddr, 3000000, "svcId") newOperatorAddress := sample.AccAddress() stakeMsgUpdateOperator.OperatorAddress = newOperatorAddress setStakeMsgSigner(stakeMsgUpdateOperator, operatorAddr) @@ -229,7 +232,7 @@ func TestMsgServer_StakeSupplier_OperatorAuthorizations(t *testing.T) { // will create a new supplier. newOperatorAddress = sample.AccAddress() stakeMsgUpdateOperator.OperatorAddress = newOperatorAddress - stakeMsgUpdateOperator.Stake.Amount = math.NewInt(400) + stakeMsgUpdateOperator.Stake.Amount = math.NewInt(4000000) setStakeMsgSigner(stakeMsgUpdateOperator, ownerAddr) _, err = srv.StakeSupplier(ctx, stakeMsgUpdateOperator) require.NoError(t, err) @@ -246,13 +249,13 @@ func TestMsgServer_StakeSupplier_OperatorAuthorizations(t *testing.T) { // Try updating the supplier's owner address using the operator as a signer // and verify that it fails. newOwnerAddress := sample.AccAddress() - stakeMsgUpdateOwner := stakeSupplierForServicesMsg(ownerAddr, operatorAddr, 500, "svcId") + stakeMsgUpdateOwner := stakeSupplierForServicesMsg(ownerAddr, operatorAddr, 5000000, "svcId") stakeMsgUpdateOwner.OwnerAddress = newOwnerAddress setStakeMsgSigner(stakeMsgUpdateOwner, operatorAddr) _, err = srv.StakeSupplier(ctx, stakeMsgUpdateOwner) + require.Equal(t, codes.InvalidArgument, status.Code(err)) require.ErrorContains(t, err, sharedtypes.ErrSharedUnauthorizedSupplierUpdate.Wrapf( - "signer %q is not allowed to update the owner address %q", - operatorAddr, ownerAddr, + "signer %q is not allowed to update the owner address %q", operatorAddr, ownerAddr, ).Error()) // Update the supplier's owner address using the owner as a signer and verify that it succeeds. @@ -275,7 +278,7 @@ func TestMsgServer_StakeSupplier_ActiveSupplier(t *testing.T) { operatorAddr := sample.AccAddress() // Prepare the supplier - stakeMsg := stakeSupplierForServicesMsg(ownerAddr, operatorAddr, 100, "svcId") + stakeMsg := stakeSupplierForServicesMsg(ownerAddr, operatorAddr, 1000000, "svcId") // Stake the supplier & verify that the supplier exists. _, err := srv.StakeSupplier(ctx, stakeMsg) @@ -304,7 +307,7 @@ func TestMsgServer_StakeSupplier_ActiveSupplier(t *testing.T) { ctx = keepertest.SetBlockHeight(ctx, sessionEndHeight+1) // Prepare the supplier stake message with a different service - updateMsg := stakeSupplierForServicesMsg(ownerAddr, operatorAddr, 200, "svcId", "svcId2") + updateMsg := stakeSupplierForServicesMsg(ownerAddr, operatorAddr, 2000000, "svcId", "svcId2") updateMsg.Signer = operatorAddr // Update the staked supplier From 698991a3e2eaa94e4e9ffa901c6dc8c00af3e0cd Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 4 Oct 2024 18:11:20 +0200 Subject: [PATCH 111/139] Empty commit From 0d63e0709f8d452b745b38f2faf97657dd841968 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 4 Oct 2024 18:59:31 +0200 Subject: [PATCH 112/139] fix: linter error --- x/application/types/message_update_param.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/application/types/message_update_param.go b/x/application/types/message_update_param.go index fa8709020..df4e1cb5f 100644 --- a/x/application/types/message_update_param.go +++ b/x/application/types/message_update_param.go @@ -8,7 +8,7 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) -var _ cosmostypes.Msg = &MsgUpdateParam{} +var _ cosmostypes.Msg = (*MsgUpdateParam)(nil) func NewMsgUpdateParam(authority string, name string, asType any) *MsgUpdateParam { var asTypeIface isMsgUpdateParam_AsType From 1faf4abbbd046269ff15c3ded1eaf491f0821cb0 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 4 Oct 2024 19:22:30 +0200 Subject: [PATCH 113/139] chore: regenerate protobufs --- api/poktroll/application/tx.pulsar.go | 2 +- go.mod | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/api/poktroll/application/tx.pulsar.go b/api/poktroll/application/tx.pulsar.go index 4c1f5fe84..866f5acf4 100644 --- a/api/poktroll/application/tx.pulsar.go +++ b/api/poktroll/application/tx.pulsar.go @@ -5,11 +5,11 @@ import ( _ "cosmossdk.io/api/amino" v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" _ "cosmossdk.io/api/cosmos/msg/v1" + shared "github.com/pokt-network/poktroll/api/poktroll/shared" fmt "fmt" _ "github.com/cosmos/cosmos-proto" runtime "github.com/cosmos/cosmos-proto/runtime" _ "github.com/cosmos/gogoproto/gogoproto" - shared "github.com/pokt-network/poktroll/api/poktroll/shared" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" diff --git a/go.mod b/go.mod index 0d0979bb8..91de15f1d 100644 --- a/go.mod +++ b/go.mod @@ -72,7 +72,7 @@ require ( golang.org/x/sync v0.7.0 golang.org/x/text v0.16.0 golang.org/x/tools v0.23.0 - google.golang.org/genproto/googleapis/api v0.0.0-20240709173604-40e1e62336c5 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240709173604-40e1e62336c5 google.golang.org/grpc v1.65.0 google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.4.0 google.golang.org/protobuf v1.34.2 From 032b849d3edf279808660f604a7f5ee4fef39b32 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 4 Oct 2024 21:20:00 +0200 Subject: [PATCH 114/139] test: add TestMsgServer_StakeSupplier_FailBelowMinStake --- .../keeper/msg_server_stake_supplier_test.go | 68 ++++++++++++++++--- 1 file changed, 58 insertions(+), 10 deletions(-) diff --git a/x/supplier/keeper/msg_server_stake_supplier_test.go b/x/supplier/keeper/msg_server_stake_supplier_test.go index 58db830c9..776388b72 100644 --- a/x/supplier/keeper/msg_server_stake_supplier_test.go +++ b/x/supplier/keeper/msg_server_stake_supplier_test.go @@ -4,7 +4,7 @@ import ( "testing" "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" + cosmostypes "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -14,7 +14,7 @@ import ( "github.com/pokt-network/poktroll/testutil/sample" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" "github.com/pokt-network/poktroll/x/supplier/keeper" - "github.com/pokt-network/poktroll/x/supplier/types" + suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" ) func TestMsgServer_StakeSupplier_SuccessfulCreateAndUpdate(t *testing.T) { @@ -160,7 +160,7 @@ func TestMsgServer_StakeSupplier_FailWithNonExistingService(t *testing.T) { // Stake the supplier & verify that it fails because the service does not exist. _, err := srv.StakeSupplier(ctx, stakeMsg) require.Equal(t, codes.InvalidArgument, status.Code(err)) - require.ErrorContains(t, err, types.ErrSupplierServiceNotFound.Wrapf( + require.ErrorContains(t, err, suppliertypes.ErrSupplierServiceNotFound.Wrapf( "service %q does not exist", "newService", ).Error()) } @@ -255,7 +255,8 @@ func TestMsgServer_StakeSupplier_OperatorAuthorizations(t *testing.T) { _, err = srv.StakeSupplier(ctx, stakeMsgUpdateOwner) require.Equal(t, codes.InvalidArgument, status.Code(err)) require.ErrorContains(t, err, sharedtypes.ErrSharedUnauthorizedSupplierUpdate.Wrapf( - "signer %q is not allowed to update the owner address %q", operatorAddr, ownerAddr, + "signer %q is not allowed to update the owner address %q", + operatorAddr, ownerAddr, ).Error()) // Update the supplier's owner address using the owner as a signer and verify that it succeeds. @@ -284,7 +285,7 @@ func TestMsgServer_StakeSupplier_ActiveSupplier(t *testing.T) { _, err := srv.StakeSupplier(ctx, stakeMsg) require.NoError(t, err) - sdkCtx := sdk.UnwrapSDKContext(ctx) + sdkCtx := cosmostypes.UnwrapSDKContext(ctx) currentHeight := sdkCtx.BlockHeight() sessionEndHeight := supplierModuleKeepers.SharedKeeper.GetSessionEndHeight(ctx, currentHeight) @@ -342,7 +343,7 @@ func stakeSupplierForServicesMsg( ownerAddr, operatorAddr string, amount int64, serviceIds ...string, -) *types.MsgStakeSupplier { +) *suppliertypes.MsgStakeSupplier { services := make([]*sharedtypes.SupplierServiceConfig, 0, len(serviceIds)) for _, serviceId := range serviceIds { services = append(services, &sharedtypes.SupplierServiceConfig{ @@ -363,20 +364,67 @@ func stakeSupplierForServicesMsg( }) } - return &types.MsgStakeSupplier{ + return &suppliertypes.MsgStakeSupplier{ Signer: ownerAddr, OwnerAddress: ownerAddr, OperatorAddress: operatorAddr, - Stake: &sdk.Coin{Denom: volatile.DenomuPOKT, Amount: math.NewInt(amount)}, + Stake: &cosmostypes.Coin{Denom: volatile.DenomuPOKT, Amount: math.NewInt(amount)}, Services: services, } } // setStakeMsgSigner sets the signer of the given MsgStakeSupplier to the given address func setStakeMsgSigner( - msg *types.MsgStakeSupplier, + msg *suppliertypes.MsgStakeSupplier, signer string, -) *types.MsgStakeSupplier { +) *suppliertypes.MsgStakeSupplier { msg.Signer = signer return msg } + +func TestMsgServer_StakeSupplier_FailBelowMinStake(t *testing.T) { + k, ctx := keepertest.SupplierKeeper(t) + srv := keeper.NewMsgServerImpl(*k.Keeper) + + addr := sample.AccAddress() + supplierStake := cosmostypes.NewInt64Coin(volatile.DenomuPOKT, 100) + minStake := supplierStake.AddAmount(math.NewInt(1)) + expectedErr := suppliertypes.ErrSupplierInvalidStake.Wrapf("supplier with owner %q must stake at least %s", addr, minStake) + + // Set the minimum stake to be greater than the supplier stake. + params := k.Keeper.GetParams(ctx) + params.MinStake = &minStake + err := k.SetParams(ctx, params) + require.NoError(t, err) + + // Prepare the application. + stakeMsg := &suppliertypes.MsgStakeSupplier{ + Signer: addr, + OwnerAddress: addr, + OperatorAddress: addr, + Stake: &supplierStake, + Services: []*sharedtypes.SupplierServiceConfig{ + { + ServiceId: "svcId", + Endpoints: []*sharedtypes.SupplierEndpoint{ + { + Url: "http://test.example:8080", + RpcType: sharedtypes.RPCType_JSON_RPC, + }, + }, + RevShare: []*sharedtypes.ServiceRevenueShare{ + { + Address: addr, + RevSharePercentage: 100, + }, + }, + }, + }, + } + + // Attempt to stake the supplier & verify that the supplier does NOT exist. + _, err = srv.StakeSupplier(ctx, stakeMsg) + require.ErrorContains(t, err, expectedErr.Error()) + _, isGatewayFound := k.GetSupplier(ctx, addr) + require.False(t, isGatewayFound) +} From ce8b68c84ee7c34b2200955323d89e7f77031262 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Mon, 7 Oct 2024 09:42:21 +0200 Subject: [PATCH 115/139] chore: add gRPC status error --- x/supplier/keeper/msg_server_stake_supplier.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x/supplier/keeper/msg_server_stake_supplier.go b/x/supplier/keeper/msg_server_stake_supplier.go index d767d9639..3ed4add08 100644 --- a/x/supplier/keeper/msg_server_stake_supplier.go +++ b/x/supplier/keeper/msg_server_stake_supplier.go @@ -96,7 +96,8 @@ func (k msgServer) StakeSupplier(ctx context.Context, msg *types.MsgStakeSupplie } coinsToEscrow, err = (*msg.Stake).SafeSub(currSupplierStake) if err != nil { - return nil, err + logger.Info(fmt.Sprintf("ERROR: %s", err)) + return nil, status.Error(codes.Internal, err.Error()) } logger.Info(fmt.Sprintf("Supplier is going to escrow an additional %+v coins", coinsToEscrow)) From e06dca2311ed6abb3175ef404fcacbbdbe68de1b Mon Sep 17 00:00:00 2001 From: Bryan White Date: Mon, 7 Oct 2024 09:47:22 +0200 Subject: [PATCH 116/139] fix: failing unit tests --- .../msg_server_unstake_supplier_test.go | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/x/supplier/keeper/msg_server_unstake_supplier_test.go b/x/supplier/keeper/msg_server_unstake_supplier_test.go index 91d49ed7f..262d1caa9 100644 --- a/x/supplier/keeper/msg_server_unstake_supplier_test.go +++ b/x/supplier/keeper/msg_server_unstake_supplier_test.go @@ -12,7 +12,7 @@ import ( "github.com/pokt-network/poktroll/x/shared" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" "github.com/pokt-network/poktroll/x/supplier/keeper" - "github.com/pokt-network/poktroll/x/supplier/types" + suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" ) func TestMsgServer_UnstakeSupplier_Success(t *testing.T) { @@ -28,7 +28,7 @@ func TestMsgServer_UnstakeSupplier_Success(t *testing.T) { _, isSupplierFound := supplierModuleKeepers.GetSupplier(ctx, unstakingSupplierOperatorAddr) require.False(t, isSupplierFound) - initialStake := int64(100) + initialStake := suppliertypes.DefaultMinStake.Amount.Int64() stakeMsg := createStakeMsg(unstakingSupplierOperatorAddr, initialStake) // Stake the supplier @@ -54,7 +54,7 @@ func TestMsgServer_UnstakeSupplier_Success(t *testing.T) { require.True(t, isSupplierFound) // Initiate the supplier unstaking - unstakeMsg := &types.MsgUnstakeSupplier{ + unstakeMsg := &suppliertypes.MsgUnstakeSupplier{ Signer: unstakingSupplierOperatorAddr, OperatorAddress: unstakingSupplierOperatorAddr, } @@ -95,7 +95,7 @@ func TestMsgServer_UnstakeSupplier_CancelUnbondingIfRestaked(t *testing.T) { supplierOperatorAddr := sample.AccAddress() // Stake the supplier - initialStake := int64(100) + initialStake := suppliertypes.DefaultMinStake.Amount.Int64() stakeMsg := createStakeMsg(supplierOperatorAddr, initialStake) _, err := srv.StakeSupplier(ctx, stakeMsg) require.NoError(t, err) @@ -106,7 +106,7 @@ func TestMsgServer_UnstakeSupplier_CancelUnbondingIfRestaked(t *testing.T) { require.False(t, foundSupplier.IsUnbonding()) // Initiate the supplier unstaking - unstakeMsg := &types.MsgUnstakeSupplier{ + unstakeMsg := &suppliertypes.MsgUnstakeSupplier{ Signer: supplierOperatorAddr, OperatorAddress: supplierOperatorAddr, } @@ -154,13 +154,13 @@ func TestMsgServer_UnstakeSupplier_FailIfNotStaked(t *testing.T) { require.False(t, isSupplierFound) // Initiate the supplier unstaking - unstakeMsg := &types.MsgUnstakeSupplier{ + unstakeMsg := &suppliertypes.MsgUnstakeSupplier{ Signer: supplierOperatorAddr, OperatorAddress: supplierOperatorAddr, } _, err := srv.UnstakeSupplier(ctx, unstakeMsg) require.Error(t, err) - require.ErrorIs(t, err, types.ErrSupplierNotFound) + require.ErrorIs(t, err, suppliertypes.ErrSupplierNotFound) _, isSupplierFound = supplierModuleKeepers.GetSupplier(ctx, supplierOperatorAddr) require.False(t, isSupplierFound) @@ -174,13 +174,13 @@ func TestMsgServer_UnstakeSupplier_FailIfCurrentlyUnstaking(t *testing.T) { supplierOperatorAddr := sample.AccAddress() // Stake the supplier - initialStake := int64(100) + initialStake := suppliertypes.DefaultMinStake.Amount.Int64() stakeMsg := createStakeMsg(supplierOperatorAddr, initialStake) _, err := srv.StakeSupplier(ctx, stakeMsg) require.NoError(t, err) // Initiate the supplier unstaking - unstakeMsg := &types.MsgUnstakeSupplier{ + unstakeMsg := &suppliertypes.MsgUnstakeSupplier{ Signer: supplierOperatorAddr, OperatorAddress: supplierOperatorAddr, } @@ -191,7 +191,7 @@ func TestMsgServer_UnstakeSupplier_FailIfCurrentlyUnstaking(t *testing.T) { ctx = keepertest.SetBlockHeight(ctx, int64(sdkCtx.BlockHeight()+1)) _, err = srv.UnstakeSupplier(ctx, unstakeMsg) - require.ErrorIs(t, err, types.ErrSupplierIsUnstaking) + require.ErrorIs(t, err, suppliertypes.ErrSupplierIsUnstaking) } func TestMsgServer_UnstakeSupplier_OperatorCanUnstake(t *testing.T) { @@ -203,14 +203,14 @@ func TestMsgServer_UnstakeSupplier_OperatorCanUnstake(t *testing.T) { supplierOperatorAddr := sample.AccAddress() // Stake the supplier - initialStake := int64(100) + initialStake := suppliertypes.DefaultMinStake.Amount.Int64() stakeMsg := createStakeMsg(ownerAddr, initialStake) stakeMsg.OperatorAddress = supplierOperatorAddr _, err := srv.StakeSupplier(ctx, stakeMsg) require.NoError(t, err) // Initiate the supplier unstaking - unstakeMsg := &types.MsgUnstakeSupplier{ + unstakeMsg := &suppliertypes.MsgUnstakeSupplier{ Signer: supplierOperatorAddr, OperatorAddress: supplierOperatorAddr, } @@ -238,9 +238,9 @@ func TestMsgServer_UnstakeSupplier_OperatorCanUnstake(t *testing.T) { require.Equal(t, initialStake, supplierModuleKeepers.SupplierUnstakedFundsMap[ownerAddr]) } -func createStakeMsg(supplierOwnerAddr string, stakeAmount int64) *types.MsgStakeSupplier { +func createStakeMsg(supplierOwnerAddr string, stakeAmount int64) *suppliertypes.MsgStakeSupplier { initialStake := sdk.NewCoin("upokt", math.NewInt(stakeAmount)) - return &types.MsgStakeSupplier{ + return &suppliertypes.MsgStakeSupplier{ Signer: supplierOwnerAddr, OwnerAddress: supplierOwnerAddr, OperatorAddress: supplierOwnerAddr, From 7bf55d652f956979b78b68e310d326581bbf75b0 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Mon, 7 Oct 2024 09:48:17 +0200 Subject: [PATCH 117/139] Empty commit From a534825a4a9f01cad24ccea0cc28685651ef405b Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 2 Oct 2024 17:27:51 +0200 Subject: [PATCH 118/139] chore: refresh shared module params impl. to match updated docs --- x/shared/keeper/msg_server_update_param.go | 108 +++++++----------- .../keeper/msg_server_update_param_test.go | 52 ++++++--- x/shared/types/message_update_param.go | 62 +++++++--- x/shared/types/params.go | 42 +++---- 4 files changed, 149 insertions(+), 115 deletions(-) diff --git a/x/shared/keeper/msg_server_update_param.go b/x/shared/keeper/msg_server_update_param.go index 6263d296d..099876660 100644 --- a/x/shared/keeper/msg_server_update_param.go +++ b/x/shared/keeper/msg_server_update_param.go @@ -2,105 +2,85 @@ package keeper import ( "context" + "fmt" + + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" "github.com/pokt-network/poktroll/x/shared/types" ) func (k msgServer) UpdateParam(ctx context.Context, msg *types.MsgUpdateParam) (*types.MsgUpdateParamResponse, error) { + logger := k.logger.With( + "method", "UpdateParam", + "param_name", msg.Name, + ) + if err := msg.ValidateBasic(); err != nil { - return nil, err + return nil, status.Error(codes.InvalidArgument, err.Error()) } if k.GetAuthority() != msg.Authority { - return nil, types.ErrSharedInvalidSigner.Wrapf("invalid authority; expected %s, got %s", k.GetAuthority(), msg.Authority) + return nil, status.Error( + codes.InvalidArgument, + types.ErrSharedInvalidSigner.Wrapf( + "invalid authority; expected %s, got %s", + k.GetAuthority(), msg.Authority, + ).Error(), + ) } 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) - } - - params.NumBlocksPerSession = uint64(value.AsInt64) + logger = logger.With("param_value", msg.GetAsInt64()) + params.NumBlocksPerSession = uint64(msg.GetAsInt64()) case types.ParamGracePeriodEndOffsetBlocks: - 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) - } - - params.GracePeriodEndOffsetBlocks = uint64(value.AsInt64) + logger = logger.With("param_value", msg.GetAsInt64()) + params.GracePeriodEndOffsetBlocks = uint64(msg.GetAsInt64()) case types.ParamClaimWindowOpenOffsetBlocks: - 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) - } - - params.ClaimWindowOpenOffsetBlocks = uint64(value.AsInt64) + logger = logger.With("param_value", msg.GetAsInt64()) + params.ClaimWindowOpenOffsetBlocks = uint64(msg.GetAsInt64()) case types.ParamClaimWindowCloseOffsetBlocks: - 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) - } - - params.ClaimWindowCloseOffsetBlocks = uint64(value.AsInt64) + logger = logger.With("param_value", msg.GetAsInt64()) + params.ClaimWindowCloseOffsetBlocks = uint64(msg.GetAsInt64()) case types.ParamProofWindowOpenOffsetBlocks: - 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) - } - - params.ProofWindowOpenOffsetBlocks = uint64(value.AsInt64) + logger = logger.With("param_value", msg.GetAsInt64()) + params.ProofWindowOpenOffsetBlocks = uint64(msg.GetAsInt64()) case types.ParamProofWindowCloseOffsetBlocks: - 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) - } - - params.ProofWindowCloseOffsetBlocks = uint64(value.AsInt64) + logger = logger.With("param_value", msg.GetAsInt64()) + params.ProofWindowCloseOffsetBlocks = uint64(msg.GetAsInt64()) case types.ParamSupplierUnbondingPeriodSessions: - 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) - } - - params.SupplierUnbondingPeriodSessions = uint64(value.AsInt64) + logger = logger.With("param_value", msg.GetAsInt64()) + params.SupplierUnbondingPeriodSessions = uint64(msg.GetAsInt64()) case types.ParamApplicationUnbondingPeriodSessions: - 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) - } - - params.ApplicationUnbondingPeriodSessions = uint64(value.AsInt64) + logger = logger.With("param_value", msg.GetAsInt64()) + params.ApplicationUnbondingPeriodSessions = uint64(msg.GetAsInt64()) case types.ParamComputeUnitsToTokensMultiplier: - 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) - } - computeUnitsToTokensMultiplier := uint64(value.AsInt64) - - if err := types.ValidateComputeUnitsToTokensMultiplier(computeUnitsToTokensMultiplier); err != nil { - return nil, err - } - - params.ComputeUnitsToTokensMultiplier = computeUnitsToTokensMultiplier + logger = logger.With("param_value", msg.GetAsInt64()) + params.ComputeUnitsToTokensMultiplier = uint64(msg.GetAsInt64()) default: - return nil, types.ErrSharedParamInvalid.Wrapf("unsupported param %q", msg.Name) + return nil, status.Error( + codes.InvalidArgument, + types.ErrSharedParamInvalid.Wrapf("unsupported param %q", msg.Name).Error(), + ) } // Perform a global validation on all params, which includes the updated param. // This is needed to ensure that the updated param is valid in the context of all other params. if err := params.ValidateBasic(); err != nil { - return nil, err + return nil, status.Error(codes.InvalidArgument, err.Error()) } if err := k.SetParams(ctx, params); err != nil { - return nil, err + err = fmt.Errorf("unable to set params: %w", err) + logger.Error(fmt.Sprintf("ERROR: %s", err)) + return nil, status.Error(codes.Internal, err.Error()) } 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 index da4a2ca03..3a84810f4 100644 --- a/x/shared/keeper/msg_server_update_param_test.go +++ b/x/shared/keeper/msg_server_update_param_test.go @@ -6,6 +6,8 @@ import ( authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "github.com/stretchr/testify/require" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" "github.com/pokt-network/poktroll/x/shared/keeper" "github.com/pokt-network/poktroll/x/shared/types" @@ -50,7 +52,7 @@ func TestMsgUpdateParam_UpdateNumBlocksPerSession(t *testing.T) { require.Equal(t, uint64(expectedNumBlocksPerSession), res.Params.NumBlocksPerSession) // Ensure the other parameters are unchanged - testkeeper.AssertDefaultParamsEqualExceptFields(t, &testSharedParams, res.Params, "NumBlocksPerSession") + testkeeper.AssertDefaultParamsEqualExceptFields(t, &testSharedParams, res.Params, string(sharedtypes.KeyNumBlocksPerSession)) } func TestMsgUpdateParam_UpdateClaimWindowOpenOffsetBlocks(t *testing.T) { @@ -95,7 +97,7 @@ func TestMsgUpdateParam_UpdateClaimWindowOpenOffsetBlocks(t *testing.T) { require.Equal(t, uint64(expectedClaimWindowOpenOffestBlocks), res.Params.ClaimWindowOpenOffsetBlocks) // Ensure the other parameters are unchanged - testkeeper.AssertDefaultParamsEqualExceptFields(t, &sharedParams, res.Params, "ClaimWindowOpenOffsetBlocks") + testkeeper.AssertDefaultParamsEqualExceptFields(t, &sharedParams, res.Params, string(sharedtypes.KeyClaimWindowOpenOffsetBlocks)) } func TestMsgUpdateParam_UpdateClaimWindowCloseOffsetBlocks(t *testing.T) { @@ -140,7 +142,7 @@ func TestMsgUpdateParam_UpdateClaimWindowCloseOffsetBlocks(t *testing.T) { require.Equal(t, uint64(expectedClaimWindowCloseOffestBlocks), res.Params.ClaimWindowCloseOffsetBlocks) // Ensure the other parameters are unchanged - testkeeper.AssertDefaultParamsEqualExceptFields(t, &sharedParams, res.Params, "ClaimWindowCloseOffsetBlocks") + testkeeper.AssertDefaultParamsEqualExceptFields(t, &sharedParams, res.Params, string(sharedtypes.KeyClaimWindowCloseOffsetBlocks)) } func TestMsgUpdateParam_UpdateProofWindowOpenOffsetBlocks(t *testing.T) { @@ -185,7 +187,7 @@ func TestMsgUpdateParam_UpdateProofWindowOpenOffsetBlocks(t *testing.T) { require.Equal(t, uint64(expectedProofWindowOpenOffestBlocks), res.Params.ProofWindowOpenOffsetBlocks) // Ensure the other parameters are unchanged - testkeeper.AssertDefaultParamsEqualExceptFields(t, &sharedParams, res.Params, "ProofWindowOpenOffsetBlocks") + testkeeper.AssertDefaultParamsEqualExceptFields(t, &sharedParams, res.Params, string(sharedtypes.KeyProofWindowOpenOffsetBlocks)) } func TestMsgUpdateParam_UpdateProofWindowCloseOffsetBlocks(t *testing.T) { @@ -230,7 +232,7 @@ func TestMsgUpdateParam_UpdateProofWindowCloseOffsetBlocks(t *testing.T) { require.Equal(t, uint64(expectedProofWindowCloseOffestBlocks), res.Params.ProofWindowCloseOffsetBlocks) // Ensure the other parameters are unchanged - testkeeper.AssertDefaultParamsEqualExceptFields(t, &sharedParams, res.Params, "ProofWindowCloseOffsetBlocks") + testkeeper.AssertDefaultParamsEqualExceptFields(t, &sharedParams, res.Params, string(sharedtypes.KeyProofWindowCloseOffsetBlocks)) } func TestMsgUpdateParam_UpdateGracePeriodEndOffsetBlocks(t *testing.T) { @@ -263,11 +265,11 @@ func TestMsgUpdateParam_UpdateGracePeriodEndOffsetBlocks(t *testing.T) { require.Equal(t, uint64(expectedGracePeriodEndOffestBlocks), res.Params.GetGracePeriodEndOffsetBlocks()) // Ensure the other parameters are unchanged - testkeeper.AssertDefaultParamsEqualExceptFields(t, &sharedParams, res.Params, "GracePeriodEndOffsetBlocks") + testkeeper.AssertDefaultParamsEqualExceptFields(t, &sharedParams, res.Params, string(sharedtypes.KeyGracePeriodEndOffsetBlocks)) } func TestMsgUpdateParam_UpdateSupplierUnbondingPeriodSessions(t *testing.T) { - var expectedSupplierUnbondingPerid int64 = 5 + var expectedSupplierUnbondingPeriod int64 = 5 k, ctx := testkeeper.SharedKeeper(t) msgSrv := keeper.NewMsgServerImpl(k) @@ -276,21 +278,21 @@ func TestMsgUpdateParam_UpdateSupplierUnbondingPeriodSessions(t *testing.T) { require.NoError(t, k.SetParams(ctx, testSharedParams)) // Ensure the default values are different from the new values we want to set - require.NotEqual(t, uint64(expectedSupplierUnbondingPerid), testSharedParams.GetSupplierUnbondingPeriodSessions()) + require.NotEqual(t, uint64(expectedSupplierUnbondingPeriod), testSharedParams.GetSupplierUnbondingPeriodSessions()) // Update the supplier unbonding period param updateParamMsg := &sharedtypes.MsgUpdateParam{ Authority: authtypes.NewModuleAddress(govtypes.ModuleName).String(), Name: sharedtypes.ParamSupplierUnbondingPeriodSessions, - AsType: &sharedtypes.MsgUpdateParam_AsInt64{AsInt64: expectedSupplierUnbondingPerid}, + AsType: &sharedtypes.MsgUpdateParam_AsInt64{AsInt64: expectedSupplierUnbondingPeriod}, } res, err := msgSrv.UpdateParam(ctx, updateParamMsg) require.NoError(t, err) - require.Equal(t, uint64(expectedSupplierUnbondingPerid), res.Params.GetSupplierUnbondingPeriodSessions()) + require.Equal(t, uint64(expectedSupplierUnbondingPeriod), res.Params.GetSupplierUnbondingPeriodSessions()) // Ensure the other parameters are unchanged - testkeeper.AssertDefaultParamsEqualExceptFields(t, &testSharedParams, res.Params, "SupplierUnbondingPeriodSessions") + testkeeper.AssertDefaultParamsEqualExceptFields(t, &testSharedParams, res.Params, string(sharedtypes.KeySupplierUnbondingPeriodSessions)) // Ensure that a supplier unbonding period that is less than the cumulative // proof window close blocks is not allowed. @@ -300,7 +302,13 @@ func TestMsgUpdateParam_UpdateSupplierUnbondingPeriodSessions(t *testing.T) { AsType: &sharedtypes.MsgUpdateParam_AsInt64{AsInt64: 1}, } _, err = msgSrv.UpdateParam(ctx, updateParamMsg) - require.ErrorIs(t, err, sharedtypes.ErrSharedParamInvalid) + require.EqualError(t, err, status.Error( + codes.InvalidArgument, + sharedtypes.ErrSharedParamInvalid.Wrapf( + "SupplierUnbondingPeriodSessions (%v session) (%v blocks) must be greater than the cumulative ProofWindowCloseOffsetBlocks (%v)", + 1, 4, 10, + ).Error(), + ).Error()) } func TestMsgUpdateParam_UpdateApplicationUnbondingPeriodSessions(t *testing.T) { @@ -327,7 +335,7 @@ func TestMsgUpdateParam_UpdateApplicationUnbondingPeriodSessions(t *testing.T) { require.Equal(t, uint64(expectedApplicationUnbondingPerid), res.Params.GetApplicationUnbondingPeriodSessions()) // Ensure the other parameters are unchanged - testkeeper.AssertDefaultParamsEqualExceptFields(t, &testSharedParams, res.Params, "ApplicationUnbondingPeriodSessions") + testkeeper.AssertDefaultParamsEqualExceptFields(t, &testSharedParams, res.Params, string(sharedtypes.KeyApplicationUnbondingPeriodSessions)) // Ensure that a application unbonding period that is less than the cumulative // proof window close blocks is not allowed. @@ -337,7 +345,13 @@ func TestMsgUpdateParam_UpdateApplicationUnbondingPeriodSessions(t *testing.T) { AsType: &sharedtypes.MsgUpdateParam_AsInt64{AsInt64: 1}, } _, err = msgSrv.UpdateParam(ctx, updateParamMsg) - require.ErrorIs(t, err, sharedtypes.ErrSharedParamInvalid) + require.EqualError(t, err, status.Error( + codes.InvalidArgument, + sharedtypes.ErrSharedParamInvalid.Wrapf( + "ApplicationUnbondingPeriodSessions (%v session) (%v blocks) must be greater than the cumulative ProofWindowCloseOffsetBlocks (%v)", + 1, 4, 10, + ).Error(), + ).Error()) } func TestMsgUpdateParam_ComputeUnitsToTokenMultiplier(t *testing.T) { @@ -364,7 +378,7 @@ func TestMsgUpdateParam_ComputeUnitsToTokenMultiplier(t *testing.T) { require.Equal(t, uint64(expectedComputeUnitsToTokenMultiplier), res.Params.GetComputeUnitsToTokensMultiplier()) // Ensure the other parameters are unchanged - testkeeper.AssertDefaultParamsEqualExceptFields(t, &testSharedParams, res.Params, "ComputeUnitsToTokensMultiplier") + testkeeper.AssertDefaultParamsEqualExceptFields(t, &testSharedParams, res.Params, string(sharedtypes.KeyComputeUnitsToTokensMultiplier)) // Ensure that compute units to token multiplier that is less than 1 is not allowed. updateParamMsg = &sharedtypes.MsgUpdateParam{ @@ -373,7 +387,12 @@ func TestMsgUpdateParam_ComputeUnitsToTokenMultiplier(t *testing.T) { AsType: &sharedtypes.MsgUpdateParam_AsInt64{AsInt64: 0}, } _, err = msgSrv.UpdateParam(ctx, updateParamMsg) - require.ErrorIs(t, err, sharedtypes.ErrSharedParamInvalid) + require.EqualError(t, err, status.Error( + codes.InvalidArgument, + sharedtypes.ErrSharedParamInvalid.Wrapf( + "invalid ComputeUnitsToTokensMultiplier: (%d)", 0, + ).Error(), + ).Error()) } // getMinActorUnbondingPeriodSessions returns the actors unbonding period @@ -386,6 +405,5 @@ func getMinActorUnbondingPeriodSessions( ) uint64 { deltaBlocks := newParamBlocksValue - oldParamBlocksValue newProofWindowCloseBlocks := types.GetSessionEndToProofWindowCloseBlocks(params) + deltaBlocks - return (newProofWindowCloseBlocks / params.NumBlocksPerSession) + 1 } diff --git a/x/shared/types/message_update_param.go b/x/shared/types/message_update_param.go index f609b0fd8..d258fc7fa 100644 --- a/x/shared/types/message_update_param.go +++ b/x/shared/types/message_update_param.go @@ -31,9 +31,10 @@ func NewMsgUpdateParam(authority string, name string, value any) (*MsgUpdatePara }, 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. +// ValidateBasic performs a basic validation of the MsgUpdateParam fields. It ensures: +// 1. The parameter name is supported. +// 2. The parameter type matches the expected type for a given parameter name. +// 3. The parameter value is valid (according to its respective validation function). func (msg *MsgUpdateParam) ValidateBasic() error { // Validate the address if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { @@ -48,16 +49,51 @@ func (msg *MsgUpdateParam) ValidateBasic() error { // Parameter name must be supported by this module. switch msg.Name { // TODO_IMPROVE: Add a Uint64 asType instead of using int64 for uint64 params. - case ParamNumBlocksPerSession, - ParamGracePeriodEndOffsetBlocks, - ParamClaimWindowOpenOffsetBlocks, - ParamClaimWindowCloseOffsetBlocks, - ParamProofWindowOpenOffsetBlocks, - ParamProofWindowCloseOffsetBlocks, - ParamSupplierUnbondingPeriodSessions, - ParamApplicationUnbondingPeriodSessions, - ParamComputeUnitsToTokensMultiplier: - return msg.paramTypeIsInt64() + case ParamNumBlocksPerSession: + if err := msg.paramTypeIsInt64(); err != nil { + return err + } + return ValidateNumBlocksPerSession(uint64(msg.GetAsInt64())) + case ParamGracePeriodEndOffsetBlocks: + if err := msg.paramTypeIsInt64(); err != nil { + return err + } + return ValidateGracePeriodEndOffsetBlocks(uint64(msg.GetAsInt64())) + case ParamClaimWindowOpenOffsetBlocks: + if err := msg.paramTypeIsInt64(); err != nil { + return err + } + return ValidateClaimWindowOpenOffsetBlocks(uint64(msg.GetAsInt64())) + case ParamClaimWindowCloseOffsetBlocks: + if err := msg.paramTypeIsInt64(); err != nil { + return err + } + return ValidateClaimWindowCloseOffsetBlocks(uint64(msg.GetAsInt64())) + case ParamProofWindowOpenOffsetBlocks: + if err := msg.paramTypeIsInt64(); err != nil { + return err + } + return ValidateProofWindowOpenOffsetBlocks(uint64(msg.GetAsInt64())) + case ParamProofWindowCloseOffsetBlocks: + if err := msg.paramTypeIsInt64(); err != nil { + return err + } + return ValidateProofWindowCloseOffsetBlocks(uint64(msg.GetAsInt64())) + case ParamSupplierUnbondingPeriodSessions: + if err := msg.paramTypeIsInt64(); err != nil { + return err + } + return ValidateSupplierUnbondingPeriodSessions(uint64(msg.GetAsInt64())) + case ParamApplicationUnbondingPeriodSessions: + if err := msg.paramTypeIsInt64(); err != nil { + return err + } + return ValidateApplicationUnbondingPeriodSessions(uint64(msg.GetAsInt64())) + case ParamComputeUnitsToTokensMultiplier: + if err := msg.paramTypeIsInt64(); err != nil { + return err + } + return ValidateComputeUnitsToTokensMultiplier(uint64(msg.GetAsInt64())) default: return ErrSharedParamNameInvalid.Wrapf("unsupported param %q", msg.Name) } diff --git a/x/shared/types/params.go b/x/shared/types/params.go index d5921f62d..52f09df79 100644 --- a/x/shared/types/params.go +++ b/x/shared/types/params.go @@ -173,8 +173,8 @@ func (params *Params) ValidateBasic() error { // ValidateNumBlocksPerSession validates the NumBlocksPerSession param // NB: The argument is an interface type to satisfy the ParamSetPair function signature. -func ValidateNumBlocksPerSession(v interface{}) error { - numBlocksPerSession, err := validateIsUint64(v) +func ValidateNumBlocksPerSession(numBlocksPerSessionAny any) error { + numBlocksPerSession, err := validateIsUint64(numBlocksPerSessionAny) if err != nil { return err } @@ -188,44 +188,44 @@ func ValidateNumBlocksPerSession(v interface{}) error { // ValidateClaimWindowOpenOffsetBlocks validates the ClaimWindowOpenOffsetBlocks param // NB: The argument is an interface type to satisfy the ParamSetPair function signature. -func ValidateClaimWindowOpenOffsetBlocks(v interface{}) error { - _, err := validateIsUint64(v) +func ValidateClaimWindowOpenOffsetBlocks(claimWindowOpenOffsetBlocksAny any) error { + _, err := validateIsUint64(claimWindowOpenOffsetBlocksAny) return err } // ValidateClaimWindowCloseOffsetBlocks validates the ClaimWindowCloseOffsetBlocks param // NB: The argument is an interface type to satisfy the ParamSetPair function signature. -func ValidateClaimWindowCloseOffsetBlocks(v interface{}) error { - _, err := validateIsUint64(v) +func ValidateClaimWindowCloseOffsetBlocks(claimWindowCloseOffsetBlocksAny any) error { + _, err := validateIsUint64(claimWindowCloseOffsetBlocksAny) return err } // ValidateProofWindowOpenOffsetBlocks validates the ProofWindowOpenOffsetBlocks param // NB: The argument is an interface type to satisfy the ParamSetPair function signature. -func ValidateProofWindowOpenOffsetBlocks(v interface{}) error { - _, err := validateIsUint64(v) +func ValidateProofWindowOpenOffsetBlocks(proofWindowOpenOffsetBlocksAny any) error { + _, err := validateIsUint64(proofWindowOpenOffsetBlocksAny) return err } // ValidateProofWindowCloseOffsetBlocks validates the ProofWindowCloseOffsetBlocks param // NB: The argument is an interface type to satisfy the ParamSetPair function signature. -func ValidateProofWindowCloseOffsetBlocks(v interface{}) error { - _, err := validateIsUint64(v) +func ValidateProofWindowCloseOffsetBlocks(proofWindowCloseOffsetBlocksAny any) error { + _, err := validateIsUint64(proofWindowCloseOffsetBlocksAny) return err } // ValidateGracePeriodEndOffsetBlocks validates the GracePeriodEndOffsetBlocks param // NB: The argument is an interface type to satisfy the ParamSetPair function signature. -func ValidateGracePeriodEndOffsetBlocks(v interface{}) error { - _, err := validateIsUint64(v) +func ValidateGracePeriodEndOffsetBlocks(gracePeriodEndOffsetBlocksAny any) error { + _, err := validateIsUint64(gracePeriodEndOffsetBlocksAny) return err } -// ValidateSupplierUnbondingPeriodSession validates the SupplierUnbondingPeriodSessions +// ValidateSupplierUnbondingPeriodSessions validates the SupplierUnbondingPeriodSessions // governance parameter. // NB: The argument is an interface type to satisfy the ParamSetPair function signature. -func ValidateSupplierUnbondingPeriodSessions(v interface{}) error { - supplierUnbondingPeriodSessions, err := validateIsUint64(v) +func ValidateSupplierUnbondingPeriodSessions(supplierUnbondingPeriodSessionsAny any) error { + supplierUnbondingPeriodSessions, err := validateIsUint64(supplierUnbondingPeriodSessionsAny) if err != nil { return err } @@ -237,11 +237,11 @@ func ValidateSupplierUnbondingPeriodSessions(v interface{}) error { return nil } -// ValidateApplicationUnbondingPeriodSession validates the ApplicationUnbondingPeriodSessions +// ValidateApplicationUnbondingPeriodSessions validates the ApplicationUnbondingPeriodSessions // governance parameter. // NB: The argument is an interface type to satisfy the ParamSetPair function signature. -func ValidateApplicationUnbondingPeriodSessions(v interface{}) error { - applicationUnbondingPeriodSessions, err := validateIsUint64(v) +func ValidateApplicationUnbondingPeriodSessions(applicationUnboindingPeriodSessionsAny any) error { + applicationUnbondingPeriodSessions, err := validateIsUint64(applicationUnboindingPeriodSessionsAny) if err != nil { return err } @@ -255,10 +255,10 @@ func ValidateApplicationUnbondingPeriodSessions(v interface{}) error { // ValidateComputeUnitsToTokensMultiplier validates the ComputeUnitsToTokensMultiplier governance parameter. // NB: The argument is an interface type to satisfy the ParamSetPair function signature. -func ValidateComputeUnitsToTokensMultiplier(v interface{}) error { - computeUnitsToTokensMultiplier, ok := v.(uint64) +func ValidateComputeUnitsToTokensMultiplier(computeUnitsToTokensMultiplerAny any) error { + computeUnitsToTokensMultiplier, ok := computeUnitsToTokensMultiplerAny.(uint64) if !ok { - return ErrSharedParamInvalid.Wrapf("invalid parameter type: %T", v) + return ErrSharedParamInvalid.Wrapf("invalid parameter type: %T", computeUnitsToTokensMultiplerAny) } if computeUnitsToTokensMultiplier <= 0 { From f7e2c41bbe76f503af277e0186270d1ba169d9b7 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 2 Oct 2024 17:28:30 +0200 Subject: [PATCH 119/139] chore: refresh proof module params impl. to match updated docs --- x/proof/keeper/msg_server_update_param.go | 72 ++++++++++--------- .../keeper/msg_server_update_param_test.go | 10 +-- x/proof/keeper/msg_update_params_test.go | 1 + x/proof/keeper/params_test.go | 26 +++---- x/proof/types/message_update_param.go | 32 ++++++--- x/proof/types/params.go | 58 +++++++++------ 6 files changed, 117 insertions(+), 82 deletions(-) diff --git a/x/proof/keeper/msg_server_update_param.go b/x/proof/keeper/msg_server_update_param.go index df698a38b..7565613bf 100644 --- a/x/proof/keeper/msg_server_update_param.go +++ b/x/proof/keeper/msg_server_update_param.go @@ -2,6 +2,11 @@ package keeper import ( "context" + "encoding/hex" + "fmt" + + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" "github.com/pokt-network/poktroll/x/proof/types" ) @@ -12,65 +17,62 @@ func (k msgServer) UpdateParam( ctx context.Context, msg *types.MsgUpdateParam, ) (*types.MsgUpdateParamResponse, error) { + logger := k.logger.With( + "method", "UpdateParam", + "param_name", msg.Name, + ) + if err := msg.ValidateBasic(); err != nil { - return nil, err + return nil, status.Error(codes.InvalidArgument, err.Error()) } if k.GetAuthority() != msg.Authority { - return nil, types.ErrProofInvalidSigner.Wrapf("invalid authority; expected %s, got %s", k.GetAuthority(), msg.Authority) + return nil, status.Error( + codes.InvalidArgument, + types.ErrProofInvalidSigner.Wrapf( + "invalid authority; expected %s, got %s", + k.GetAuthority(), msg.Authority, + ).Error(), + ) } params := k.GetParams(ctx) switch msg.Name { case types.ParamRelayDifficultyTargetHash: - value, ok := msg.AsType.(*types.MsgUpdateParam_AsBytes) - if !ok { - return nil, types.ErrProofParamInvalid.Wrapf("unsupported value type for %s param: %T", msg.Name, msg.AsType) - } - - params.RelayDifficultyTargetHash = value.AsBytes + logger = logger.With("param_value", hex.EncodeToString(msg.GetAsBytes())) + params.RelayDifficultyTargetHash = msg.GetAsBytes() case types.ParamProofRequestProbability: - value, ok := msg.AsType.(*types.MsgUpdateParam_AsFloat) - if !ok { - return nil, types.ErrProofParamInvalid.Wrapf("unsupported value type for %s param: %T", msg.Name, msg.AsType) - } - - params.ProofRequestProbability = value.AsFloat + logger = logger.With("param_value", msg.GetAsFloat()) + params.ProofRequestProbability = msg.GetAsFloat() case types.ParamProofRequirementThreshold: - value, ok := msg.AsType.(*types.MsgUpdateParam_AsCoin) - if !ok { - return nil, types.ErrProofParamInvalid.Wrapf("unsupported value type for %s param: %T", msg.Name, msg.AsType) - } - - params.ProofRequirementThreshold = value.AsCoin + logger = logger.With("param_value", msg.GetAsCoin()) + params.ProofRequirementThreshold = msg.GetAsCoin() case types.ParamProofMissingPenalty: - value, ok := msg.AsType.(*types.MsgUpdateParam_AsCoin) - if !ok { - return nil, types.ErrProofParamInvalid.Wrapf("unsupported value type for %s param: %T", msg.Name, msg.AsType) - } - - params.ProofMissingPenalty = value.AsCoin + logger = logger.With("param_value", msg.GetAsCoin()) + params.ProofMissingPenalty = msg.GetAsCoin() case types.ParamProofSubmissionFee: - value, ok := msg.AsType.(*types.MsgUpdateParam_AsCoin) - if !ok { - return nil, types.ErrProofParamInvalid.Wrapf("unsupported value type for %s param: %T", msg.Name, msg.AsType) - } - - params.ProofSubmissionFee = value.AsCoin + logger = logger.With("param_value", msg.GetAsCoin()) + params.ProofSubmissionFee = msg.GetAsCoin() default: - return nil, types.ErrProofParamInvalid.Wrapf("unsupported param %q", msg.Name) + return nil, status.Error( + codes.InvalidArgument, + types.ErrProofParamInvalid.Wrapf("unsupported param %q", msg.Name).Error(), + ) } if err := params.ValidateBasic(); err != nil { - return nil, err + return nil, status.Error(codes.InvalidArgument, err.Error()) } if err := k.SetParams(ctx, params); err != nil { - return nil, err + err = fmt.Errorf("unable to set params: %w", err) + logger.Error(fmt.Sprintf("ERROR: %s", err)) + return nil, status.Error(codes.Internal, err.Error()) } updatedParams := k.GetParams(ctx) + return &types.MsgUpdateParamResponse{ Params: &updatedParams, }, nil diff --git a/x/proof/keeper/msg_server_update_param_test.go b/x/proof/keeper/msg_server_update_param_test.go index 52078f52a..9bbb02845 100644 --- a/x/proof/keeper/msg_server_update_param_test.go +++ b/x/proof/keeper/msg_server_update_param_test.go @@ -40,7 +40,7 @@ func TestMsgUpdateParam_UpdateMinRelayDifficultyBitsOnly(t *testing.T) { require.Equal(t, expectedRelayDifficultyTargetHash, res.Params.RelayDifficultyTargetHash) // Ensure the other parameters are unchanged - testkeeper.AssertDefaultParamsEqualExceptFields(t, &defaultParams, res.Params, "RelayDifficultyTargetHash") + testkeeper.AssertDefaultParamsEqualExceptFields(t, &defaultParams, res.Params, string(prooftypes.KeyRelayDifficultyTargetHash)) } func TestMsgUpdateParam_UpdateProofRequestProbabilityOnly(t *testing.T) { @@ -67,7 +67,7 @@ func TestMsgUpdateParam_UpdateProofRequestProbabilityOnly(t *testing.T) { require.Equal(t, expectedProofRequestProbability, res.Params.ProofRequestProbability) // Ensure the other parameters are unchanged - testkeeper.AssertDefaultParamsEqualExceptFields(t, &defaultParams, res.Params, "ProofRequestProbability") + testkeeper.AssertDefaultParamsEqualExceptFields(t, &defaultParams, res.Params, string(prooftypes.KeyProofRequestProbability)) } func TestMsgUpdateParam_UpdateProofRequirementThresholdOnly(t *testing.T) { @@ -94,7 +94,7 @@ func TestMsgUpdateParam_UpdateProofRequirementThresholdOnly(t *testing.T) { require.Equal(t, &expectedProofRequirementThreshold, res.Params.ProofRequirementThreshold) // Ensure the other parameters are unchanged - testkeeper.AssertDefaultParamsEqualExceptFields(t, &defaultParams, res.Params, "ProofRequirementThreshold") + testkeeper.AssertDefaultParamsEqualExceptFields(t, &defaultParams, res.Params, string(prooftypes.KeyProofRequirementThreshold)) } func TestMsgUpdateParam_UpdateProofMissingPenaltyOnly(t *testing.T) { @@ -121,7 +121,7 @@ func TestMsgUpdateParam_UpdateProofMissingPenaltyOnly(t *testing.T) { require.Equal(t, &expectedProofMissingPenalty, res.Params.ProofMissingPenalty) // Ensure the other parameters are unchanged - testkeeper.AssertDefaultParamsEqualExceptFields(t, &defaultParams, res.Params, "ProofMissingPenalty") + testkeeper.AssertDefaultParamsEqualExceptFields(t, &defaultParams, res.Params, string(prooftypes.KeyProofMissingPenalty)) } func TestMsgUpdateParam_UpdateProofSubmissionFeeOnly(t *testing.T) { @@ -148,5 +148,5 @@ func TestMsgUpdateParam_UpdateProofSubmissionFeeOnly(t *testing.T) { require.Equal(t, &expectedProofSubmissionFee, res.Params.ProofSubmissionFee) // Ensure the other parameters are unchanged - testkeeper.AssertDefaultParamsEqualExceptFields(t, &defaultParams, res.Params, "ProofSubmissionFee") + testkeeper.AssertDefaultParamsEqualExceptFields(t, &defaultParams, res.Params, string(prooftypes.KeyProofSubmissionFee)) } diff --git a/x/proof/keeper/msg_update_params_test.go b/x/proof/keeper/msg_update_params_test.go index f50570c46..bfb00d24d 100644 --- a/x/proof/keeper/msg_update_params_test.go +++ b/x/proof/keeper/msg_update_params_test.go @@ -42,6 +42,7 @@ func TestMsgUpdateParams(t *testing.T) { params: &types.MsgUpdateParams{ Authority: k.GetAuthority(), Params: types.Params{ + ProofRequirementThreshold: &types.DefaultProofRequirementThreshold, ProofMissingPenalty: &types.DefaultProofMissingPenalty, ProofSubmissionFee: &types.MinProofSubmissionFee, RelayDifficultyTargetHash: types.DefaultRelayDifficultyTargetHash, diff --git a/x/proof/keeper/params_test.go b/x/proof/keeper/params_test.go index 50370a3d2..343bc0762 100644 --- a/x/proof/keeper/params_test.go +++ b/x/proof/keeper/params_test.go @@ -135,7 +135,7 @@ func TestParams_ValidateProofMissingPenalty(t *testing.T) { { desc: "invalid denomination", proofMissingPenalty: &invalidDenomCoin, - expectedErr: prooftypes.ErrProofParamInvalid.Wrap("invalid coin denom: invalid_denom"), + expectedErr: prooftypes.ErrProofParamInvalid.Wrap("invalid proof_missing_penalty denom: invalid_denom"), }, { desc: "missing", @@ -153,12 +153,12 @@ func TestParams_ValidateProofMissingPenalty(t *testing.T) { }, } - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - err := prooftypes.ValidateProofMissingPenalty(tt.proofMissingPenalty) - if tt.expectedErr != nil { + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + err := prooftypes.ValidateProofMissingPenalty(test.proofMissingPenalty) + if test.expectedErr != nil { require.Error(t, err) - require.Contains(t, err.Error(), tt.expectedErr.Error()) + require.EqualError(t, err, test.expectedErr.Error()) } else { require.NoError(t, err) } @@ -184,7 +184,7 @@ func TestParams_ValidateProofSubmissionFee(t *testing.T) { { desc: "invalid denomination", proofSubmissionFee: &invalidDenomCoin, - expectedErr: prooftypes.ErrProofParamInvalid.Wrap("invalid coin denom: invalid_denom"), + expectedErr: prooftypes.ErrProofParamInvalid.Wrap("invalid proof_submission_fee denom: invalid_denom"), }, { desc: "missing", @@ -200,7 +200,7 @@ func TestParams_ValidateProofSubmissionFee(t *testing.T) { desc: "below minimum", proofSubmissionFee: &belowMinProofSubmissionFee, expectedErr: prooftypes.ErrProofParamInvalid.Wrapf( - "ProofSubmissionFee param is below minimum value %s: got %s", + "proof_submission_fee is below minimum value %s: got %s", prooftypes.MinProofSubmissionFee, belowMinProofSubmissionFee, ), @@ -211,12 +211,12 @@ func TestParams_ValidateProofSubmissionFee(t *testing.T) { }, } - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - err := prooftypes.ValidateProofSubmissionFee(tt.proofSubmissionFee) - if tt.expectedErr != nil { + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + err := prooftypes.ValidateProofSubmissionFee(test.proofSubmissionFee) + if test.expectedErr != nil { require.Error(t, err) - require.Contains(t, err.Error(), tt.expectedErr.Error()) + require.EqualError(t, err, test.expectedErr.Error()) } else { require.NoError(t, err) } diff --git a/x/proof/types/message_update_param.go b/x/proof/types/message_update_param.go index 9f1a26539..85dafa4b3 100644 --- a/x/proof/types/message_update_param.go +++ b/x/proof/types/message_update_param.go @@ -33,9 +33,10 @@ func NewMsgUpdateParam(authority string, name string, value any) (*MsgUpdatePara }, 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. +// ValidateBasic performs a basic validation of the MsgUpdateParam fields. It ensures: +// 1. The parameter name is supported. +// 2. The parameter type matches the expected type for a given parameter name. +// 3. The parameter value is valid (according to its respective validation function). func (msg *MsgUpdateParam) ValidateBasic() error { // Validate the address if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { @@ -50,15 +51,30 @@ func (msg *MsgUpdateParam) ValidateBasic() error { // Parameter name must be supported by this module. switch msg.Name { case ParamRelayDifficultyTargetHash: - return msg.paramTypeIsBytes() + if err := msg.paramTypeIsBytes(); err != nil { + return err + } + return ValidateRelayDifficultyTargetHash(msg.GetAsBytes()) case ParamProofRequestProbability: - return msg.paramTypeIsFloat() + if err := msg.paramTypeIsFloat(); err != nil { + return err + } + return ValidateProofRequestProbability(msg.GetAsFloat()) case ParamProofRequirementThreshold: - return msg.paramTypeIsCoin() + if err := msg.paramTypeIsCoin(); err != nil { + return err + } + return ValidateProofRequirementThreshold(msg.GetAsCoin()) case ParamProofMissingPenalty: - return msg.paramTypeIsCoin() + if err := msg.paramTypeIsCoin(); err != nil { + return err + } + return ValidateProofMissingPenalty(msg.GetAsCoin()) case ParamProofSubmissionFee: - return msg.paramTypeIsCoin() + if err := msg.paramTypeIsCoin(); err != nil { + return err + } + return ValidateProofSubmissionFee(msg.GetAsCoin()) default: return ErrProofParamNameInvalid.Wrapf("unsupported param %q", msg.Name) } diff --git a/x/proof/types/params.go b/x/proof/types/params.go index 9b35c3871..65884a134 100644 --- a/x/proof/types/params.go +++ b/x/proof/types/params.go @@ -139,10 +139,10 @@ func (params *Params) ValidateBasic() error { // ValidateRelayDifficultyTargetHash validates the MinRelayDifficultyBits param. // NB: The argument is an interface type to satisfy the ParamSetPair function signature. -func ValidateRelayDifficultyTargetHash(v interface{}) error { - relayDifficultyTargetHash, ok := v.([]byte) +func ValidateRelayDifficultyTargetHash(relayDifficultyTargetHashAny any) error { + relayDifficultyTargetHash, ok := relayDifficultyTargetHashAny.([]byte) if !ok { - return ErrProofParamInvalid.Wrapf("invalid parameter type: %T", v) + return ErrProofParamInvalid.Wrapf("invalid parameter type: %T", relayDifficultyTargetHashAny) } if len(relayDifficultyTargetHash) != protocol.RelayHasherSize { @@ -159,10 +159,10 @@ func ValidateRelayDifficultyTargetHash(v interface{}) error { // ValidateProofRequestProbability validates the ProofRequestProbability param. // NB: The argument is an interface type to satisfy the ParamSetPair function signature. -func ValidateProofRequestProbability(v interface{}) error { - proofRequestProbability, ok := v.(float32) +func ValidateProofRequestProbability(proofRequestProbabilityAny any) error { + proofRequestProbability, ok := proofRequestProbabilityAny.(float32) if !ok { - return ErrProofParamInvalid.Wrapf("invalid parameter type: %T", v) + return ErrProofParamInvalid.Wrapf("invalid parameter type: %T", proofRequestProbabilityAny) } if proofRequestProbability < 0 || proofRequestProbability > 1 { @@ -174,10 +174,22 @@ func ValidateProofRequestProbability(v interface{}) error { // ValidateProofRequirementThreshold validates the ProofRequirementThreshold param. // NB: The argument is an interface type to satisfy the ParamSetPair function signature. -func ValidateProofRequirementThreshold(v interface{}) error { - _, ok := v.(*cosmostypes.Coin) +func ValidateProofRequirementThreshold(proofRequirementThresholdAny any) error { + proofRequirementThresholdCoin, ok := proofRequirementThresholdAny.(*cosmostypes.Coin) if !ok { - return ErrProofParamInvalid.Wrapf("invalid parameter type: %T", v) + return ErrProofParamInvalid.Wrapf("invalid parameter type: %T", proofRequirementThresholdAny) + } + + if proofRequirementThresholdCoin == nil { + return ErrProofParamInvalid.Wrap("missing proof_requirement_threshold") + } + + if proofRequirementThresholdCoin.Denom != volatile.DenomuPOKT { + return ErrProofParamInvalid.Wrapf("invalid proof_requirement_threshold denom: %s", proofRequirementThresholdCoin.Denom) + } + + if proofRequirementThresholdCoin.IsZero() || proofRequirementThresholdCoin.IsNegative() { + return ErrProofParamInvalid.Wrapf("invalid proof_requirement_threshold amount: %s <= 0", proofRequirementThresholdCoin) } return nil @@ -185,29 +197,33 @@ func ValidateProofRequirementThreshold(v interface{}) error { // ValidateProofMissingPenalty validates the ProofMissingPenalty param. // NB: The argument is an interface type to satisfy the ParamSetPair function signature. -func ValidateProofMissingPenalty(v interface{}) error { - coin, ok := v.(*cosmostypes.Coin) +func ValidateProofMissingPenalty(proofMissingPenaltyAny any) error { + proofMissingPenaltyCoin, ok := proofMissingPenaltyAny.(*cosmostypes.Coin) if !ok { - return ErrProofParamInvalid.Wrapf("invalid parameter type: %T", v) + return ErrProofParamInvalid.Wrapf("invalid parameter type: %T", proofMissingPenaltyAny) } - if coin == nil { + if proofMissingPenaltyCoin == nil { return ErrProofParamInvalid.Wrap("missing proof_missing_penalty") } - if coin.Denom != volatile.DenomuPOKT { - return ErrProofParamInvalid.Wrapf("invalid coin denom: %s", coin.Denom) + if proofMissingPenaltyCoin.Denom != volatile.DenomuPOKT { + return ErrProofParamInvalid.Wrapf("invalid proof_missing_penalty denom: %s", proofMissingPenaltyCoin.Denom) + } + + if proofMissingPenaltyCoin.IsZero() || proofMissingPenaltyCoin.IsNegative() { + return ErrProofParamInvalid.Wrapf("invalid proof_missing_penalty amount: %s <= 0", proofMissingPenaltyCoin) } return nil } -// ValidateProofSubmission validates the ProofSubmissionFee param. +// ValidateProofSubmissionFee validates the ProofSubmissionFee param. // NB: The argument is an interface type to satisfy the ParamSetPair function signature. -func ValidateProofSubmissionFee(v interface{}) error { - submissionFeeCoin, ok := v.(*cosmostypes.Coin) +func ValidateProofSubmissionFee(proofSubmissionFeeAny any) error { + submissionFeeCoin, ok := proofSubmissionFeeAny.(*cosmostypes.Coin) if !ok { - return ErrProofParamInvalid.Wrapf("invalid parameter type: %T", v) + return ErrProofParamInvalid.Wrapf("invalid parameter type: %T", proofSubmissionFeeAny) } if submissionFeeCoin == nil { @@ -215,12 +231,12 @@ func ValidateProofSubmissionFee(v interface{}) error { } if submissionFeeCoin.Denom != volatile.DenomuPOKT { - return ErrProofParamInvalid.Wrapf("invalid coin denom: %s", submissionFeeCoin.Denom) + return ErrProofParamInvalid.Wrapf("invalid proof_submission_fee denom: %s", submissionFeeCoin.Denom) } if submissionFeeCoin.Amount.LT(MinProofSubmissionFee.Amount) { return ErrProofParamInvalid.Wrapf( - "ProofSubmissionFee param is below minimum value %s: got %s", + "proof_submission_fee is below minimum value %s: got %s", MinProofSubmissionFee, submissionFeeCoin, ) From 9fa962c43db2451bf107f74cf2e2aa95310a47b2 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Mon, 7 Oct 2024 11:27:55 +0200 Subject: [PATCH 120/139] fix: failing unit test --- x/shared/types/message_update_param_test.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/x/shared/types/message_update_param_test.go b/x/shared/types/message_update_param_test.go index 65f4931b3..1da38b6e0 100644 --- a/x/shared/types/message_update_param_test.go +++ b/x/shared/types/message_update_param_test.go @@ -52,13 +52,14 @@ func TestMsgUpdateParam_ValidateBasic(t *testing.T) { Name: ParamComputeUnitsToTokensMultiplier, AsType: &MsgUpdateParam_AsInt64{AsInt64: 0}, }, + expectedErr: ErrSharedParamInvalid, }, } - 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()) + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + err := test.msg.ValidateBasic() + if test.expectedErr != nil { + require.ErrorContains(t, err, test.expectedErr.Error()) return } require.NoError(t, err) From 60e37922807665940e637ef6bb1a7347c6440285 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Mon, 7 Oct 2024 12:12:07 +0200 Subject: [PATCH 121/139] chore: refresh service module params impl. to match updated docs --- x/service/keeper/msg_server_update_param.go | 46 ++++++++++----- .../keeper/msg_server_update_param_test.go | 2 +- x/service/keeper/msg_update_params_test.go | 4 +- x/service/keeper/params_test.go | 34 ++++++++++- x/service/types/errors.go | 2 - x/service/types/genesis_test.go | 2 +- x/service/types/message_update_param.go | 25 ++++---- x/service/types/message_update_param_test.go | 57 +++++++++++++++++++ x/service/types/params.go | 23 ++++---- 9 files changed, 149 insertions(+), 46 deletions(-) create mode 100644 x/service/types/message_update_param_test.go diff --git a/x/service/keeper/msg_server_update_param.go b/x/service/keeper/msg_server_update_param.go index d2d224dba..6c5a6070d 100644 --- a/x/service/keeper/msg_server_update_param.go +++ b/x/service/keeper/msg_server_update_param.go @@ -3,6 +3,9 @@ package keeper import ( "context" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "github.com/pokt-network/poktroll/x/service/types" ) @@ -12,38 +15,51 @@ func (k msgServer) UpdateParam( ctx context.Context, msg *types.MsgUpdateParam, ) (*types.MsgUpdateParamResponse, error) { + logger := k.logger.With( + "method", "UpdateParam", + "param_name", msg.Name, + ) + if err := msg.ValidateBasic(); err != nil { - return nil, err + return nil, status.Error(codes.InvalidArgument, err.Error()) } if k.GetAuthority() != msg.Authority { - return nil, types.ErrServiceInvalidSigner.Wrapf("invalid authority; expected %s, got %s", k.GetAuthority(), msg.Authority) + return nil, status.Error( + codes.InvalidArgument, + types.ErrServiceInvalidSigner.Wrapf( + "invalid authority; expected %s, got %s", + k.GetAuthority(), msg.Authority, + ).Error(), + ) } params := k.GetParams(ctx) switch msg.Name { case types.ParamAddServiceFee: - value, ok := msg.AsType.(*types.MsgUpdateParam_AsCoin) - if !ok { - return nil, types.ErrServiceParamInvalid.Wrapf("unsupported value type for %s param: %T", msg.Name, msg.AsType) - } - addServiceFee := value.AsCoin - - if err := types.ValidateAddServiceFee(addServiceFee); err != nil { - return nil, err - } - - params.AddServiceFee = addServiceFee + logger = logger.With("param_value", msg.GetAsCoin()) + params.AddServiceFee = msg.GetAsCoin() default: - return nil, types.ErrServiceParamInvalid.Wrapf("unsupported param %q", msg.Name) + return nil, status.Error( + codes.InvalidArgument, + types.ErrServiceParamInvalid.Wrapf("unsupported param %q", msg.Name).Error(), + ) + } + + // Perform a global validation on all params, which includes the updated param. + // This is needed to ensure that the updated param is valid in the context of all other params. + if err := params.ValidateBasic(); err != nil { + return nil, status.Error(codes.InvalidArgument, err.Error()) } if err := k.SetParams(ctx, params); err != nil { - return nil, err + k.logger.Info("ERROR: %s", err) + return nil, status.Error(codes.Internal, err.Error()) } updatedParams := k.GetParams(ctx) + return &types.MsgUpdateParamResponse{ Params: &updatedParams, }, nil diff --git a/x/service/keeper/msg_server_update_param_test.go b/x/service/keeper/msg_server_update_param_test.go index 74c038d20..67c2eb979 100644 --- a/x/service/keeper/msg_server_update_param_test.go +++ b/x/service/keeper/msg_server_update_param_test.go @@ -14,7 +14,7 @@ import ( servicetypes "github.com/pokt-network/poktroll/x/service/types" ) -func TestMsgUpdateParam_UpdateAddServiceFee(t *testing.T) { +func TestMsgUpdateParam_UpdateAddServiceFeeOnly(t *testing.T) { expectedAddServiceFee := &sdk.Coin{Denom: volatile.DenomuPOKT, Amount: math.NewInt(1000000001)} // Set the parameters to their default values diff --git a/x/service/keeper/msg_update_params_test.go b/x/service/keeper/msg_update_params_test.go index e2340e064..e473aab7d 100644 --- a/x/service/keeper/msg_update_params_test.go +++ b/x/service/keeper/msg_update_params_test.go @@ -30,13 +30,13 @@ func TestMsgUpdateParams(t *testing.T) { expectedErrMsg: "invalid authority", }, { - desc: "send empty params", + desc: "invalid: send empty params", input: &types.MsgUpdateParams{ Authority: k.GetAuthority(), Params: types.Params{}, }, shouldError: true, - expectedErrMsg: "invalid ServiceFee", + expectedErrMsg: "missing add_service_fee", }, { desc: "valid: send default params", diff --git a/x/service/keeper/params_test.go b/x/service/keeper/params_test.go index 2c7100aef..556f1de0f 100644 --- a/x/service/keeper/params_test.go +++ b/x/service/keeper/params_test.go @@ -6,13 +6,43 @@ import ( "github.com/stretchr/testify/require" keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/x/service/types" + servicetypes "github.com/pokt-network/poktroll/x/service/types" ) func TestGetParams(t *testing.T) { k, ctx := keepertest.ServiceKeeper(t) - params := types.DefaultParams() + params := servicetypes.DefaultParams() require.NoError(t, k.SetParams(ctx, params)) require.EqualValues(t, params, k.GetParams(ctx)) } + +func TestParams_ValidateAddServiceFee(t *testing.T) { + tests := []struct { + desc string + addServiceFee any + expectedErr error + }{ + { + desc: "invalid type", + addServiceFee: "100upokt", + expectedErr: servicetypes.ErrServiceParamInvalid, + }, + { + desc: "valid AddServiceFee", + addServiceFee: &servicetypes.MinAddServiceFee, + }, + } + + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + err := servicetypes.ValidateAddServiceFee(test.addServiceFee) + if test.expectedErr != nil { + require.Error(t, err) + require.Contains(t, err.Error(), test.expectedErr.Error()) + } else { + require.NoError(t, err) + } + }) + } +} diff --git a/x/service/types/errors.go b/x/service/types/errors.go index d593be500..aaab0d6d5 100644 --- a/x/service/types/errors.go +++ b/x/service/types/errors.go @@ -12,13 +12,11 @@ var ( ErrServiceMissingID = sdkerrors.Register(ModuleName, 1103, "missing service ID") ErrServiceMissingName = sdkerrors.Register(ModuleName, 1104, "missing service name") ErrServiceAlreadyExists = sdkerrors.Register(ModuleName, 1105, "service already exists") - ErrServiceInvalidServiceFee = sdkerrors.Register(ModuleName, 1106, "invalid ServiceFee") ErrServiceAccountNotFound = sdkerrors.Register(ModuleName, 1107, "account not found") ErrServiceNotEnoughFunds = sdkerrors.Register(ModuleName, 1108, "not enough funds to add service") ErrServiceFailedToDeductFee = sdkerrors.Register(ModuleName, 1109, "failed to deduct fee") ErrServiceInvalidRelayResponse = sdkerrors.Register(ModuleName, 1110, "invalid relay response") ErrServiceInvalidRelayRequest = sdkerrors.Register(ModuleName, 1111, "invalid relay request") ErrServiceInvalidOwnerAddress = sdkerrors.Register(ModuleName, 1113, "invalid owner address") - ErrServiceParamNameInvalid = sdkerrors.Register(ModuleName, 1114, "the provided param name is invalid") ErrServiceParamInvalid = sdkerrors.Register(ModuleName, 1115, "the provided param is invalid") ) diff --git a/x/service/types/genesis_test.go b/x/service/types/genesis_test.go index aa90380bc..6b4b4b77a 100644 --- a/x/service/types/genesis_test.go +++ b/x/service/types/genesis_test.go @@ -79,7 +79,7 @@ func TestGenesisState_Validate(t *testing.T) { *svc1, *svc2, }, }, - expectedErr: types.ErrServiceInvalidServiceFee, + expectedErr: types.ErrServiceParamInvalid, }, // this line is used by starport scaffolding # types/genesis/testcase } diff --git a/x/service/types/message_update_param.go b/x/service/types/message_update_param.go index 04c7db8f6..7d3ad2c15 100644 --- a/x/service/types/message_update_param.go +++ b/x/service/types/message_update_param.go @@ -1,8 +1,6 @@ package types import ( - "fmt" - sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -10,20 +8,20 @@ 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 +func NewMsgUpdateParam(authority string, name string, asType any) (*MsgUpdateParam, error) { + var asTypeIface isMsgUpdateParam_AsType - switch v := value.(type) { + switch t := asType.(type) { case *sdk.Coin: - valueAsType = &MsgUpdateParam_AsCoin{AsCoin: v} + asTypeIface = &MsgUpdateParam_AsCoin{AsCoin: t} default: - return nil, fmt.Errorf("unexpected param value type: %T", value) + return nil, ErrServiceParamInvalid.Wrapf("unexpected param value type: %T", asType) } return &MsgUpdateParam{ Authority: authority, Name: name, - AsType: valueAsType, + AsType: asTypeIface, }, nil } @@ -36,17 +34,20 @@ func (msg *MsgUpdateParam) ValidateBasic() error { return ErrServiceInvalidAddress.Wrapf("invalid authority address %s; (%v)", msg.Authority, err) } - // Parameter value cannot be nil. + // Parameter value MUST NOT be nil. if msg.AsType == nil { return ErrServiceParamInvalid.Wrap("missing param AsType") } - // Parameter name must be supported by this module. + // Parameter name MUST be supported by this module. switch msg.Name { case ParamAddServiceFee: - return msg.paramTypeIsCoin() + if err := msg.paramTypeIsCoin(); err != nil { + return err + } + return ValidateAddServiceFee(msg.GetAsCoin()) default: - return ErrServiceParamNameInvalid.Wrapf("unsupported param %q", msg.Name) + return ErrServiceParamInvalid.Wrapf("unsupported param %q", msg.Name) } } diff --git a/x/service/types/message_update_param_test.go b/x/service/types/message_update_param_test.go new file mode 100644 index 000000000..75a45c41a --- /dev/null +++ b/x/service/types/message_update_param_test.go @@ -0,0 +1,57 @@ +package types + +import ( + "testing" + + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/testutil/sample" +) + +func TestMsgUpdateParam_ValidateBasic(t *testing.T) { + tests := []struct { + name string + desc string + msg MsgUpdateParam + expectedErr error + }{ + { + name: "invalid address", + desc: "invalid: authority address invalid", + msg: MsgUpdateParam{ + Authority: "invalid_address", + Name: "", // Doesn't matter for this test + AsType: &MsgUpdateParam_AsCoin{AsCoin: nil}, + }, + expectedErr: sdkerrors.ErrInvalidAddress, + }, { + desc: "invalid: param name incorrect (non-existent)", + msg: MsgUpdateParam{ + Authority: sample.AccAddress(), + Name: "non_existent", + AsType: &MsgUpdateParam_AsCoin{AsCoin: &MinAddServiceFee}, + }, + expectedErr: ErrServiceParamInvalid, + }, { + name: "valid address", + desc: "valid: correct address, param name, and type", + msg: MsgUpdateParam{ + Authority: sample.AccAddress(), + Name: ParamAddServiceFee, + AsType: &MsgUpdateParam_AsCoin{AsCoin: &MinAddServiceFee}, + }, + }, + } + + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + err := test.msg.ValidateBasic() + if test.expectedErr != nil { + require.ErrorContains(t, err, test.expectedErr.Error()) + return + } + require.NoError(t, err) + }) + } +} diff --git a/x/service/types/params.go b/x/service/types/params.go index 542eda53f..a454d86f1 100644 --- a/x/service/types/params.go +++ b/x/service/types/params.go @@ -4,6 +4,7 @@ import ( "cosmossdk.io/math" cosmostypes "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + "github.com/pokt-network/poktroll/app/volatile" ) @@ -55,26 +56,26 @@ func (p Params) ValidateBasic() error { } // validateAddServiceFee validates the AddServiceFee param -func ValidateAddServiceFee(v interface{}) error { - addServiceFeeCoin, ok := v.(*cosmostypes.Coin) +func ValidateAddServiceFee(addServiceFeeAny any) error { + addServiceFee, ok := addServiceFeeAny.(*cosmostypes.Coin) if !ok { - return ErrServiceInvalidServiceFee.Wrapf("invalid parameter type: %T", v) + return ErrServiceParamInvalid.Wrapf("invalid parameter type: %T", addServiceFeeAny) } - if addServiceFeeCoin == nil { - return ErrServiceInvalidServiceFee.Wrap("missing proof_submission_fee") + if addServiceFee == nil { + return ErrServiceParamInvalid.Wrap("missing add_service_fee") } - if addServiceFeeCoin.Denom != volatile.DenomuPOKT { - return ErrServiceInvalidServiceFee.Wrapf("invalid coin denom: %s", addServiceFeeCoin.Denom) + if addServiceFee.Denom != volatile.DenomuPOKT { + return ErrServiceParamInvalid.Wrapf("invalid add_service_fee denom: %s", addServiceFee.Denom) } // TODO_MAINNET: Look into better validation - if addServiceFeeCoin.Amount.LT(MinAddServiceFee.Amount) { - return ErrServiceInvalidServiceFee.Wrapf( - "AddServiceFee param is below minimum value %s: got %s", + if addServiceFee.Amount.LT(MinAddServiceFee.Amount) { + return ErrServiceParamInvalid.Wrapf( + "add_service_fee param is below minimum value %s: got %s", MinAddServiceFee, - addServiceFeeCoin, + addServiceFee, ) } From c5a9b945d577c77d65ade068162013bee50d0ee0 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Mon, 7 Oct 2024 13:35:29 +0200 Subject: [PATCH 122/139] fix: linter error --- x/service/keeper/msg_server_update_param.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/service/keeper/msg_server_update_param.go b/x/service/keeper/msg_server_update_param.go index 6c5a6070d..ac1ea6a6c 100644 --- a/x/service/keeper/msg_server_update_param.go +++ b/x/service/keeper/msg_server_update_param.go @@ -54,7 +54,7 @@ func (k msgServer) UpdateParam( } if err := k.SetParams(ctx, params); err != nil { - k.logger.Info("ERROR: %s", err) + logger.Info("ERROR: %s", err) return nil, status.Error(codes.Internal, err.Error()) } From 7e9bd33655ad23282f632e937ce06a83b1e7db9a Mon Sep 17 00:00:00 2001 From: Bryan White Date: Mon, 7 Oct 2024 16:13:55 +0200 Subject: [PATCH 123/139] Empty commit From 69c275529fc0bb0d14c715ea1a8564ce4875a735 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 9 Oct 2024 18:59:55 +0200 Subject: [PATCH 124/139] Empty commit From c89ee93136fd4ad961ee6065981809fdf485b05d Mon Sep 17 00:00:00 2001 From: Bryan White Date: Thu, 10 Oct 2024 09:23:30 +0200 Subject: [PATCH 125/139] chore: quick fixes --- x/application/keeper/msg_server_stake_application.go | 6 +++--- x/tokenomics/keeper/token_logic_modules.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/x/application/keeper/msg_server_stake_application.go b/x/application/keeper/msg_server_stake_application.go index f056d3592..3bbd22f0d 100644 --- a/x/application/keeper/msg_server_stake_application.go +++ b/x/application/keeper/msg_server_stake_application.go @@ -71,11 +71,11 @@ func (k msgServer) StakeApplication(ctx context.Context, msg *types.MsgStakeAppl // TODO_CONSIDERATION: If we support multiple native tokens, we will need to // start checking the denom here. if msg.Stake.Amount.LT(minStake.Amount) { - errFmt := "application %q must stake at least %s" - logger.Info(fmt.Sprintf(errFmt, msg.Address, minStake)) + err = fmt.Errorf("application %q must stake at least %s", msg.GetAddress(), minStake) + logger.Info(err.Error()) return nil, status.Error( codes.InvalidArgument, - types.ErrAppInvalidStake.Wrapf(errFmt, msg.Address, minStake).Error(), + types.ErrAppInvalidStake.Wrapf("%s", err).Error(), ) } diff --git a/x/tokenomics/keeper/token_logic_modules.go b/x/tokenomics/keeper/token_logic_modules.go index b7bc4502b..fca0dc177 100644 --- a/x/tokenomics/keeper/token_logic_modules.go +++ b/x/tokenomics/keeper/token_logic_modules.go @@ -284,7 +284,7 @@ func (k Keeper) ProcessTokenLogicModules( // start checking the denom here. if application.Stake.Amount.LT(apptypes.DefaultMinStake.Amount) { // Unbond the application because it has less than the minimum stake. - if err := k.applicationKeeper.UnbondApplication(ctx, &application); err != nil { + if err = k.applicationKeeper.UnbondApplication(ctx, &application); err != nil { return err } From ed0d795ff4f080095486a4660202da516f297626 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Thu, 10 Oct 2024 13:54:54 +0200 Subject: [PATCH 126/139] fix: linter error --- x/tokenomics/keeper/token_logic_modules.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/tokenomics/keeper/token_logic_modules.go b/x/tokenomics/keeper/token_logic_modules.go index fca0dc177..2697eaf31 100644 --- a/x/tokenomics/keeper/token_logic_modules.go +++ b/x/tokenomics/keeper/token_logic_modules.go @@ -274,7 +274,7 @@ func (k Keeper) ProcessTokenLogicModules( // Execute all the token logic modules processors for tlm, tlmProcessor := range tokenLogicModuleProcessorMap { logger.Info(fmt.Sprintf("Starting TLM processing: %q", tlm)) - if err := tlmProcessor(k, ctx, &service, claim.GetSessionHeader(), &application, &supplier, actualSettlementCoin, &relayMiningDifficulty); err != nil { + if err = tlmProcessor(k, ctx, &service, claim.GetSessionHeader(), &application, &supplier, actualSettlementCoin, &relayMiningDifficulty); err != nil { return tokenomicstypes.ErrTokenomicsTLMError.Wrapf("TLM %q: %v", tlm, err) } logger.Info(fmt.Sprintf("Finished TLM processing: %q", tlm)) From 0be55c6d612ca050525fa40297008d627fa60b76 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Thu, 10 Oct 2024 19:54:13 +0200 Subject: [PATCH 127/139] Empty commit From 14a5c79e2b8ca7fa108d5fee54c927b3cfb0c07c Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 11 Oct 2024 12:27:55 +0200 Subject: [PATCH 128/139] chore: review feedback improvements Co-authored-by: red-0ne --- x/application/types/application.go | 5 +++- x/tokenomics/keeper/settle_pending_claims.go | 28 ++++++++++++++++++++ x/tokenomics/keeper/token_logic_modules.go | 6 ++--- 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/x/application/types/application.go b/x/application/types/application.go index b4a33cd5b..c584d75a1 100644 --- a/x/application/types/application.go +++ b/x/application/types/application.go @@ -4,7 +4,10 @@ import sharedtypes "github.com/pokt-network/poktroll/x/shared/types" // ApplicationNotUnstaking is the value of `unstake_session_end_height` if the // application is not actively in the unbonding period. -const ApplicationNotUnstaking uint64 = 0 +const ( + ApplicationNotUnstaking uint64 = iota + ApplicationBelowMinStake +) // IsUnbonding returns true if the application is actively unbonding. // It determines if the application has submitted an unstake message, in which case diff --git a/x/tokenomics/keeper/settle_pending_claims.go b/x/tokenomics/keeper/settle_pending_claims.go index ad49932b7..04d8b1fc5 100644 --- a/x/tokenomics/keeper/settle_pending_claims.go +++ b/x/tokenomics/keeper/settle_pending_claims.go @@ -1,6 +1,7 @@ package keeper import ( + "context" "fmt" "cosmossdk.io/math" @@ -8,6 +9,7 @@ import ( "github.com/cosmos/cosmos-sdk/types/query" "github.com/pokt-network/poktroll/app/volatile" + apptypes "github.com/pokt-network/poktroll/x/application/types" prooftypes "github.com/pokt-network/poktroll/x/proof/types" "github.com/pokt-network/poktroll/x/shared" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" @@ -202,6 +204,10 @@ func (k Keeper) SettlePendingClaims(ctx sdk.Context) ( logger.Info(fmt.Sprintf("Successfully settled claim for session ID %q at block height %d", claim.SessionHeader.SessionId, blockHeight)) } + // Unbond applications whose post-settlement stake has dropped below the + // application minimum stake requirement. + k.unbondApplicationsBelowMinStake(ctx, expiringClaims) + // Slash all the suppliers that have been marked for slashing slashingCount times. for supplierOperatorAddress, slashingCount := range supplierToExpiredClaimCount { if err := k.slashSupplierStake(ctx, supplierOperatorAddress, slashingCount); err != nil { @@ -269,6 +275,28 @@ func (k Keeper) getExpiringClaims(ctx sdk.Context) (expiringClaims []prooftypes. return expiringClaims, nil } +// unbondApplicationsBelowMinStake unbonds applications whose post-settlement stake has dropped below the +// application minimum stake requirement. +func (k Keeper) unbondApplicationsBelowMinStake(ctx context.Context, claims []prooftypes.Claim) { + logger := k.logger.With("method", "unbondApplicationsBelowMinStake") + + for _, claim := range claims { + app, isAppFound := k.applicationKeeper.GetApplication(ctx, claim.SessionHeader.ApplicationAddress) + if !isAppFound { + logger.Error(apptypes.ErrAppNotFound.Wrapf("application address: %q", claim.SessionHeader.ApplicationAddress).Error()) + continue + } + + // Unbond the application because it has less than the minimum stake. + if app.GetUnstakeSessionEndHeight() == apptypes.ApplicationBelowMinStake { + if err := k.applicationKeeper.UnbondApplication(ctx, &app); err != nil { + logger.Error(fmt.Sprintf("unbonding application (%+v): %s", app, err)) + continue + } + } + } +} + // slashSupplierStake slashes the stake of a supplier and transfers the total // slashing amount from the supplier bank module to the tokenomics module account. func (k Keeper) slashSupplierStake( diff --git a/x/tokenomics/keeper/token_logic_modules.go b/x/tokenomics/keeper/token_logic_modules.go index 2697eaf31..de19f6900 100644 --- a/x/tokenomics/keeper/token_logic_modules.go +++ b/x/tokenomics/keeper/token_logic_modules.go @@ -283,10 +283,8 @@ func (k Keeper) ProcessTokenLogicModules( // TODO_CONSIDERATION: If we support multiple native tokens, we will need to // start checking the denom here. if application.Stake.Amount.LT(apptypes.DefaultMinStake.Amount) { - // Unbond the application because it has less than the minimum stake. - if err = k.applicationKeeper.UnbondApplication(ctx, &application); err != nil { - return err - } + // Mark the application as unbonding if it has less than the minimum stake. + application.UnstakeSessionEndHeight = apptypes.ApplicationBelowMinStake // TODO_UPNEXT:(@bryanchriswhite): emit a new EventApplicationUnbondedBelowMinStake event. } else { From 735ca2aab8a0142b5861865242cca3c72d2b467c Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 11 Oct 2024 13:00:59 +0200 Subject: [PATCH 129/139] test: fix application min stake integration test --- tests/integration/application/min_stake_test.go | 17 ++++++++++++++--- x/tokenomics/keeper/token_logic_modules.go | 9 ++++----- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/tests/integration/application/min_stake_test.go b/tests/integration/application/min_stake_test.go index 5e552ea8b..014d129db 100644 --- a/tests/integration/application/min_stake_test.go +++ b/tests/integration/application/min_stake_test.go @@ -20,6 +20,7 @@ import ( apptypes "github.com/pokt-network/poktroll/x/application/types" prooftypes "github.com/pokt-network/poktroll/x/proof/types" sessiontypes "github.com/pokt-network/poktroll/x/session/types" + "github.com/pokt-network/poktroll/x/shared" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" ) @@ -82,9 +83,19 @@ func (s *applicationMinStakeTestSuite) TestAppIsUnbondedIfBelowMinStakeWhenSettl // Create a claim whose settlement amount drops the application below min stake claim := s.getClaim(sessionHeader) + s.keepers.ProofKeeper.UpsertClaim(s.ctx, *claim) - // Process TLMs for the claim. - err := s.keepers.Keeper.ProcessTokenLogicModules(s.ctx, claim) + // Set the current height to the claim settlement height. + sdkCtx := cosmostypes.UnwrapSDKContext(s.ctx) + currentHeight := sdkCtx.BlockHeight() + sharedParams := s.keepers.SharedKeeper.GetParams(s.ctx) + currentSessionEndHeight := shared.GetSessionEndHeight(&sharedParams, currentHeight) + claimSettlementHeight := currentSessionEndHeight + int64(sharedtypes.GetSessionEndToProofWindowCloseBlocks(&sharedParams)) + 1 + sdkCtx = sdkCtx.WithBlockHeight(claimSettlementHeight) + s.ctx = sdkCtx + + // Settle pending claims; this should cause the application to be unbonded. + _, _, err := s.keepers.Keeper.SettlePendingClaims(sdkCtx) require.NoError(s.T(), err) // Assert that the application was unbonded. @@ -131,7 +142,7 @@ func (s *applicationMinStakeTestSuite) stakeSupplier() { RevShare: []*sharedtypes.ServiceRevenueShare{ { Address: s.supplierBech32, - RevSharePercentage: 1, + RevSharePercentage: 100, }, }, }, diff --git a/x/tokenomics/keeper/token_logic_modules.go b/x/tokenomics/keeper/token_logic_modules.go index de19f6900..fac928341 100644 --- a/x/tokenomics/keeper/token_logic_modules.go +++ b/x/tokenomics/keeper/token_logic_modules.go @@ -287,13 +287,12 @@ func (k Keeper) ProcessTokenLogicModules( application.UnstakeSessionEndHeight = apptypes.ApplicationBelowMinStake // TODO_UPNEXT:(@bryanchriswhite): emit a new EventApplicationUnbondedBelowMinStake event. - } else { - // State mutation: update the application's on-chain record. - k.applicationKeeper.SetApplication(ctx, application) - logger.Info(fmt.Sprintf("updated on-chain application record with address %q", application.Address)) - } + // State mutation: update the application's on-chain record. + k.applicationKeeper.SetApplication(ctx, application) + logger.Info(fmt.Sprintf("updated on-chain application record with address %q", application.Address)) + // TODO_MAINNET: If the application stake has dropped to (near?) zero, should // we unstake it? Should we use it's balance? Should there be a payee of last resort? // Make sure to document whatever decision we come to. From 1c2579875f56e101a5de8c6d5fc072d8351d5eed Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 11 Oct 2024 13:24:53 +0200 Subject: [PATCH 130/139] chore: review feedback improvements --- proto/poktroll/supplier/tx.proto | 4 ---- 1 file changed, 4 deletions(-) diff --git a/proto/poktroll/supplier/tx.proto b/proto/poktroll/supplier/tx.proto index b1f862081..b9431d520 100644 --- a/proto/poktroll/supplier/tx.proto +++ b/proto/poktroll/supplier/tx.proto @@ -32,10 +32,6 @@ message MsgUpdateParams { // authority is the address that controls the module (defaults to x/gov unless overwritten). string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - // TODO_IMPROVE(#322): The requirement to provide all params is adopted from the - // latest Cosmos SDK version. We should look into either improving this ourselves - // or seeing if it is on their roadmap. - // params defines the x/supplier parameters to update. // NOTE: All parameters must be supplied. Params params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; From d2dfbd2786dbd16a29bcef1e2e9541d0e1e95539 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 11 Oct 2024 13:25:24 +0200 Subject: [PATCH 131/139] chore: regenerate protobufs --- api/poktroll/supplier/tx.pulsar.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/poktroll/supplier/tx.pulsar.go b/api/poktroll/supplier/tx.pulsar.go index 7a709f7f0..1d2057b01 100644 --- a/api/poktroll/supplier/tx.pulsar.go +++ b/api/poktroll/supplier/tx.pulsar.go @@ -5,11 +5,11 @@ import ( _ "cosmossdk.io/api/amino" v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" _ "cosmossdk.io/api/cosmos/msg/v1" + shared "github.com/pokt-network/poktroll/api/poktroll/shared" fmt "fmt" _ "github.com/cosmos/cosmos-proto" runtime "github.com/cosmos/cosmos-proto/runtime" _ "github.com/cosmos/gogoproto/gogoproto" - shared "github.com/pokt-network/poktroll/api/poktroll/shared" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" From 48df9355934a0a1748f83d18b9ee4d87eddac4c0 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 11 Oct 2024 13:31:14 +0200 Subject: [PATCH 132/139] chore: review feedback improvements Co-authored-by: red-0ne --- x/supplier/keeper/msg_server_stake_supplier_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/x/supplier/keeper/msg_server_stake_supplier_test.go b/x/supplier/keeper/msg_server_stake_supplier_test.go index 776388b72..5c7918ee7 100644 --- a/x/supplier/keeper/msg_server_stake_supplier_test.go +++ b/x/supplier/keeper/msg_server_stake_supplier_test.go @@ -397,7 +397,7 @@ func TestMsgServer_StakeSupplier_FailBelowMinStake(t *testing.T) { err := k.SetParams(ctx, params) require.NoError(t, err) - // Prepare the application. + // Prepare the supplier stake message. stakeMsg := &suppliertypes.MsgStakeSupplier{ Signer: addr, OwnerAddress: addr, @@ -425,6 +425,6 @@ func TestMsgServer_StakeSupplier_FailBelowMinStake(t *testing.T) { // Attempt to stake the supplier & verify that the supplier does NOT exist. _, err = srv.StakeSupplier(ctx, stakeMsg) require.ErrorContains(t, err, expectedErr.Error()) - _, isGatewayFound := k.GetSupplier(ctx, addr) - require.False(t, isGatewayFound) + _, isSupplierFound := k.GetSupplier(ctx, addr) + require.False(t, isSupplierFound) } From b2201771ff96215f53474a2d55f70fbb217b63c5 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 11 Oct 2024 15:28:12 +0200 Subject: [PATCH 133/139] Empty commit From 071149b049a08fe1eb45af49c11352899b8fc2d1 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Mon, 14 Oct 2024 11:20:22 +0200 Subject: [PATCH 134/139] fix: flaky test --- tests/integration/application/min_stake_test.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/integration/application/min_stake_test.go b/tests/integration/application/min_stake_test.go index 014d129db..0815dba96 100644 --- a/tests/integration/application/min_stake_test.go +++ b/tests/integration/application/min_stake_test.go @@ -49,6 +49,11 @@ func TestApplicationMinStakeTestSuite(t *testing.T) { func (s *applicationMinStakeTestSuite) SetupTest() { s.keepers, s.ctx = keeper.NewTokenomicsModuleKeepers(s.T(), cosmoslog.NewNopLogger()) + proofParams := prooftypes.DefaultParams() + proofParams.ProofRequestProbability = 0 + err := s.keepers.ProofKeeper.SetParams(s.ctx, proofParams) + require.NoError(s.T(), err) + s.serviceId = "svc1" s.appBech32 = sample.AccAddress() s.supplierBech32 = sample.AccAddress() From 395126d09a65766135b74254c8944aabef05bc09 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Mon, 14 Oct 2024 11:25:07 +0200 Subject: [PATCH 135/139] fix: linter error --- x/supplier/types/message_update_param.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/supplier/types/message_update_param.go b/x/supplier/types/message_update_param.go index 843e69aaf..5819e1ed2 100644 --- a/x/supplier/types/message_update_param.go +++ b/x/supplier/types/message_update_param.go @@ -8,7 +8,7 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) -var _ cosmostypes.Msg = &MsgUpdateParam{} +var _ cosmostypes.Msg = (*MsgUpdateParam)(nil) func NewMsgUpdateParam(authority string, name string, asType any) *MsgUpdateParam { var asTypeIface isMsgUpdateParam_AsType From f18e34798fcc97e58569eb6e0b9d98ad2e288a3a Mon Sep 17 00:00:00 2001 From: Bryan White Date: Mon, 14 Oct 2024 11:51:12 +0200 Subject: [PATCH 136/139] test: supplier up-staking from below min. stake --- .../keeper/msg_server_stake_supplier_test.go | 63 ++++++++++++------- 1 file changed, 39 insertions(+), 24 deletions(-) diff --git a/x/supplier/keeper/msg_server_stake_supplier_test.go b/x/supplier/keeper/msg_server_stake_supplier_test.go index 5c7918ee7..5682425fe 100644 --- a/x/supplier/keeper/msg_server_stake_supplier_test.go +++ b/x/supplier/keeper/msg_server_stake_supplier_test.go @@ -352,7 +352,7 @@ func stakeSupplierForServicesMsg( { Url: "http://localhost:8080", RpcType: sharedtypes.RPCType_JSON_RPC, - Configs: make([]*sharedtypes.ConfigOption, 0), + Configs: nil, }, }, RevShare: []*sharedtypes.ServiceRevenueShare{ @@ -398,29 +398,7 @@ func TestMsgServer_StakeSupplier_FailBelowMinStake(t *testing.T) { require.NoError(t, err) // Prepare the supplier stake message. - stakeMsg := &suppliertypes.MsgStakeSupplier{ - Signer: addr, - OwnerAddress: addr, - OperatorAddress: addr, - Stake: &supplierStake, - Services: []*sharedtypes.SupplierServiceConfig{ - { - ServiceId: "svcId", - Endpoints: []*sharedtypes.SupplierEndpoint{ - { - Url: "http://test.example:8080", - RpcType: sharedtypes.RPCType_JSON_RPC, - }, - }, - RevShare: []*sharedtypes.ServiceRevenueShare{ - { - Address: addr, - RevSharePercentage: 100, - }, - }, - }, - }, - } + stakeMsg := stakeSupplierForServicesMsg(addr, addr, 100, "svcId") // Attempt to stake the supplier & verify that the supplier does NOT exist. _, err = srv.StakeSupplier(ctx, stakeMsg) @@ -428,3 +406,40 @@ func TestMsgServer_StakeSupplier_FailBelowMinStake(t *testing.T) { _, isSupplierFound := k.GetSupplier(ctx, addr) require.False(t, isSupplierFound) } + +func TestMsgServer_StakeSupplier_UpStakeFromBelowMinStake(t *testing.T) { + k, ctx := keepertest.SupplierKeeper(t) + srv := keeper.NewMsgServerImpl(*k.Keeper) + + addr := sample.AccAddress() + supplierParams := k.Keeper.GetParams(ctx) + minStake := supplierParams.GetMinStake() + belowMinStake := minStake.AddAmount(math.NewInt(-1)) + aboveMinStake := minStake.AddAmount(math.NewInt(1)) + + stakeMsg := stakeSupplierForServicesMsg(addr, addr, aboveMinStake.Amount.Int64(), "svcId") + + // Stake (via keeper methods) a supplier with stake below min. stake. + initialSupplier := sharedtypes.Supplier{ + OwnerAddress: addr, + OperatorAddress: addr, + Stake: &belowMinStake, + Services: stakeMsg.GetServices(), + ServicesActivationHeightsMap: map[string]uint64{ + "svcId": 0, + }, + } + + k.SetSupplier(ctx, initialSupplier) + + // Attempt to upstake the supplier with stake above min. stake. + _, err := srv.StakeSupplier(ctx, stakeMsg) + require.NoError(t, err) + + // Assert supplier is staked for above min. stake. + expectedSupplier := initialSupplier + expectedSupplier.Stake = &aboveMinStake + supplier, isSupplierFound := k.GetSupplier(ctx, addr) + require.True(t, isSupplierFound) + require.EqualValues(t, expectedSupplier, supplier) +} From d85daf76c6b83327a870950d4cb78e585883a804 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Mon, 14 Oct 2024 14:18:12 +0200 Subject: [PATCH 137/139] Empty commit From 654dba25b4401b81d4570a8d900e35dd733b2da8 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Mon, 14 Oct 2024 14:48:54 +0200 Subject: [PATCH 138/139] fix: linter error --- x/proof/keeper/msg_update_params_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x/proof/keeper/msg_update_params_test.go b/x/proof/keeper/msg_update_params_test.go index 2452fe603..d7509dc93 100644 --- a/x/proof/keeper/msg_update_params_test.go +++ b/x/proof/keeper/msg_update_params_test.go @@ -43,8 +43,8 @@ func TestMsgUpdateParams(t *testing.T) { Authority: k.GetAuthority(), Params: types.Params{ ProofRequirementThreshold: &types.DefaultProofRequirementThreshold, - ProofMissingPenalty: &types.DefaultProofMissingPenalty, - ProofSubmissionFee: &types.MinProofSubmissionFee, + ProofMissingPenalty: &types.DefaultProofMissingPenalty, + ProofSubmissionFee: &types.MinProofSubmissionFee, }, }, shouldError: false, From b5509abc55619fba3cd7707c275c935aef25c687 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Mon, 14 Oct 2024 22:02:58 +0200 Subject: [PATCH 139/139] Empty commit