From d1cd5e69fd97bc5263303ef8bf783c755e54cae0 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Mon, 9 Sep 2024 11:13:25 +0200 Subject: [PATCH 01/40] 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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15, 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,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xb7, 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 02/40] 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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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, 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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 03/40] 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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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,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, 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 04/40] 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 05/40] 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 06/40] 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, - 0xa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78, 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, 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dd, 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, 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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 07/40] 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, 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63, 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 08/40] 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 09/40] 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 10/40] 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 11/40] 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 12/40] 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 13/40] =?UTF-8?q?chore:=20add=20as=5Fcoin=20as=5Ftype=20ty?= =?UTF-8?q?pe=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, 0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57, 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, 0x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94, 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 14/40] 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 15/40] 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 16/40] 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 17/40] 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 18/40] 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 19/40] 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 20/40] 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 21/40] 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 22/40] 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 434059064f218dc68d3f15c325b32d704bc46332 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Mon, 30 Sep 2024 11:12:09 +0200 Subject: [PATCH 23/40] 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 0839ae4d2abc00955ddf833ccc1c76f80a216032 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Mon, 30 Sep 2024 12:06:22 +0200 Subject: [PATCH 24/40] 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 25/40] 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 26/40] 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 891a858c4fb7d72e7caab9a5d765f6d1e034e81b Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 2 Oct 2024 08:53:47 +0200 Subject: [PATCH 27/40] 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 ccc3f53913dddfffc82f88dd82dce9ea477245cb Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 2 Oct 2024 10:08:37 +0200 Subject: [PATCH 28/40] 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 b29843e356bbdd665dfa81ad5dd0d305f4fc7d30 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 2 Oct 2024 12:28:10 +0200 Subject: [PATCH 29/40] 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 30/40] Empty commit From 4e259c98ce93f7d3998b65b14f81a83f2cba059e Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 2 Oct 2024 19:49:57 +0200 Subject: [PATCH 31/40] 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 32/40] 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 3280142714a82e6070ac568955f2b435700ee48a Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 4 Oct 2024 10:33:17 +0200 Subject: [PATCH 33/40] 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 c256eaeeb0362cf5208d831c4906ac0f795433b1 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 4 Oct 2024 11:04:09 +0200 Subject: [PATCH 34/40] 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 1c309b81eff0ab53e6ee624edd34832e89840228 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 4 Oct 2024 13:23:48 +0200 Subject: [PATCH 35/40] Empty commit From 4d2c2d96363366167dd96aa18571a7e81858af0f Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 4 Oct 2024 15:26:58 +0200 Subject: [PATCH 36/40] 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 37/40] 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 3e4ef9e82e4b41cc47b1ea9e137d71b845effcd8 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 4 Oct 2024 15:41:45 +0200 Subject: [PATCH 38/40] 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 cd5e420f065a7115bbf783ea42628af5d6651a5f Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 4 Oct 2024 16:28:34 +0200 Subject: [PATCH 39/40] 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 698991a3e2eaa94e4e9ffa901c6dc8c00af3e0cd Mon Sep 17 00:00:00 2001 From: Bryan White Date: Fri, 4 Oct 2024 18:11:20 +0200 Subject: [PATCH 40/40] Empty commit