From 67fb9dc072bfabe8e47c8a702c55bece4c10052d Mon Sep 17 00:00:00 2001 From: Redouane Lakrache Date: Thu, 8 Feb 2024 06:55:30 +0100 Subject: [PATCH 01/10] scaffold: module gateway --dep bank ignite scaffold module gateway --dep bank --- api/poktroll/gateway/genesis.pulsar.go | 595 ++++++++++ api/poktroll/gateway/module/module.pulsar.go | 578 ++++++++++ api/poktroll/gateway/params.pulsar.go | 499 ++++++++ api/poktroll/gateway/query.pulsar.go | 1010 ++++++++++++++++ api/poktroll/gateway/tx.pulsar.go | 1089 ++++++++++++++++++ app/app.go | 3 + app/app_config.go | 11 + go.mod | 2 +- proto/poktroll/gateway/genesis.proto | 17 + proto/poktroll/gateway/module/module.proto | 14 + proto/poktroll/gateway/params.proto | 15 + proto/poktroll/gateway/query.proto | 30 + proto/poktroll/gateway/tx.proto | 40 + testutil/keeper/gateway.go | 50 + x/gateway/keeper/keeper.go | 58 + x/gateway/keeper/msg_server.go | 17 + x/gateway/keeper/msg_server_test.go | 24 + x/gateway/keeper/msg_update_params.go | 23 + x/gateway/keeper/msg_update_params_test.go | 64 + x/gateway/keeper/params.go | 33 + x/gateway/keeper/params_test.go | 18 + x/gateway/keeper/query.go | 7 + x/gateway/keeper/query_params.go | 20 + x/gateway/keeper/query_params_test.go | 20 + x/gateway/module/autocli.go | 35 + x/gateway/module/genesis.go | 24 + x/gateway/module/genesis_test.go | 29 + x/gateway/module/module.go | 215 ++++ x/gateway/module/simulation.go | 64 + x/gateway/simulation/helpers.go | 15 + x/gateway/types/codec.go | 17 + x/gateway/types/errors.go | 13 + x/gateway/types/expected_keepers.go | 25 + x/gateway/types/genesis.go | 24 + x/gateway/types/genesis_test.go | 41 + x/gateway/types/keys.go | 20 + x/gateway/types/msg_update_params.go | 21 + x/gateway/types/params.go | 32 + x/gateway/types/types.go | 1 + 39 files changed, 4812 insertions(+), 1 deletion(-) create mode 100644 api/poktroll/gateway/genesis.pulsar.go create mode 100644 api/poktroll/gateway/module/module.pulsar.go create mode 100644 api/poktroll/gateway/params.pulsar.go create mode 100644 api/poktroll/gateway/query.pulsar.go create mode 100644 api/poktroll/gateway/tx.pulsar.go create mode 100644 proto/poktroll/gateway/genesis.proto create mode 100644 proto/poktroll/gateway/module/module.proto create mode 100644 proto/poktroll/gateway/params.proto create mode 100644 proto/poktroll/gateway/query.proto create mode 100644 proto/poktroll/gateway/tx.proto create mode 100644 testutil/keeper/gateway.go create mode 100644 x/gateway/keeper/keeper.go create mode 100644 x/gateway/keeper/msg_server.go create mode 100644 x/gateway/keeper/msg_server_test.go create mode 100644 x/gateway/keeper/msg_update_params.go create mode 100644 x/gateway/keeper/msg_update_params_test.go create mode 100644 x/gateway/keeper/params.go create mode 100644 x/gateway/keeper/params_test.go create mode 100644 x/gateway/keeper/query.go create mode 100644 x/gateway/keeper/query_params.go create mode 100644 x/gateway/keeper/query_params_test.go create mode 100644 x/gateway/module/autocli.go create mode 100644 x/gateway/module/genesis.go create mode 100644 x/gateway/module/genesis_test.go create mode 100644 x/gateway/module/module.go create mode 100644 x/gateway/module/simulation.go create mode 100644 x/gateway/simulation/helpers.go create mode 100644 x/gateway/types/codec.go create mode 100644 x/gateway/types/errors.go create mode 100644 x/gateway/types/expected_keepers.go create mode 100644 x/gateway/types/genesis.go create mode 100644 x/gateway/types/genesis_test.go create mode 100644 x/gateway/types/keys.go create mode 100644 x/gateway/types/msg_update_params.go create mode 100644 x/gateway/types/params.go create mode 100644 x/gateway/types/types.go diff --git a/api/poktroll/gateway/genesis.pulsar.go b/api/poktroll/gateway/genesis.pulsar.go new file mode 100644 index 000000000..8b92fab2a --- /dev/null +++ b/api/poktroll/gateway/genesis.pulsar.go @@ -0,0 +1,595 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package gateway + +import ( + _ "cosmossdk.io/api/amino" + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_GenesisState protoreflect.MessageDescriptor + fd_GenesisState_params protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_gateway_genesis_proto_init() + md_GenesisState = File_poktroll_gateway_genesis_proto.Messages().ByName("GenesisState") + fd_GenesisState_params = md_GenesisState.Fields().ByName("params") +} + +var _ protoreflect.Message = (*fastReflection_GenesisState)(nil) + +type fastReflection_GenesisState GenesisState + +func (x *GenesisState) ProtoReflect() protoreflect.Message { + return (*fastReflection_GenesisState)(x) +} + +func (x *GenesisState) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_gateway_genesis_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_GenesisState_messageType fastReflection_GenesisState_messageType +var _ protoreflect.MessageType = fastReflection_GenesisState_messageType{} + +type fastReflection_GenesisState_messageType struct{} + +func (x fastReflection_GenesisState_messageType) Zero() protoreflect.Message { + return (*fastReflection_GenesisState)(nil) +} +func (x fastReflection_GenesisState_messageType) New() protoreflect.Message { + return new(fastReflection_GenesisState) +} +func (x fastReflection_GenesisState_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_GenesisState +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_GenesisState) Descriptor() protoreflect.MessageDescriptor { + return md_GenesisState +} + +// 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_GenesisState) Type() protoreflect.MessageType { + return _fastReflection_GenesisState_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_GenesisState) New() protoreflect.Message { + return new(fastReflection_GenesisState) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_GenesisState) Interface() protoreflect.ProtoMessage { + return (*GenesisState)(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_GenesisState) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Params != nil { + value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + if !f(fd_GenesisState_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_GenesisState) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.gateway.GenesisState.params": + return x.Params != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.GenesisState")) + } + panic(fmt.Errorf("message poktroll.gateway.GenesisState 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_GenesisState) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.gateway.GenesisState.params": + x.Params = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.GenesisState")) + } + panic(fmt.Errorf("message poktroll.gateway.GenesisState 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_GenesisState) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.gateway.GenesisState.params": + value := x.Params + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.GenesisState")) + } + panic(fmt.Errorf("message poktroll.gateway.GenesisState 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_GenesisState) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.gateway.GenesisState.params": + x.Params = value.Message().Interface().(*Params) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.GenesisState")) + } + panic(fmt.Errorf("message poktroll.gateway.GenesisState 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_GenesisState) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.gateway.GenesisState.params": + if x.Params == nil { + x.Params = new(Params) + } + return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.GenesisState")) + } + panic(fmt.Errorf("message poktroll.gateway.GenesisState 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_GenesisState) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.gateway.GenesisState.params": + m := new(Params) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.GenesisState")) + } + panic(fmt.Errorf("message poktroll.gateway.GenesisState 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_GenesisState) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.gateway.GenesisState", 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_GenesisState) 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_GenesisState) 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_GenesisState) 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_GenesisState) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*GenesisState) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Params != nil { + l = options.Size(x.Params) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*GenesisState) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Params != nil { + encoded, err := options.Marshal(x.Params) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*GenesisState) + 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: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Params == nil { + x.Params = &Params{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/gateway/genesis.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// GenesisState defines the gateway module's genesis state. +type GenesisState struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // params defines all the parameters of the module. + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` +} + +func (x *GenesisState) Reset() { + *x = GenesisState{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_gateway_genesis_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GenesisState) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GenesisState) ProtoMessage() {} + +// Deprecated: Use GenesisState.ProtoReflect.Descriptor instead. +func (*GenesisState) Descriptor() ([]byte, []int) { + return file_poktroll_gateway_genesis_proto_rawDescGZIP(), []int{0} +} + +func (x *GenesisState) GetParams() *Params { + if x != nil { + return x.Params + } + return nil +} + +var File_poktroll_gateway_genesis_proto protoreflect.FileDescriptor + +var file_poktroll_gateway_genesis_proto_rawDesc = []byte{ + 0x0a, 0x1e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, + 0x61, 0x79, 0x2f, 0x67, 0x65, 0x6e, 0x65, 0x73, 0x69, 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, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x70, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x4b, 0x0a, 0x0c, 0x47, 0x65, + 0x6e, 0x65, 0x73, 0x69, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x3b, 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, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, + 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0xa8, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, + 0x42, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 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 ( + file_poktroll_gateway_genesis_proto_rawDescOnce sync.Once + file_poktroll_gateway_genesis_proto_rawDescData = file_poktroll_gateway_genesis_proto_rawDesc +) + +func file_poktroll_gateway_genesis_proto_rawDescGZIP() []byte { + file_poktroll_gateway_genesis_proto_rawDescOnce.Do(func() { + file_poktroll_gateway_genesis_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_gateway_genesis_proto_rawDescData) + }) + return file_poktroll_gateway_genesis_proto_rawDescData +} + +var file_poktroll_gateway_genesis_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_poktroll_gateway_genesis_proto_goTypes = []interface{}{ + (*GenesisState)(nil), // 0: poktroll.gateway.GenesisState + (*Params)(nil), // 1: poktroll.gateway.Params +} +var file_poktroll_gateway_genesis_proto_depIdxs = []int32{ + 1, // 0: poktroll.gateway.GenesisState.params:type_name -> poktroll.gateway.Params + 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_genesis_proto_init() } +func file_poktroll_gateway_genesis_proto_init() { + if File_poktroll_gateway_genesis_proto != nil { + return + } + file_poktroll_gateway_params_proto_init() + if !protoimpl.UnsafeEnabled { + file_poktroll_gateway_genesis_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GenesisState); 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{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_gateway_genesis_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_poktroll_gateway_genesis_proto_goTypes, + DependencyIndexes: file_poktroll_gateway_genesis_proto_depIdxs, + MessageInfos: file_poktroll_gateway_genesis_proto_msgTypes, + }.Build() + File_poktroll_gateway_genesis_proto = out.File + file_poktroll_gateway_genesis_proto_rawDesc = nil + file_poktroll_gateway_genesis_proto_goTypes = nil + file_poktroll_gateway_genesis_proto_depIdxs = nil +} diff --git a/api/poktroll/gateway/module/module.pulsar.go b/api/poktroll/gateway/module/module.pulsar.go new file mode 100644 index 000000000..07c2e332a --- /dev/null +++ b/api/poktroll/gateway/module/module.pulsar.go @@ -0,0 +1,578 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package module + +import ( + _ "cosmossdk.io/api/cosmos/app/v1alpha1" + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_Module protoreflect.MessageDescriptor + fd_Module_authority protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_gateway_module_module_proto_init() + md_Module = File_poktroll_gateway_module_module_proto.Messages().ByName("Module") + fd_Module_authority = md_Module.Fields().ByName("authority") +} + +var _ protoreflect.Message = (*fastReflection_Module)(nil) + +type fastReflection_Module Module + +func (x *Module) ProtoReflect() protoreflect.Message { + return (*fastReflection_Module)(x) +} + +func (x *Module) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_gateway_module_module_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_Module_messageType fastReflection_Module_messageType +var _ protoreflect.MessageType = fastReflection_Module_messageType{} + +type fastReflection_Module_messageType struct{} + +func (x fastReflection_Module_messageType) Zero() protoreflect.Message { + return (*fastReflection_Module)(nil) +} +func (x fastReflection_Module_messageType) New() protoreflect.Message { + return new(fastReflection_Module) +} +func (x fastReflection_Module_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_Module +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_Module) Descriptor() protoreflect.MessageDescriptor { + return md_Module +} + +// 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_Module) Type() protoreflect.MessageType { + return _fastReflection_Module_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_Module) New() protoreflect.Message { + return new(fastReflection_Module) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_Module) Interface() protoreflect.ProtoMessage { + return (*Module)(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_Module) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Authority != "" { + value := protoreflect.ValueOfString(x.Authority) + if !f(fd_Module_authority, 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_Module) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.gateway.module.Module.authority": + return x.Authority != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.module.Module")) + } + panic(fmt.Errorf("message poktroll.gateway.module.Module 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_Module) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.gateway.module.Module.authority": + x.Authority = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.module.Module")) + } + panic(fmt.Errorf("message poktroll.gateway.module.Module 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_Module) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.gateway.module.Module.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.module.Module")) + } + panic(fmt.Errorf("message poktroll.gateway.module.Module 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_Module) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.gateway.module.Module.authority": + x.Authority = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.module.Module")) + } + panic(fmt.Errorf("message poktroll.gateway.module.Module 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_Module) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.gateway.module.Module.authority": + panic(fmt.Errorf("field authority of message poktroll.gateway.module.Module is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.module.Module")) + } + panic(fmt.Errorf("message poktroll.gateway.module.Module 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_Module) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.gateway.module.Module.authority": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.module.Module")) + } + panic(fmt.Errorf("message poktroll.gateway.module.Module 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_Module) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.gateway.module.Module", 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_Module) 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_Module) 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_Module) 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_Module) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*Module) + 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)) + } + 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().(*Module) + 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.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().(*Module) + 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: Module: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Module: 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 + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/gateway/module/module.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Module is the config object for the module. +type Module struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // authority defines the custom module authority. If not set, defaults to the governance module. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` +} + +func (x *Module) Reset() { + *x = Module{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_gateway_module_module_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Module) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Module) ProtoMessage() {} + +// Deprecated: Use Module.ProtoReflect.Descriptor instead. +func (*Module) Descriptor() ([]byte, []int) { + return file_poktroll_gateway_module_module_proto_rawDescGZIP(), []int{0} +} + +func (x *Module) GetAuthority() string { + if x != nil { + return x.Authority + } + return "" +} + +var File_poktroll_gateway_module_module_proto protoreflect.FileDescriptor + +var file_poktroll_gateway_module_module_proto_rawDesc = []byte{ + 0x0a, 0x24, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, + 0x61, 0x79, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x17, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x1a, + 0x20, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x22, 0x5a, 0x0a, 0x06, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 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, 0x3a, 0x32, 0xba, 0xc0, 0x96, 0xda, 0x01, + 0x2c, 0x0a, 0x2a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x6f, + 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2f, 0x78, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, 0xd2, 0x01, + 0x0a, 0x1b, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, + 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x42, 0x0b, 0x4d, + 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x28, 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, 0x2f, + 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0xa2, 0x02, 0x03, 0x50, 0x47, 0x4d, 0xaa, 0x02, 0x17, 0x50, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, + 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0xca, 0x02, 0x17, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x5c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, + 0xe2, 0x02, 0x23, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x5c, 0x47, 0x61, 0x74, 0x65, + 0x77, 0x61, 0x79, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x19, 0x50, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x3a, 0x3a, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x3a, 0x3a, 0x4d, 0x6f, 0x64, 0x75, + 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_poktroll_gateway_module_module_proto_rawDescOnce sync.Once + file_poktroll_gateway_module_module_proto_rawDescData = file_poktroll_gateway_module_module_proto_rawDesc +) + +func file_poktroll_gateway_module_module_proto_rawDescGZIP() []byte { + file_poktroll_gateway_module_module_proto_rawDescOnce.Do(func() { + file_poktroll_gateway_module_module_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_gateway_module_module_proto_rawDescData) + }) + return file_poktroll_gateway_module_module_proto_rawDescData +} + +var file_poktroll_gateway_module_module_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_poktroll_gateway_module_module_proto_goTypes = []interface{}{ + (*Module)(nil), // 0: poktroll.gateway.module.Module +} +var file_poktroll_gateway_module_module_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 +} + +func init() { file_poktroll_gateway_module_module_proto_init() } +func file_poktroll_gateway_module_module_proto_init() { + if File_poktroll_gateway_module_module_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_poktroll_gateway_module_module_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Module); 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{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_gateway_module_module_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_poktroll_gateway_module_module_proto_goTypes, + DependencyIndexes: file_poktroll_gateway_module_module_proto_depIdxs, + MessageInfos: file_poktroll_gateway_module_module_proto_msgTypes, + }.Build() + File_poktroll_gateway_module_module_proto = out.File + file_poktroll_gateway_module_module_proto_rawDesc = nil + file_poktroll_gateway_module_module_proto_goTypes = nil + file_poktroll_gateway_module_module_proto_depIdxs = nil +} diff --git a/api/poktroll/gateway/params.pulsar.go b/api/poktroll/gateway/params.pulsar.go new file mode 100644 index 000000000..19969e717 --- /dev/null +++ b/api/poktroll/gateway/params.pulsar.go @@ -0,0 +1,499 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package gateway + +import ( + _ "cosmossdk.io/api/amino" + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_Params protoreflect.MessageDescriptor +) + +func init() { + file_poktroll_gateway_params_proto_init() + md_Params = File_poktroll_gateway_params_proto.Messages().ByName("Params") +} + +var _ protoreflect.Message = (*fastReflection_Params)(nil) + +type fastReflection_Params Params + +func (x *Params) ProtoReflect() protoreflect.Message { + return (*fastReflection_Params)(x) +} + +func (x *Params) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_gateway_params_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_Params_messageType fastReflection_Params_messageType +var _ protoreflect.MessageType = fastReflection_Params_messageType{} + +type fastReflection_Params_messageType struct{} + +func (x fastReflection_Params_messageType) Zero() protoreflect.Message { + return (*fastReflection_Params)(nil) +} +func (x fastReflection_Params_messageType) New() protoreflect.Message { + return new(fastReflection_Params) +} +func (x fastReflection_Params_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_Params +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_Params) Descriptor() protoreflect.MessageDescriptor { + return md_Params +} + +// 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_Params) Type() protoreflect.MessageType { + return _fastReflection_Params_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_Params) New() protoreflect.Message { + return new(fastReflection_Params) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_Params) Interface() protoreflect.ProtoMessage { + return (*Params)(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_Params) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_Params) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.Params")) + } + panic(fmt.Errorf("message poktroll.gateway.Params 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_Params) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.Params")) + } + panic(fmt.Errorf("message poktroll.gateway.Params 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_Params) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.Params")) + } + panic(fmt.Errorf("message poktroll.gateway.Params 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_Params) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.Params")) + } + panic(fmt.Errorf("message poktroll.gateway.Params 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_Params) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.Params")) + } + panic(fmt.Errorf("message poktroll.gateway.Params 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_Params) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.Params")) + } + panic(fmt.Errorf("message poktroll.gateway.Params 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_Params) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.gateway.Params", 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_Params) 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_Params) 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_Params) 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_Params) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*Params) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*Params) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*Params) + 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: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/gateway/params.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Params defines the parameters for the module. +type Params struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *Params) Reset() { + *x = Params{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_gateway_params_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Params) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Params) ProtoMessage() {} + +// Deprecated: Use Params.ProtoReflect.Descriptor instead. +func (*Params) Descriptor() ([]byte, []int) { + return file_poktroll_gateway_params_proto_rawDescGZIP(), []int{0} +} + +var File_poktroll_gateway_params_proto protoreflect.FileDescriptor + +var file_poktroll_gateway_params_proto_rawDesc = []byte{ + 0x0a, 0x1d, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, + 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, 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, 0xa7, 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 ( + file_poktroll_gateway_params_proto_rawDescOnce sync.Once + file_poktroll_gateway_params_proto_rawDescData = file_poktroll_gateway_params_proto_rawDesc +) + +func file_poktroll_gateway_params_proto_rawDescGZIP() []byte { + file_poktroll_gateway_params_proto_rawDescOnce.Do(func() { + file_poktroll_gateway_params_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_gateway_params_proto_rawDescData) + }) + return file_poktroll_gateway_params_proto_rawDescData +} + +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 +} +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 +} + +func init() { file_poktroll_gateway_params_proto_init() } +func file_poktroll_gateway_params_proto_init() { + if File_poktroll_gateway_params_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_poktroll_gateway_params_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Params); 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{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_gateway_params_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_poktroll_gateway_params_proto_goTypes, + DependencyIndexes: file_poktroll_gateway_params_proto_depIdxs, + MessageInfos: file_poktroll_gateway_params_proto_msgTypes, + }.Build() + File_poktroll_gateway_params_proto = out.File + file_poktroll_gateway_params_proto_rawDesc = nil + file_poktroll_gateway_params_proto_goTypes = nil + file_poktroll_gateway_params_proto_depIdxs = nil +} diff --git a/api/poktroll/gateway/query.pulsar.go b/api/poktroll/gateway/query.pulsar.go new file mode 100644 index 000000000..8cc099f3e --- /dev/null +++ b/api/poktroll/gateway/query.pulsar.go @@ -0,0 +1,1010 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package gateway + +import ( + _ "cosmossdk.io/api/amino" + _ "cosmossdk.io/api/cosmos/base/query/v1beta1" + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_QueryParamsRequest protoreflect.MessageDescriptor +) + +func init() { + file_poktroll_gateway_query_proto_init() + md_QueryParamsRequest = File_poktroll_gateway_query_proto.Messages().ByName("QueryParamsRequest") +} + +var _ protoreflect.Message = (*fastReflection_QueryParamsRequest)(nil) + +type fastReflection_QueryParamsRequest QueryParamsRequest + +func (x *QueryParamsRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryParamsRequest)(x) +} + +func (x *QueryParamsRequest) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_gateway_query_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryParamsRequest_messageType fastReflection_QueryParamsRequest_messageType +var _ protoreflect.MessageType = fastReflection_QueryParamsRequest_messageType{} + +type fastReflection_QueryParamsRequest_messageType struct{} + +func (x fastReflection_QueryParamsRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryParamsRequest)(nil) +} +func (x fastReflection_QueryParamsRequest_messageType) New() protoreflect.Message { + return new(fastReflection_QueryParamsRequest) +} +func (x fastReflection_QueryParamsRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryParamsRequest +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryParamsRequest) Descriptor() protoreflect.MessageDescriptor { + return md_QueryParamsRequest +} + +// 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_QueryParamsRequest) Type() protoreflect.MessageType { + return _fastReflection_QueryParamsRequest_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryParamsRequest) New() protoreflect.Message { + return new(fastReflection_QueryParamsRequest) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryParamsRequest) Interface() protoreflect.ProtoMessage { + return (*QueryParamsRequest)(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_QueryParamsRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryParamsRequest) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryParamsRequest 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_QueryParamsRequest) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryParamsRequest 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_QueryParamsRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryParamsRequest 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_QueryParamsRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryParamsRequest 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_QueryParamsRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryParamsRequest 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_QueryParamsRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryParamsRequest")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryParamsRequest 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_QueryParamsRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.gateway.QueryParamsRequest", 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_QueryParamsRequest) 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_QueryParamsRequest) 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_QueryParamsRequest) 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_QueryParamsRequest) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryParamsRequest) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryParamsRequest) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryParamsRequest) + 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: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_QueryParamsResponse protoreflect.MessageDescriptor + fd_QueryParamsResponse_params protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_gateway_query_proto_init() + md_QueryParamsResponse = File_poktroll_gateway_query_proto.Messages().ByName("QueryParamsResponse") + fd_QueryParamsResponse_params = md_QueryParamsResponse.Fields().ByName("params") +} + +var _ protoreflect.Message = (*fastReflection_QueryParamsResponse)(nil) + +type fastReflection_QueryParamsResponse QueryParamsResponse + +func (x *QueryParamsResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryParamsResponse)(x) +} + +func (x *QueryParamsResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_gateway_query_proto_msgTypes[1] + 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_QueryParamsResponse_messageType fastReflection_QueryParamsResponse_messageType +var _ protoreflect.MessageType = fastReflection_QueryParamsResponse_messageType{} + +type fastReflection_QueryParamsResponse_messageType struct{} + +func (x fastReflection_QueryParamsResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryParamsResponse)(nil) +} +func (x fastReflection_QueryParamsResponse_messageType) New() protoreflect.Message { + return new(fastReflection_QueryParamsResponse) +} +func (x fastReflection_QueryParamsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryParamsResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryParamsResponse) Descriptor() protoreflect.MessageDescriptor { + return md_QueryParamsResponse +} + +// 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_QueryParamsResponse) Type() protoreflect.MessageType { + return _fastReflection_QueryParamsResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryParamsResponse) New() protoreflect.Message { + return new(fastReflection_QueryParamsResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryParamsResponse) Interface() protoreflect.ProtoMessage { + return (*QueryParamsResponse)(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_QueryParamsResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Params != nil { + value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + if !f(fd_QueryParamsResponse_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_QueryParamsResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.gateway.QueryParamsResponse.params": + return x.Params != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryParamsResponse 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_QueryParamsResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.gateway.QueryParamsResponse.params": + x.Params = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryParamsResponse 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_QueryParamsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.gateway.QueryParamsResponse.params": + value := x.Params + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryParamsResponse 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_QueryParamsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.gateway.QueryParamsResponse.params": + x.Params = value.Message().Interface().(*Params) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryParamsResponse 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_QueryParamsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.gateway.QueryParamsResponse.params": + if x.Params == nil { + x.Params = new(Params) + } + return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryParamsResponse 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_QueryParamsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.gateway.QueryParamsResponse.params": + m := new(Params) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryParamsResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryParamsResponse 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_QueryParamsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.gateway.QueryParamsResponse", 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_QueryParamsResponse) 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_QueryParamsResponse) 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_QueryParamsResponse) 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_QueryParamsResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryParamsResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Params != nil { + l = options.Size(x.Params) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*QueryParamsResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Params != nil { + encoded, err := options.Marshal(x.Params) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryParamsResponse) + 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: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Params == nil { + x.Params = &Params{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/gateway/query.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// QueryParamsRequest is request type for the Query/Params RPC method. +type QueryParamsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *QueryParamsRequest) Reset() { + *x = QueryParamsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_gateway_query_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryParamsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryParamsRequest) ProtoMessage() {} + +// Deprecated: Use QueryParamsRequest.ProtoReflect.Descriptor instead. +func (*QueryParamsRequest) Descriptor() ([]byte, []int) { + return file_poktroll_gateway_query_proto_rawDescGZIP(), []int{0} +} + +// QueryParamsResponse is response type for the Query/Params RPC method. +type QueryParamsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // params holds all the parameters of this module. + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` +} + +func (x *QueryParamsResponse) Reset() { + *x = QueryParamsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_gateway_query_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryParamsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryParamsResponse) ProtoMessage() {} + +// Deprecated: Use QueryParamsResponse.ProtoReflect.Descriptor instead. +func (*QueryParamsResponse) Descriptor() ([]byte, []int) { + return file_poktroll_gateway_query_proto_rawDescGZIP(), []int{1} +} + +func (x *QueryParamsResponse) GetParams() *Params { + if x != nil { + return x.Params + } + return nil +} + +var File_poktroll_gateway_query_proto protoreflect.FileDescriptor + +var file_poktroll_gateway_query_proto_rawDesc = []byte{ + 0x0a, 0x1c, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, + 0x61, 0x79, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 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, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, + 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, + 0x62, 0x61, 0x73, 0x65, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x2f, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, + 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0x14, 0x0a, 0x12, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x52, 0x0a, 0x13, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x3b, 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, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, + 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x32, 0x8e, 0x01, 0x0a, + 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x84, 0x01, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x12, 0x24, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, + 0x65, 0x77, 0x61, 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2d, + 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x12, 0x25, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, + 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, + 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0xa6, 0x01, + 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, + 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 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 ( + file_poktroll_gateway_query_proto_rawDescOnce sync.Once + file_poktroll_gateway_query_proto_rawDescData = file_poktroll_gateway_query_proto_rawDesc +) + +func file_poktroll_gateway_query_proto_rawDescGZIP() []byte { + file_poktroll_gateway_query_proto_rawDescOnce.Do(func() { + file_poktroll_gateway_query_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_gateway_query_proto_rawDescData) + }) + return file_poktroll_gateway_query_proto_rawDescData +} + +var file_poktroll_gateway_query_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_poktroll_gateway_query_proto_goTypes = []interface{}{ + (*QueryParamsRequest)(nil), // 0: poktroll.gateway.QueryParamsRequest + (*QueryParamsResponse)(nil), // 1: poktroll.gateway.QueryParamsResponse + (*Params)(nil), // 2: poktroll.gateway.Params +} +var file_poktroll_gateway_query_proto_depIdxs = []int32{ + 2, // 0: poktroll.gateway.QueryParamsResponse.params:type_name -> poktroll.gateway.Params + 0, // 1: poktroll.gateway.Query.Params:input_type -> poktroll.gateway.QueryParamsRequest + 1, // 2: poktroll.gateway.Query.Params:output_type -> poktroll.gateway.QueryParamsResponse + 2, // [2:3] is the sub-list for method output_type + 1, // [1:2] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_poktroll_gateway_query_proto_init() } +func file_poktroll_gateway_query_proto_init() { + if File_poktroll_gateway_query_proto != nil { + return + } + file_poktroll_gateway_params_proto_init() + if !protoimpl.UnsafeEnabled { + file_poktroll_gateway_query_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryParamsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_gateway_query_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryParamsResponse); 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{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_gateway_query_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_poktroll_gateway_query_proto_goTypes, + DependencyIndexes: file_poktroll_gateway_query_proto_depIdxs, + MessageInfos: file_poktroll_gateway_query_proto_msgTypes, + }.Build() + File_poktroll_gateway_query_proto = out.File + file_poktroll_gateway_query_proto_rawDesc = nil + file_poktroll_gateway_query_proto_goTypes = nil + file_poktroll_gateway_query_proto_depIdxs = nil +} diff --git a/api/poktroll/gateway/tx.pulsar.go b/api/poktroll/gateway/tx.pulsar.go new file mode 100644 index 000000000..57ef30053 --- /dev/null +++ b/api/poktroll/gateway/tx.pulsar.go @@ -0,0 +1,1089 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package gateway + +import ( + _ "cosmossdk.io/api/amino" + _ "cosmossdk.io/api/cosmos/msg/v1" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_MsgUpdateParams protoreflect.MessageDescriptor + fd_MsgUpdateParams_authority protoreflect.FieldDescriptor + fd_MsgUpdateParams_params protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_gateway_tx_proto_init() + md_MsgUpdateParams = File_poktroll_gateway_tx_proto.Messages().ByName("MsgUpdateParams") + fd_MsgUpdateParams_authority = md_MsgUpdateParams.Fields().ByName("authority") + fd_MsgUpdateParams_params = md_MsgUpdateParams.Fields().ByName("params") +} + +var _ protoreflect.Message = (*fastReflection_MsgUpdateParams)(nil) + +type fastReflection_MsgUpdateParams MsgUpdateParams + +func (x *MsgUpdateParams) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUpdateParams)(x) +} + +func (x *MsgUpdateParams) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_gateway_tx_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgUpdateParams_messageType fastReflection_MsgUpdateParams_messageType +var _ protoreflect.MessageType = fastReflection_MsgUpdateParams_messageType{} + +type fastReflection_MsgUpdateParams_messageType struct{} + +func (x fastReflection_MsgUpdateParams_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUpdateParams)(nil) +} +func (x fastReflection_MsgUpdateParams_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParams) +} +func (x fastReflection_MsgUpdateParams_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParams +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUpdateParams) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParams +} + +// 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_MsgUpdateParams) Type() protoreflect.MessageType { + return _fastReflection_MsgUpdateParams_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUpdateParams) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParams) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUpdateParams) Interface() protoreflect.ProtoMessage { + return (*MsgUpdateParams)(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_MsgUpdateParams) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Authority != "" { + value := protoreflect.ValueOfString(x.Authority) + if !f(fd_MsgUpdateParams_authority, value) { + return + } + } + if x.Params != nil { + value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + if !f(fd_MsgUpdateParams_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_MsgUpdateParams) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.gateway.MsgUpdateParams.authority": + return x.Authority != "" + case "poktroll.gateway.MsgUpdateParams.params": + return x.Params != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgUpdateParams 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_MsgUpdateParams) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.gateway.MsgUpdateParams.authority": + x.Authority = "" + case "poktroll.gateway.MsgUpdateParams.params": + x.Params = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgUpdateParams 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_MsgUpdateParams) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.gateway.MsgUpdateParams.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + case "poktroll.gateway.MsgUpdateParams.params": + value := x.Params + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgUpdateParams 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_MsgUpdateParams) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.gateway.MsgUpdateParams.authority": + x.Authority = value.Interface().(string) + case "poktroll.gateway.MsgUpdateParams.params": + x.Params = value.Message().Interface().(*Params) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgUpdateParams 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_MsgUpdateParams) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.gateway.MsgUpdateParams.params": + if x.Params == nil { + x.Params = new(Params) + } + return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + case "poktroll.gateway.MsgUpdateParams.authority": + panic(fmt.Errorf("field authority of message poktroll.gateway.MsgUpdateParams is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgUpdateParams 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_MsgUpdateParams) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.gateway.MsgUpdateParams.authority": + return protoreflect.ValueOfString("") + case "poktroll.gateway.MsgUpdateParams.params": + m := new(Params) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParams")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgUpdateParams 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_MsgUpdateParams) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.gateway.MsgUpdateParams", 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_MsgUpdateParams) 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_MsgUpdateParams) 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_MsgUpdateParams) 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_MsgUpdateParams) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgUpdateParams) + 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)) + } + if x.Params != nil { + l = options.Size(x.Params) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParams) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Params != nil { + encoded, err := options.Marshal(x.Params) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 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().(*MsgUpdateParams) + 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: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParams: 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 Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if x.Params == nil { + x.Params = &Params{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgUpdateParamsResponse protoreflect.MessageDescriptor +) + +func init() { + file_poktroll_gateway_tx_proto_init() + md_MsgUpdateParamsResponse = File_poktroll_gateway_tx_proto.Messages().ByName("MsgUpdateParamsResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgUpdateParamsResponse)(nil) + +type fastReflection_MsgUpdateParamsResponse MsgUpdateParamsResponse + +func (x *MsgUpdateParamsResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUpdateParamsResponse)(x) +} + +func (x *MsgUpdateParamsResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_gateway_tx_proto_msgTypes[1] + 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_MsgUpdateParamsResponse_messageType fastReflection_MsgUpdateParamsResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgUpdateParamsResponse_messageType{} + +type fastReflection_MsgUpdateParamsResponse_messageType struct{} + +func (x fastReflection_MsgUpdateParamsResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUpdateParamsResponse)(nil) +} +func (x fastReflection_MsgUpdateParamsResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParamsResponse) +} +func (x fastReflection_MsgUpdateParamsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParamsResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUpdateParamsResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateParamsResponse +} + +// 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_MsgUpdateParamsResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgUpdateParamsResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUpdateParamsResponse) New() protoreflect.Message { + return new(fastReflection_MsgUpdateParamsResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUpdateParamsResponse) Interface() protoreflect.ProtoMessage { + return (*MsgUpdateParamsResponse)(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_MsgUpdateParamsResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgUpdateParamsResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgUpdateParamsResponse 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_MsgUpdateParamsResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgUpdateParamsResponse 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_MsgUpdateParamsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgUpdateParamsResponse 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_MsgUpdateParamsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgUpdateParamsResponse 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_MsgUpdateParamsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgUpdateParamsResponse 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_MsgUpdateParamsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUpdateParamsResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgUpdateParamsResponse 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_MsgUpdateParamsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.gateway.MsgUpdateParamsResponse", 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_MsgUpdateParamsResponse) 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_MsgUpdateParamsResponse) 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_MsgUpdateParamsResponse) 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_MsgUpdateParamsResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgUpdateParamsResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParamsResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateParamsResponse) + 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: MsgUpdateParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/gateway/tx.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// MsgUpdateParams is the Msg/UpdateParams request type. +type MsgUpdateParams struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // authority is the address that controls the module (defaults to x/gov unless overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the module parameters to update. + // + // NOTE: All parameters must be supplied. + Params *Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty"` +} + +func (x *MsgUpdateParams) Reset() { + *x = MsgUpdateParams{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_gateway_tx_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUpdateParams) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUpdateParams) ProtoMessage() {} + +// Deprecated: Use MsgUpdateParams.ProtoReflect.Descriptor instead. +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return file_poktroll_gateway_tx_proto_rawDescGZIP(), []int{0} +} + +func (x *MsgUpdateParams) GetAuthority() string { + if x != nil { + return x.Authority + } + return "" +} + +func (x *MsgUpdateParams) GetParams() *Params { + if x != nil { + return x.Params + } + return nil +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +type MsgUpdateParamsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgUpdateParamsResponse) Reset() { + *x = MsgUpdateParamsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_gateway_tx_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUpdateParamsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUpdateParamsResponse) ProtoMessage() {} + +// Deprecated: Use MsgUpdateParamsResponse.ProtoReflect.Descriptor instead. +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return file_poktroll_gateway_tx_proto_rawDescGZIP(), []int{1} +} + +var File_poktroll_gateway_tx_proto protoreflect.FileDescriptor + +var file_poktroll_gateway_tx_proto_rawDesc = []byte{ + 0x0a, 0x19, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, + 0x61, 0x79, 0x2f, 0x74, 0x78, 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, 0x17, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x73, 0x67, 0x2f, 0x76, 0x31, 0x2f, + 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, + 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x70, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x70, 0x61, 0x72, + 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbd, 0x01, 0x0a, 0x0f, 0x4d, 0x73, + 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 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, 0x3b, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, + 0x02, 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, 0x42, + 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x3a, 0x35, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, + 0x74, 0x79, 0x8a, 0xe7, 0xb0, 0x2a, 0x22, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, + 0x78, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x19, 0x0a, 0x17, 0x4d, 0x73, 0x67, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x6a, 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, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, + 0x42, 0xa3, 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 ( + file_poktroll_gateway_tx_proto_rawDescOnce sync.Once + file_poktroll_gateway_tx_proto_rawDescData = file_poktroll_gateway_tx_proto_rawDesc +) + +func file_poktroll_gateway_tx_proto_rawDescGZIP() []byte { + file_poktroll_gateway_tx_proto_rawDescOnce.Do(func() { + file_poktroll_gateway_tx_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_gateway_tx_proto_rawDescData) + }) + return file_poktroll_gateway_tx_proto_rawDescData +} + +var file_poktroll_gateway_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_poktroll_gateway_tx_proto_goTypes = []interface{}{ + (*MsgUpdateParams)(nil), // 0: poktroll.gateway.MsgUpdateParams + (*MsgUpdateParamsResponse)(nil), // 1: poktroll.gateway.MsgUpdateParamsResponse + (*Params)(nil), // 2: poktroll.gateway.Params +} +var file_poktroll_gateway_tx_proto_depIdxs = []int32{ + 2, // 0: poktroll.gateway.MsgUpdateParams.params:type_name -> poktroll.gateway.Params + 0, // 1: poktroll.gateway.Msg.UpdateParams:input_type -> poktroll.gateway.MsgUpdateParams + 1, // 2: poktroll.gateway.Msg.UpdateParams:output_type -> poktroll.gateway.MsgUpdateParamsResponse + 2, // [2:3] is the sub-list for method output_type + 1, // [1:2] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_poktroll_gateway_tx_proto_init() } +func file_poktroll_gateway_tx_proto_init() { + if File_poktroll_gateway_tx_proto != nil { + return + } + file_poktroll_gateway_params_proto_init() + if !protoimpl.UnsafeEnabled { + file_poktroll_gateway_tx_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgUpdateParams); 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[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgUpdateParamsResponse); 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{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_gateway_tx_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_poktroll_gateway_tx_proto_goTypes, + DependencyIndexes: file_poktroll_gateway_tx_proto_depIdxs, + MessageInfos: file_poktroll_gateway_tx_proto_msgTypes, + }.Build() + File_poktroll_gateway_tx_proto = out.File + file_poktroll_gateway_tx_proto_rawDesc = nil + file_poktroll_gateway_tx_proto_goTypes = nil + file_poktroll_gateway_tx_proto_depIdxs = nil +} diff --git a/app/app.go b/app/app.go index 8f157015a..bd6c97d0f 100644 --- a/app/app.go +++ b/app/app.go @@ -53,6 +53,7 @@ import ( ibctransferkeeper "github.com/cosmos/ibc-go/v8/modules/apps/transfer/keeper" ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" + gatewaymodulekeeper "github.com/pokt-network/poktroll/x/gateway/keeper" // this line is used by starport scaffolding # stargate/app/moduleImport "github.com/pokt-network/poktroll/docs" @@ -117,6 +118,7 @@ type App struct { ScopedICAControllerKeeper capabilitykeeper.ScopedKeeper ScopedICAHostKeeper capabilitykeeper.ScopedKeeper + GatewayKeeper gatewaymodulekeeper.Keeper // this line is used by starport scaffolding # stargate/app/keeperDeclaration // simulation manager @@ -254,6 +256,7 @@ func New( &app.GroupKeeper, &app.ConsensusParamsKeeper, &app.CircuitBreakerKeeper, + &app.GatewayKeeper, // this line is used by starport scaffolding # stargate/app/keeperDefinition ); err != nil { panic(err) diff --git a/app/app_config.go b/app/app_config.go index 29f20c962..e8ac747e0 100644 --- a/app/app_config.go +++ b/app/app_config.go @@ -69,6 +69,9 @@ import ( ibcfeetypes "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types" ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" + gatewaymodulev1 "github.com/pokt-network/poktroll/api/poktroll/gateway/module" + _ "github.com/pokt-network/poktroll/x/gateway/module" // import for side-effects + gatewaymoduletypes "github.com/pokt-network/poktroll/x/gateway/types" "google.golang.org/protobuf/types/known/durationpb" // this line is used by starport scaffolding # stargate/app/moduleImport ) @@ -107,6 +110,7 @@ var ( consensusparamtypes.ModuleName, circuittypes.ModuleName, // chain modules + gatewaymoduletypes.ModuleName, // this line is used by starport scaffolding # stargate/app/initGenesis } @@ -131,6 +135,7 @@ var ( icatypes.ModuleName, ibcfeetypes.ModuleName, // chain modules + gatewaymoduletypes.ModuleName, // this line is used by starport scaffolding # stargate/app/beginBlockers } @@ -149,6 +154,7 @@ var ( icatypes.ModuleName, ibcfeetypes.ModuleName, // chain modules + gatewaymoduletypes.ModuleName, // this line is used by starport scaffolding # stargate/app/endBlockers } @@ -168,6 +174,7 @@ var ( {Account: ibctransfertypes.ModuleName, Permissions: []string{authtypes.Minter, authtypes.Burner}}, {Account: ibcfeetypes.ModuleName}, {Account: icatypes.ModuleName}, + {Account: gatewaymoduletypes.ModuleName, Permissions: []string{authtypes.Minter, authtypes.Burner, authtypes.Staking}}, // this line is used by starport scaffolding # stargate/app/maccPerms } @@ -298,6 +305,10 @@ var ( Name: circuittypes.ModuleName, Config: appconfig.WrapAny(&circuitmodulev1.Module{}), }, + { + Name: gatewaymoduletypes.ModuleName, + Config: appconfig.WrapAny(&gatewaymodulev1.Module{}), + }, // this line is used by starport scaffolding # stargate/app/moduleConfig }, }) diff --git a/go.mod b/go.mod index 4dcf1553b..8efea2720 100644 --- a/go.mod +++ b/go.mod @@ -16,6 +16,7 @@ require ( cosmossdk.io/client/v2 v2.0.0-beta.1 cosmossdk.io/core v0.11.0 cosmossdk.io/depinject v1.0.0-alpha.4 + cosmossdk.io/errors v1.0.0 cosmossdk.io/log v1.2.1 cosmossdk.io/store v1.0.1 cosmossdk.io/tools/confix v0.1.1 @@ -54,7 +55,6 @@ require ( connectrpc.com/connect v1.14.0 // indirect connectrpc.com/otelconnect v0.7.0 // indirect cosmossdk.io/collections v0.4.0 // indirect - cosmossdk.io/errors v1.0.0 // indirect cosmossdk.io/math v1.2.0 // indirect cosmossdk.io/x/tx v0.12.0 // indirect filippo.io/edwards25519 v1.0.0 // indirect diff --git a/proto/poktroll/gateway/genesis.proto b/proto/poktroll/gateway/genesis.proto new file mode 100644 index 000000000..bfd16472f --- /dev/null +++ b/proto/poktroll/gateway/genesis.proto @@ -0,0 +1,17 @@ +syntax = "proto3"; +package poktroll.gateway; + +import "amino/amino.proto"; +import "gogoproto/gogo.proto"; +import "poktroll/gateway/params.proto"; + +option go_package = "github.com/pokt-network/poktroll/x/gateway/types"; + +// GenesisState defines the gateway module's genesis state. +message GenesisState { + // params defines all the parameters of the module. + Params params = 1 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; +} diff --git a/proto/poktroll/gateway/module/module.proto b/proto/poktroll/gateway/module/module.proto new file mode 100644 index 000000000..a60bd4c46 --- /dev/null +++ b/proto/poktroll/gateway/module/module.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; +package poktroll.gateway.module; + +import "cosmos/app/v1alpha1/module.proto"; + +// Module is the config object for the module. +message Module { + option (cosmos.app.v1alpha1.module) = { + go_import: "github.com/pokt-network/poktroll/x/gateway" + }; + + // authority defines the custom module authority. If not set, defaults to the governance module. + string authority = 1; +} \ No newline at end of file diff --git a/proto/poktroll/gateway/params.proto b/proto/poktroll/gateway/params.proto new file mode 100644 index 000000000..9a4c44b81 --- /dev/null +++ b/proto/poktroll/gateway/params.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; +package poktroll.gateway; + +import "amino/amino.proto"; +import "gogoproto/gogo.proto"; + +option go_package = "github.com/pokt-network/poktroll/x/gateway/types"; + +// Params defines the parameters for the module. +message Params { + option (amino.name) = "poktroll/x/gateway/Params"; + option (gogoproto.equal) = true; + + +} \ No newline at end of file diff --git a/proto/poktroll/gateway/query.proto b/proto/poktroll/gateway/query.proto new file mode 100644 index 000000000..a14a8a778 --- /dev/null +++ b/proto/poktroll/gateway/query.proto @@ -0,0 +1,30 @@ +syntax = "proto3"; +package poktroll.gateway; + +import "amino/amino.proto"; +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; +import "poktroll/gateway/params.proto"; + +option go_package = "github.com/pokt-network/poktroll/x/gateway/types"; + +// Query defines the gRPC querier service. +service Query { + // Parameters queries the parameters of the module. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/pokt-network/poktroll/gateway/params"; + } +} + +// QueryParamsRequest is request type for the Query/Params RPC method. +message QueryParamsRequest {} + +// QueryParamsResponse is response type for the Query/Params RPC method. +message QueryParamsResponse { + // params holds all the parameters of this module. + Params params = 1 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; +} \ No newline at end of file diff --git a/proto/poktroll/gateway/tx.proto b/proto/poktroll/gateway/tx.proto new file mode 100644 index 000000000..8d78d1901 --- /dev/null +++ b/proto/poktroll/gateway/tx.proto @@ -0,0 +1,40 @@ +syntax = "proto3"; +package poktroll.gateway; + +import "amino/amino.proto"; +import "cosmos/msg/v1/msg.proto"; +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; +import "poktroll/gateway/params.proto"; + +option go_package = "github.com/pokt-network/poktroll/x/gateway/types"; + +// Msg defines the Msg service. +service Msg { + option (cosmos.msg.v1.service) = true; + + // UpdateParams defines a (governance) operation for updating the module + // parameters. The authority defaults to the x/gov module account. + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); +} + +// MsgUpdateParams is the Msg/UpdateParams request type. +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"]; + + // params defines the module parameters to update. + // + // NOTE: All parameters must be supplied. + Params params = 2 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +message MsgUpdateParamsResponse {} \ No newline at end of file diff --git a/testutil/keeper/gateway.go b/testutil/keeper/gateway.go new file mode 100644 index 000000000..23407f4f2 --- /dev/null +++ b/testutil/keeper/gateway.go @@ -0,0 +1,50 @@ +package keeper + +import ( + "testing" + + "cosmossdk.io/log" + "cosmossdk.io/store" + "cosmossdk.io/store/metrics" + storetypes "cosmossdk.io/store/types" + cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" + dbm "github.com/cosmos/cosmos-db" + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/runtime" + sdk "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/x/gateway/keeper" + "github.com/pokt-network/poktroll/x/gateway/types" +) + +func GatewayKeeper(t testing.TB) (keeper.Keeper, sdk.Context) { + storeKey := storetypes.NewKVStoreKey(types.StoreKey) + + db := dbm.NewMemDB() + stateStore := store.NewCommitMultiStore(db, log.NewNopLogger(), metrics.NewNoOpMetrics()) + stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) + require.NoError(t, stateStore.LoadLatestVersion()) + + registry := codectypes.NewInterfaceRegistry() + cdc := codec.NewProtoCodec(registry) + authority := authtypes.NewModuleAddress(govtypes.ModuleName) + + k := keeper.NewKeeper( + cdc, + runtime.NewKVStoreService(storeKey), + log.NewNopLogger(), + authority.String(), + nil, + ) + + ctx := sdk.NewContext(stateStore, cmtproto.Header{}, false, log.NewNopLogger()) + + // Initialize params + k.SetParams(ctx, types.DefaultParams()) + + return k, ctx +} diff --git a/x/gateway/keeper/keeper.go b/x/gateway/keeper/keeper.go new file mode 100644 index 000000000..e5bd0187e --- /dev/null +++ b/x/gateway/keeper/keeper.go @@ -0,0 +1,58 @@ +package keeper + +import ( + "fmt" + + "cosmossdk.io/core/store" + "cosmossdk.io/log" + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/pokt-network/poktroll/x/gateway/types" +) + +type ( + Keeper struct { + cdc codec.BinaryCodec + storeService store.KVStoreService + logger log.Logger + + // the address capable of executing a MsgUpdateParams message. Typically, this + // should be the x/gov module account. + authority string + + bankKeeper types.BankKeeper + } +) + +func NewKeeper( + cdc codec.BinaryCodec, + storeService store.KVStoreService, + logger log.Logger, + authority string, + + bankKeeper types.BankKeeper, +) Keeper { + if _, err := sdk.AccAddressFromBech32(authority); err != nil { + panic(fmt.Sprintf("invalid authority address: %s", authority)) + } + + return Keeper{ + cdc: cdc, + storeService: storeService, + authority: authority, + logger: logger, + + bankKeeper: bankKeeper, + } +} + +// GetAuthority returns the module's authority. +func (k Keeper) GetAuthority() string { + return k.authority +} + +// Logger returns a module-specific logger. +func (k Keeper) Logger() log.Logger { + return k.logger.With("module", fmt.Sprintf("x/%s", types.ModuleName)) +} diff --git a/x/gateway/keeper/msg_server.go b/x/gateway/keeper/msg_server.go new file mode 100644 index 000000000..fafeff27b --- /dev/null +++ b/x/gateway/keeper/msg_server.go @@ -0,0 +1,17 @@ +package keeper + +import ( + "github.com/pokt-network/poktroll/x/gateway/types" +) + +type msgServer struct { + Keeper +} + +// NewMsgServerImpl returns an implementation of the MsgServer interface +// for the provided Keeper. +func NewMsgServerImpl(keeper Keeper) types.MsgServer { + return &msgServer{Keeper: keeper} +} + +var _ types.MsgServer = msgServer{} diff --git a/x/gateway/keeper/msg_server_test.go b/x/gateway/keeper/msg_server_test.go new file mode 100644 index 000000000..64fa7a9d3 --- /dev/null +++ b/x/gateway/keeper/msg_server_test.go @@ -0,0 +1,24 @@ +package keeper_test + +import ( + "context" + "testing" + + "github.com/stretchr/testify/require" + + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/x/gateway/keeper" + "github.com/pokt-network/poktroll/x/gateway/types" +) + +func setupMsgServer(t testing.TB) (keeper.Keeper, types.MsgServer, context.Context) { + k, ctx := keepertest.GatewayKeeper(t) + return k, keeper.NewMsgServerImpl(k), ctx +} + +func TestMsgServer(t *testing.T) { + k, ms, ctx := setupMsgServer(t) + require.NotNil(t, ms) + require.NotNil(t, ctx) + require.NotEmpty(t, k) +} diff --git a/x/gateway/keeper/msg_update_params.go b/x/gateway/keeper/msg_update_params.go new file mode 100644 index 000000000..d79ee2dee --- /dev/null +++ b/x/gateway/keeper/msg_update_params.go @@ -0,0 +1,23 @@ +package keeper + +import ( + "context" + + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/pokt-network/poktroll/x/gateway/types" +) + +func (k msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { + if k.GetAuthority() != req.Authority { + return nil, errorsmod.Wrapf(types.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.GetAuthority(), req.Authority) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + if err := k.SetParams(ctx, req.Params); err != nil { + return nil, err + } + + return &types.MsgUpdateParamsResponse{}, nil +} diff --git a/x/gateway/keeper/msg_update_params_test.go b/x/gateway/keeper/msg_update_params_test.go new file mode 100644 index 000000000..80ab28696 --- /dev/null +++ b/x/gateway/keeper/msg_update_params_test.go @@ -0,0 +1,64 @@ +package keeper_test + +import ( + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/x/gateway/types" +) + +func TestMsgUpdateParams(t *testing.T) { + k, ms, ctx := setupMsgServer(t) + params := types.DefaultParams() + require.NoError(t, k.SetParams(ctx, params)) + wctx := sdk.UnwrapSDKContext(ctx) + + // default params + testCases := []struct { + name string + input *types.MsgUpdateParams + expErr bool + expErrMsg string + }{ + { + name: "invalid authority", + input: &types.MsgUpdateParams{ + Authority: "invalid", + Params: params, + }, + expErr: true, + expErrMsg: "invalid authority", + }, + { + name: "send enabled param", + input: &types.MsgUpdateParams{ + Authority: k.GetAuthority(), + Params: types.Params{}, + }, + expErr: false, + }, + { + name: "all good", + input: &types.MsgUpdateParams{ + Authority: k.GetAuthority(), + Params: params, + }, + expErr: false, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + _, err := ms.UpdateParams(wctx, tc.input) + + if tc.expErr { + require.Error(t, err) + require.Contains(t, err.Error(), tc.expErrMsg) + } else { + require.NoError(t, err) + } + }) + } +} diff --git a/x/gateway/keeper/params.go b/x/gateway/keeper/params.go new file mode 100644 index 000000000..7a720a898 --- /dev/null +++ b/x/gateway/keeper/params.go @@ -0,0 +1,33 @@ +package keeper + +import ( + "context" + + "github.com/cosmos/cosmos-sdk/runtime" + + "github.com/pokt-network/poktroll/x/gateway/types" +) + +// GetParams get all parameters as types.Params +func (k Keeper) GetParams(ctx context.Context) (params types.Params) { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + bz := store.Get(types.ParamsKey) + if bz == nil { + return params + } + + k.cdc.MustUnmarshal(bz, ¶ms) + return params +} + +// SetParams set the params +func (k Keeper) SetParams(ctx context.Context, params types.Params) error { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + bz, err := k.cdc.Marshal(¶ms) + if err != nil { + return err + } + store.Set(types.ParamsKey, bz) + + return nil +} diff --git a/x/gateway/keeper/params_test.go b/x/gateway/keeper/params_test.go new file mode 100644 index 000000000..7d4c17132 --- /dev/null +++ b/x/gateway/keeper/params_test.go @@ -0,0 +1,18 @@ +package keeper_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/x/gateway/types" +) + +func TestGetParams(t *testing.T) { + k, ctx := keepertest.GatewayKeeper(t) + params := types.DefaultParams() + + require.NoError(t, k.SetParams(ctx, params)) + require.EqualValues(t, params, k.GetParams(ctx)) +} diff --git a/x/gateway/keeper/query.go b/x/gateway/keeper/query.go new file mode 100644 index 000000000..ffa80d00d --- /dev/null +++ b/x/gateway/keeper/query.go @@ -0,0 +1,7 @@ +package keeper + +import ( + "github.com/pokt-network/poktroll/x/gateway/types" +) + +var _ types.QueryServer = Keeper{} diff --git a/x/gateway/keeper/query_params.go b/x/gateway/keeper/query_params.go new file mode 100644 index 000000000..8d3afe26d --- /dev/null +++ b/x/gateway/keeper/query_params.go @@ -0,0 +1,20 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/pokt-network/poktroll/x/gateway/types" +) + +func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(goCtx) + + return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil +} diff --git a/x/gateway/keeper/query_params_test.go b/x/gateway/keeper/query_params_test.go new file mode 100644 index 000000000..c24ed298a --- /dev/null +++ b/x/gateway/keeper/query_params_test.go @@ -0,0 +1,20 @@ +package keeper_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/x/gateway/types" +) + +func TestParamsQuery(t *testing.T) { + keeper, ctx := keepertest.GatewayKeeper(t) + params := types.DefaultParams() + require.NoError(t, keeper.SetParams(ctx, params)) + + response, err := keeper.Params(ctx, &types.QueryParamsRequest{}) + require.NoError(t, err) + require.Equal(t, &types.QueryParamsResponse{Params: params}, response) +} diff --git a/x/gateway/module/autocli.go b/x/gateway/module/autocli.go new file mode 100644 index 000000000..2bc32c3cc --- /dev/null +++ b/x/gateway/module/autocli.go @@ -0,0 +1,35 @@ +package gateway + +import ( + autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" + + modulev1 "github.com/pokt-network/poktroll/api/poktroll/gateway" +) + +// AutoCLIOptions implements the autocli.HasAutoCLIConfig interface. +func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { + return &autocliv1.ModuleOptions{ + Query: &autocliv1.ServiceCommandDescriptor{ + Service: modulev1.Query_ServiceDesc.ServiceName, + RpcCommandOptions: []*autocliv1.RpcCommandOptions{ + { + RpcMethod: "Params", + Use: "params", + Short: "Shows the parameters of the module", + }, + // this line is used by ignite scaffolding # autocli/query + }, + }, + Tx: &autocliv1.ServiceCommandDescriptor{ + Service: modulev1.Msg_ServiceDesc.ServiceName, + EnhanceCustomCommand: true, // only required if you want to use the custom command + RpcCommandOptions: []*autocliv1.RpcCommandOptions{ + { + RpcMethod: "UpdateParams", + Skip: true, // skipped because authority gated + }, + // this line is used by ignite scaffolding # autocli/tx + }, + }, + } +} diff --git a/x/gateway/module/genesis.go b/x/gateway/module/genesis.go new file mode 100644 index 000000000..4bb2d6ef9 --- /dev/null +++ b/x/gateway/module/genesis.go @@ -0,0 +1,24 @@ +package gateway + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/pokt-network/poktroll/x/gateway/keeper" + "github.com/pokt-network/poktroll/x/gateway/types" +) + +// InitGenesis initializes the module's state from a provided genesis state. +func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { + // this line is used by starport scaffolding # genesis/module/init + k.SetParams(ctx, genState.Params) +} + +// ExportGenesis returns the module's exported genesis. +func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { + genesis := types.DefaultGenesis() + genesis.Params = k.GetParams(ctx) + + // this line is used by starport scaffolding # genesis/module/export + + return genesis +} diff --git a/x/gateway/module/genesis_test.go b/x/gateway/module/genesis_test.go new file mode 100644 index 000000000..0df041a76 --- /dev/null +++ b/x/gateway/module/genesis_test.go @@ -0,0 +1,29 @@ +package gateway_test + +import ( + "testing" + + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/testutil/nullify" + "github.com/pokt-network/poktroll/x/gateway/module" + "github.com/pokt-network/poktroll/x/gateway/types" + "github.com/stretchr/testify/require" +) + +func TestGenesis(t *testing.T) { + genesisState := types.GenesisState{ + Params: types.DefaultParams(), + + // this line is used by starport scaffolding # genesis/test/state + } + + k, ctx := keepertest.GatewayKeeper(t) + gateway.InitGenesis(ctx, k, genesisState) + got := gateway.ExportGenesis(ctx, k) + require.NotNil(t, got) + + nullify.Fill(&genesisState) + nullify.Fill(got) + + // this line is used by starport scaffolding # genesis/test/assert +} diff --git a/x/gateway/module/module.go b/x/gateway/module/module.go new file mode 100644 index 000000000..0294e85cc --- /dev/null +++ b/x/gateway/module/module.go @@ -0,0 +1,215 @@ +package gateway + +import ( + "context" + "encoding/json" + "fmt" + + "cosmossdk.io/core/appmodule" + "cosmossdk.io/core/store" + "cosmossdk.io/depinject" + "cosmossdk.io/log" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + + // this line is used by starport scaffolding # 1 + + modulev1 "github.com/pokt-network/poktroll/api/poktroll/gateway/module" + "github.com/pokt-network/poktroll/x/gateway/keeper" + "github.com/pokt-network/poktroll/x/gateway/types" +) + +var ( + _ module.AppModuleBasic = (*AppModule)(nil) + _ module.AppModuleSimulation = (*AppModule)(nil) + _ module.HasGenesis = (*AppModule)(nil) + _ module.HasInvariants = (*AppModule)(nil) + _ module.HasConsensusVersion = (*AppModule)(nil) + + _ appmodule.AppModule = (*AppModule)(nil) + _ appmodule.HasBeginBlocker = (*AppModule)(nil) + _ appmodule.HasEndBlocker = (*AppModule)(nil) +) + +// ---------------------------------------------------------------------------- +// AppModuleBasic +// ---------------------------------------------------------------------------- + +// AppModuleBasic implements the AppModuleBasic interface that defines the +// independent methods a Cosmos SDK module needs to implement. +type AppModuleBasic struct { + cdc codec.BinaryCodec +} + +func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic { + return AppModuleBasic{cdc: cdc} +} + +// Name returns the name of the module as a string. +func (AppModuleBasic) Name() string { + return types.ModuleName +} + +// RegisterLegacyAminoCodec registers the amino codec for the module, which is used +// to marshal and unmarshal structs to/from []byte in order to persist them in the module's KVStore. +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {} + +// RegisterInterfaces registers a module's interface types and their concrete implementations as proto.Message. +func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { + types.RegisterInterfaces(reg) +} + +// DefaultGenesis returns a default GenesisState for the module, marshalled to json.RawMessage. +// The default GenesisState need to be defined by the module developer and is primarily used for testing. +func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + return cdc.MustMarshalJSON(types.DefaultGenesis()) +} + +// ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form. +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { + var genState types.GenesisState + if err := cdc.UnmarshalJSON(bz, &genState); err != nil { + return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) + } + return genState.Validate() +} + +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. +func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { + if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil { + panic(err) + } +} + +// ---------------------------------------------------------------------------- +// AppModule +// ---------------------------------------------------------------------------- + +// AppModule implements the AppModule interface that defines the inter-dependent methods that modules need to implement +type AppModule struct { + AppModuleBasic + + keeper keeper.Keeper + accountKeeper types.AccountKeeper + bankKeeper types.BankKeeper +} + +func NewAppModule( + cdc codec.Codec, + keeper keeper.Keeper, + accountKeeper types.AccountKeeper, + bankKeeper types.BankKeeper, +) AppModule { + return AppModule{ + AppModuleBasic: NewAppModuleBasic(cdc), + keeper: keeper, + accountKeeper: accountKeeper, + bankKeeper: bankKeeper, + } +} + +// RegisterServices registers a gRPC query service to respond to the module-specific gRPC queries +func (am AppModule) RegisterServices(cfg module.Configurator) { + types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) + types.RegisterQueryServer(cfg.QueryServer(), am.keeper) +} + +// RegisterInvariants registers the invariants of the module. If an invariant deviates from its predicted value, the InvariantRegistry triggers appropriate logic (most often the chain will be halted) +func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} + +// InitGenesis performs the module's genesis initialization. It returns no validator updates. +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) { + var genState types.GenesisState + // Initialize global index to index in genesis state + cdc.MustUnmarshalJSON(gs, &genState) + + InitGenesis(ctx, am.keeper, genState) +} + +// ExportGenesis returns the module's exported genesis state as raw JSON bytes. +func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { + genState := ExportGenesis(ctx, am.keeper) + return cdc.MustMarshalJSON(genState) +} + +// ConsensusVersion is a sequence number for state-breaking change of the module. +// It should be incremented on each consensus-breaking change introduced by the module. +// To avoid wrong/empty versions, the initial version should be set to 1. +func (AppModule) ConsensusVersion() uint64 { return 1 } + +// BeginBlock contains the logic that is automatically triggered at the beginning of each block. +// The begin block implementation is optional. +func (am AppModule) BeginBlock(_ context.Context) error { + return nil +} + +// EndBlock contains the logic that is automatically triggered at the end of each block. +// The end block implementation is optional. +func (am AppModule) EndBlock(_ context.Context) error { + return nil +} + +// IsOnePerModuleType implements the depinject.OnePerModuleType interface. +func (am AppModule) IsOnePerModuleType() {} + +// IsAppModule implements the appmodule.AppModule interface. +func (am AppModule) IsAppModule() {} + +// ---------------------------------------------------------------------------- +// App Wiring Setup +// ---------------------------------------------------------------------------- + +func init() { + appmodule.Register( + &modulev1.Module{}, + appmodule.Provide(ProvideModule), + ) +} + +type ModuleInputs struct { + depinject.In + + StoreService store.KVStoreService + Cdc codec.Codec + Config *modulev1.Module + Logger log.Logger + + AccountKeeper types.AccountKeeper + BankKeeper types.BankKeeper +} + +type ModuleOutputs struct { + depinject.Out + + GatewayKeeper keeper.Keeper + Module appmodule.AppModule +} + +func ProvideModule(in ModuleInputs) ModuleOutputs { + // default to governance authority if not provided + authority := authtypes.NewModuleAddress(govtypes.ModuleName) + if in.Config.Authority != "" { + authority = authtypes.NewModuleAddressOrBech32Address(in.Config.Authority) + } + k := keeper.NewKeeper( + in.Cdc, + in.StoreService, + in.Logger, + authority.String(), + in.BankKeeper, + ) + m := NewAppModule( + in.Cdc, + k, + in.AccountKeeper, + in.BankKeeper, + ) + + return ModuleOutputs{GatewayKeeper: k, Module: m} +} diff --git a/x/gateway/module/simulation.go b/x/gateway/module/simulation.go new file mode 100644 index 000000000..2d04c9d93 --- /dev/null +++ b/x/gateway/module/simulation.go @@ -0,0 +1,64 @@ +package gateway + +import ( + "math/rand" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/cosmos/cosmos-sdk/x/simulation" + + "github.com/pokt-network/poktroll/testutil/sample" + gatewaysimulation "github.com/pokt-network/poktroll/x/gateway/simulation" + "github.com/pokt-network/poktroll/x/gateway/types" +) + +// avoid unused import issue +var ( + _ = gatewaysimulation.FindAccount + _ = rand.Rand{} + _ = sample.AccAddress + _ = sdk.AccAddress{} + _ = simulation.MsgEntryKind +) + +const ( +// this line is used by starport scaffolding # simapp/module/const +) + +// GenerateGenesisState creates a randomized GenState of the module. +func (AppModule) GenerateGenesisState(simState *module.SimulationState) { + accs := make([]string, len(simState.Accounts)) + for i, acc := range simState.Accounts { + accs[i] = acc.Address.String() + } + gatewayGenesis := types.GenesisState{ + Params: types.DefaultParams(), + // this line is used by starport scaffolding # simapp/module/genesisState + } + simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&gatewayGenesis) +} + +// RegisterStoreDecoder registers a decoder. +func (am AppModule) RegisterStoreDecoder(_ simtypes.StoreDecoderRegistry) {} + +// ProposalContents doesn't return any content functions for governance proposals. +func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { + return nil +} + +// WeightedOperations returns the all the gov module operations with their respective weights. +func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { + operations := make([]simtypes.WeightedOperation, 0) + + // this line is used by starport scaffolding # simapp/module/operation + + return operations +} + +// ProposalMsgs returns msgs used for governance proposals for simulations. +func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg { + return []simtypes.WeightedProposalMsg{ + // this line is used by starport scaffolding # simapp/module/OpMsg + } +} diff --git a/x/gateway/simulation/helpers.go b/x/gateway/simulation/helpers.go new file mode 100644 index 000000000..92c437c0d --- /dev/null +++ b/x/gateway/simulation/helpers.go @@ -0,0 +1,15 @@ +package simulation + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" +) + +// FindAccount find a specific address from an account list +func FindAccount(accs []simtypes.Account, address string) (simtypes.Account, bool) { + creator, err := sdk.AccAddressFromBech32(address) + if err != nil { + panic(err) + } + return simtypes.FindAccount(accs, creator) +} diff --git a/x/gateway/types/codec.go b/x/gateway/types/codec.go new file mode 100644 index 000000000..ac5526374 --- /dev/null +++ b/x/gateway/types/codec.go @@ -0,0 +1,17 @@ +package types + +import ( + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" + // this line is used by starport scaffolding # 1 +) + +func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { + // this line is used by starport scaffolding # 3 + + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgUpdateParams{}, + ) + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) +} diff --git a/x/gateway/types/errors.go b/x/gateway/types/errors.go new file mode 100644 index 000000000..e48f9a1ab --- /dev/null +++ b/x/gateway/types/errors.go @@ -0,0 +1,13 @@ +package types + +// DONTCOVER + +import ( + sdkerrors "cosmossdk.io/errors" +) + +// x/gateway module sentinel errors +var ( + ErrInvalidSigner = sdkerrors.Register(ModuleName, 1100, "expected gov account as only signer for proposal message") + ErrSample = sdkerrors.Register(ModuleName, 1101, "sample error") +) diff --git a/x/gateway/types/expected_keepers.go b/x/gateway/types/expected_keepers.go new file mode 100644 index 000000000..4a50d01a9 --- /dev/null +++ b/x/gateway/types/expected_keepers.go @@ -0,0 +1,25 @@ +package types + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// AccountKeeper defines the expected interface for the Account module. +type AccountKeeper interface { + GetAccount(context.Context, sdk.AccAddress) sdk.AccountI // only used for simulation + // Methods imported from account should be defined here +} + +// BankKeeper defines the expected interface for the Bank module. +type BankKeeper interface { + SpendableCoins(context.Context, sdk.AccAddress) sdk.Coins + // Methods imported from bank should be defined here +} + +// ParamSubspace defines the expected Subspace interface for parameters. +type ParamSubspace interface { + Get(context.Context, []byte, interface{}) + Set(context.Context, []byte, interface{}) +} diff --git a/x/gateway/types/genesis.go b/x/gateway/types/genesis.go new file mode 100644 index 000000000..0af9b4416 --- /dev/null +++ b/x/gateway/types/genesis.go @@ -0,0 +1,24 @@ +package types + +import ( +// this line is used by starport scaffolding # genesis/types/import +) + +// DefaultIndex is the default global index +const DefaultIndex uint64 = 1 + +// DefaultGenesis returns the default genesis state +func DefaultGenesis() *GenesisState { + return &GenesisState{ + // this line is used by starport scaffolding # genesis/types/default + Params: DefaultParams(), + } +} + +// Validate performs basic genesis state validation returning an error upon any +// failure. +func (gs GenesisState) Validate() error { + // this line is used by starport scaffolding # genesis/types/validate + + return gs.Params.Validate() +} diff --git a/x/gateway/types/genesis_test.go b/x/gateway/types/genesis_test.go new file mode 100644 index 000000000..b4fce8cdc --- /dev/null +++ b/x/gateway/types/genesis_test.go @@ -0,0 +1,41 @@ +package types_test + +import ( + "testing" + + "github.com/pokt-network/poktroll/x/gateway/types" + "github.com/stretchr/testify/require" +) + +func TestGenesisState_Validate(t *testing.T) { + tests := []struct { + desc string + genState *types.GenesisState + valid bool + }{ + { + desc: "default is valid", + genState: types.DefaultGenesis(), + valid: true, + }, + { + desc: "valid genesis state", + genState: &types.GenesisState{ + + // this line is used by starport scaffolding # types/genesis/validField + }, + valid: true, + }, + // this line is used by starport scaffolding # types/genesis/testcase + } + for _, tc := range tests { + t.Run(tc.desc, func(t *testing.T) { + err := tc.genState.Validate() + if tc.valid { + require.NoError(t, err) + } else { + require.Error(t, err) + } + }) + } +} diff --git a/x/gateway/types/keys.go b/x/gateway/types/keys.go new file mode 100644 index 000000000..4d65ff460 --- /dev/null +++ b/x/gateway/types/keys.go @@ -0,0 +1,20 @@ +package types + +const ( + // ModuleName defines the module name + ModuleName = "gateway" + + // StoreKey defines the primary module store key + StoreKey = ModuleName + + // MemStoreKey defines the in-memory store key + MemStoreKey = "mem_gateway" +) + +var ( + ParamsKey = []byte("p_gateway") +) + +func KeyPrefix(p string) []byte { + return []byte(p) +} diff --git a/x/gateway/types/msg_update_params.go b/x/gateway/types/msg_update_params.go new file mode 100644 index 000000000..e36d023de --- /dev/null +++ b/x/gateway/types/msg_update_params.go @@ -0,0 +1,21 @@ +package types + +import ( + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +var _ sdk.Msg = &MsgUpdateParams{} + +// ValidateBasic does a sanity check on the provided data. +func (m *MsgUpdateParams) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { + return errorsmod.Wrap(err, "invalid authority address") + } + + if err := m.Params.Validate(); err != nil { + return err + } + + return nil +} diff --git a/x/gateway/types/params.go b/x/gateway/types/params.go new file mode 100644 index 000000000..4f3215e35 --- /dev/null +++ b/x/gateway/types/params.go @@ -0,0 +1,32 @@ +package types + +import ( + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" +) + +var _ paramtypes.ParamSet = (*Params)(nil) + +// ParamKeyTable the param key table for launch module +func ParamKeyTable() paramtypes.KeyTable { + return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) +} + +// NewParams creates a new Params instance +func NewParams() Params { + return Params{} +} + +// DefaultParams returns a default set of parameters +func DefaultParams() Params { + return NewParams() +} + +// ParamSetPairs get the params.ParamSet +func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { + return paramtypes.ParamSetPairs{} +} + +// Validate validates the set of params +func (p Params) Validate() error { + return nil +} diff --git a/x/gateway/types/types.go b/x/gateway/types/types.go new file mode 100644 index 000000000..ab1254f4c --- /dev/null +++ b/x/gateway/types/types.go @@ -0,0 +1 @@ +package types From 51c62d489e22ae9292f51fe946c17e222691b6c0 Mon Sep 17 00:00:00 2001 From: Redouane Lakrache Date: Thu, 8 Feb 2024 06:57:31 +0100 Subject: [PATCH 02/10] scaffold: map gateway --module gateway ignite scaffold map gateway stake:coin --module gateway --no-message --index address --signer address --- api/poktroll/gateway/gateway.pulsar.go | 664 +++++++ api/poktroll/gateway/genesis.pulsar.go | 203 ++- api/poktroll/gateway/query.pulsar.go | 2194 +++++++++++++++++++++++- proto/poktroll/gateway/gateway.proto | 13 + proto/poktroll/gateway/genesis.proto | 10 +- proto/poktroll/gateway/query.proto | 44 +- x/gateway/keeper/gateway.go | 70 + x/gateway/keeper/gateway_test.go | 63 + x/gateway/keeper/query_gateway.go | 55 + x/gateway/keeper/query_gateway_test.go | 124 ++ x/gateway/module/autocli.go | 11 + x/gateway/module/genesis.go | 5 + x/gateway/module/genesis_test.go | 9 + x/gateway/types/genesis.go | 13 +- x/gateway/types/genesis_test.go | 24 +- x/gateway/types/key_gateway.go | 23 + 16 files changed, 3453 insertions(+), 72 deletions(-) create mode 100644 api/poktroll/gateway/gateway.pulsar.go create mode 100644 proto/poktroll/gateway/gateway.proto create mode 100644 x/gateway/keeper/gateway.go create mode 100644 x/gateway/keeper/gateway_test.go create mode 100644 x/gateway/keeper/query_gateway.go create mode 100644 x/gateway/keeper/query_gateway_test.go create mode 100644 x/gateway/types/key_gateway.go diff --git a/api/poktroll/gateway/gateway.pulsar.go b/api/poktroll/gateway/gateway.pulsar.go new file mode 100644 index 000000000..e7fdcbe74 --- /dev/null +++ b/api/poktroll/gateway/gateway.pulsar.go @@ -0,0 +1,664 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package gateway + +import ( + v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_Gateway protoreflect.MessageDescriptor + fd_Gateway_address protoreflect.FieldDescriptor + fd_Gateway_stake protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_gateway_gateway_proto_init() + md_Gateway = File_poktroll_gateway_gateway_proto.Messages().ByName("Gateway") + fd_Gateway_address = md_Gateway.Fields().ByName("address") + fd_Gateway_stake = md_Gateway.Fields().ByName("stake") +} + +var _ protoreflect.Message = (*fastReflection_Gateway)(nil) + +type fastReflection_Gateway Gateway + +func (x *Gateway) ProtoReflect() protoreflect.Message { + return (*fastReflection_Gateway)(x) +} + +func (x *Gateway) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_gateway_gateway_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_Gateway_messageType fastReflection_Gateway_messageType +var _ protoreflect.MessageType = fastReflection_Gateway_messageType{} + +type fastReflection_Gateway_messageType struct{} + +func (x fastReflection_Gateway_messageType) Zero() protoreflect.Message { + return (*fastReflection_Gateway)(nil) +} +func (x fastReflection_Gateway_messageType) New() protoreflect.Message { + return new(fastReflection_Gateway) +} +func (x fastReflection_Gateway_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_Gateway +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_Gateway) Descriptor() protoreflect.MessageDescriptor { + return md_Gateway +} + +// 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_Gateway) Type() protoreflect.MessageType { + return _fastReflection_Gateway_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_Gateway) New() protoreflect.Message { + return new(fastReflection_Gateway) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_Gateway) Interface() protoreflect.ProtoMessage { + return (*Gateway)(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_Gateway) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Address != "" { + value := protoreflect.ValueOfString(x.Address) + if !f(fd_Gateway_address, value) { + return + } + } + if x.Stake != nil { + value := protoreflect.ValueOfMessage(x.Stake.ProtoReflect()) + if !f(fd_Gateway_stake, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_Gateway) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.gateway.Gateway.address": + return x.Address != "" + case "poktroll.gateway.Gateway.stake": + return x.Stake != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.Gateway")) + } + panic(fmt.Errorf("message poktroll.gateway.Gateway 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_Gateway) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.gateway.Gateway.address": + x.Address = "" + case "poktroll.gateway.Gateway.stake": + x.Stake = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.Gateway")) + } + panic(fmt.Errorf("message poktroll.gateway.Gateway 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_Gateway) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.gateway.Gateway.address": + value := x.Address + return protoreflect.ValueOfString(value) + case "poktroll.gateway.Gateway.stake": + value := x.Stake + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.Gateway")) + } + panic(fmt.Errorf("message poktroll.gateway.Gateway 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_Gateway) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.gateway.Gateway.address": + x.Address = value.Interface().(string) + case "poktroll.gateway.Gateway.stake": + x.Stake = value.Message().Interface().(*v1beta1.Coin) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.Gateway")) + } + panic(fmt.Errorf("message poktroll.gateway.Gateway 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_Gateway) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.gateway.Gateway.stake": + if x.Stake == nil { + x.Stake = new(v1beta1.Coin) + } + return protoreflect.ValueOfMessage(x.Stake.ProtoReflect()) + case "poktroll.gateway.Gateway.address": + panic(fmt.Errorf("field address of message poktroll.gateway.Gateway is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.Gateway")) + } + panic(fmt.Errorf("message poktroll.gateway.Gateway 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_Gateway) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.gateway.Gateway.address": + return protoreflect.ValueOfString("") + case "poktroll.gateway.Gateway.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.Gateway")) + } + panic(fmt.Errorf("message poktroll.gateway.Gateway 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_Gateway) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.gateway.Gateway", 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_Gateway) 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_Gateway) 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_Gateway) 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_Gateway) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*Gateway) + 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.Address) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Stake != nil { + l = options.Size(x.Stake) + 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().(*Gateway) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Stake != nil { + encoded, err := options.Marshal(x.Stake) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + if len(x.Address) > 0 { + i -= len(x.Address) + copy(dAtA[i:], x.Address) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Address))) + 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().(*Gateway) + 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: Gateway: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Gateway: 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 Address", 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.Address = 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 Stake", 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.Stake == nil { + x.Stake = &v1beta1.Coin{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Stake); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: poktroll/gateway/gateway.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Gateway struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + Stake *v1beta1.Coin `protobuf:"bytes,2,opt,name=stake,proto3" json:"stake,omitempty"` +} + +func (x *Gateway) Reset() { + *x = Gateway{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_gateway_gateway_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Gateway) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Gateway) ProtoMessage() {} + +// Deprecated: Use Gateway.ProtoReflect.Descriptor instead. +func (*Gateway) Descriptor() ([]byte, []int) { + return file_poktroll_gateway_gateway_proto_rawDescGZIP(), []int{0} +} + +func (x *Gateway) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +func (x *Gateway) GetStake() *v1beta1.Coin { + if x != nil { + return x.Stake + } + return nil +} + +var File_poktroll_gateway_gateway_proto protoreflect.FileDescriptor + +var file_poktroll_gateway_gateway_proto_rawDesc = []byte{ + 0x0a, 0x1e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, + 0x61, 0x79, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 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, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, + 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x6f, + 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x5a, 0x0a, 0x07, 0x47, 0x61, 0x74, 0x65, + 0x77, 0x61, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x35, 0x0a, + 0x05, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x05, 0x73, + 0x74, 0x61, 0x6b, 0x65, 0x42, 0xa8, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, 0x0c, 0x47, + 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 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 ( + file_poktroll_gateway_gateway_proto_rawDescOnce sync.Once + file_poktroll_gateway_gateway_proto_rawDescData = file_poktroll_gateway_gateway_proto_rawDesc +) + +func file_poktroll_gateway_gateway_proto_rawDescGZIP() []byte { + file_poktroll_gateway_gateway_proto_rawDescOnce.Do(func() { + file_poktroll_gateway_gateway_proto_rawDescData = protoimpl.X.CompressGZIP(file_poktroll_gateway_gateway_proto_rawDescData) + }) + return file_poktroll_gateway_gateway_proto_rawDescData +} + +var file_poktroll_gateway_gateway_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_poktroll_gateway_gateway_proto_goTypes = []interface{}{ + (*Gateway)(nil), // 0: poktroll.gateway.Gateway + (*v1beta1.Coin)(nil), // 1: cosmos.base.v1beta1.Coin +} +var file_poktroll_gateway_gateway_proto_depIdxs = []int32{ + 1, // 0: poktroll.gateway.Gateway.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_gateway_proto_init() } +func file_poktroll_gateway_gateway_proto_init() { + if File_poktroll_gateway_gateway_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_poktroll_gateway_gateway_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Gateway); 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{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_poktroll_gateway_gateway_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_poktroll_gateway_gateway_proto_goTypes, + DependencyIndexes: file_poktroll_gateway_gateway_proto_depIdxs, + MessageInfos: file_poktroll_gateway_gateway_proto_msgTypes, + }.Build() + File_poktroll_gateway_gateway_proto = out.File + file_poktroll_gateway_gateway_proto_rawDesc = nil + file_poktroll_gateway_gateway_proto_goTypes = nil + file_poktroll_gateway_gateway_proto_depIdxs = nil +} diff --git a/api/poktroll/gateway/genesis.pulsar.go b/api/poktroll/gateway/genesis.pulsar.go index 8b92fab2a..d8b47995a 100644 --- a/api/poktroll/gateway/genesis.pulsar.go +++ b/api/poktroll/gateway/genesis.pulsar.go @@ -14,15 +14,68 @@ import ( sync "sync" ) +var _ protoreflect.List = (*_GenesisState_2_list)(nil) + +type _GenesisState_2_list struct { + list *[]*Gateway +} + +func (x *_GenesisState_2_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_GenesisState_2_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_GenesisState_2_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Gateway) + (*x.list)[i] = concreteValue +} + +func (x *_GenesisState_2_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Gateway) + *x.list = append(*x.list, concreteValue) +} + +func (x *_GenesisState_2_list) AppendMutable() protoreflect.Value { + v := new(Gateway) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_GenesisState_2_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_GenesisState_2_list) NewElement() protoreflect.Value { + v := new(Gateway) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_GenesisState_2_list) IsValid() bool { + return x.list != nil +} + var ( - md_GenesisState protoreflect.MessageDescriptor - fd_GenesisState_params protoreflect.FieldDescriptor + md_GenesisState protoreflect.MessageDescriptor + fd_GenesisState_params protoreflect.FieldDescriptor + fd_GenesisState_gatewayList protoreflect.FieldDescriptor ) func init() { file_poktroll_gateway_genesis_proto_init() md_GenesisState = File_poktroll_gateway_genesis_proto.Messages().ByName("GenesisState") fd_GenesisState_params = md_GenesisState.Fields().ByName("params") + fd_GenesisState_gatewayList = md_GenesisState.Fields().ByName("gatewayList") } var _ protoreflect.Message = (*fastReflection_GenesisState)(nil) @@ -96,6 +149,12 @@ func (x *fastReflection_GenesisState) Range(f func(protoreflect.FieldDescriptor, return } } + if len(x.GatewayList) != 0 { + value := protoreflect.ValueOfList(&_GenesisState_2_list{list: &x.GatewayList}) + if !f(fd_GenesisState_gatewayList, value) { + return + } + } } // Has reports whether a field is populated. @@ -113,6 +172,8 @@ func (x *fastReflection_GenesisState) Has(fd protoreflect.FieldDescriptor) bool switch fd.FullName() { case "poktroll.gateway.GenesisState.params": return x.Params != nil + case "poktroll.gateway.GenesisState.gatewayList": + return len(x.GatewayList) != 0 default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.GenesisState")) @@ -131,6 +192,8 @@ func (x *fastReflection_GenesisState) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { case "poktroll.gateway.GenesisState.params": x.Params = nil + case "poktroll.gateway.GenesisState.gatewayList": + x.GatewayList = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.GenesisState")) @@ -150,6 +213,12 @@ func (x *fastReflection_GenesisState) Get(descriptor protoreflect.FieldDescripto case "poktroll.gateway.GenesisState.params": value := x.Params return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "poktroll.gateway.GenesisState.gatewayList": + if len(x.GatewayList) == 0 { + return protoreflect.ValueOfList(&_GenesisState_2_list{}) + } + listValue := &_GenesisState_2_list{list: &x.GatewayList} + return protoreflect.ValueOfList(listValue) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.GenesisState")) @@ -172,6 +241,10 @@ func (x *fastReflection_GenesisState) Set(fd protoreflect.FieldDescriptor, value switch fd.FullName() { case "poktroll.gateway.GenesisState.params": x.Params = value.Message().Interface().(*Params) + case "poktroll.gateway.GenesisState.gatewayList": + lv := value.List() + clv := lv.(*_GenesisState_2_list) + x.GatewayList = *clv.list default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.GenesisState")) @@ -197,6 +270,12 @@ func (x *fastReflection_GenesisState) Mutable(fd protoreflect.FieldDescriptor) p x.Params = new(Params) } return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + case "poktroll.gateway.GenesisState.gatewayList": + if x.GatewayList == nil { + x.GatewayList = []*Gateway{} + } + value := &_GenesisState_2_list{list: &x.GatewayList} + return protoreflect.ValueOfList(value) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.GenesisState")) @@ -213,6 +292,9 @@ func (x *fastReflection_GenesisState) NewField(fd protoreflect.FieldDescriptor) case "poktroll.gateway.GenesisState.params": m := new(Params) return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "poktroll.gateway.GenesisState.gatewayList": + list := []*Gateway{} + return protoreflect.ValueOfList(&_GenesisState_2_list{list: &list}) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.GenesisState")) @@ -286,6 +368,12 @@ func (x *fastReflection_GenesisState) ProtoMethods() *protoiface.Methods { l = options.Size(x.Params) n += 1 + l + runtime.Sov(uint64(l)) } + if len(x.GatewayList) > 0 { + for _, e := range x.GatewayList { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -315,6 +403,22 @@ func (x *fastReflection_GenesisState) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if len(x.GatewayList) > 0 { + for iNdEx := len(x.GatewayList) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.GatewayList[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + } if x.Params != nil { encoded, err := options.Marshal(x.Params) if err != nil { @@ -414,6 +518,40 @@ func (x *fastReflection_GenesisState) ProtoMethods() *protoiface.Methods { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err } iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field GatewayList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.GatewayList = append(x.GatewayList, &Gateway{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.GatewayList[len(x.GatewayList)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -469,7 +607,8 @@ type GenesisState struct { unknownFields protoimpl.UnknownFields // params defines all the parameters of the module. - Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` + GatewayList []*Gateway `protobuf:"bytes,2,rep,name=gatewayList,proto3" json:"gatewayList,omitempty"` } func (x *GenesisState) Reset() { @@ -499,6 +638,13 @@ func (x *GenesisState) GetParams() *Params { return nil } +func (x *GenesisState) GetGatewayList() []*Gateway { + if x != nil { + return x.GatewayList + } + return nil +} + var File_poktroll_gateway_genesis_proto protoreflect.FileDescriptor var file_poktroll_gateway_genesis_proto_rawDesc = []byte{ @@ -509,23 +655,29 @@ var file_poktroll_gateway_genesis_proto_rawDesc = []byte{ 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, 0x1a, 0x1d, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x70, 0x61, - 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x4b, 0x0a, 0x0c, 0x47, 0x65, - 0x6e, 0x65, 0x73, 0x69, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x3b, 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, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, - 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0xa8, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, + 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x70, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x67, 0x61, 0x74, + 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x8e, 0x01, 0x0a, 0x0c, 0x47, + 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x3b, 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, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, + 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x41, 0x0a, 0x0b, 0x67, 0x61, 0x74, 0x65, + 0x77, 0x61, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, - 0x42, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 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, + 0x2e, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0b, + 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x42, 0xa8, 0x01, 0x0a, 0x14, + 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, + 0x65, 0x77, 0x61, 0x79, 0x42, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 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 ( @@ -544,14 +696,16 @@ var file_poktroll_gateway_genesis_proto_msgTypes = make([]protoimpl.MessageInfo, var file_poktroll_gateway_genesis_proto_goTypes = []interface{}{ (*GenesisState)(nil), // 0: poktroll.gateway.GenesisState (*Params)(nil), // 1: poktroll.gateway.Params + (*Gateway)(nil), // 2: poktroll.gateway.Gateway } var file_poktroll_gateway_genesis_proto_depIdxs = []int32{ 1, // 0: poktroll.gateway.GenesisState.params:type_name -> poktroll.gateway.Params - 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 + 2, // 1: poktroll.gateway.GenesisState.gatewayList:type_name -> poktroll.gateway.Gateway + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name } func init() { file_poktroll_gateway_genesis_proto_init() } @@ -560,6 +714,7 @@ func file_poktroll_gateway_genesis_proto_init() { return } file_poktroll_gateway_params_proto_init() + file_poktroll_gateway_gateway_proto_init() if !protoimpl.UnsafeEnabled { file_poktroll_gateway_genesis_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GenesisState); i { diff --git a/api/poktroll/gateway/query.pulsar.go b/api/poktroll/gateway/query.pulsar.go index 8cc099f3e..6f821812b 100644 --- a/api/poktroll/gateway/query.pulsar.go +++ b/api/poktroll/gateway/query.pulsar.go @@ -3,7 +3,8 @@ package gateway import ( _ "cosmossdk.io/api/amino" - _ "cosmossdk.io/api/cosmos/base/query/v1beta1" + v1beta1 "cosmossdk.io/api/cosmos/base/query/v1beta1" + _ "cosmossdk.io/api/cosmos/base/v1beta1" fmt "fmt" runtime "github.com/cosmos/cosmos-proto/runtime" _ "github.com/cosmos/gogoproto/gogoproto" @@ -807,6 +808,1869 @@ func (x *fastReflection_QueryParamsResponse) ProtoMethods() *protoiface.Methods } } +var ( + md_QueryGetGatewayRequest protoreflect.MessageDescriptor + fd_QueryGetGatewayRequest_address protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_gateway_query_proto_init() + md_QueryGetGatewayRequest = File_poktroll_gateway_query_proto.Messages().ByName("QueryGetGatewayRequest") + fd_QueryGetGatewayRequest_address = md_QueryGetGatewayRequest.Fields().ByName("address") +} + +var _ protoreflect.Message = (*fastReflection_QueryGetGatewayRequest)(nil) + +type fastReflection_QueryGetGatewayRequest QueryGetGatewayRequest + +func (x *QueryGetGatewayRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryGetGatewayRequest)(x) +} + +func (x *QueryGetGatewayRequest) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_gateway_query_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryGetGatewayRequest_messageType fastReflection_QueryGetGatewayRequest_messageType +var _ protoreflect.MessageType = fastReflection_QueryGetGatewayRequest_messageType{} + +type fastReflection_QueryGetGatewayRequest_messageType struct{} + +func (x fastReflection_QueryGetGatewayRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryGetGatewayRequest)(nil) +} +func (x fastReflection_QueryGetGatewayRequest_messageType) New() protoreflect.Message { + return new(fastReflection_QueryGetGatewayRequest) +} +func (x fastReflection_QueryGetGatewayRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryGetGatewayRequest +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryGetGatewayRequest) Descriptor() protoreflect.MessageDescriptor { + return md_QueryGetGatewayRequest +} + +// 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_QueryGetGatewayRequest) Type() protoreflect.MessageType { + return _fastReflection_QueryGetGatewayRequest_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryGetGatewayRequest) New() protoreflect.Message { + return new(fastReflection_QueryGetGatewayRequest) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryGetGatewayRequest) Interface() protoreflect.ProtoMessage { + return (*QueryGetGatewayRequest)(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_QueryGetGatewayRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Address != "" { + value := protoreflect.ValueOfString(x.Address) + if !f(fd_QueryGetGatewayRequest_address, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_QueryGetGatewayRequest) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.gateway.QueryGetGatewayRequest.address": + return x.Address != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryGetGatewayRequest")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryGetGatewayRequest 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_QueryGetGatewayRequest) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.gateway.QueryGetGatewayRequest.address": + x.Address = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryGetGatewayRequest")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryGetGatewayRequest 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_QueryGetGatewayRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.gateway.QueryGetGatewayRequest.address": + value := x.Address + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryGetGatewayRequest")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryGetGatewayRequest 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_QueryGetGatewayRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.gateway.QueryGetGatewayRequest.address": + x.Address = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryGetGatewayRequest")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryGetGatewayRequest 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_QueryGetGatewayRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.gateway.QueryGetGatewayRequest.address": + panic(fmt.Errorf("field address of message poktroll.gateway.QueryGetGatewayRequest is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryGetGatewayRequest")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryGetGatewayRequest 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_QueryGetGatewayRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.gateway.QueryGetGatewayRequest.address": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryGetGatewayRequest")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryGetGatewayRequest 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_QueryGetGatewayRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.gateway.QueryGetGatewayRequest", 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_QueryGetGatewayRequest) 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_QueryGetGatewayRequest) 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_QueryGetGatewayRequest) 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_QueryGetGatewayRequest) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryGetGatewayRequest) + 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.Address) + 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().(*QueryGetGatewayRequest) + 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.Address) > 0 { + i -= len(x.Address) + copy(dAtA[i:], x.Address) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Address))) + 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().(*QueryGetGatewayRequest) + 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: QueryGetGatewayRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryGetGatewayRequest: 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 Address", 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.Address = 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_QueryGetGatewayResponse protoreflect.MessageDescriptor + fd_QueryGetGatewayResponse_gateway protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_gateway_query_proto_init() + md_QueryGetGatewayResponse = File_poktroll_gateway_query_proto.Messages().ByName("QueryGetGatewayResponse") + fd_QueryGetGatewayResponse_gateway = md_QueryGetGatewayResponse.Fields().ByName("gateway") +} + +var _ protoreflect.Message = (*fastReflection_QueryGetGatewayResponse)(nil) + +type fastReflection_QueryGetGatewayResponse QueryGetGatewayResponse + +func (x *QueryGetGatewayResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryGetGatewayResponse)(x) +} + +func (x *QueryGetGatewayResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_gateway_query_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_QueryGetGatewayResponse_messageType fastReflection_QueryGetGatewayResponse_messageType +var _ protoreflect.MessageType = fastReflection_QueryGetGatewayResponse_messageType{} + +type fastReflection_QueryGetGatewayResponse_messageType struct{} + +func (x fastReflection_QueryGetGatewayResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryGetGatewayResponse)(nil) +} +func (x fastReflection_QueryGetGatewayResponse_messageType) New() protoreflect.Message { + return new(fastReflection_QueryGetGatewayResponse) +} +func (x fastReflection_QueryGetGatewayResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryGetGatewayResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryGetGatewayResponse) Descriptor() protoreflect.MessageDescriptor { + return md_QueryGetGatewayResponse +} + +// 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_QueryGetGatewayResponse) Type() protoreflect.MessageType { + return _fastReflection_QueryGetGatewayResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryGetGatewayResponse) New() protoreflect.Message { + return new(fastReflection_QueryGetGatewayResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryGetGatewayResponse) Interface() protoreflect.ProtoMessage { + return (*QueryGetGatewayResponse)(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_QueryGetGatewayResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Gateway != nil { + value := protoreflect.ValueOfMessage(x.Gateway.ProtoReflect()) + if !f(fd_QueryGetGatewayResponse_gateway, 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_QueryGetGatewayResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.gateway.QueryGetGatewayResponse.gateway": + return x.Gateway != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryGetGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryGetGatewayResponse 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_QueryGetGatewayResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.gateway.QueryGetGatewayResponse.gateway": + x.Gateway = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryGetGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryGetGatewayResponse 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_QueryGetGatewayResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.gateway.QueryGetGatewayResponse.gateway": + value := x.Gateway + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryGetGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryGetGatewayResponse 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_QueryGetGatewayResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.gateway.QueryGetGatewayResponse.gateway": + x.Gateway = value.Message().Interface().(*Gateway) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryGetGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryGetGatewayResponse 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_QueryGetGatewayResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.gateway.QueryGetGatewayResponse.gateway": + if x.Gateway == nil { + x.Gateway = new(Gateway) + } + return protoreflect.ValueOfMessage(x.Gateway.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryGetGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryGetGatewayResponse 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_QueryGetGatewayResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.gateway.QueryGetGatewayResponse.gateway": + m := new(Gateway) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryGetGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryGetGatewayResponse 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_QueryGetGatewayResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.gateway.QueryGetGatewayResponse", 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_QueryGetGatewayResponse) 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_QueryGetGatewayResponse) 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_QueryGetGatewayResponse) 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_QueryGetGatewayResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryGetGatewayResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Gateway != nil { + l = options.Size(x.Gateway) + 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().(*QueryGetGatewayResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Gateway != nil { + encoded, err := options.Marshal(x.Gateway) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryGetGatewayResponse) + 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: QueryGetGatewayResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryGetGatewayResponse: 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 Gateway", 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.Gateway == nil { + x.Gateway = &Gateway{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Gateway); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_QueryAllGatewayRequest protoreflect.MessageDescriptor + fd_QueryAllGatewayRequest_pagination protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_gateway_query_proto_init() + md_QueryAllGatewayRequest = File_poktroll_gateway_query_proto.Messages().ByName("QueryAllGatewayRequest") + fd_QueryAllGatewayRequest_pagination = md_QueryAllGatewayRequest.Fields().ByName("pagination") +} + +var _ protoreflect.Message = (*fastReflection_QueryAllGatewayRequest)(nil) + +type fastReflection_QueryAllGatewayRequest QueryAllGatewayRequest + +func (x *QueryAllGatewayRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryAllGatewayRequest)(x) +} + +func (x *QueryAllGatewayRequest) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_gateway_query_proto_msgTypes[4] + 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_QueryAllGatewayRequest_messageType fastReflection_QueryAllGatewayRequest_messageType +var _ protoreflect.MessageType = fastReflection_QueryAllGatewayRequest_messageType{} + +type fastReflection_QueryAllGatewayRequest_messageType struct{} + +func (x fastReflection_QueryAllGatewayRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryAllGatewayRequest)(nil) +} +func (x fastReflection_QueryAllGatewayRequest_messageType) New() protoreflect.Message { + return new(fastReflection_QueryAllGatewayRequest) +} +func (x fastReflection_QueryAllGatewayRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllGatewayRequest +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryAllGatewayRequest) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllGatewayRequest +} + +// 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_QueryAllGatewayRequest) Type() protoreflect.MessageType { + return _fastReflection_QueryAllGatewayRequest_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryAllGatewayRequest) New() protoreflect.Message { + return new(fastReflection_QueryAllGatewayRequest) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryAllGatewayRequest) Interface() protoreflect.ProtoMessage { + return (*QueryAllGatewayRequest)(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_QueryAllGatewayRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Pagination != nil { + value := protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + if !f(fd_QueryAllGatewayRequest_pagination, 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_QueryAllGatewayRequest) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.gateway.QueryAllGatewayRequest.pagination": + return x.Pagination != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewayRequest")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewayRequest 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_QueryAllGatewayRequest) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.gateway.QueryAllGatewayRequest.pagination": + x.Pagination = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewayRequest")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewayRequest 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_QueryAllGatewayRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.gateway.QueryAllGatewayRequest.pagination": + value := x.Pagination + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewayRequest")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewayRequest 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_QueryAllGatewayRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.gateway.QueryAllGatewayRequest.pagination": + x.Pagination = value.Message().Interface().(*v1beta1.PageRequest) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewayRequest")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewayRequest 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_QueryAllGatewayRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.gateway.QueryAllGatewayRequest.pagination": + if x.Pagination == nil { + x.Pagination = new(v1beta1.PageRequest) + } + return protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewayRequest")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewayRequest 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_QueryAllGatewayRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.gateway.QueryAllGatewayRequest.pagination": + m := new(v1beta1.PageRequest) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewayRequest")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewayRequest 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_QueryAllGatewayRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.gateway.QueryAllGatewayRequest", 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_QueryAllGatewayRequest) 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_QueryAllGatewayRequest) 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_QueryAllGatewayRequest) 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_QueryAllGatewayRequest) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryAllGatewayRequest) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.Pagination != nil { + l = options.Size(x.Pagination) + 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().(*QueryAllGatewayRequest) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Pagination != nil { + encoded, err := options.Marshal(x.Pagination) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryAllGatewayRequest) + 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: QueryAllGatewayRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllGatewayRequest: 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 Pagination", 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.Pagination == nil { + x.Pagination = &v1beta1.PageRequest{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Pagination); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var _ protoreflect.List = (*_QueryAllGatewayResponse_1_list)(nil) + +type _QueryAllGatewayResponse_1_list struct { + list *[]*Gateway +} + +func (x *_QueryAllGatewayResponse_1_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_QueryAllGatewayResponse_1_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_QueryAllGatewayResponse_1_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Gateway) + (*x.list)[i] = concreteValue +} + +func (x *_QueryAllGatewayResponse_1_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Gateway) + *x.list = append(*x.list, concreteValue) +} + +func (x *_QueryAllGatewayResponse_1_list) AppendMutable() protoreflect.Value { + v := new(Gateway) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_QueryAllGatewayResponse_1_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_QueryAllGatewayResponse_1_list) NewElement() protoreflect.Value { + v := new(Gateway) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_QueryAllGatewayResponse_1_list) IsValid() bool { + return x.list != nil +} + +var ( + md_QueryAllGatewayResponse protoreflect.MessageDescriptor + fd_QueryAllGatewayResponse_gateway protoreflect.FieldDescriptor + fd_QueryAllGatewayResponse_pagination protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_gateway_query_proto_init() + md_QueryAllGatewayResponse = File_poktroll_gateway_query_proto.Messages().ByName("QueryAllGatewayResponse") + fd_QueryAllGatewayResponse_gateway = md_QueryAllGatewayResponse.Fields().ByName("gateway") + fd_QueryAllGatewayResponse_pagination = md_QueryAllGatewayResponse.Fields().ByName("pagination") +} + +var _ protoreflect.Message = (*fastReflection_QueryAllGatewayResponse)(nil) + +type fastReflection_QueryAllGatewayResponse QueryAllGatewayResponse + +func (x *QueryAllGatewayResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryAllGatewayResponse)(x) +} + +func (x *QueryAllGatewayResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_gateway_query_proto_msgTypes[5] + 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_QueryAllGatewayResponse_messageType fastReflection_QueryAllGatewayResponse_messageType +var _ protoreflect.MessageType = fastReflection_QueryAllGatewayResponse_messageType{} + +type fastReflection_QueryAllGatewayResponse_messageType struct{} + +func (x fastReflection_QueryAllGatewayResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryAllGatewayResponse)(nil) +} +func (x fastReflection_QueryAllGatewayResponse_messageType) New() protoreflect.Message { + return new(fastReflection_QueryAllGatewayResponse) +} +func (x fastReflection_QueryAllGatewayResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllGatewayResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryAllGatewayResponse) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllGatewayResponse +} + +// 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_QueryAllGatewayResponse) Type() protoreflect.MessageType { + return _fastReflection_QueryAllGatewayResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryAllGatewayResponse) New() protoreflect.Message { + return new(fastReflection_QueryAllGatewayResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryAllGatewayResponse) Interface() protoreflect.ProtoMessage { + return (*QueryAllGatewayResponse)(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_QueryAllGatewayResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if len(x.Gateway) != 0 { + value := protoreflect.ValueOfList(&_QueryAllGatewayResponse_1_list{list: &x.Gateway}) + if !f(fd_QueryAllGatewayResponse_gateway, value) { + return + } + } + if x.Pagination != nil { + value := protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + if !f(fd_QueryAllGatewayResponse_pagination, 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_QueryAllGatewayResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.gateway.QueryAllGatewayResponse.gateway": + return len(x.Gateway) != 0 + case "poktroll.gateway.QueryAllGatewayResponse.pagination": + return x.Pagination != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewayResponse 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_QueryAllGatewayResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.gateway.QueryAllGatewayResponse.gateway": + x.Gateway = nil + case "poktroll.gateway.QueryAllGatewayResponse.pagination": + x.Pagination = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewayResponse 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_QueryAllGatewayResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.gateway.QueryAllGatewayResponse.gateway": + if len(x.Gateway) == 0 { + return protoreflect.ValueOfList(&_QueryAllGatewayResponse_1_list{}) + } + listValue := &_QueryAllGatewayResponse_1_list{list: &x.Gateway} + return protoreflect.ValueOfList(listValue) + case "poktroll.gateway.QueryAllGatewayResponse.pagination": + value := x.Pagination + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewayResponse 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_QueryAllGatewayResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.gateway.QueryAllGatewayResponse.gateway": + lv := value.List() + clv := lv.(*_QueryAllGatewayResponse_1_list) + x.Gateway = *clv.list + case "poktroll.gateway.QueryAllGatewayResponse.pagination": + x.Pagination = value.Message().Interface().(*v1beta1.PageResponse) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewayResponse 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_QueryAllGatewayResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.gateway.QueryAllGatewayResponse.gateway": + if x.Gateway == nil { + x.Gateway = []*Gateway{} + } + value := &_QueryAllGatewayResponse_1_list{list: &x.Gateway} + return protoreflect.ValueOfList(value) + case "poktroll.gateway.QueryAllGatewayResponse.pagination": + if x.Pagination == nil { + x.Pagination = new(v1beta1.PageResponse) + } + return protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewayResponse 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_QueryAllGatewayResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.gateway.QueryAllGatewayResponse.gateway": + list := []*Gateway{} + return protoreflect.ValueOfList(&_QueryAllGatewayResponse_1_list{list: &list}) + case "poktroll.gateway.QueryAllGatewayResponse.pagination": + m := new(v1beta1.PageResponse) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewayResponse 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_QueryAllGatewayResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.gateway.QueryAllGatewayResponse", 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_QueryAllGatewayResponse) 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_QueryAllGatewayResponse) 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_QueryAllGatewayResponse) 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_QueryAllGatewayResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryAllGatewayResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if len(x.Gateway) > 0 { + for _, e := range x.Gateway { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if x.Pagination != nil { + l = options.Size(x.Pagination) + 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().(*QueryAllGatewayResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Pagination != nil { + encoded, err := options.Marshal(x.Pagination) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + if len(x.Gateway) > 0 { + for iNdEx := len(x.Gateway) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.Gateway[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*QueryAllGatewayResponse) + 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: QueryAllGatewayResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllGatewayResponse: 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 Gateway", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Gateway = append(x.Gateway, &Gateway{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Gateway[len(x.Gateway)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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.Pagination == nil { + x.Pagination = &v1beta1.PageResponse{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Pagination); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 @@ -884,6 +2748,154 @@ func (x *QueryParamsResponse) GetParams() *Params { return nil } +type QueryGetGatewayRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` +} + +func (x *QueryGetGatewayRequest) Reset() { + *x = QueryGetGatewayRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_gateway_query_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryGetGatewayRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryGetGatewayRequest) ProtoMessage() {} + +// Deprecated: Use QueryGetGatewayRequest.ProtoReflect.Descriptor instead. +func (*QueryGetGatewayRequest) Descriptor() ([]byte, []int) { + return file_poktroll_gateway_query_proto_rawDescGZIP(), []int{2} +} + +func (x *QueryGetGatewayRequest) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +type QueryGetGatewayResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Gateway *Gateway `protobuf:"bytes,1,opt,name=gateway,proto3" json:"gateway,omitempty"` +} + +func (x *QueryGetGatewayResponse) Reset() { + *x = QueryGetGatewayResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_gateway_query_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryGetGatewayResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryGetGatewayResponse) ProtoMessage() {} + +// Deprecated: Use QueryGetGatewayResponse.ProtoReflect.Descriptor instead. +func (*QueryGetGatewayResponse) Descriptor() ([]byte, []int) { + return file_poktroll_gateway_query_proto_rawDescGZIP(), []int{3} +} + +func (x *QueryGetGatewayResponse) GetGateway() *Gateway { + if x != nil { + return x.Gateway + } + return nil +} + +type QueryAllGatewayRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Pagination *v1beta1.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (x *QueryAllGatewayRequest) Reset() { + *x = QueryAllGatewayRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_gateway_query_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryAllGatewayRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryAllGatewayRequest) ProtoMessage() {} + +// Deprecated: Use QueryAllGatewayRequest.ProtoReflect.Descriptor instead. +func (*QueryAllGatewayRequest) Descriptor() ([]byte, []int) { + return file_poktroll_gateway_query_proto_rawDescGZIP(), []int{4} +} + +func (x *QueryAllGatewayRequest) GetPagination() *v1beta1.PageRequest { + if x != nil { + return x.Pagination + } + return nil +} + +type QueryAllGatewayResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Gateway []*Gateway `protobuf:"bytes,1,rep,name=gateway,proto3" json:"gateway,omitempty"` + Pagination *v1beta1.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (x *QueryAllGatewayResponse) Reset() { + *x = QueryAllGatewayResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_gateway_query_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryAllGatewayResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryAllGatewayResponse) ProtoMessage() {} + +// Deprecated: Use QueryAllGatewayResponse.ProtoReflect.Descriptor instead. +func (*QueryAllGatewayResponse) Descriptor() ([]byte, []int) { + return file_poktroll_gateway_query_proto_rawDescGZIP(), []int{5} +} + +func (x *QueryAllGatewayResponse) GetGateway() []*Gateway { + if x != nil { + return x.Gateway + } + return nil +} + +func (x *QueryAllGatewayResponse) GetPagination() *v1beta1.PageResponse { + if x != nil { + return x.Pagination + } + return nil +} + var File_poktroll_gateway_query_proto protoreflect.FileDescriptor var file_poktroll_gateway_query_proto_rawDesc = []byte{ @@ -899,33 +2911,81 @@ var file_poktroll_gateway_query_proto_rawDesc = []byte{ 0x61, 0x31, 0x2f, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x1e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, + 0x65, 0x77, 0x61, 0x79, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x14, 0x0a, 0x12, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x52, 0x0a, 0x13, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 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, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, - 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x32, 0x8e, 0x01, 0x0a, - 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x84, 0x01, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x73, 0x12, 0x24, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, - 0x65, 0x77, 0x61, 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, - 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2d, - 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x12, 0x25, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, - 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, - 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0xa6, 0x01, - 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, - 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 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, + 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x32, 0x0a, 0x16, + 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x22, 0x54, 0x0a, 0x17, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x47, 0x61, 0x74, 0x65, + 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a, 0x07, 0x67, + 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, + 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x07, 0x67, + 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x22, 0x60, 0x0a, 0x16, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, + 0x6c, 0x6c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x46, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, + 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x0a, 0x70, 0x61, + 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x9d, 0x01, 0x0a, 0x17, 0x51, 0x75, 0x65, + 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a, 0x07, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, + 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x07, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, + 0x47, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, + 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, + 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x0a, 0x70, 0x61, + 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x32, 0xbd, 0x03, 0x0a, 0x05, 0x51, 0x75, 0x65, + 0x72, 0x79, 0x12, 0x84, 0x01, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x24, 0x2e, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, + 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, + 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2d, 0x82, 0xd3, 0xe4, 0x93, + 0x02, 0x27, 0x12, 0x25, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, + 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, + 0x61, 0x79, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x98, 0x01, 0x0a, 0x07, 0x47, 0x61, + 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x28, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, + 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, + 0x74, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, + 0x61, 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x47, 0x61, 0x74, 0x65, 0x77, + 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x38, 0x82, 0xd3, 0xe4, 0x93, + 0x02, 0x32, 0x12, 0x30, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, + 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, + 0x61, 0x79, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x7b, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x7d, 0x12, 0x91, 0x01, 0x0a, 0x0a, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, + 0x41, 0x6c, 0x6c, 0x12, 0x28, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, + 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x47, + 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, + 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x28, + 0x12, 0x26, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, + 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, + 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, 0xa6, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, + 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, + 0x79, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 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 ( @@ -940,21 +3000,36 @@ func file_poktroll_gateway_query_proto_rawDescGZIP() []byte { return file_poktroll_gateway_query_proto_rawDescData } -var file_poktroll_gateway_query_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_poktroll_gateway_query_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_poktroll_gateway_query_proto_goTypes = []interface{}{ - (*QueryParamsRequest)(nil), // 0: poktroll.gateway.QueryParamsRequest - (*QueryParamsResponse)(nil), // 1: poktroll.gateway.QueryParamsResponse - (*Params)(nil), // 2: poktroll.gateway.Params + (*QueryParamsRequest)(nil), // 0: poktroll.gateway.QueryParamsRequest + (*QueryParamsResponse)(nil), // 1: poktroll.gateway.QueryParamsResponse + (*QueryGetGatewayRequest)(nil), // 2: poktroll.gateway.QueryGetGatewayRequest + (*QueryGetGatewayResponse)(nil), // 3: poktroll.gateway.QueryGetGatewayResponse + (*QueryAllGatewayRequest)(nil), // 4: poktroll.gateway.QueryAllGatewayRequest + (*QueryAllGatewayResponse)(nil), // 5: poktroll.gateway.QueryAllGatewayResponse + (*Params)(nil), // 6: poktroll.gateway.Params + (*Gateway)(nil), // 7: poktroll.gateway.Gateway + (*v1beta1.PageRequest)(nil), // 8: cosmos.base.query.v1beta1.PageRequest + (*v1beta1.PageResponse)(nil), // 9: cosmos.base.query.v1beta1.PageResponse } var file_poktroll_gateway_query_proto_depIdxs = []int32{ - 2, // 0: poktroll.gateway.QueryParamsResponse.params:type_name -> poktroll.gateway.Params - 0, // 1: poktroll.gateway.Query.Params:input_type -> poktroll.gateway.QueryParamsRequest - 1, // 2: poktroll.gateway.Query.Params:output_type -> poktroll.gateway.QueryParamsResponse - 2, // [2:3] is the sub-list for method output_type - 1, // [1:2] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name + 6, // 0: poktroll.gateway.QueryParamsResponse.params:type_name -> poktroll.gateway.Params + 7, // 1: poktroll.gateway.QueryGetGatewayResponse.gateway:type_name -> poktroll.gateway.Gateway + 8, // 2: poktroll.gateway.QueryAllGatewayRequest.pagination:type_name -> cosmos.base.query.v1beta1.PageRequest + 7, // 3: poktroll.gateway.QueryAllGatewayResponse.gateway:type_name -> poktroll.gateway.Gateway + 9, // 4: poktroll.gateway.QueryAllGatewayResponse.pagination:type_name -> cosmos.base.query.v1beta1.PageResponse + 0, // 5: poktroll.gateway.Query.Params:input_type -> poktroll.gateway.QueryParamsRequest + 2, // 6: poktroll.gateway.Query.Gateway:input_type -> poktroll.gateway.QueryGetGatewayRequest + 4, // 7: poktroll.gateway.Query.GatewayAll:input_type -> poktroll.gateway.QueryAllGatewayRequest + 1, // 8: poktroll.gateway.Query.Params:output_type -> poktroll.gateway.QueryParamsResponse + 3, // 9: poktroll.gateway.Query.Gateway:output_type -> poktroll.gateway.QueryGetGatewayResponse + 5, // 10: poktroll.gateway.Query.GatewayAll:output_type -> poktroll.gateway.QueryAllGatewayResponse + 8, // [8:11] is the sub-list for method output_type + 5, // [5:8] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name } func init() { file_poktroll_gateway_query_proto_init() } @@ -963,6 +3038,7 @@ func file_poktroll_gateway_query_proto_init() { return } file_poktroll_gateway_params_proto_init() + file_poktroll_gateway_gateway_proto_init() if !protoimpl.UnsafeEnabled { file_poktroll_gateway_query_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*QueryParamsRequest); i { @@ -988,6 +3064,54 @@ func file_poktroll_gateway_query_proto_init() { return nil } } + file_poktroll_gateway_query_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryGetGatewayRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_gateway_query_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryGetGatewayResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_gateway_query_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryAllGatewayRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_poktroll_gateway_query_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryAllGatewayResponse); 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{ @@ -995,7 +3119,7 @@ func file_poktroll_gateway_query_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_poktroll_gateway_query_proto_rawDesc, NumEnums: 0, - NumMessages: 2, + NumMessages: 6, NumExtensions: 0, NumServices: 1, }, diff --git a/proto/poktroll/gateway/gateway.proto b/proto/poktroll/gateway/gateway.proto new file mode 100644 index 000000000..6d3797001 --- /dev/null +++ b/proto/poktroll/gateway/gateway.proto @@ -0,0 +1,13 @@ +syntax = "proto3"; +package poktroll.gateway; + +option go_package = "github.com/pokt-network/poktroll/x/gateway/types"; +import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +message Gateway { + string address = 1; + cosmos.base.v1beta1.Coin stake = 2 [(gogoproto.nullable) = false]; + +} + diff --git a/proto/poktroll/gateway/genesis.proto b/proto/poktroll/gateway/genesis.proto index bfd16472f..c2ee8cf4e 100644 --- a/proto/poktroll/gateway/genesis.proto +++ b/proto/poktroll/gateway/genesis.proto @@ -1,17 +1,19 @@ syntax = "proto3"; + package poktroll.gateway; import "amino/amino.proto"; import "gogoproto/gogo.proto"; import "poktroll/gateway/params.proto"; +import "poktroll/gateway/gateway.proto"; option go_package = "github.com/pokt-network/poktroll/x/gateway/types"; // GenesisState defines the gateway module's genesis state. message GenesisState { + // params defines all the parameters of the module. - Params params = 1 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; + Params params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + repeated Gateway gatewayList = 2 [(gogoproto.nullable) = false] ; } + diff --git a/proto/poktroll/gateway/query.proto b/proto/poktroll/gateway/query.proto index a14a8a778..49f08457f 100644 --- a/proto/poktroll/gateway/query.proto +++ b/proto/poktroll/gateway/query.proto @@ -1,4 +1,5 @@ syntax = "proto3"; + package poktroll.gateway; import "amino/amino.proto"; @@ -6,25 +7,54 @@ import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; import "poktroll/gateway/params.proto"; +import "poktroll/gateway/gateway.proto"; +import "cosmos/base/v1beta1/coin.proto"; option go_package = "github.com/pokt-network/poktroll/x/gateway/types"; // Query defines the gRPC querier service. service Query { + // Parameters queries the parameters of the module. - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + rpc Params (QueryParamsRequest) returns (QueryParamsResponse) { option (google.api.http).get = "/pokt-network/poktroll/gateway/params"; + + } + + // Queries a list of Gateway items. + rpc Gateway (QueryGetGatewayRequest) returns (QueryGetGatewayResponse) { + option (google.api.http).get = "/pokt-network/poktroll/gateway/gateway/{address}"; + + } + rpc GatewayAll (QueryAllGatewayRequest) returns (QueryAllGatewayResponse) { + option (google.api.http).get = "/pokt-network/poktroll/gateway/gateway"; + } } - // QueryParamsRequest is request type for the Query/Params RPC method. message QueryParamsRequest {} // QueryParamsResponse is response type for the Query/Params RPC method. message QueryParamsResponse { + // params holds all the parameters of this module. - Params params = 1 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; -} \ No newline at end of file + Params params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; +} + +message QueryGetGatewayRequest { + string address = 1; +} + +message QueryGetGatewayResponse { + Gateway gateway = 1 [(gogoproto.nullable) = false]; +} + +message QueryAllGatewayRequest { + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +message QueryAllGatewayResponse { + repeated Gateway gateway = 1 [(gogoproto.nullable) = false]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + diff --git a/x/gateway/keeper/gateway.go b/x/gateway/keeper/gateway.go new file mode 100644 index 000000000..b04b955e8 --- /dev/null +++ b/x/gateway/keeper/gateway.go @@ -0,0 +1,70 @@ +package keeper + +import ( + "context" + + "cosmossdk.io/store/prefix" + storetypes "cosmossdk.io/store/types" + "github.com/cosmos/cosmos-sdk/runtime" + "github.com/pokt-network/poktroll/x/gateway/types" +) + +// SetGateway set a specific gateway in the store from its index +func (k Keeper) SetGateway(ctx context.Context, gateway types.Gateway) { + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.GatewayKeyPrefix)) + b := k.cdc.MustMarshal(&gateway) + store.Set(types.GatewayKey( + gateway.Address, + ), b) +} + +// GetGateway returns a gateway from its index +func (k Keeper) GetGateway( + ctx context.Context, + address string, + +) (val types.Gateway, found bool) { + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.GatewayKeyPrefix)) + + b := store.Get(types.GatewayKey( + address, + )) + if b == nil { + return val, false + } + + k.cdc.MustUnmarshal(b, &val) + return val, true +} + +// RemoveGateway removes a gateway from the store +func (k Keeper) RemoveGateway( + ctx context.Context, + address string, + +) { + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.GatewayKeyPrefix)) + store.Delete(types.GatewayKey( + address, + )) +} + +// GetAllGateway returns all gateway +func (k Keeper) GetAllGateway(ctx context.Context) (list []types.Gateway) { + storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.GatewayKeyPrefix)) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) + + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var val types.Gateway + k.cdc.MustUnmarshal(iterator.Value(), &val) + list = append(list, val) + } + + return +} diff --git a/x/gateway/keeper/gateway_test.go b/x/gateway/keeper/gateway_test.go new file mode 100644 index 000000000..c9e42654f --- /dev/null +++ b/x/gateway/keeper/gateway_test.go @@ -0,0 +1,63 @@ +package keeper_test + +import ( + "context" + "strconv" + "testing" + + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/testutil/nullify" + "github.com/pokt-network/poktroll/x/gateway/keeper" + "github.com/pokt-network/poktroll/x/gateway/types" + "github.com/stretchr/testify/require" +) + +// Prevent strconv unused error +var _ = strconv.IntSize + +func createNGateway(keeper keeper.Keeper, ctx context.Context, n int) []types.Gateway { + items := make([]types.Gateway, n) + for i := range items { + items[i].Address = strconv.Itoa(i) + + keeper.SetGateway(ctx, items[i]) + } + return items +} + +func TestGatewayGet(t *testing.T) { + keeper, ctx := keepertest.GatewayKeeper(t) + items := createNGateway(keeper, ctx, 10) + for _, item := range items { + rst, found := keeper.GetGateway(ctx, + item.Address, + ) + require.True(t, found) + require.Equal(t, + nullify.Fill(&item), + nullify.Fill(&rst), + ) + } +} +func TestGatewayRemove(t *testing.T) { + keeper, ctx := keepertest.GatewayKeeper(t) + items := createNGateway(keeper, ctx, 10) + for _, item := range items { + keeper.RemoveGateway(ctx, + item.Address, + ) + _, found := keeper.GetGateway(ctx, + item.Address, + ) + require.False(t, found) + } +} + +func TestGatewayGetAll(t *testing.T) { + keeper, ctx := keepertest.GatewayKeeper(t) + items := createNGateway(keeper, ctx, 10) + require.ElementsMatch(t, + nullify.Fill(items), + nullify.Fill(keeper.GetAllGateway(ctx)), + ) +} diff --git a/x/gateway/keeper/query_gateway.go b/x/gateway/keeper/query_gateway.go new file mode 100644 index 000000000..c81024bba --- /dev/null +++ b/x/gateway/keeper/query_gateway.go @@ -0,0 +1,55 @@ +package keeper + +import ( + "context" + + "cosmossdk.io/store/prefix" + "github.com/cosmos/cosmos-sdk/runtime" + "github.com/cosmos/cosmos-sdk/types/query" + "github.com/pokt-network/poktroll/x/gateway/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func (k Keeper) GatewayAll(ctx context.Context, req *types.QueryAllGatewayRequest) (*types.QueryAllGatewayResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + var gateways []types.Gateway + + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + gatewayStore := prefix.NewStore(store, types.KeyPrefix(types.GatewayKeyPrefix)) + + pageRes, err := query.Paginate(gatewayStore, req.Pagination, func(key []byte, value []byte) error { + var gateway types.Gateway + if err := k.cdc.Unmarshal(value, &gateway); err != nil { + return err + } + + gateways = append(gateways, gateway) + return nil + }) + + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + + return &types.QueryAllGatewayResponse{Gateway: gateways, Pagination: pageRes}, nil +} + +func (k Keeper) Gateway(ctx context.Context, req *types.QueryGetGatewayRequest) (*types.QueryGetGatewayResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + val, found := k.GetGateway( + ctx, + req.Address, + ) + if !found { + return nil, status.Error(codes.NotFound, "not found") + } + + return &types.QueryGetGatewayResponse{Gateway: val}, nil +} diff --git a/x/gateway/keeper/query_gateway_test.go b/x/gateway/keeper/query_gateway_test.go new file mode 100644 index 000000000..0f780dbc3 --- /dev/null +++ b/x/gateway/keeper/query_gateway_test.go @@ -0,0 +1,124 @@ +package keeper_test + +import ( + "strconv" + "testing" + + "github.com/cosmos/cosmos-sdk/types/query" + "github.com/stretchr/testify/require" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/testutil/nullify" + "github.com/pokt-network/poktroll/x/gateway/types" +) + +// Prevent strconv unused error +var _ = strconv.IntSize + +func TestGatewayQuerySingle(t *testing.T) { + keeper, ctx := keepertest.GatewayKeeper(t) + msgs := createNGateway(keeper, ctx, 2) + tests := []struct { + desc string + request *types.QueryGetGatewayRequest + response *types.QueryGetGatewayResponse + err error + }{ + { + desc: "First", + request: &types.QueryGetGatewayRequest{ + Address: msgs[0].Address, + }, + response: &types.QueryGetGatewayResponse{Gateway: msgs[0]}, + }, + { + desc: "Second", + request: &types.QueryGetGatewayRequest{ + Address: msgs[1].Address, + }, + response: &types.QueryGetGatewayResponse{Gateway: msgs[1]}, + }, + { + desc: "KeyNotFound", + request: &types.QueryGetGatewayRequest{ + Address: strconv.Itoa(100000), + }, + err: status.Error(codes.NotFound, "not found"), + }, + { + desc: "InvalidRequest", + err: status.Error(codes.InvalidArgument, "invalid request"), + }, + } + for _, tc := range tests { + t.Run(tc.desc, func(t *testing.T) { + response, err := keeper.Gateway(ctx, tc.request) + if tc.err != nil { + require.ErrorIs(t, err, tc.err) + } else { + require.NoError(t, err) + require.Equal(t, + nullify.Fill(tc.response), + nullify.Fill(response), + ) + } + }) + } +} + +func TestGatewayQueryPaginated(t *testing.T) { + keeper, ctx := keepertest.GatewayKeeper(t) + msgs := createNGateway(keeper, ctx, 5) + + request := func(next []byte, offset, limit uint64, total bool) *types.QueryAllGatewayRequest { + return &types.QueryAllGatewayRequest{ + Pagination: &query.PageRequest{ + Key: next, + Offset: offset, + Limit: limit, + CountTotal: total, + }, + } + } + t.Run("ByOffset", func(t *testing.T) { + step := 2 + for i := 0; i < len(msgs); i += step { + resp, err := keeper.GatewayAll(ctx, request(nil, uint64(i), uint64(step), false)) + require.NoError(t, err) + require.LessOrEqual(t, len(resp.Gateway), step) + require.Subset(t, + nullify.Fill(msgs), + nullify.Fill(resp.Gateway), + ) + } + }) + t.Run("ByKey", func(t *testing.T) { + step := 2 + var next []byte + for i := 0; i < len(msgs); i += step { + resp, err := keeper.GatewayAll(ctx, request(next, 0, uint64(step), false)) + require.NoError(t, err) + require.LessOrEqual(t, len(resp.Gateway), step) + require.Subset(t, + nullify.Fill(msgs), + nullify.Fill(resp.Gateway), + ) + next = resp.Pagination.NextKey + } + }) + t.Run("Total", func(t *testing.T) { + resp, err := keeper.GatewayAll(ctx, request(nil, 0, 0, true)) + require.NoError(t, err) + require.Equal(t, len(msgs), int(resp.Pagination.Total)) + require.ElementsMatch(t, + nullify.Fill(msgs), + nullify.Fill(resp.Gateway), + ) + }) + t.Run("InvalidRequest", func(t *testing.T) { + _, err := keeper.GatewayAll(ctx, nil) + require.ErrorIs(t, err, status.Error(codes.InvalidArgument, "invalid request")) + }) +} diff --git a/x/gateway/module/autocli.go b/x/gateway/module/autocli.go index 2bc32c3cc..65d72973a 100644 --- a/x/gateway/module/autocli.go +++ b/x/gateway/module/autocli.go @@ -17,6 +17,17 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { Use: "params", Short: "Shows the parameters of the module", }, + { + RpcMethod: "GatewayAll", + Use: "list-gateway", + Short: "List all gateway", + }, + { + RpcMethod: "Gateway", + Use: "show-gateway [id]", + Short: "Shows a gateway", + PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "address"}}, + }, // this line is used by ignite scaffolding # autocli/query }, }, diff --git a/x/gateway/module/genesis.go b/x/gateway/module/genesis.go index 4bb2d6ef9..302f2a1cc 100644 --- a/x/gateway/module/genesis.go +++ b/x/gateway/module/genesis.go @@ -9,6 +9,10 @@ import ( // InitGenesis initializes the module's state from a provided genesis state. func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { + // Set all the gateway + for _, elem := range genState.GatewayList { + k.SetGateway(ctx, elem) + } // this line is used by starport scaffolding # genesis/module/init k.SetParams(ctx, genState.Params) } @@ -18,6 +22,7 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { genesis := types.DefaultGenesis() genesis.Params = k.GetParams(ctx) + genesis.GatewayList = k.GetAllGateway(ctx) // this line is used by starport scaffolding # genesis/module/export return genesis diff --git a/x/gateway/module/genesis_test.go b/x/gateway/module/genesis_test.go index 0df041a76..2525dcd45 100644 --- a/x/gateway/module/genesis_test.go +++ b/x/gateway/module/genesis_test.go @@ -14,6 +14,14 @@ func TestGenesis(t *testing.T) { genesisState := types.GenesisState{ Params: types.DefaultParams(), + GatewayList: []types.Gateway{ + { + Address: "0", + }, + { + Address: "1", + }, + }, // this line is used by starport scaffolding # genesis/test/state } @@ -25,5 +33,6 @@ func TestGenesis(t *testing.T) { nullify.Fill(&genesisState) nullify.Fill(got) + require.ElementsMatch(t, genesisState.GatewayList, got.GatewayList) // this line is used by starport scaffolding # genesis/test/assert } diff --git a/x/gateway/types/genesis.go b/x/gateway/types/genesis.go index 0af9b4416..e06a6c5cb 100644 --- a/x/gateway/types/genesis.go +++ b/x/gateway/types/genesis.go @@ -1,7 +1,7 @@ package types import ( -// this line is used by starport scaffolding # genesis/types/import + "fmt" ) // DefaultIndex is the default global index @@ -10,6 +10,7 @@ const DefaultIndex uint64 = 1 // DefaultGenesis returns the default genesis state func DefaultGenesis() *GenesisState { return &GenesisState{ + GatewayList: []Gateway{}, // this line is used by starport scaffolding # genesis/types/default Params: DefaultParams(), } @@ -18,6 +19,16 @@ func DefaultGenesis() *GenesisState { // Validate performs basic genesis state validation returning an error upon any // failure. func (gs GenesisState) Validate() error { + // Check for duplicated index in gateway + gatewayIndexMap := make(map[string]struct{}) + + for _, elem := range gs.GatewayList { + index := string(GatewayKey(elem.Address)) + if _, ok := gatewayIndexMap[index]; ok { + return fmt.Errorf("duplicated index for gateway") + } + gatewayIndexMap[index] = struct{}{} + } // this line is used by starport scaffolding # genesis/types/validate return gs.Params.Validate() diff --git a/x/gateway/types/genesis_test.go b/x/gateway/types/genesis_test.go index b4fce8cdc..446f2db3b 100644 --- a/x/gateway/types/genesis_test.go +++ b/x/gateway/types/genesis_test.go @@ -19,13 +19,35 @@ func TestGenesisState_Validate(t *testing.T) { valid: true, }, { - desc: "valid genesis state", + desc: "valid genesis state", genState: &types.GenesisState{ + GatewayList: []types.Gateway{ + { + Address: "0", + }, + { + Address: "1", + }, + }, // this line is used by starport scaffolding # types/genesis/validField }, valid: true, }, + { + desc: "duplicated gateway", + genState: &types.GenesisState{ + GatewayList: []types.Gateway{ + { + Address: "0", + }, + { + Address: "0", + }, + }, + }, + valid: false, + }, // this line is used by starport scaffolding # types/genesis/testcase } for _, tc := range tests { diff --git a/x/gateway/types/key_gateway.go b/x/gateway/types/key_gateway.go new file mode 100644 index 000000000..aaf7397a5 --- /dev/null +++ b/x/gateway/types/key_gateway.go @@ -0,0 +1,23 @@ +package types + +import "encoding/binary" + +var _ binary.ByteOrder + +const ( + // GatewayKeyPrefix is the prefix to retrieve all Gateway + GatewayKeyPrefix = "Gateway/value/" +) + +// GatewayKey returns the store key to retrieve a Gateway from the index fields +func GatewayKey( + address string, +) []byte { + var key []byte + + addressBytes := []byte(address) + key = append(key, addressBytes...) + key = append(key, []byte("/")...) + + return key +} From ae4ef3671b505057b348ef4a9dcb3d1cec53eca3 Mon Sep 17 00:00:00 2001 From: Redouane Lakrache Date: Thu, 8 Feb 2024 07:06:47 +0100 Subject: [PATCH 03/10] scaffold: message stake_gateway --module gateway ignite scaffold message stake_gateway stake:coin --signer address --module gateway --- api/poktroll/gateway/tx.pulsar.go | 1034 ++++++++++++++++- proto/poktroll/gateway/tx.proto | 32 +- x/gateway/keeper/msg_server_stake_gateway.go | 17 + x/gateway/module/autocli.go | 6 + x/gateway/module/simulation.go | 25 +- x/gateway/simulation/stake_gateway.go | 29 + x/gateway/types/codec.go | 3 + x/gateway/types/message_stake_gateway.go | 24 + x/gateway/types/message_stake_gateway_test.go | 40 + 9 files changed, 1165 insertions(+), 45 deletions(-) create mode 100644 x/gateway/keeper/msg_server_stake_gateway.go create mode 100644 x/gateway/simulation/stake_gateway.go create mode 100644 x/gateway/types/message_stake_gateway.go create mode 100644 x/gateway/types/message_stake_gateway_test.go diff --git a/api/poktroll/gateway/tx.pulsar.go b/api/poktroll/gateway/tx.pulsar.go index 57ef30053..65f83b8f9 100644 --- a/api/poktroll/gateway/tx.pulsar.go +++ b/api/poktroll/gateway/tx.pulsar.go @@ -3,6 +3,7 @@ package gateway import ( _ "cosmossdk.io/api/amino" + v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" _ "cosmossdk.io/api/cosmos/msg/v1" fmt "fmt" _ "github.com/cosmos/cosmos-proto" @@ -871,6 +872,861 @@ func (x *fastReflection_MsgUpdateParamsResponse) ProtoMethods() *protoiface.Meth } } +var ( + md_MsgStakeGateway protoreflect.MessageDescriptor + fd_MsgStakeGateway_address protoreflect.FieldDescriptor + fd_MsgStakeGateway_stake protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_gateway_tx_proto_init() + md_MsgStakeGateway = File_poktroll_gateway_tx_proto.Messages().ByName("MsgStakeGateway") + fd_MsgStakeGateway_address = md_MsgStakeGateway.Fields().ByName("address") + fd_MsgStakeGateway_stake = md_MsgStakeGateway.Fields().ByName("stake") +} + +var _ protoreflect.Message = (*fastReflection_MsgStakeGateway)(nil) + +type fastReflection_MsgStakeGateway MsgStakeGateway + +func (x *MsgStakeGateway) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgStakeGateway)(x) +} + +func (x *MsgStakeGateway) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_gateway_tx_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgStakeGateway_messageType fastReflection_MsgStakeGateway_messageType +var _ protoreflect.MessageType = fastReflection_MsgStakeGateway_messageType{} + +type fastReflection_MsgStakeGateway_messageType struct{} + +func (x fastReflection_MsgStakeGateway_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgStakeGateway)(nil) +} +func (x fastReflection_MsgStakeGateway_messageType) New() protoreflect.Message { + return new(fastReflection_MsgStakeGateway) +} +func (x fastReflection_MsgStakeGateway_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgStakeGateway +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgStakeGateway) Descriptor() protoreflect.MessageDescriptor { + return md_MsgStakeGateway +} + +// 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_MsgStakeGateway) Type() protoreflect.MessageType { + return _fastReflection_MsgStakeGateway_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgStakeGateway) New() protoreflect.Message { + return new(fastReflection_MsgStakeGateway) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgStakeGateway) Interface() protoreflect.ProtoMessage { + return (*MsgStakeGateway)(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_MsgStakeGateway) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Address != "" { + value := protoreflect.ValueOfString(x.Address) + if !f(fd_MsgStakeGateway_address, value) { + return + } + } + if x.Stake != nil { + value := protoreflect.ValueOfMessage(x.Stake.ProtoReflect()) + if !f(fd_MsgStakeGateway_stake, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgStakeGateway) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.gateway.MsgStakeGateway.address": + return x.Address != "" + case "poktroll.gateway.MsgStakeGateway.stake": + return x.Stake != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgStakeGateway")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgStakeGateway 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_MsgStakeGateway) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.gateway.MsgStakeGateway.address": + x.Address = "" + case "poktroll.gateway.MsgStakeGateway.stake": + x.Stake = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgStakeGateway")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgStakeGateway 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_MsgStakeGateway) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.gateway.MsgStakeGateway.address": + value := x.Address + return protoreflect.ValueOfString(value) + case "poktroll.gateway.MsgStakeGateway.stake": + value := x.Stake + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgStakeGateway")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgStakeGateway 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_MsgStakeGateway) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.gateway.MsgStakeGateway.address": + x.Address = value.Interface().(string) + case "poktroll.gateway.MsgStakeGateway.stake": + x.Stake = value.Message().Interface().(*v1beta1.Coin) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgStakeGateway")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgStakeGateway 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_MsgStakeGateway) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.gateway.MsgStakeGateway.stake": + if x.Stake == nil { + x.Stake = new(v1beta1.Coin) + } + return protoreflect.ValueOfMessage(x.Stake.ProtoReflect()) + case "poktroll.gateway.MsgStakeGateway.address": + panic(fmt.Errorf("field address of message poktroll.gateway.MsgStakeGateway is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgStakeGateway")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgStakeGateway 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_MsgStakeGateway) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.gateway.MsgStakeGateway.address": + return protoreflect.ValueOfString("") + case "poktroll.gateway.MsgStakeGateway.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.MsgStakeGateway")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgStakeGateway 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_MsgStakeGateway) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.gateway.MsgStakeGateway", 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_MsgStakeGateway) 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_MsgStakeGateway) 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_MsgStakeGateway) 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_MsgStakeGateway) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgStakeGateway) + 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.Address) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Stake != nil { + l = options.Size(x.Stake) + 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().(*MsgStakeGateway) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Stake != nil { + encoded, err := options.Marshal(x.Stake) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + if len(x.Address) > 0 { + i -= len(x.Address) + copy(dAtA[i:], x.Address) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Address))) + 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().(*MsgStakeGateway) + 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: MsgStakeGateway: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgStakeGateway: 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 Address", 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.Address = 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 Stake", 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.Stake == nil { + x.Stake = &v1beta1.Coin{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Stake); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgStakeGatewayResponse protoreflect.MessageDescriptor +) + +func init() { + file_poktroll_gateway_tx_proto_init() + md_MsgStakeGatewayResponse = File_poktroll_gateway_tx_proto.Messages().ByName("MsgStakeGatewayResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgStakeGatewayResponse)(nil) + +type fastReflection_MsgStakeGatewayResponse MsgStakeGatewayResponse + +func (x *MsgStakeGatewayResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgStakeGatewayResponse)(x) +} + +func (x *MsgStakeGatewayResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_gateway_tx_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgStakeGatewayResponse_messageType fastReflection_MsgStakeGatewayResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgStakeGatewayResponse_messageType{} + +type fastReflection_MsgStakeGatewayResponse_messageType struct{} + +func (x fastReflection_MsgStakeGatewayResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgStakeGatewayResponse)(nil) +} +func (x fastReflection_MsgStakeGatewayResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgStakeGatewayResponse) +} +func (x fastReflection_MsgStakeGatewayResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgStakeGatewayResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgStakeGatewayResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgStakeGatewayResponse +} + +// 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_MsgStakeGatewayResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgStakeGatewayResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgStakeGatewayResponse) New() protoreflect.Message { + return new(fastReflection_MsgStakeGatewayResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgStakeGatewayResponse) Interface() protoreflect.ProtoMessage { + return (*MsgStakeGatewayResponse)(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_MsgStakeGatewayResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgStakeGatewayResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgStakeGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgStakeGatewayResponse 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_MsgStakeGatewayResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgStakeGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgStakeGatewayResponse 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_MsgStakeGatewayResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgStakeGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgStakeGatewayResponse 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_MsgStakeGatewayResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgStakeGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgStakeGatewayResponse 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_MsgStakeGatewayResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgStakeGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgStakeGatewayResponse 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_MsgStakeGatewayResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgStakeGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgStakeGatewayResponse 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_MsgStakeGatewayResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.gateway.MsgStakeGatewayResponse", 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_MsgStakeGatewayResponse) 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_MsgStakeGatewayResponse) 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_MsgStakeGatewayResponse) 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_MsgStakeGatewayResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgStakeGatewayResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgStakeGatewayResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgStakeGatewayResponse) + 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: MsgStakeGatewayResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgStakeGatewayResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 @@ -892,8 +1748,6 @@ type MsgUpdateParams struct { // authority is the address that controls the module (defaults to x/gov unless overwritten). Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` - // params defines the module parameters to update. - // // NOTE: All parameters must be supplied. Params *Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty"` } @@ -960,6 +1814,75 @@ func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { return file_poktroll_gateway_tx_proto_rawDescGZIP(), []int{1} } +type MsgStakeGateway struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + Stake *v1beta1.Coin `protobuf:"bytes,2,opt,name=stake,proto3" json:"stake,omitempty"` +} + +func (x *MsgStakeGateway) Reset() { + *x = MsgStakeGateway{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_gateway_tx_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgStakeGateway) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgStakeGateway) ProtoMessage() {} + +// Deprecated: Use MsgStakeGateway.ProtoReflect.Descriptor instead. +func (*MsgStakeGateway) Descriptor() ([]byte, []int) { + return file_poktroll_gateway_tx_proto_rawDescGZIP(), []int{2} +} + +func (x *MsgStakeGateway) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +func (x *MsgStakeGateway) GetStake() *v1beta1.Coin { + if x != nil { + return x.Stake + } + return nil +} + +type MsgStakeGatewayResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgStakeGatewayResponse) Reset() { + *x = MsgStakeGatewayResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_gateway_tx_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgStakeGatewayResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgStakeGatewayResponse) ProtoMessage() {} + +// Deprecated: Use MsgStakeGatewayResponse.ProtoReflect.Descriptor instead. +func (*MsgStakeGatewayResponse) Descriptor() ([]byte, []int) { + return file_poktroll_gateway_tx_proto_rawDescGZIP(), []int{3} +} + var File_poktroll_gateway_tx_proto protoreflect.FileDescriptor var file_poktroll_gateway_tx_proto_rawDesc = []byte{ @@ -973,7 +1896,9 @@ var file_poktroll_gateway_tx_proto_rawDesc = []byte{ 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, 0x1a, 0x1d, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x70, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbd, 0x01, 0x0a, 0x0f, 0x4d, 0x73, + 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, + 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbd, 0x01, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 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, @@ -987,24 +1912,39 @@ var file_poktroll_gateway_tx_proto_rawDesc = []byte{ 0x78, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x19, 0x0a, 0x17, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x6a, 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, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, - 0x42, 0xa3, 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, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x70, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, + 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x12, 0x35, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x04, 0xc8, 0xde, 0x1f, + 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x3a, 0x0c, 0x82, 0xe7, 0xb0, 0x2a, 0x07, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x19, 0x0a, 0x17, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, + 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x32, 0xc8, 0x01, 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, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xa3, 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 ( @@ -1019,21 +1959,27 @@ 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, 2) +var file_poktroll_gateway_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_poktroll_gateway_tx_proto_goTypes = []interface{}{ (*MsgUpdateParams)(nil), // 0: poktroll.gateway.MsgUpdateParams (*MsgUpdateParamsResponse)(nil), // 1: poktroll.gateway.MsgUpdateParamsResponse - (*Params)(nil), // 2: poktroll.gateway.Params + (*MsgStakeGateway)(nil), // 2: poktroll.gateway.MsgStakeGateway + (*MsgStakeGatewayResponse)(nil), // 3: poktroll.gateway.MsgStakeGatewayResponse + (*Params)(nil), // 4: poktroll.gateway.Params + (*v1beta1.Coin)(nil), // 5: cosmos.base.v1beta1.Coin } var file_poktroll_gateway_tx_proto_depIdxs = []int32{ - 2, // 0: poktroll.gateway.MsgUpdateParams.params:type_name -> poktroll.gateway.Params - 0, // 1: poktroll.gateway.Msg.UpdateParams:input_type -> poktroll.gateway.MsgUpdateParams - 1, // 2: poktroll.gateway.Msg.UpdateParams:output_type -> poktroll.gateway.MsgUpdateParamsResponse - 2, // [2:3] is the sub-list for method output_type - 1, // [1:2] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name + 4, // 0: poktroll.gateway.MsgUpdateParams.params:type_name -> poktroll.gateway.Params + 5, // 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 + 1, // 4: poktroll.gateway.Msg.UpdateParams:output_type -> poktroll.gateway.MsgUpdateParamsResponse + 3, // 5: poktroll.gateway.Msg.StakeGateway:output_type -> poktroll.gateway.MsgStakeGatewayResponse + 4, // [4:6] is the sub-list for method output_type + 2, // [2:4] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name } func init() { file_poktroll_gateway_tx_proto_init() } @@ -1067,6 +2013,30 @@ func file_poktroll_gateway_tx_proto_init() { return nil } } + file_poktroll_gateway_tx_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgStakeGateway); 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[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgStakeGatewayResponse); 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{ @@ -1074,7 +2044,7 @@ func file_poktroll_gateway_tx_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_poktroll_gateway_tx_proto_rawDesc, NumEnums: 0, - NumMessages: 2, + NumMessages: 4, NumExtensions: 0, NumServices: 1, }, diff --git a/proto/poktroll/gateway/tx.proto b/proto/poktroll/gateway/tx.proto index 8d78d1901..0b95835e7 100644 --- a/proto/poktroll/gateway/tx.proto +++ b/proto/poktroll/gateway/tx.proto @@ -1,4 +1,5 @@ syntax = "proto3"; + package poktroll.gateway; import "amino/amino.proto"; @@ -6,35 +7,42 @@ import "cosmos/msg/v1/msg.proto"; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; import "poktroll/gateway/params.proto"; +import "cosmos/base/v1beta1/coin.proto"; option go_package = "github.com/pokt-network/poktroll/x/gateway/types"; // Msg defines the Msg service. service Msg { option (cosmos.msg.v1.service) = true; - + // UpdateParams defines a (governance) operation for updating the module // parameters. The authority defaults to the x/gov module account. - rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); + rpc UpdateParams (MsgUpdateParams) returns (MsgUpdateParamsResponse); + rpc StakeGateway (MsgStakeGateway) returns (MsgStakeGatewayResponse); } - // 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"]; // params defines the module parameters to update. - // + // NOTE: All parameters must be supplied. - Params params = 2 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; + Params params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // MsgUpdateParamsResponse defines the response structure for executing a // MsgUpdateParams message. -message MsgUpdateParamsResponse {} \ No newline at end of file +message MsgUpdateParamsResponse {} + +message MsgStakeGateway { + option (cosmos.msg.v1.signer) = "address"; + string address = 1; + cosmos.base.v1beta1.Coin stake = 2 [(gogoproto.nullable) = false]; +} + +message MsgStakeGatewayResponse {} + diff --git a/x/gateway/keeper/msg_server_stake_gateway.go b/x/gateway/keeper/msg_server_stake_gateway.go new file mode 100644 index 000000000..fae872100 --- /dev/null +++ b/x/gateway/keeper/msg_server_stake_gateway.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) StakeGateway(goCtx context.Context, msg *types.MsgStakeGateway) (*types.MsgStakeGatewayResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + // TODO: Handling the message + _ = ctx + + return &types.MsgStakeGatewayResponse{}, nil +} diff --git a/x/gateway/module/autocli.go b/x/gateway/module/autocli.go index 65d72973a..11ffb61d9 100644 --- a/x/gateway/module/autocli.go +++ b/x/gateway/module/autocli.go @@ -39,6 +39,12 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { RpcMethod: "UpdateParams", Skip: true, // skipped because authority gated }, + { + RpcMethod: "StakeGateway", + Use: "stake-gateway [stake]", + Short: "Send a stake_gateway tx", + PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "stake"}}, + }, // this line is used by ignite scaffolding # autocli/tx }, }, diff --git a/x/gateway/module/simulation.go b/x/gateway/module/simulation.go index 2d04c9d93..49091e24d 100644 --- a/x/gateway/module/simulation.go +++ b/x/gateway/module/simulation.go @@ -23,7 +23,11 @@ var ( ) const ( -// this line is used by starport scaffolding # simapp/module/const + opWeightMsgStakeGateway = "op_weight_msg_stake_gateway" + // TODO: Determine the simulation weight value + defaultWeightMsgStakeGateway int = 100 + + // this line is used by starport scaffolding # simapp/module/const ) // GenerateGenesisState creates a randomized GenState of the module. @@ -51,6 +55,17 @@ func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedP func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { operations := make([]simtypes.WeightedOperation, 0) + var weightMsgStakeGateway int + simState.AppParams.GetOrGenerate(opWeightMsgStakeGateway, &weightMsgStakeGateway, nil, + func(_ *rand.Rand) { + weightMsgStakeGateway = defaultWeightMsgStakeGateway + }, + ) + operations = append(operations, simulation.NewWeightedOperation( + weightMsgStakeGateway, + gatewaysimulation.SimulateMsgStakeGateway(am.accountKeeper, am.bankKeeper, am.keeper), + )) + // this line is used by starport scaffolding # simapp/module/operation return operations @@ -59,6 +74,14 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp // ProposalMsgs returns msgs used for governance proposals for simulations. func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg { return []simtypes.WeightedProposalMsg{ + simulation.NewWeightedProposalMsg( + opWeightMsgStakeGateway, + defaultWeightMsgStakeGateway, + func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { + gatewaysimulation.SimulateMsgStakeGateway(am.accountKeeper, am.bankKeeper, am.keeper) + return nil + }, + ), // this line is used by starport scaffolding # simapp/module/OpMsg } } diff --git a/x/gateway/simulation/stake_gateway.go b/x/gateway/simulation/stake_gateway.go new file mode 100644 index 000000000..ebffa84a5 --- /dev/null +++ b/x/gateway/simulation/stake_gateway.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 SimulateMsgStakeGateway( + 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.MsgStakeGateway{ + Address: simAccount.Address.String(), + } + + // TODO: Handling the StakeGateway simulation + + return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(msg), "StakeGateway simulation not implemented"), nil, nil + } +} diff --git a/x/gateway/types/codec.go b/x/gateway/types/codec.go index ac5526374..7bedad1e0 100644 --- a/x/gateway/types/codec.go +++ b/x/gateway/types/codec.go @@ -8,6 +8,9 @@ import ( ) func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgStakeGateway{}, + ) // this line is used by starport scaffolding # 3 registry.RegisterImplementations((*sdk.Msg)(nil), diff --git a/x/gateway/types/message_stake_gateway.go b/x/gateway/types/message_stake_gateway.go new file mode 100644 index 000000000..9d2d53473 --- /dev/null +++ b/x/gateway/types/message_stake_gateway.go @@ -0,0 +1,24 @@ +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 = &MsgStakeGateway{} + +func NewMsgStakeGateway(address string, stake sdk.Coin) *MsgStakeGateway { + return &MsgStakeGateway{ + Address: address, + Stake: stake, + } +} + +func (msg *MsgStakeGateway) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.Address) + if err != nil { + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid address address (%s)", err) + } + return nil +} diff --git a/x/gateway/types/message_stake_gateway_test.go b/x/gateway/types/message_stake_gateway_test.go new file mode 100644 index 000000000..3d5d4fc80 --- /dev/null +++ b/x/gateway/types/message_stake_gateway_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 TestMsgStakeGateway_ValidateBasic(t *testing.T) { + tests := []struct { + name string + msg MsgStakeGateway + err error + }{ + { + name: "invalid address", + msg: MsgStakeGateway{ + Address: "invalid_address", + }, + err: sdkerrors.ErrInvalidAddress, + }, { + name: "valid address", + msg: MsgStakeGateway{ + Address: 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) + }) + } +} From c9263bfa9a74308b8efc2041855cd0666c1049b7 Mon Sep 17 00:00:00 2001 From: Redouane Lakrache Date: Thu, 8 Feb 2024 07:09:54 +0100 Subject: [PATCH 04/10] scaffold: message unstake_gateway --module gateway ignite scaffold message unstake_gateway --signer address --module gateway --- api/poktroll/gateway/tx.pulsar.go | 953 +++++++++++++++++- proto/poktroll/gateway/tx.proto | 12 +- .../keeper/msg_server_unstake_gateway.go | 17 + x/gateway/module/autocli.go | 6 + x/gateway/module/simulation.go | 23 + x/gateway/simulation/unstake_gateway.go | 29 + x/gateway/types/codec.go | 3 + x/gateway/types/message_unstake_gateway.go | 23 + .../types/message_unstake_gateway_test.go | 40 + 9 files changed, 1066 insertions(+), 40 deletions(-) create mode 100644 x/gateway/keeper/msg_server_unstake_gateway.go create mode 100644 x/gateway/simulation/unstake_gateway.go create mode 100644 x/gateway/types/message_unstake_gateway.go create mode 100644 x/gateway/types/message_unstake_gateway_test.go diff --git a/api/poktroll/gateway/tx.pulsar.go b/api/poktroll/gateway/tx.pulsar.go index 65f83b8f9..4dfabde01 100644 --- a/api/poktroll/gateway/tx.pulsar.go +++ b/api/poktroll/gateway/tx.pulsar.go @@ -1727,6 +1727,782 @@ func (x *fastReflection_MsgStakeGatewayResponse) ProtoMethods() *protoiface.Meth } } +var ( + md_MsgUnstakeGateway protoreflect.MessageDescriptor + fd_MsgUnstakeGateway_address protoreflect.FieldDescriptor +) + +func init() { + file_poktroll_gateway_tx_proto_init() + md_MsgUnstakeGateway = File_poktroll_gateway_tx_proto.Messages().ByName("MsgUnstakeGateway") + fd_MsgUnstakeGateway_address = md_MsgUnstakeGateway.Fields().ByName("address") +} + +var _ protoreflect.Message = (*fastReflection_MsgUnstakeGateway)(nil) + +type fastReflection_MsgUnstakeGateway MsgUnstakeGateway + +func (x *MsgUnstakeGateway) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUnstakeGateway)(x) +} + +func (x *MsgUnstakeGateway) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_gateway_tx_proto_msgTypes[4] + 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_MsgUnstakeGateway_messageType fastReflection_MsgUnstakeGateway_messageType +var _ protoreflect.MessageType = fastReflection_MsgUnstakeGateway_messageType{} + +type fastReflection_MsgUnstakeGateway_messageType struct{} + +func (x fastReflection_MsgUnstakeGateway_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUnstakeGateway)(nil) +} +func (x fastReflection_MsgUnstakeGateway_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUnstakeGateway) +} +func (x fastReflection_MsgUnstakeGateway_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUnstakeGateway +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUnstakeGateway) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUnstakeGateway +} + +// 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_MsgUnstakeGateway) Type() protoreflect.MessageType { + return _fastReflection_MsgUnstakeGateway_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUnstakeGateway) New() protoreflect.Message { + return new(fastReflection_MsgUnstakeGateway) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUnstakeGateway) Interface() protoreflect.ProtoMessage { + return (*MsgUnstakeGateway)(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_MsgUnstakeGateway) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Address != "" { + value := protoreflect.ValueOfString(x.Address) + if !f(fd_MsgUnstakeGateway_address, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgUnstakeGateway) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "poktroll.gateway.MsgUnstakeGateway.address": + return x.Address != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUnstakeGateway")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgUnstakeGateway 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_MsgUnstakeGateway) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "poktroll.gateway.MsgUnstakeGateway.address": + x.Address = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUnstakeGateway")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgUnstakeGateway 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_MsgUnstakeGateway) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "poktroll.gateway.MsgUnstakeGateway.address": + value := x.Address + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUnstakeGateway")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgUnstakeGateway 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_MsgUnstakeGateway) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "poktroll.gateway.MsgUnstakeGateway.address": + x.Address = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUnstakeGateway")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgUnstakeGateway 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_MsgUnstakeGateway) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.gateway.MsgUnstakeGateway.address": + panic(fmt.Errorf("field address of message poktroll.gateway.MsgUnstakeGateway is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUnstakeGateway")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgUnstakeGateway 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_MsgUnstakeGateway) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "poktroll.gateway.MsgUnstakeGateway.address": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUnstakeGateway")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgUnstakeGateway 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_MsgUnstakeGateway) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.gateway.MsgUnstakeGateway", 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_MsgUnstakeGateway) 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_MsgUnstakeGateway) 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_MsgUnstakeGateway) 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_MsgUnstakeGateway) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgUnstakeGateway) + 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.Address) + 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().(*MsgUnstakeGateway) + 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.Address) > 0 { + i -= len(x.Address) + copy(dAtA[i:], x.Address) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Address))) + 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().(*MsgUnstakeGateway) + 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: MsgUnstakeGateway: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUnstakeGateway: 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 Address", 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.Address = 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_MsgUnstakeGatewayResponse protoreflect.MessageDescriptor +) + +func init() { + file_poktroll_gateway_tx_proto_init() + md_MsgUnstakeGatewayResponse = File_poktroll_gateway_tx_proto.Messages().ByName("MsgUnstakeGatewayResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgUnstakeGatewayResponse)(nil) + +type fastReflection_MsgUnstakeGatewayResponse MsgUnstakeGatewayResponse + +func (x *MsgUnstakeGatewayResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUnstakeGatewayResponse)(x) +} + +func (x *MsgUnstakeGatewayResponse) slowProtoReflect() protoreflect.Message { + mi := &file_poktroll_gateway_tx_proto_msgTypes[5] + 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_MsgUnstakeGatewayResponse_messageType fastReflection_MsgUnstakeGatewayResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgUnstakeGatewayResponse_messageType{} + +type fastReflection_MsgUnstakeGatewayResponse_messageType struct{} + +func (x fastReflection_MsgUnstakeGatewayResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUnstakeGatewayResponse)(nil) +} +func (x fastReflection_MsgUnstakeGatewayResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUnstakeGatewayResponse) +} +func (x fastReflection_MsgUnstakeGatewayResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUnstakeGatewayResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUnstakeGatewayResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUnstakeGatewayResponse +} + +// 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_MsgUnstakeGatewayResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgUnstakeGatewayResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUnstakeGatewayResponse) New() protoreflect.Message { + return new(fastReflection_MsgUnstakeGatewayResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUnstakeGatewayResponse) Interface() protoreflect.ProtoMessage { + return (*MsgUnstakeGatewayResponse)(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_MsgUnstakeGatewayResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgUnstakeGatewayResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUnstakeGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgUnstakeGatewayResponse 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_MsgUnstakeGatewayResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUnstakeGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgUnstakeGatewayResponse 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_MsgUnstakeGatewayResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUnstakeGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgUnstakeGatewayResponse 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_MsgUnstakeGatewayResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUnstakeGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgUnstakeGatewayResponse 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_MsgUnstakeGatewayResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUnstakeGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgUnstakeGatewayResponse 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_MsgUnstakeGatewayResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.MsgUnstakeGatewayResponse")) + } + panic(fmt.Errorf("message poktroll.gateway.MsgUnstakeGatewayResponse 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_MsgUnstakeGatewayResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in poktroll.gateway.MsgUnstakeGatewayResponse", 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_MsgUnstakeGatewayResponse) 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_MsgUnstakeGatewayResponse) 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_MsgUnstakeGatewayResponse) 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_MsgUnstakeGatewayResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgUnstakeGatewayResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgUnstakeGatewayResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgUnstakeGatewayResponse) + 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: MsgUnstakeGatewayResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUnstakeGatewayResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 @@ -1883,6 +2659,67 @@ func (*MsgStakeGatewayResponse) Descriptor() ([]byte, []int) { return file_poktroll_gateway_tx_proto_rawDescGZIP(), []int{3} } +type MsgUnstakeGateway struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` +} + +func (x *MsgUnstakeGateway) Reset() { + *x = MsgUnstakeGateway{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_gateway_tx_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUnstakeGateway) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUnstakeGateway) ProtoMessage() {} + +// Deprecated: Use MsgUnstakeGateway.ProtoReflect.Descriptor instead. +func (*MsgUnstakeGateway) Descriptor() ([]byte, []int) { + return file_poktroll_gateway_tx_proto_rawDescGZIP(), []int{4} +} + +func (x *MsgUnstakeGateway) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +type MsgUnstakeGatewayResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgUnstakeGatewayResponse) Reset() { + *x = MsgUnstakeGatewayResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_poktroll_gateway_tx_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUnstakeGatewayResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUnstakeGatewayResponse) ProtoMessage() {} + +// Deprecated: Use MsgUnstakeGatewayResponse.ProtoReflect.Descriptor instead. +func (*MsgUnstakeGatewayResponse) Descriptor() ([]byte, []int) { + return file_poktroll_gateway_tx_proto_rawDescGZIP(), []int{5} +} + var File_poktroll_gateway_tx_proto protoreflect.FileDescriptor var file_poktroll_gateway_tx_proto_rawDesc = []byte{ @@ -1921,30 +2758,42 @@ var file_poktroll_gateway_tx_proto_rawDesc = []byte{ 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x3a, 0x0c, 0x82, 0xe7, 0xb0, 0x2a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x19, 0x0a, 0x17, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x32, 0xc8, 0x01, 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, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xa3, 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, 0x22, 0x3b, 0x0a, 0x11, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x47, + 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 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, 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, 0xa3, 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 ( @@ -1959,24 +2808,28 @@ 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, 4) +var file_poktroll_gateway_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_poktroll_gateway_tx_proto_goTypes = []interface{}{ - (*MsgUpdateParams)(nil), // 0: poktroll.gateway.MsgUpdateParams - (*MsgUpdateParamsResponse)(nil), // 1: poktroll.gateway.MsgUpdateParamsResponse - (*MsgStakeGateway)(nil), // 2: poktroll.gateway.MsgStakeGateway - (*MsgStakeGatewayResponse)(nil), // 3: poktroll.gateway.MsgStakeGatewayResponse - (*Params)(nil), // 4: poktroll.gateway.Params - (*v1beta1.Coin)(nil), // 5: cosmos.base.v1beta1.Coin + (*MsgUpdateParams)(nil), // 0: poktroll.gateway.MsgUpdateParams + (*MsgUpdateParamsResponse)(nil), // 1: poktroll.gateway.MsgUpdateParamsResponse + (*MsgStakeGateway)(nil), // 2: poktroll.gateway.MsgStakeGateway + (*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 } var file_poktroll_gateway_tx_proto_depIdxs = []int32{ - 4, // 0: poktroll.gateway.MsgUpdateParams.params:type_name -> poktroll.gateway.Params - 5, // 1: poktroll.gateway.MsgStakeGateway.stake:type_name -> cosmos.base.v1beta1.Coin + 6, // 0: poktroll.gateway.MsgUpdateParams.params:type_name -> poktroll.gateway.Params + 7, // 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 - 1, // 4: poktroll.gateway.Msg.UpdateParams:output_type -> poktroll.gateway.MsgUpdateParamsResponse - 3, // 5: poktroll.gateway.Msg.StakeGateway:output_type -> poktroll.gateway.MsgStakeGatewayResponse - 4, // [4:6] is the sub-list for method output_type - 2, // [2:4] is the sub-list for method input_type + 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 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 @@ -2037,6 +2890,30 @@ func file_poktroll_gateway_tx_proto_init() { return nil } } + file_poktroll_gateway_tx_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgUnstakeGateway); 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[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgUnstakeGatewayResponse); 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{ @@ -2044,7 +2921,7 @@ func file_poktroll_gateway_tx_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_poktroll_gateway_tx_proto_rawDesc, NumEnums: 0, - NumMessages: 4, + NumMessages: 6, NumExtensions: 0, NumServices: 1, }, diff --git a/proto/poktroll/gateway/tx.proto b/proto/poktroll/gateway/tx.proto index 0b95835e7..e2fe86b36 100644 --- a/proto/poktroll/gateway/tx.proto +++ b/proto/poktroll/gateway/tx.proto @@ -17,8 +17,9 @@ service Msg { // 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 UpdateParams (MsgUpdateParams ) returns (MsgUpdateParamsResponse ); + rpc StakeGateway (MsgStakeGateway ) returns (MsgStakeGatewayResponse ); + rpc UnstakeGateway (MsgUnstakeGateway) returns (MsgUnstakeGatewayResponse); } // MsgUpdateParams is the Msg/UpdateParams request type. message MsgUpdateParams { @@ -46,3 +47,10 @@ message MsgStakeGateway { message MsgStakeGatewayResponse {} +message MsgUnstakeGateway { + option (cosmos.msg.v1.signer) = "address"; + string address = 1; +} + +message MsgUnstakeGatewayResponse {} + diff --git a/x/gateway/keeper/msg_server_unstake_gateway.go b/x/gateway/keeper/msg_server_unstake_gateway.go new file mode 100644 index 000000000..841590314 --- /dev/null +++ b/x/gateway/keeper/msg_server_unstake_gateway.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) UnstakeGateway(goCtx context.Context, msg *types.MsgUnstakeGateway) (*types.MsgUnstakeGatewayResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + // TODO: Handling the message + _ = ctx + + return &types.MsgUnstakeGatewayResponse{}, nil +} diff --git a/x/gateway/module/autocli.go b/x/gateway/module/autocli.go index 11ffb61d9..8506d3c82 100644 --- a/x/gateway/module/autocli.go +++ b/x/gateway/module/autocli.go @@ -45,6 +45,12 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { Short: "Send a stake_gateway tx", PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "stake"}}, }, + { + RpcMethod: "UnstakeGateway", + Use: "unstake-gateway", + Short: "Send a unstake_gateway tx", + PositionalArgs: []*autocliv1.PositionalArgDescriptor{}, + }, // this line is used by ignite scaffolding # autocli/tx }, }, diff --git a/x/gateway/module/simulation.go b/x/gateway/module/simulation.go index 49091e24d..d87166a4c 100644 --- a/x/gateway/module/simulation.go +++ b/x/gateway/module/simulation.go @@ -27,6 +27,10 @@ const ( // TODO: Determine the simulation weight value defaultWeightMsgStakeGateway int = 100 + opWeightMsgUnstakeGateway = "op_weight_msg_unstake_gateway" + // TODO: Determine the simulation weight value + defaultWeightMsgUnstakeGateway int = 100 + // this line is used by starport scaffolding # simapp/module/const ) @@ -66,6 +70,17 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp gatewaysimulation.SimulateMsgStakeGateway(am.accountKeeper, am.bankKeeper, am.keeper), )) + var weightMsgUnstakeGateway int + simState.AppParams.GetOrGenerate(opWeightMsgUnstakeGateway, &weightMsgUnstakeGateway, nil, + func(_ *rand.Rand) { + weightMsgUnstakeGateway = defaultWeightMsgUnstakeGateway + }, + ) + operations = append(operations, simulation.NewWeightedOperation( + weightMsgUnstakeGateway, + gatewaysimulation.SimulateMsgUnstakeGateway(am.accountKeeper, am.bankKeeper, am.keeper), + )) + // this line is used by starport scaffolding # simapp/module/operation return operations @@ -82,6 +97,14 @@ func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.Wei return nil }, ), + simulation.NewWeightedProposalMsg( + opWeightMsgUnstakeGateway, + defaultWeightMsgUnstakeGateway, + func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { + gatewaysimulation.SimulateMsgUnstakeGateway(am.accountKeeper, am.bankKeeper, am.keeper) + return nil + }, + ), // this line is used by starport scaffolding # simapp/module/OpMsg } } diff --git a/x/gateway/simulation/unstake_gateway.go b/x/gateway/simulation/unstake_gateway.go new file mode 100644 index 000000000..69bc3233b --- /dev/null +++ b/x/gateway/simulation/unstake_gateway.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 SimulateMsgUnstakeGateway( + 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.MsgUnstakeGateway{ + Address: simAccount.Address.String(), + } + + // TODO: Handling the UnstakeGateway simulation + + return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(msg), "UnstakeGateway simulation not implemented"), nil, nil + } +} diff --git a/x/gateway/types/codec.go b/x/gateway/types/codec.go index 7bedad1e0..4d175c529 100644 --- a/x/gateway/types/codec.go +++ b/x/gateway/types/codec.go @@ -11,6 +11,9 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { registry.RegisterImplementations((*sdk.Msg)(nil), &MsgStakeGateway{}, ) + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgUnstakeGateway{}, + ) // this line is used by starport scaffolding # 3 registry.RegisterImplementations((*sdk.Msg)(nil), diff --git a/x/gateway/types/message_unstake_gateway.go b/x/gateway/types/message_unstake_gateway.go new file mode 100644 index 000000000..4af462de9 --- /dev/null +++ b/x/gateway/types/message_unstake_gateway.go @@ -0,0 +1,23 @@ +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 = &MsgUnstakeGateway{} + +func NewMsgUnstakeGateway(address string) *MsgUnstakeGateway { + return &MsgUnstakeGateway{ + Address: address, + } +} + +func (msg *MsgUnstakeGateway) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.Address) + if err != nil { + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid address address (%s)", err) + } + return nil +} diff --git a/x/gateway/types/message_unstake_gateway_test.go b/x/gateway/types/message_unstake_gateway_test.go new file mode 100644 index 000000000..9fca2d39d --- /dev/null +++ b/x/gateway/types/message_unstake_gateway_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 TestMsgUnstakeGateway_ValidateBasic(t *testing.T) { + tests := []struct { + name string + msg MsgUnstakeGateway + err error + }{ + { + name: "invalid address", + msg: MsgUnstakeGateway{ + Address: "invalid_address", + }, + err: sdkerrors.ErrInvalidAddress, + }, { + name: "valid address", + msg: MsgUnstakeGateway{ + Address: 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) + }) + } +} From f860fe8dbb8d03eed6a14d755a004dcd5abdfa6b Mon Sep 17 00:00:00 2001 From: Redouane Lakrache Date: Thu, 8 Feb 2024 10:21:15 +0100 Subject: [PATCH 05/10] reconcile: gateway stake --- Makefile | 2 +- api/poktroll/gateway/gateway.pulsar.go | 46 ++--- api/poktroll/gateway/query.pulsar.go | 168 +++++++++--------- api/poktroll/gateway/tx.pulsar.go | 97 +++++----- go.mod | 4 +- proto/poktroll/gateway/gateway.proto | 10 +- proto/poktroll/gateway/genesis.proto | 1 - proto/poktroll/gateway/query.proto | 15 +- proto/poktroll/gateway/tx.proto | 12 +- testutil/gateway/mocks/mocks.go | 11 ++ testutil/keeper/gateway.go | 9 +- x/gateway/keeper/gateway.go | 1 + x/gateway/keeper/gateway_test.go | 14 +- x/gateway/keeper/msg_server_stake_gateway.go | 74 +++++++- .../keeper/msg_server_stake_gateway_test.go | 92 ++++++++++ x/gateway/keeper/msg_update_params.go | 5 +- x/gateway/keeper/query_gateway.go | 4 +- x/gateway/keeper/query_gateway_test.go | 3 +- x/gateway/types/errors.go | 7 +- x/gateway/types/expected_keepers.go | 6 +- x/gateway/types/message_stake_gateway.go | 24 ++- x/gateway/types/message_stake_gateway_test.go | 51 +++++- 22 files changed, 464 insertions(+), 192 deletions(-) create mode 100644 testutil/gateway/mocks/mocks.go create mode 100644 x/gateway/keeper/msg_server_stake_gateway_test.go diff --git a/Makefile b/Makefile index 2de00ef69..9b438dde1 100644 --- a/Makefile +++ b/Makefile @@ -237,7 +237,7 @@ itest: check_go_version ## Run tests iteratively (see usage for more) go_mockgen: ## Use `mockgen` to generate mocks used for testing purposes of all the modules. find . -name "*_mock.go" | xargs --no-run-if-empty rm # go generate ./x/application/types/ - # go generate ./x/gateway/types/ + go generate ./x/gateway/types/ # go generate ./x/supplier/types/ # go generate ./x/session/types/ # go generate ./x/service/types/ diff --git a/api/poktroll/gateway/gateway.pulsar.go b/api/poktroll/gateway/gateway.pulsar.go index e7fdcbe74..edcafe393 100644 --- a/api/poktroll/gateway/gateway.pulsar.go +++ b/api/poktroll/gateway/gateway.pulsar.go @@ -4,6 +4,7 @@ package gateway import ( v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1" fmt "fmt" + _ "github.com/cosmos/cosmos-proto" runtime "github.com/cosmos/cosmos-proto/runtime" _ "github.com/cosmos/gogoproto/gogoproto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" @@ -575,27 +576,30 @@ var file_poktroll_gateway_gateway_proto_rawDesc = []byte{ 0x0a, 0x1e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 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, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, - 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x6f, - 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x5a, 0x0a, 0x07, 0x47, 0x61, 0x74, 0x65, - 0x77, 0x61, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x35, 0x0a, - 0x05, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, - 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x05, 0x73, - 0x74, 0x61, 0x6b, 0x65, 0x42, 0xa8, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, 0x0c, 0x47, - 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 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, + 0x61, 0x79, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, + 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, + 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x22, 0x6e, 0x0a, 0x07, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x32, + 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x12, 0x2f, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x52, 0x05, 0x73, 0x74, + 0x61, 0x6b, 0x65, 0x42, 0xa8, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, 0x0c, 0x47, 0x61, + 0x74, 0x65, 0x77, 0x61, 0x79, 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 ( diff --git a/api/poktroll/gateway/query.pulsar.go b/api/poktroll/gateway/query.pulsar.go index 6f821812b..dce0a107e 100644 --- a/api/poktroll/gateway/query.pulsar.go +++ b/api/poktroll/gateway/query.pulsar.go @@ -6,6 +6,7 @@ import ( v1beta1 "cosmossdk.io/api/cosmos/base/query/v1beta1" _ "cosmossdk.io/api/cosmos/base/v1beta1" fmt "fmt" + _ "github.com/cosmos/cosmos-proto" runtime "github.com/cosmos/cosmos-proto/runtime" _ "github.com/cosmos/gogoproto/gogoproto" _ "google.golang.org/genproto/googleapis/api/annotations" @@ -2903,89 +2904,92 @@ var file_poktroll_gateway_query_proto_rawDesc = []byte{ 0x61, 0x79, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 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, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, - 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, - 0x62, 0x61, 0x73, 0x65, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, - 0x61, 0x31, 0x2f, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, - 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x1a, 0x1e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, - 0x65, 0x77, 0x61, 0x79, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, - 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x22, 0x14, 0x0a, 0x12, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x52, 0x0a, 0x13, 0x51, 0x75, 0x65, 0x72, - 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x3b, 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, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, - 0xe7, 0xb0, 0x2a, 0x01, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x32, 0x0a, 0x16, - 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x22, 0x54, 0x0a, 0x17, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x47, 0x61, 0x74, 0x65, - 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a, 0x07, 0x67, - 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, - 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, - 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x07, 0x67, - 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x22, 0x60, 0x0a, 0x16, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, - 0x6c, 0x6c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x46, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, - 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, - 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x0a, 0x70, 0x61, - 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x9d, 0x01, 0x0a, 0x17, 0x51, 0x75, 0x65, - 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a, 0x07, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x18, - 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, - 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x07, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, - 0x47, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, - 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, - 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x0a, 0x70, 0x61, - 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x32, 0xbd, 0x03, 0x0a, 0x05, 0x51, 0x75, 0x65, - 0x72, 0x79, 0x12, 0x84, 0x01, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x24, 0x2e, - 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, - 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, - 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2d, 0x82, 0xd3, 0xe4, 0x93, - 0x02, 0x27, 0x12, 0x25, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, - 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, - 0x61, 0x79, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x98, 0x01, 0x0a, 0x07, 0x47, 0x61, - 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x28, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, - 0x74, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, - 0x61, 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x47, 0x61, 0x74, 0x65, 0x77, - 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x38, 0x82, 0xd3, 0xe4, 0x93, - 0x02, 0x32, 0x12, 0x30, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, - 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, - 0x61, 0x79, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x7b, 0x61, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x7d, 0x12, 0x91, 0x01, 0x0a, 0x0a, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, - 0x41, 0x6c, 0x6c, 0x12, 0x28, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, - 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x47, - 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, - 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, - 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x28, - 0x12, 0x26, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, + 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, + 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, + 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x2a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, + 0x71, 0x75, 0x65, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x70, 0x61, + 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, - 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, 0xa6, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, - 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, - 0x79, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 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, + 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, + 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x14, 0x0a, + 0x12, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x22, 0x52, 0x0a, 0x13, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 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, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, + 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x4c, 0x0a, 0x16, 0x51, 0x75, 0x65, 0x72, 0x79, + 0x47, 0x65, 0x74, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x32, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x61, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x54, 0x0a, 0x17, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, + 0x74, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x39, 0x0a, 0x07, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, + 0x65, 0x77, 0x61, 0x79, 0x2e, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, 0x04, 0xc8, 0xde, + 0x1f, 0x00, 0x52, 0x07, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x22, 0x60, 0x0a, 0x16, 0x51, + 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x46, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x31, + 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x9d, 0x01, + 0x0a, 0x17, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, + 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a, 0x07, 0x67, 0x61, 0x74, + 0x65, 0x77, 0x61, 0x79, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x47, 0x61, + 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x07, 0x67, 0x61, 0x74, + 0x65, 0x77, 0x61, 0x79, 0x12, 0x47, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x62, + 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x32, 0xbd, 0x03, + 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x84, 0x01, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x12, 0x24, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, + 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x2d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x12, 0x25, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, + 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, + 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x98, + 0x01, 0x0a, 0x07, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x28, 0x2e, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x51, 0x75, + 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, + 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, + 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x38, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x32, 0x12, 0x30, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, + 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, + 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, + 0x7b, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x7d, 0x12, 0x91, 0x01, 0x0a, 0x0a, 0x47, 0x61, + 0x74, 0x65, 0x77, 0x61, 0x79, 0x41, 0x6c, 0x6c, 0x12, 0x28, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x41, 0x6c, 0x6c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, + 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x47, 0x61, + 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2e, 0x82, + 0xd3, 0xe4, 0x93, 0x02, 0x28, 0x12, 0x26, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, + 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, + 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, 0xa6, 0x01, + 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, + 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 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 ( diff --git a/api/poktroll/gateway/tx.pulsar.go b/api/poktroll/gateway/tx.pulsar.go index 4dfabde01..0455a1622 100644 --- a/api/poktroll/gateway/tx.pulsar.go +++ b/api/poktroll/gateway/tx.pulsar.go @@ -2595,8 +2595,8 @@ type MsgStakeGateway struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - Stake *v1beta1.Coin `protobuf:"bytes,2,opt,name=stake,proto3" json:"stake,omitempty"` + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // The Bech32 address of the gateway + Stake *v1beta1.Coin `protobuf:"bytes,2,opt,name=stake,proto3" json:"stake,omitempty"` // The total amount of uPOKT the gateway is staking. Must be ≥ to the current amount that the gateway has staked (if any) } func (x *MsgStakeGateway) Reset() { @@ -2749,51 +2749,54 @@ var file_poktroll_gateway_tx_proto_rawDesc = []byte{ 0x78, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x19, 0x0a, 0x17, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x70, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, - 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, - 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x12, 0x35, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, - 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x04, 0xc8, 0xde, 0x1f, - 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x3a, 0x0c, 0x82, 0xe7, 0xb0, 0x2a, 0x07, 0x61, - 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x19, 0x0a, 0x17, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, - 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x3b, 0x0a, 0x11, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x47, - 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 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, 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, 0xa3, 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, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x84, 0x01, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, + 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x32, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, + 0x69, 0x6e, 0x67, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x2f, 0x0a, 0x05, + 0x73, 0x74, 0x61, 0x6b, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x52, 0x05, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x3a, 0x0c, 0x82, + 0xe7, 0xb0, 0x2a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x19, 0x0a, 0x17, 0x4d, + 0x73, 0x67, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x55, 0x0a, 0x11, 0x4d, 0x73, 0x67, 0x55, 0x6e, 0x73, + 0x74, 0x61, 0x6b, 0x65, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x32, 0x0a, 0x07, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, + 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 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, + 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, 0xa3, 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 ( diff --git a/go.mod b/go.mod index 8efea2720..5ad018f52 100644 --- a/go.mod +++ b/go.mod @@ -18,6 +18,7 @@ require ( cosmossdk.io/depinject v1.0.0-alpha.4 cosmossdk.io/errors v1.0.0 cosmossdk.io/log v1.2.1 + cosmossdk.io/math v1.2.0 cosmossdk.io/store v1.0.1 cosmossdk.io/tools/confix v0.1.1 cosmossdk.io/x/circuit v0.1.0 @@ -32,6 +33,7 @@ require ( github.com/cosmos/gogoproto v1.4.11 github.com/cosmos/ibc-go/modules/capability v1.0.0 github.com/cosmos/ibc-go/v8 v8.0.0 + github.com/golang/mock v1.6.0 github.com/golang/protobuf v1.5.3 github.com/gorilla/mux v1.8.1 github.com/grpc-ecosystem/grpc-gateway v1.16.0 @@ -55,7 +57,6 @@ require ( connectrpc.com/connect v1.14.0 // indirect connectrpc.com/otelconnect v0.7.0 // indirect cosmossdk.io/collections v0.4.0 // indirect - cosmossdk.io/math v1.2.0 // indirect cosmossdk.io/x/tx v0.12.0 // indirect filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect @@ -142,7 +143,6 @@ require ( github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/glog v1.2.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect - github.com/golang/mock v1.6.0 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/btree v1.1.2 // indirect github.com/google/cel-go v0.19.0 // indirect diff --git a/proto/poktroll/gateway/gateway.proto b/proto/poktroll/gateway/gateway.proto index 6d3797001..030ae58b9 100644 --- a/proto/poktroll/gateway/gateway.proto +++ b/proto/poktroll/gateway/gateway.proto @@ -2,12 +2,12 @@ syntax = "proto3"; package poktroll.gateway; option go_package = "github.com/pokt-network/poktroll/x/gateway/types"; -import "gogoproto/gogo.proto"; -import "cosmos/base/v1beta1/coin.proto"; +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; message Gateway { - string address = 1; - cosmos.base.v1beta1.Coin stake = 2 [(gogoproto.nullable) = false]; - + string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + cosmos.base.v1beta1.Coin stake = 2; } diff --git a/proto/poktroll/gateway/genesis.proto b/proto/poktroll/gateway/genesis.proto index c2ee8cf4e..88cef7248 100644 --- a/proto/poktroll/gateway/genesis.proto +++ b/proto/poktroll/gateway/genesis.proto @@ -11,7 +11,6 @@ option go_package = "github.com/pokt-network/poktroll/x/gateway/types"; // GenesisState defines the gateway module's genesis state. message GenesisState { - // params defines all the parameters of the module. Params params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; repeated Gateway gatewayList = 2 [(gogoproto.nullable) = false] ; diff --git a/proto/poktroll/gateway/query.proto b/proto/poktroll/gateway/query.proto index 49f08457f..0cf6d43a2 100644 --- a/proto/poktroll/gateway/query.proto +++ b/proto/poktroll/gateway/query.proto @@ -3,6 +3,7 @@ syntax = "proto3"; package poktroll.gateway; import "amino/amino.proto"; +import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; @@ -14,21 +15,21 @@ option go_package = "github.com/pokt-network/poktroll/x/gateway/types"; // Query defines the gRPC querier service. service Query { - + // Parameters queries the parameters of the module. rpc Params (QueryParamsRequest) returns (QueryParamsResponse) { option (google.api.http).get = "/pokt-network/poktroll/gateway/params"; - + } - + // Queries a list of Gateway items. rpc Gateway (QueryGetGatewayRequest) returns (QueryGetGatewayResponse) { option (google.api.http).get = "/pokt-network/poktroll/gateway/gateway/{address}"; - + } rpc GatewayAll (QueryAllGatewayRequest) returns (QueryAllGatewayResponse) { option (google.api.http).get = "/pokt-network/poktroll/gateway/gateway"; - + } } // QueryParamsRequest is request type for the Query/Params RPC method. @@ -36,13 +37,13 @@ message QueryParamsRequest {} // QueryParamsResponse is response type for the Query/Params RPC method. message QueryParamsResponse { - + // params holds all the parameters of this module. Params params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } message QueryGetGatewayRequest { - string address = 1; + string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } message QueryGetGatewayResponse { diff --git a/proto/poktroll/gateway/tx.proto b/proto/poktroll/gateway/tx.proto index e2fe86b36..0e0cb1eb9 100644 --- a/proto/poktroll/gateway/tx.proto +++ b/proto/poktroll/gateway/tx.proto @@ -14,7 +14,7 @@ option go_package = "github.com/pokt-network/poktroll/x/gateway/types"; // Msg defines the Msg service. service Msg { option (cosmos.msg.v1.service) = true; - + // UpdateParams defines a (governance) operation for updating the module // parameters. The authority defaults to the x/gov module account. rpc UpdateParams (MsgUpdateParams ) returns (MsgUpdateParamsResponse ); @@ -25,12 +25,12 @@ 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"]; // params defines the module parameters to update. - + // NOTE: All parameters must be supplied. Params params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } @@ -41,15 +41,15 @@ message MsgUpdateParamsResponse {} message MsgStakeGateway { option (cosmos.msg.v1.signer) = "address"; - string address = 1; - cosmos.base.v1beta1.Coin stake = 2 [(gogoproto.nullable) = false]; + 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 {} message MsgUnstakeGateway { option (cosmos.msg.v1.signer) = "address"; - string address = 1; + string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } message MsgUnstakeGatewayResponse {} diff --git a/testutil/gateway/mocks/mocks.go b/testutil/gateway/mocks/mocks.go new file mode 100644 index 000000000..595954e65 --- /dev/null +++ b/testutil/gateway/mocks/mocks.go @@ -0,0 +1,11 @@ +package mocks + +// This file is in place to declare the package for dynamically generated structs. +// +// Note that this does not follow the Cosmos SDK pattern of committing Mocks to main. +// For example, they commit auto-generate code to main: https://github.com/cosmos/cosmos-sdk/blob/main/x/gov/testutil/expected_keepers_mocks.go +// Documentation on how Cosmos uses mockgen can be found here: https://docs.cosmos.network/main/build/building-modules/testing#unit-tests +// +// IMPORTANT: We have attempted to use `.gitkeep` files instead, but it causes a circular dependency issue with protobuf and mock generation +// since we are leveraging `ignite` to compile `.proto` files which runs `go mod tidy` before generating, requiring the entire dependency tree +// to be valid before mock implementations have been generated. diff --git a/testutil/keeper/gateway.go b/testutil/keeper/gateway.go index 23407f4f2..906a742dd 100644 --- a/testutil/keeper/gateway.go +++ b/testutil/keeper/gateway.go @@ -15,8 +15,10 @@ import ( sdk "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/golang/mock/gomock" "github.com/stretchr/testify/require" + mocks "github.com/pokt-network/poktroll/testutil/gateway/mocks" "github.com/pokt-network/poktroll/x/gateway/keeper" "github.com/pokt-network/poktroll/x/gateway/types" ) @@ -33,12 +35,17 @@ func GatewayKeeper(t testing.TB) (keeper.Keeper, sdk.Context) { cdc := codec.NewProtoCodec(registry) authority := authtypes.NewModuleAddress(govtypes.ModuleName) + ctrl := gomock.NewController(t) + mockBankKeeper := mocks.NewMockBankKeeper(ctrl) + mockBankKeeper.EXPECT().DelegateCoinsFromAccountToModule(gomock.Any(), gomock.Any(), types.ModuleName, gomock.Any()).AnyTimes() + mockBankKeeper.EXPECT().UndelegateCoinsFromModuleToAccount(gomock.Any(), types.ModuleName, gomock.Any(), gomock.Any()).AnyTimes() + k := keeper.NewKeeper( cdc, runtime.NewKVStoreService(storeKey), log.NewNopLogger(), authority.String(), - nil, + mockBankKeeper, ) ctx := sdk.NewContext(stateStore, cmtproto.Header{}, false, log.NewNopLogger()) diff --git a/x/gateway/keeper/gateway.go b/x/gateway/keeper/gateway.go index b04b955e8..a1b8ea56d 100644 --- a/x/gateway/keeper/gateway.go +++ b/x/gateway/keeper/gateway.go @@ -6,6 +6,7 @@ import ( "cosmossdk.io/store/prefix" storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/runtime" + "github.com/pokt-network/poktroll/x/gateway/types" ) diff --git a/x/gateway/keeper/gateway_test.go b/x/gateway/keeper/gateway_test.go index c9e42654f..0e77c232e 100644 --- a/x/gateway/keeper/gateway_test.go +++ b/x/gateway/keeper/gateway_test.go @@ -5,16 +5,23 @@ import ( "strconv" "testing" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/cmd/poktrolld/cmd" keepertest "github.com/pokt-network/poktroll/testutil/keeper" "github.com/pokt-network/poktroll/testutil/nullify" "github.com/pokt-network/poktroll/x/gateway/keeper" "github.com/pokt-network/poktroll/x/gateway/types" - "github.com/stretchr/testify/require" ) // Prevent strconv unused error var _ = strconv.IntSize +func init() { + cmd.InitSDKConfig() +} + func createNGateway(keeper keeper.Keeper, ctx context.Context, n int) []types.Gateway { items := make([]types.Gateway, n) for i := range items { @@ -25,6 +32,11 @@ func createNGateway(keeper keeper.Keeper, ctx context.Context, n int) []types.Ga return items } +func TestGatewayModuleAddress(t *testing.T) { + moduleAddress := authtypes.NewModuleAddress(types.ModuleName) + require.Equal(t, "pokt1f6j7u6875p2cvyrgjr0d2uecyzah0kget9vlpl", moduleAddress.String()) +} + func TestGatewayGet(t *testing.T) { keeper, ctx := keepertest.GatewayKeeper(t) items := createNGateway(keeper, ctx, 10) diff --git a/x/gateway/keeper/msg_server_stake_gateway.go b/x/gateway/keeper/msg_server_stake_gateway.go index fae872100..daf956530 100644 --- a/x/gateway/keeper/msg_server_stake_gateway.go +++ b/x/gateway/keeper/msg_server_stake_gateway.go @@ -2,16 +2,86 @@ package keeper import ( "context" + "fmt" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/pokt-network/poktroll/x/gateway/types" ) func (k msgServer) StakeGateway(goCtx context.Context, msg *types.MsgStakeGateway) (*types.MsgStakeGatewayResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - // TODO: Handling the message - _ = ctx + logger := k.Logger().With("method", "StakeGateway") + logger.Info(fmt.Sprintf("About to stake gateway with msg: %v", msg)) + + if err := msg.ValidateBasic(); err != nil { + return nil, err + } + + // Check if the gateway already exists or not + var err error + var coinsToDelegate sdk.Coin + gateway, isGatewayFound := k.GetGateway(ctx, msg.Address) + if !isGatewayFound { + logger.Info(fmt.Sprintf("Gateway not found. Creating new gateway for address %s", msg.Address)) + gateway = k.createGateway(ctx, msg) + coinsToDelegate = *msg.Stake + } else { + logger.Info(fmt.Sprintf("Gateway found. Updating gateway stake for address %s", msg.Address)) + currGatewayStake := *gateway.Stake + if err = k.updateGateway(ctx, &gateway, msg); err != nil { + return nil, err + } + coinsToDelegate = (*msg.Stake).Sub(currGatewayStake) + } + + // Retrieve the address of the gateway + gatewayAddress, err := sdk.AccAddressFromBech32(msg.Address) + if err != nil { + logger.Error(fmt.Sprintf("could not parse address %s", msg.Address)) + return nil, err + } + + // Send the coins from the gateway to the staked gateway pool + err = k.bankKeeper.DelegateCoinsFromAccountToModule(ctx, gatewayAddress, types.ModuleName, []sdk.Coin{coinsToDelegate}) + if err != nil { + logger.Error(fmt.Sprintf("could not send %v coins from %s to %s module account due to %v", coinsToDelegate, gatewayAddress, types.ModuleName, err)) + return nil, err + } + + // Update the Gateway in the store + k.SetGateway(ctx, gateway) + logger.Info(fmt.Sprintf("Successfully updated stake for gateway: %+v", gateway)) return &types.MsgStakeGatewayResponse{}, nil } + +func (k msgServer) createGateway( + _ sdk.Context, + msg *types.MsgStakeGateway, +) types.Gateway { + return types.Gateway{ + Address: msg.Address, + Stake: msg.Stake, + } +} + +func (k msgServer) updateGateway( + _ sdk.Context, + gateway *types.Gateway, + msg *types.MsgStakeGateway, +) error { + // Checks if the the msg address is the same as the current owner + if msg.Address != gateway.Address { + return types.ErrGatewayUnauthorized.Wrapf("msg Address (%s) != gateway address (%s)", msg.Address, gateway.Address) + } + if msg.Stake.IsZero() { + return types.ErrGatewayInvalidStake.Wrap("stake amount cannot be 0") + } + if msg.Stake.IsLTE(*gateway.Stake) { + return types.ErrGatewayInvalidStake.Wrapf("stake amount %v must be higher than previous stake amount %v", msg.Stake, gateway.Stake) + } + gateway.Stake = msg.Stake + return nil +} diff --git a/x/gateway/keeper/msg_server_stake_gateway_test.go b/x/gateway/keeper/msg_server_stake_gateway_test.go new file mode 100644 index 000000000..9645c1a0a --- /dev/null +++ b/x/gateway/keeper/msg_server_stake_gateway_test.go @@ -0,0 +1,92 @@ +package keeper_test + +import ( + "testing" + + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/testutil/sample" + "github.com/pokt-network/poktroll/x/gateway/keeper" + "github.com/pokt-network/poktroll/x/gateway/types" +) + +func TestMsgServer_StakeGateway_SuccessfulCreateAndUpdate(t *testing.T) { + k, ctx := keepertest.GatewayKeeper(t) + srv := keeper.NewMsgServerImpl(k) + + // Generate an address for the gateway + addr := sample.AccAddress() + + // Verify that the gateway does not exist yet + _, isGatewayFound := k.GetGateway(ctx, addr) + require.False(t, isGatewayFound) + + // Prepare the gateway + initialStake := sdk.NewCoin("upokt", math.NewInt(100)) + stakeMsg := &types.MsgStakeGateway{ + Address: addr, + Stake: &initialStake, + } + + // Stake the gateway + _, err := srv.StakeGateway(ctx, stakeMsg) + require.NoError(t, err) + + // 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 + updatedStake := sdk.NewCoin("upokt", math.NewInt(200)) + updateMsg := &types.MsgStakeGateway{ + Address: addr, + Stake: &updatedStake, + } + + // Update the staked gateway + _, err = srv.StakeGateway(ctx, updateMsg) + require.NoError(t, err) + foundGateway, isGatewayFound = k.GetGateway(ctx, addr) + require.True(t, isGatewayFound) + require.Equal(t, updatedStake.Amount, foundGateway.Stake.Amount) +} + +func TestMsgServer_StakeGateway_FailLoweringStake(t *testing.T) { + k, ctx := keepertest.GatewayKeeper(t) + srv := keeper.NewMsgServerImpl(k) + + // Prepare the gateway + addr := sample.AccAddress() + initialStake := sdk.NewCoin("upokt", math.NewInt(100)) + stakeMsg := &types.MsgStakeGateway{ + Address: addr, + Stake: &initialStake, + } + + // 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 + updatedStake := sdk.NewCoin("upokt", math.NewInt(50)) + updateMsg := &types.MsgStakeGateway{ + Address: addr, + Stake: &updatedStake, + } + + // Verify that it fails + _, err = srv.StakeGateway(ctx, updateMsg) + require.Error(t, err) + + // 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) +} diff --git a/x/gateway/keeper/msg_update_params.go b/x/gateway/keeper/msg_update_params.go index d79ee2dee..5a2fffc12 100644 --- a/x/gateway/keeper/msg_update_params.go +++ b/x/gateway/keeper/msg_update_params.go @@ -9,7 +9,10 @@ import ( "github.com/pokt-network/poktroll/x/gateway/types" ) -func (k msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { +func (k msgServer) UpdateParams( + goCtx context.Context, + req *types.MsgUpdateParams, +) (*types.MsgUpdateParamsResponse, error) { if k.GetAuthority() != req.Authority { return nil, errorsmod.Wrapf(types.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.GetAuthority(), req.Authority) } diff --git a/x/gateway/keeper/query_gateway.go b/x/gateway/keeper/query_gateway.go index c81024bba..284fbe0fe 100644 --- a/x/gateway/keeper/query_gateway.go +++ b/x/gateway/keeper/query_gateway.go @@ -2,6 +2,7 @@ package keeper import ( "context" + "fmt" "cosmossdk.io/store/prefix" "github.com/cosmos/cosmos-sdk/runtime" @@ -48,7 +49,8 @@ func (k Keeper) Gateway(ctx context.Context, req *types.QueryGetGatewayRequest) req.Address, ) if !found { - return nil, status.Error(codes.NotFound, "not found") + return nil, status.Error(codes.NotFound, fmt.Sprintf("gateway not found: address %s", req.Address)) + } return &types.QueryGetGatewayResponse{Gateway: val}, nil diff --git a/x/gateway/keeper/query_gateway_test.go b/x/gateway/keeper/query_gateway_test.go index 0f780dbc3..ff5146f60 100644 --- a/x/gateway/keeper/query_gateway_test.go +++ b/x/gateway/keeper/query_gateway_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + "fmt" "strconv" "testing" @@ -45,7 +46,7 @@ func TestGatewayQuerySingle(t *testing.T) { request: &types.QueryGetGatewayRequest{ Address: strconv.Itoa(100000), }, - err: status.Error(codes.NotFound, "not found"), + err: status.Error(codes.NotFound, fmt.Sprintf("gateway not found: address %s", strconv.Itoa(100000))), }, { desc: "InvalidRequest", diff --git a/x/gateway/types/errors.go b/x/gateway/types/errors.go index e48f9a1ab..d7c56ceae 100644 --- a/x/gateway/types/errors.go +++ b/x/gateway/types/errors.go @@ -8,6 +8,9 @@ import ( // x/gateway module sentinel errors var ( - ErrInvalidSigner = sdkerrors.Register(ModuleName, 1100, "expected gov account as only signer for proposal message") - ErrSample = sdkerrors.Register(ModuleName, 1101, "sample error") + ErrInvalidSigner = sdkerrors.Register(ModuleName, 1100, "expected gov account as only signer for proposal message") + ErrSample = sdkerrors.Register(ModuleName, 1101, "sample error") + ErrGatewayInvalidAddress = sdkerrors.Register(ModuleName, 1102, "invalid gateway address") + ErrGatewayInvalidStake = sdkerrors.Register(ModuleName, 1103, "invalid gateway stake") + ErrGatewayUnauthorized = sdkerrors.Register(ModuleName, 1104, "unauthorized signer") ) diff --git a/x/gateway/types/expected_keepers.go b/x/gateway/types/expected_keepers.go index 4a50d01a9..ba51f87b0 100644 --- a/x/gateway/types/expected_keepers.go +++ b/x/gateway/types/expected_keepers.go @@ -1,5 +1,7 @@ package types +//go:generate mockgen -destination ../../../testutil/gateway/mocks/expected_keepers_mock.go -package mocks . AccountKeeper,BankKeeper + import ( "context" @@ -14,8 +16,8 @@ type AccountKeeper interface { // BankKeeper defines the expected interface for the Bank module. type BankKeeper interface { - SpendableCoins(context.Context, sdk.AccAddress) sdk.Coins - // Methods imported from bank should be defined here + DelegateCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + UndelegateCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error } // ParamSubspace defines the expected Subspace interface for parameters. diff --git a/x/gateway/types/message_stake_gateway.go b/x/gateway/types/message_stake_gateway.go index 9d2d53473..6b763f0b2 100644 --- a/x/gateway/types/message_stake_gateway.go +++ b/x/gateway/types/message_stake_gateway.go @@ -1,9 +1,7 @@ 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 = &MsgStakeGateway{} @@ -11,14 +9,32 @@ var _ sdk.Msg = &MsgStakeGateway{} func NewMsgStakeGateway(address string, stake sdk.Coin) *MsgStakeGateway { return &MsgStakeGateway{ Address: address, - Stake: stake, + Stake: &stake, } } func (msg *MsgStakeGateway) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Address) if err != nil { - return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid address address (%s)", err) + return ErrGatewayInvalidAddress.Wrapf("invalid gateway address %s; (%v)", msg.Address, err) + } + + // Validate the stake amount + if msg.Stake == nil { + return ErrGatewayInvalidStake.Wrapf("nil gateway stake; (%v)", err) + } + stake, err := sdk.ParseCoinNormalized(msg.Stake.String()) + if !stake.IsValid() { + return ErrGatewayInvalidStake.Wrapf("invalid gateway stake %v; (%v)", msg.Stake, stake.Validate()) + } + if err != nil { + return ErrGatewayInvalidStake.Wrapf("cannot parse gateway stake %v; (%v)", msg.Stake, err) + } + if stake.IsZero() || stake.IsNegative() { + return ErrGatewayInvalidStake.Wrapf("invalid stake amount for gateway: %v <= 0", msg.Stake) + } + if stake.Denom != "upokt" { + return ErrGatewayInvalidStake.Wrapf("invalid stake amount denom for gateway %v", msg.Stake) } return nil } diff --git a/x/gateway/types/message_stake_gateway_test.go b/x/gateway/types/message_stake_gateway_test.go index 3d5d4fc80..f6b40a403 100644 --- a/x/gateway/types/message_stake_gateway_test.go +++ b/x/gateway/types/message_stake_gateway_test.go @@ -3,30 +3,71 @@ package types import ( "testing" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/pokt-network/poktroll/testutil/sample" + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/testutil/sample" ) func TestMsgStakeGateway_ValidateBasic(t *testing.T) { + coins := sdk.NewCoin("upokt", math.NewInt(100)) tests := []struct { name string msg MsgStakeGateway err error }{ { - name: "invalid address", + name: "invalid address - no stake", msg: MsgStakeGateway{ Address: "invalid_address", + // Stake explicitly nil + }, + err: ErrGatewayInvalidAddress, + }, { + name: "valid address - nil stake", + msg: MsgStakeGateway{ + Address: sample.AccAddress(), + // Stake explicitly nil + }, + err: ErrGatewayInvalidStake, + }, { + name: "valid address - zero stake", + msg: MsgStakeGateway{ + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(0)}, + }, + err: ErrGatewayInvalidStake, + }, { + name: "valid address - negative stake", + msg: MsgStakeGateway{ + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(-100)}, + }, + err: ErrGatewayInvalidStake, + }, { + name: "valid address - invalid stake denom", + msg: MsgStakeGateway{ + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "invalid", Amount: math.NewInt(100)}, + }, + err: ErrGatewayInvalidStake, + }, { + name: "valid address - invalid stake missing denom", + msg: MsgStakeGateway{ + Address: sample.AccAddress(), + Stake: &sdk.Coin{Denom: "", Amount: math.NewInt(100)}, }, - err: sdkerrors.ErrInvalidAddress, + err: ErrGatewayInvalidStake, }, { - name: "valid address", + name: "valid address - valid stake", msg: MsgStakeGateway{ Address: sample.AccAddress(), + Stake: &coins, }, }, } + for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { err := tt.msg.ValidateBasic() From 1844e6cc784851341e1e3d2d0d75e6c890d8b123 Mon Sep 17 00:00:00 2001 From: Redouane Lakrache Date: Thu, 8 Feb 2024 12:34:28 +0100 Subject: [PATCH 06/10] reconcile: gateway unstake --- .../keeper/msg_server_unstake_gateway.go | 36 ++++++++- .../keeper/msg_server_unstake_gateway_test.go | 73 +++++++++++++++++++ x/gateway/types/errors.go | 1 + x/gateway/types/message_unstake_gateway.go | 4 +- .../types/message_unstake_gateway_test.go | 8 +- 5 files changed, 114 insertions(+), 8 deletions(-) create mode 100644 x/gateway/keeper/msg_server_unstake_gateway_test.go diff --git a/x/gateway/keeper/msg_server_unstake_gateway.go b/x/gateway/keeper/msg_server_unstake_gateway.go index 841590314..ebf919477 100644 --- a/x/gateway/keeper/msg_server_unstake_gateway.go +++ b/x/gateway/keeper/msg_server_unstake_gateway.go @@ -2,6 +2,7 @@ package keeper import ( "context" + "fmt" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/pokt-network/poktroll/x/gateway/types" @@ -10,8 +11,39 @@ import ( func (k msgServer) UnstakeGateway(goCtx context.Context, msg *types.MsgUnstakeGateway) (*types.MsgUnstakeGatewayResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - // TODO: Handling the message - _ = ctx + logger := k.Logger().With("method", "UnstakeGateway") + logger.Info(fmt.Sprintf("About to unstake gateway with msg: %v", msg)) + + if err := msg.ValidateBasic(); err != nil { + return nil, err + } + + // Check if the gateway already exists or not + var err error + gateway, isGatewayFound := k.GetGateway(ctx, msg.Address) + if !isGatewayFound { + logger.Info(fmt.Sprintf("Gateway not found. Cannot unstake address %s", msg.Address)) + return nil, types.ErrGatewayNotFound + } + logger.Info(fmt.Sprintf("Gateway found. Unstaking gateway for address %s", msg.Address)) + + // Retrieve the address of the gateway + gatewayAddress, err := sdk.AccAddressFromBech32(msg.Address) + if err != nil { + logger.Error(fmt.Sprintf("could not parse address %s", msg.Address)) + return nil, err + } + + // Send the coins from the gateway pool back to the gateway + err = k.bankKeeper.UndelegateCoinsFromModuleToAccount(ctx, types.ModuleName, gatewayAddress, []sdk.Coin{*gateway.Stake}) + if err != nil { + logger.Error(fmt.Sprintf("could not send %v coins from %s module to %s account due to %v", gateway.Stake, gatewayAddress, types.ModuleName, err)) + return nil, err + } + + // Update the Gateway in the store + k.RemoveGateway(ctx, gatewayAddress.String()) + logger.Info(fmt.Sprintf("Successfully removed the gateway: %+v", gateway)) return &types.MsgUnstakeGatewayResponse{}, nil } diff --git a/x/gateway/keeper/msg_server_unstake_gateway_test.go b/x/gateway/keeper/msg_server_unstake_gateway_test.go new file mode 100644 index 000000000..4c977ef3c --- /dev/null +++ b/x/gateway/keeper/msg_server_unstake_gateway_test.go @@ -0,0 +1,73 @@ +package keeper_test + +import ( + "testing" + + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/testutil/sample" + "github.com/pokt-network/poktroll/x/gateway/keeper" + "github.com/pokt-network/poktroll/x/gateway/types" +) + +func TestMsgServer_UnstakeGateway_Success(t *testing.T) { + k, ctx := keepertest.GatewayKeeper(t) + srv := keeper.NewMsgServerImpl(k) + + // Generate an address for the gateway + addr := sample.AccAddress() + + // Verify that the gateway does not exist yet + _, isGatewayFound := k.GetGateway(ctx, addr) + require.False(t, isGatewayFound) + + // Prepare the gateway + initialStake := sdk.NewCoin("upokt", math.NewInt(100)) + stakeMsg := &types.MsgStakeGateway{ + Address: addr, + Stake: &initialStake, + } + + // Stake the gateway + _, err := srv.StakeGateway(ctx, stakeMsg) + require.NoError(t, err) + + // 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) + + // Unstake the gateway + unstakeMsg := &types.MsgUnstakeGateway{Address: addr} + _, err = srv.UnstakeGateway(ctx, unstakeMsg) + require.NoError(t, err) + + // Make sure the gateway can no longer be found after unstaking + _, isGatewayFound = k.GetGateway(ctx, addr) + require.False(t, isGatewayFound) +} + +func TestMsgServer_UnstakeGateway_FailIfNotStaked(t *testing.T) { + k, ctx := keepertest.GatewayKeeper(t) + srv := keeper.NewMsgServerImpl(k) + + // Generate an address for the gateway + addr := sample.AccAddress() + + // Verify that the gateway does not exist yet + _, isGatewayFound := k.GetGateway(ctx, addr) + require.False(t, isGatewayFound) + + // Unstake the gateway + unstakeMsg := &types.MsgUnstakeGateway{Address: addr} + _, err := srv.UnstakeGateway(ctx, unstakeMsg) + require.Error(t, err) + require.ErrorIs(t, err, types.ErrGatewayNotFound) + + _, isGatewayFound = k.GetGateway(ctx, addr) + require.False(t, isGatewayFound) +} diff --git a/x/gateway/types/errors.go b/x/gateway/types/errors.go index d7c56ceae..7b15af1d9 100644 --- a/x/gateway/types/errors.go +++ b/x/gateway/types/errors.go @@ -13,4 +13,5 @@ var ( ErrGatewayInvalidAddress = sdkerrors.Register(ModuleName, 1102, "invalid gateway address") ErrGatewayInvalidStake = sdkerrors.Register(ModuleName, 1103, "invalid gateway stake") ErrGatewayUnauthorized = sdkerrors.Register(ModuleName, 1104, "unauthorized signer") + ErrGatewayNotFound = sdkerrors.Register(ModuleName, 1105, "gateway not found") ) diff --git a/x/gateway/types/message_unstake_gateway.go b/x/gateway/types/message_unstake_gateway.go index 4af462de9..59e752abf 100644 --- a/x/gateway/types/message_unstake_gateway.go +++ b/x/gateway/types/message_unstake_gateway.go @@ -1,9 +1,7 @@ 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 = &MsgUnstakeGateway{} @@ -17,7 +15,7 @@ func NewMsgUnstakeGateway(address string) *MsgUnstakeGateway { func (msg *MsgUnstakeGateway) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Address) if err != nil { - return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid address address (%s)", err) + return ErrGatewayInvalidAddress.Wrapf("invalid gateway address (%s); (%v)", msg.Address, err) } return nil } diff --git a/x/gateway/types/message_unstake_gateway_test.go b/x/gateway/types/message_unstake_gateway_test.go index 9fca2d39d..6212bee1c 100644 --- a/x/gateway/types/message_unstake_gateway_test.go +++ b/x/gateway/types/message_unstake_gateway_test.go @@ -3,7 +3,6 @@ package types import ( "testing" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/pokt-network/poktroll/testutil/sample" "github.com/stretchr/testify/require" ) @@ -19,9 +18,12 @@ func TestMsgUnstakeGateway_ValidateBasic(t *testing.T) { msg: MsgUnstakeGateway{ Address: "invalid_address", }, - err: sdkerrors.ErrInvalidAddress, + err: ErrGatewayInvalidAddress, }, { - name: "valid address", + name: "missing address", + msg: MsgUnstakeGateway{}, + err: ErrGatewayInvalidAddress, + }, {name: "valid address", msg: MsgUnstakeGateway{ Address: sample.AccAddress(), }, From 5f32352243715b8a9e16d382bfaf703765891bb8 Mon Sep 17 00:00:00 2001 From: Redouane Lakrache Date: Fri, 9 Feb 2024 03:24:16 +0100 Subject: [PATCH 07/10] reconcile: gateway CLI commands --- Makefile | 4 +- api/poktroll/gateway/tx.pulsar.go | 2 +- cmd/poktrolld/cmd/root.go | 2 +- go.mod | 4 +- proto/poktroll/gateway/tx.proto | 2 +- testutil/network/network.go | 56 +++++++ testutil/yaml/yaml.go | 31 ++++ x/gateway/module/config/errors.go | 10 ++ .../module/config/gateway_config_reader.go | 62 ++++++++ .../config/gateway_config_reader_test.go | 81 ++++++++++ x/gateway/module/helpers_test.go | 31 ++++ x/gateway/module/query.go | 29 ++++ x/gateway/module/query_gateway.go | 78 +++++++++ x/gateway/module/query_gateway_test.go | 142 +++++++++++++++++ x/gateway/module/query_params.go | 36 +++++ x/gateway/module/tx.go | 35 ++++ x/gateway/module/tx_stake_gateway.go | 61 +++++++ x/gateway/module/tx_stake_gateway_test.go | 150 ++++++++++++++++++ x/gateway/module/tx_unstake_gateway.go | 44 +++++ x/gateway/module/tx_unstake_gateway_test.go | 97 +++++++++++ x/gateway/types/expected_keepers.go | 14 +- x/gateway/types/message_stake_gateway.go | 2 +- x/gateway/types/message_unstake_gateway.go | 2 +- x/gateway/types/msg_update_params.go | 2 +- 24 files changed, 966 insertions(+), 11 deletions(-) create mode 100644 testutil/yaml/yaml.go create mode 100644 x/gateway/module/config/errors.go create mode 100644 x/gateway/module/config/gateway_config_reader.go create mode 100644 x/gateway/module/config/gateway_config_reader_test.go create mode 100644 x/gateway/module/helpers_test.go create mode 100644 x/gateway/module/query.go create mode 100644 x/gateway/module/query_gateway.go create mode 100644 x/gateway/module/query_gateway_test.go create mode 100644 x/gateway/module/query_params.go create mode 100644 x/gateway/module/tx.go create mode 100644 x/gateway/module/tx_stake_gateway.go create mode 100644 x/gateway/module/tx_stake_gateway_test.go create mode 100644 x/gateway/module/tx_unstake_gateway.go create mode 100644 x/gateway/module/tx_unstake_gateway_test.go diff --git a/Makefile b/Makefile index 9b438dde1..a4f805d5c 100644 --- a/Makefile +++ b/Makefile @@ -178,8 +178,8 @@ localnet_regenesis: ## Regenerate the localnet genesis file cp ${HOME}/.poktroll/config/*_key.json $(POKTROLLD_HOME)/config/ ;\ ADDRESS=$$(jq -r '.address' $(POKTROLLD_HOME)/config/priv_validator_key.json) ;\ PUB_KEY=$$(jq -r '.pub_key' $(POKTROLLD_HOME)/config/priv_validator_key.json) ;\ - POWER=$$(yq ".validators[0].bonded" ./config.yml | sed 's,000000upokt,,') ;\ - NAME=$$(yq ".validators[0].name" ./config.yml) ;\ + POWER=$$(yq -r ".validators[0].bonded" ./config.yml | sed 's,000000upokt,,') ;\ + NAME=$$(yq -r ".validators[0].name" ./config.yml) ;\ echo "Regenerating genesis file with new validator..." ;\ jq --argjson pubKey "$$PUB_KEY" '.consensus["validators"]=[{"address": "'$$ADDRESS'", "pub_key": $$pubKey, "power": "'$$POWER'", "name": "'$$NAME'"}]' ${HOME}/.poktroll/config/genesis.json > temp.json ;\ mv temp.json ${HOME}/.poktroll/config/genesis.json ;\ diff --git a/api/poktroll/gateway/tx.pulsar.go b/api/poktroll/gateway/tx.pulsar.go index 0455a1622..0c3dff1c9 100644 --- a/api/poktroll/gateway/tx.pulsar.go +++ b/api/poktroll/gateway/tx.pulsar.go @@ -2664,7 +2664,7 @@ type MsgUnstakeGateway struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // The Bech32 address of the gateway } func (x *MsgUnstakeGateway) Reset() { diff --git a/cmd/poktrolld/cmd/root.go b/cmd/poktrolld/cmd/root.go index 64ac47d0e..1bfbfd135 100644 --- a/cmd/poktrolld/cmd/root.go +++ b/cmd/poktrolld/cmd/root.go @@ -29,7 +29,7 @@ import ( // NewRootCmd creates a new root command for poktrolld. It is called once in the main function. func NewRootCmd() *cobra.Command { - initSDKConfig() + InitSDKConfig() var ( txConfigOpts tx.ConfigOptions diff --git a/go.mod b/go.mod index 5ad018f52..6b79eacf7 100644 --- a/go.mod +++ b/go.mod @@ -43,8 +43,11 @@ require ( github.com/spf13/viper v1.18.2 github.com/stretchr/testify v1.8.4 golang.org/x/tools v0.17.0 + google.golang.org/genproto/googleapis/api v0.0.0-20240116215550-a9fa1716bcac + google.golang.org/grpc v1.60.1 google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0 google.golang.org/protobuf v1.32.0 + gopkg.in/yaml.v2 v2.4.0 ) require ( @@ -328,7 +331,6 @@ require ( google.golang.org/genproto/googleapis/rpc v0.0.0-20240116215550-a9fa1716bcac // indirect google.golang.org/grpc v1.60.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect - gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect gotest.tools/v3 v3.5.1 // indirect lukechampine.com/blake3 v1.2.1 // indirect diff --git a/proto/poktroll/gateway/tx.proto b/proto/poktroll/gateway/tx.proto index 0e0cb1eb9..0d7312952 100644 --- a/proto/poktroll/gateway/tx.proto +++ b/proto/poktroll/gateway/tx.proto @@ -49,7 +49,7 @@ message MsgStakeGatewayResponse {} message MsgUnstakeGateway { option (cosmos.msg.v1.signer) = "address"; - string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // The Bech32 address of the gateway } message MsgUnstakeGatewayResponse {} diff --git a/testutil/network/network.go b/testutil/network/network.go index 103480318..964c7da02 100644 --- a/testutil/network/network.go +++ b/testutil/network/network.go @@ -1,13 +1,22 @@ package network import ( + "encoding/json" "fmt" "testing" + sdkmath "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/client/flags" + addresscodec "github.com/cosmos/cosmos-sdk/codec/address" + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" "github.com/cosmos/cosmos-sdk/testutil/network" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" "github.com/pokt-network/poktroll/app" + "github.com/pokt-network/poktroll/cmd/poktrolld/cmd" + "github.com/pokt-network/poktroll/testutil/sample" + gatewaytypes "github.com/pokt-network/poktroll/x/gateway/types" ) type ( @@ -15,6 +24,10 @@ type ( Config = network.Config ) +func init() { + cmd.InitSDKConfig() +} + // New creates instance with fully configured cosmos network. // Accepts optional config, that will be used in place of the DefaultConfig() if provided. func New(t *testing.T, configs ...Config) *Network { @@ -59,6 +72,49 @@ func DefaultConfig() network.Config { return cfg } +// DefaultGatewayModuleGenesisState generates a GenesisState object with a given +// number of gateways. It returns the populated GenesisState object. +func DefaultGatewayModuleGenesisState(t *testing.T, n int) *gatewaytypes.GenesisState { + t.Helper() + state := gatewaytypes.DefaultGenesis() + for i := 0; i < n; i++ { + stake := sdk.NewCoin("upokt", sdkmath.NewInt(int64(i))) + gateway := gatewaytypes.Gateway{ + Address: sample.AccAddress(), + Stake: &stake, + } + // TODO_CONSIDERATION: Evaluate whether we need `nullify.Fill` or if we should enforce `(gogoproto.nullable) = false` everywhere + // nullify.Fill(&gateway) + state.GatewayList = append(state.GatewayList, gateway) + } + return state +} + +// TODO_CLEANUP: Consolidate all of the helpers below to use shared business +// logic and move into its own helpers file. + +// InitAccount initializes an Account by sending it some funds from the validator +// in the network to the address provided +func InitAccount(t *testing.T, net *Network, addr sdk.AccAddress) { + t.Helper() + val := net.Validators[0] + ctx := val.ClientCtx + args := []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), + } + amount := sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(200))) + addrCodec := addresscodec.NewBech32Codec(app.AccountAddressPrefix) + responseRaw, err := clitestutil.MsgSendExec(ctx, val.Address, addr, amount, addrCodec, args...) + require.NoError(t, err) + var responseJSON map[string]interface{} + err = json.Unmarshal(responseRaw.Bytes(), &responseJSON) + require.NoError(t, err) + require.Equal(t, float64(0), responseJSON["code"], "code is not 0 in the response: %v", responseJSON) +} + // freePorts return the available ports based on the number of requested ports. func freePorts(n int) ([]string, error) { closeFns := make([]func() error, n) diff --git a/testutil/yaml/yaml.go b/testutil/yaml/yaml.go new file mode 100644 index 000000000..56a29cc89 --- /dev/null +++ b/testutil/yaml/yaml.go @@ -0,0 +1,31 @@ +package yaml + +import "strings" + +// YAML is indentation sensitive, so we need to remove the extra indentation from the test cases and make sure +// it is space-indented instead of tab-indented, otherwise the YAML parser will fail +func NormalizeYAMLIndentation(rawContent string) string { + var processedContent = rawContent + // Remove extra newlines + processedContent = strings.TrimPrefix(processedContent, "\n") + + // Replace tab indentation with 2 spaces as our code is tab-indented but YAML is expecting double spaces + processedContent = strings.ReplaceAll(processedContent, "\t", " ") + + // Get the extra indentation from the first line that will serve as the basis for the rest of the lines + extraIndentationCount := len(processedContent) - len(strings.TrimLeft(processedContent, " ")) + + // Create a prefix to trim from the beginning of each line + extraIndentation := strings.Repeat(" ", extraIndentationCount) + + // Split the content into lines, trim the extra indentation from each line, and rejoin the lines + lines := strings.Split(processedContent, "\n") + for i := range lines { + lines[i] = strings.TrimPrefix(lines[i], extraIndentation) + } + + // Recover the processed content + processedContent = strings.Trim(strings.Join(lines, "\n"), "\n") + + return processedContent +} diff --git a/x/gateway/module/config/errors.go b/x/gateway/module/config/errors.go new file mode 100644 index 000000000..aa01b3a46 --- /dev/null +++ b/x/gateway/module/config/errors.go @@ -0,0 +1,10 @@ +package config + +import sdkerrors "cosmossdk.io/errors" + +var ( + codespace = "gatewayconfig" + ErrGatewayConfigEmptyContent = sdkerrors.Register(codespace, 1, "empty gateway staking config content") + ErrGatewayConfigUnmarshalYAML = sdkerrors.Register(codespace, 2, "config reader cannot unmarshal yaml content") + ErrGatewayConfigInvalidStake = sdkerrors.Register(codespace, 3, "invalid stake in gateway stake config") +) diff --git a/x/gateway/module/config/gateway_config_reader.go b/x/gateway/module/config/gateway_config_reader.go new file mode 100644 index 000000000..6bf7aa3e3 --- /dev/null +++ b/x/gateway/module/config/gateway_config_reader.go @@ -0,0 +1,62 @@ +package config + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "gopkg.in/yaml.v2" +) + +// YAMLStakeGateway is the structure describing the gateway stake config file +type YAMLStakeGateway struct { + StakeAmount string `yaml:"stake_amount"` +} + +// GatewayStakeConfig is the structure describing the gateway stake config +type GatewayStakeConfig struct { + StakeAmount sdk.Coin +} + +// ParseGatewayConfig parses the gateway stake yaml config file into a StakeGatewayConfig struct +func ParseGatewayConfig(configContent []byte) (*GatewayStakeConfig, error) { + var stakeConfig *YAMLStakeGateway + + if len(configContent) == 0 { + return nil, ErrGatewayConfigEmptyContent + } + + // Unmarshal the stake config file into a stakeConfig + if err := yaml.Unmarshal(configContent, &stakeConfig); err != nil { + return nil, ErrGatewayConfigUnmarshalYAML.Wrap(err.Error()) + } + + // Validate the stake config + if len(stakeConfig.StakeAmount) == 0 { + return nil, ErrGatewayConfigInvalidStake + } + + // Parse the stake amount to a coin struct + stakeAmount, err := sdk.ParseCoinNormalized(stakeConfig.StakeAmount) + if err != nil { + return nil, ErrGatewayConfigInvalidStake.Wrap(err.Error()) + } + + // Basic validation of the stake amount + if err := stakeAmount.Validate(); err != nil { + return nil, ErrGatewayConfigInvalidStake.Wrap(err.Error()) + } + + if stakeAmount.IsZero() { + return nil, ErrGatewayConfigInvalidStake.Wrap("stake amount cannot be zero") + } + + // Only allow upokt coins staking + if stakeAmount.Denom != "upokt" { + return nil, ErrGatewayConfigInvalidStake.Wrapf( + "invalid stake denom, expecting: upokt, got: %s", + stakeAmount.Denom, + ) + } + + return &GatewayStakeConfig{ + StakeAmount: stakeAmount, + }, nil +} diff --git a/x/gateway/module/config/gateway_config_reader_test.go b/x/gateway/module/config/gateway_config_reader_test.go new file mode 100644 index 000000000..11c632cc8 --- /dev/null +++ b/x/gateway/module/config/gateway_config_reader_test.go @@ -0,0 +1,81 @@ +package config_test + +import ( + "testing" + + sdkerrors "cosmossdk.io/errors" + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/testutil/yaml" + "github.com/pokt-network/poktroll/x/gateway/module/config" +) + +func Test_ParseGatewayStakeConfig(t *testing.T) { + tests := []struct { + desc string + expectedError *sdkerrors.Error + expectedConfig *config.GatewayStakeConfig + inputConfig string + }{ + // Valid Configs + { + desc: "valid gateway stake config", + inputConfig: ` + stake_amount: 1000upokt + `, + expectedError: nil, + expectedConfig: &config.GatewayStakeConfig{ + StakeAmount: sdk.NewCoin("upokt", sdkmath.NewInt(1000)), + }, + }, + // Invalid Configs + { + desc: "services_test: invalid service config with empty content", + expectedError: config.ErrGatewayConfigEmptyContent, + inputConfig: ``, + }, + { + desc: "invalid stake denom", + inputConfig: ` + stake_amount: 1000invalid + `, + expectedError: config.ErrGatewayConfigInvalidStake, + }, + { + desc: "negative stake amount", + inputConfig: ` + stake_amount: -1000upokt + `, + expectedError: config.ErrGatewayConfigInvalidStake, + }, + { + desc: "zero stake amount", + inputConfig: ` + stake_amount: 0upokt + `, + expectedError: config.ErrGatewayConfigInvalidStake, + }, + } + + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) { + normalizedConfig := yaml.NormalizeYAMLIndentation(tt.inputConfig) + supplierServiceConfig, err := config.ParseGatewayConfig([]byte(normalizedConfig)) + + if tt.expectedError != nil { + require.Error(t, err) + require.ErrorIs(t, err, tt.expectedError) + require.Contains(t, err.Error(), tt.expectedError.Error()) + require.Nil(t, supplierServiceConfig) + return + } + + require.NoError(t, err) + + require.Equal(t, tt.expectedConfig.StakeAmount, supplierServiceConfig.StakeAmount) + require.Equal(t, tt.expectedConfig.StakeAmount.Denom, supplierServiceConfig.StakeAmount.Denom) + }) + } +} diff --git a/x/gateway/module/helpers_test.go b/x/gateway/module/helpers_test.go new file mode 100644 index 000000000..45f9c42a8 --- /dev/null +++ b/x/gateway/module/helpers_test.go @@ -0,0 +1,31 @@ +package gateway_test + +import ( + "strconv" + "testing" + + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/cmd/poktrolld/cmd" + "github.com/pokt-network/poktroll/testutil/network" + "github.com/pokt-network/poktroll/x/gateway/types" +) + +// Dummy variable to avoid unused import error. +var _ = strconv.IntSize + +// init initializes the SDK configuration. +func init() { + cmd.InitSDKConfig() +} + +// networkWithGatewayObjects creates a network with a populated gateway state of n gateway objects +func networkWithGatewayObjects(t *testing.T, n int) (*network.Network, []types.Gateway) { + t.Helper() + cfg := network.DefaultConfig() + gatewayGenesisState := network.DefaultGatewayModuleGenesisState(t, n) + buf, err := cfg.Codec.MarshalJSON(gatewayGenesisState) + require.NoError(t, err) + cfg.GenesisState[types.ModuleName] = buf + return network.New(t, cfg), gatewayGenesisState.GatewayList +} diff --git a/x/gateway/module/query.go b/x/gateway/module/query.go new file mode 100644 index 000000000..4c3856f0e --- /dev/null +++ b/x/gateway/module/query.go @@ -0,0 +1,29 @@ +package gateway + +import ( + "fmt" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/spf13/cobra" + + "github.com/pokt-network/poktroll/x/gateway/types" +) + +// GetQueryCmd returns the cli query commands for this module +func (am AppModule) GetQueryCmd(queryRoute string) *cobra.Command { + // Group gateway queries under a subcommand + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand(CmdQueryParams()) + cmd.AddCommand(CmdListGateway()) + cmd.AddCommand(CmdShowGateway()) + // this line is used by starport scaffolding # 1 + + return cmd +} diff --git a/x/gateway/module/query_gateway.go b/x/gateway/module/query_gateway.go new file mode 100644 index 000000000..e4d37131e --- /dev/null +++ b/x/gateway/module/query_gateway.go @@ -0,0 +1,78 @@ +package gateway + +import ( + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/spf13/cobra" + + "github.com/pokt-network/poktroll/x/gateway/types" +) + +func CmdListGateway() *cobra.Command { + cmd := &cobra.Command{ + Use: "list-gateway", + Short: "list all gateways", + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + pageReq, err := client.ReadPageRequest(cmd.Flags()) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + params := &types.QueryAllGatewayRequest{ + Pagination: pageReq, + } + + res, err := queryClient.GatewayAll(cmd.Context(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddPaginationFlagsToCmd(cmd, cmd.Use) + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +func CmdShowGateway() *cobra.Command { + cmd := &cobra.Command{ + Use: "show-gateway ", + Short: "shows a gateway", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) (err error) { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + argAddress := args[0] + + params := &types.QueryGetGatewayRequest{ + Address: argAddress, + } + + res, err := queryClient.Gateway(cmd.Context(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/gateway/module/query_gateway_test.go b/x/gateway/module/query_gateway_test.go new file mode 100644 index 000000000..fd2d12d5a --- /dev/null +++ b/x/gateway/module/query_gateway_test.go @@ -0,0 +1,142 @@ +package gateway_test + +import ( + "fmt" + "strconv" + "testing" + + tmcli "github.com/cometbft/cometbft/libs/cli" + "github.com/cosmos/cosmos-sdk/client/flags" + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" + "github.com/stretchr/testify/require" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/pokt-network/poktroll/testutil/nullify" + gateway "github.com/pokt-network/poktroll/x/gateway/module" + "github.com/pokt-network/poktroll/x/gateway/types" +) + +// Prevent strconv unused error +var _ = strconv.IntSize + +func TestShowGateway(t *testing.T) { + net, objs := networkWithGatewayObjects(t, 2) + + ctx := net.Validators[0].ClientCtx + common := []string{ + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + } + tests := []struct { + desc string + idAddress string + + args []string + err error + obj types.Gateway + }{ + { + desc: "found", + idAddress: objs[0].Address, + + args: common, + obj: objs[0], + }, + { + desc: "not found", + idAddress: strconv.Itoa(100000), + + args: common, + err: status.Error(codes.NotFound, "not found"), + }, + } + for _, tc := range tests { + t.Run(tc.desc, func(t *testing.T) { + args := []string{ + tc.idAddress, + } + args = append(args, tc.args...) + out, err := clitestutil.ExecTestCLICmd(ctx, gateway.CmdShowGateway(), args) + if tc.err != nil { + stat, ok := status.FromError(tc.err) + require.True(t, ok) + require.ErrorIs(t, stat.Err(), tc.err) + } else { + require.NoError(t, err) + var resp types.QueryGetGatewayResponse + require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) + require.NotNil(t, resp.Gateway) + require.Equal(t, + nullify.Fill(&tc.obj), + nullify.Fill(&resp.Gateway), + ) + } + }) + } +} + +func TestListGateway(t *testing.T) { + net, objs := networkWithGatewayObjects(t, 5) + + ctx := net.Validators[0].ClientCtx + request := func(next []byte, offset, limit uint64, total bool) []string { + args := []string{ + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + } + if next == nil { + args = append(args, fmt.Sprintf("--%s=%d", flags.FlagOffset, offset)) + } else { + args = append(args, fmt.Sprintf("--%s=%s", flags.FlagPageKey, next)) + } + args = append(args, fmt.Sprintf("--%s=%d", flags.FlagLimit, limit)) + if total { + args = append(args, fmt.Sprintf("--%s", flags.FlagCountTotal)) + } + return args + } + t.Run("ByOffset", func(t *testing.T) { + step := 2 + for i := 0; i < len(objs); i += step { + args := request(nil, uint64(i), uint64(step), false) + out, err := clitestutil.ExecTestCLICmd(ctx, gateway.CmdListGateway(), args) + require.NoError(t, err) + var resp types.QueryAllGatewayResponse + require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) + require.LessOrEqual(t, len(resp.Gateway), step) + require.Subset(t, + nullify.Fill(objs), + nullify.Fill(resp.Gateway), + ) + } + }) + t.Run("ByKey", func(t *testing.T) { + step := 2 + var next []byte + for i := 0; i < len(objs); i += step { + args := request(next, 0, uint64(step), false) + out, err := clitestutil.ExecTestCLICmd(ctx, gateway.CmdListGateway(), args) + require.NoError(t, err) + var resp types.QueryAllGatewayResponse + require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) + require.LessOrEqual(t, len(resp.Gateway), step) + require.Subset(t, + nullify.Fill(objs), + nullify.Fill(resp.Gateway), + ) + next = resp.Pagination.NextKey + } + }) + t.Run("Total", func(t *testing.T) { + args := request(nil, 0, uint64(len(objs)), true) + out, err := clitestutil.ExecTestCLICmd(ctx, gateway.CmdListGateway(), args) + require.NoError(t, err) + var resp types.QueryAllGatewayResponse + require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) + require.NoError(t, err) + require.Equal(t, len(objs), int(resp.Pagination.Total)) + require.ElementsMatch(t, + nullify.Fill(objs), + nullify.Fill(resp.Gateway), + ) + }) +} diff --git a/x/gateway/module/query_params.go b/x/gateway/module/query_params.go new file mode 100644 index 000000000..d3d3a95a9 --- /dev/null +++ b/x/gateway/module/query_params.go @@ -0,0 +1,36 @@ +package gateway + +import ( + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/spf13/cobra" + + "github.com/pokt-network/poktroll/x/gateway/types" +) + +func CmdQueryParams() *cobra.Command { + cmd := &cobra.Command{ + Use: "params", + Short: "shows the parameters of the module", + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + + res, err := queryClient.Params(cmd.Context(), &types.QueryParamsRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/gateway/module/tx.go b/x/gateway/module/tx.go new file mode 100644 index 000000000..3f6b0060a --- /dev/null +++ b/x/gateway/module/tx.go @@ -0,0 +1,35 @@ +package gateway + +import ( + "fmt" + "time" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/spf13/cobra" + + "github.com/pokt-network/poktroll/x/gateway/types" +) + +var DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) + +const ( + flagPacketTimeoutTimestamp = "packet-timeout-timestamp" + listSeparator = "," +) + +// GetTxCmd returns the transaction commands for this module +func (am AppModule) GetTxCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + cmd.AddCommand(CmdStakeGateway()) + cmd.AddCommand(CmdUnstakeGateway()) + // this line is used by starport scaffolding # 1 + + return cmd +} diff --git a/x/gateway/module/tx_stake_gateway.go b/x/gateway/module/tx_stake_gateway.go new file mode 100644 index 000000000..4f5376ed7 --- /dev/null +++ b/x/gateway/module/tx_stake_gateway.go @@ -0,0 +1,61 @@ +package gateway + +import ( + "os" + "strconv" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + "github.com/spf13/cobra" + + "github.com/pokt-network/poktroll/x/gateway/module/config" + "github.com/pokt-network/poktroll/x/gateway/types" +) + +var ( + flagStakeConfig string + _ = strconv.Itoa(0) +) + +func CmdStakeGateway() *cobra.Command { + cmd := &cobra.Command{ + Use: "stake-gateway --config ", + Short: "Stake a gateway", + Long: `Stake a gateway with the provided parameters. This is a broadcast operation that +will stake the tokens and associate them with the gateway specified by the 'from' address. +Example: +$ poktrolld --home=$(POKTROLLD_HOME) tx gateway stake-gateway --config stake_config.yaml --keyring-backend test --from $(GATEWAY) --node $(POCKET_NODE)`, + Args: cobra.ExactArgs(0), + RunE: func(cmd *cobra.Command, _ []string) (err error) { + configContent, err := os.ReadFile(flagStakeConfig) + if err != nil { + return err + } + + gatewayStakeConfig, err := config.ParseGatewayConfig(configContent) + if err != nil { + return err + } + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + msg := types.NewMsgStakeGateway( + clientCtx.GetFromAddress().String(), + gatewayStakeConfig.StakeAmount, + ) + if err := msg.ValidateBasic(); err != nil { + return err + } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + cmd.Flags().StringVar(&flagStakeConfig, "config", "", "Path to the stake config file") + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/x/gateway/module/tx_stake_gateway_test.go b/x/gateway/module/tx_stake_gateway_test.go new file mode 100644 index 000000000..5a2f82f21 --- /dev/null +++ b/x/gateway/module/tx_stake_gateway_test.go @@ -0,0 +1,150 @@ +package gateway_test + +import ( + "fmt" + "os" + "testing" + + sdkerrors "cosmossdk.io/errors" + sdkmath "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/testutil" + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + "google.golang.org/grpc/status" + + "github.com/pokt-network/poktroll/testutil/network" + "github.com/pokt-network/poktroll/testutil/yaml" + gateway "github.com/pokt-network/poktroll/x/gateway/module" + "github.com/pokt-network/poktroll/x/gateway/types" +) + +func TestCLI_StakeGateway(t *testing.T) { + net, _ := networkWithGatewayObjects(t, 2) + val := net.Validators[0] + ctx := val.ClientCtx + + // Create a keyring and add an account for the gateway to be staked + kr := ctx.Keyring + accounts := testutil.CreateKeyringAccounts(t, kr, 1) + gatewayAccount := accounts[0] + + // Update the context with the new keyring + ctx = ctx.WithKeyring(kr) + + // Common args used for all requests + commonArgs := []string{ + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), + } + + tests := []struct { + desc string + address string + inputConfig string + expectedError *sdkerrors.Error + }{ + { + desc: "stake gateway: invalid address", + address: "invalid", + inputConfig: ` + stake_amount: 1000upokt + `, + expectedError: types.ErrGatewayInvalidAddress, + }, + { + desc: "stake gateway: missing address", + // address: gatewayAccount.Address.String(), + inputConfig: ` + stake_amount: 1000upokt + `, + expectedError: types.ErrGatewayInvalidAddress, + }, + { + desc: "stake gateway: invalid stake amount (zero)", + address: gatewayAccount.Address.String(), + inputConfig: ` + stake_amount: 0upokt + `, + expectedError: types.ErrGatewayInvalidStake, + }, + { + desc: "stake gateway: invalid stake amount (negative)", + address: gatewayAccount.Address.String(), + inputConfig: ` + stake_amount: -1000upokt + `, + expectedError: types.ErrGatewayInvalidStake, + }, + { + desc: "stake gateway: invalid stake denom", + address: gatewayAccount.Address.String(), + inputConfig: ` + stake_amount: 1000invalid + `, + expectedError: types.ErrGatewayInvalidStake, + }, + { + desc: "stake gateway: invalid stake missing denom", + address: gatewayAccount.Address.String(), + inputConfig: ` + stake_amount: 1000 + `, + expectedError: types.ErrGatewayInvalidStake, + }, + { + desc: "stake gateway: invalid stake missing stake", + address: gatewayAccount.Address.String(), + inputConfig: ``, + expectedError: types.ErrGatewayInvalidStake, + }, + { + desc: "stake gateway: valid", + address: gatewayAccount.Address.String(), + inputConfig: ` + stake_amount: 1000upokt + `, + }, + } + + // Initialize the Gateway Account by sending it some funds from the validator account that is part of genesis + network.InitAccount(t, net, gatewayAccount.Address) + + // Run the tests + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) { + // Wait for a new block to be committed + require.NoError(t, net.WaitForNextBlock()) + + // write the stake config to a file + configPath := testutil.WriteToNewTempFile(t, yaml.NormalizeYAMLIndentation(tt.inputConfig)).Name() + t.Cleanup(func() { os.Remove(configPath) }) + + // Prepare the arguments for the CLI command + args := []string{ + fmt.Sprintf("--config=%s", configPath), + fmt.Sprintf("--%s=%s", flags.FlagFrom, tt.address), + } + args = append(args, commonArgs...) + + // Execute the command + outStake, err := clitestutil.ExecTestCLICmd(ctx, gateway.CmdStakeGateway(), args) + if tt.expectedError != nil { + stat, ok := status.FromError(tt.expectedError) + require.True(t, ok) + require.Contains(t, stat.Message(), tt.expectedError.Error()) + return + } + require.NoError(t, err) + + require.NoError(t, err) + var resp sdk.TxResponse + require.NoError(t, net.Config.Codec.UnmarshalJSON(outStake.Bytes(), &resp)) + require.NotNil(t, resp) + require.NotNil(t, resp.TxHash) + require.Equal(t, uint32(0), resp.Code) + }) + } +} diff --git a/x/gateway/module/tx_unstake_gateway.go b/x/gateway/module/tx_unstake_gateway.go new file mode 100644 index 000000000..de3e811ff --- /dev/null +++ b/x/gateway/module/tx_unstake_gateway.go @@ -0,0 +1,44 @@ +package gateway + +import ( + "strconv" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + "github.com/spf13/cobra" + + "github.com/pokt-network/poktroll/x/gateway/types" +) + +var _ = strconv.Itoa(0) + +func CmdUnstakeGateway() *cobra.Command { + // fromAddress & signature is retrieved via `flags.FlagFrom` in the `clientCtx` + cmd := &cobra.Command{ + Use: "unstake-gateway ", + Short: "Unstake a gateway", + Long: `Unstake a gateway. This is a broadcast operation that will unstake the gateway specified by the 'from' address. + +Example: +$ poktrolld --home=$(POKTROLLD_HOME) tx gateway unstake-gateway --keyring-backend test --from $(GATEWAY) --node $(POCKET_NODE)`, + Args: cobra.ExactArgs(0), + RunE: func(cmd *cobra.Command, _ []string) (err error) { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + msg := types.NewMsgUnstakeGateway( + clientCtx.GetFromAddress().String(), + ) + if err := msg.ValidateBasic(); err != nil { + return err + } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/x/gateway/module/tx_unstake_gateway_test.go b/x/gateway/module/tx_unstake_gateway_test.go new file mode 100644 index 000000000..fb2e1cc07 --- /dev/null +++ b/x/gateway/module/tx_unstake_gateway_test.go @@ -0,0 +1,97 @@ +package gateway_test + +import ( + "fmt" + "testing" + + sdkerrors "cosmossdk.io/errors" + sdkmath "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/testutil" + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + "google.golang.org/grpc/status" + + "github.com/pokt-network/poktroll/testutil/network" + gateway "github.com/pokt-network/poktroll/x/gateway/module" + "github.com/pokt-network/poktroll/x/gateway/types" +) + +func TestCLI_UnstakeGateway(t *testing.T) { + net, _ := networkWithGatewayObjects(t, 2) + val := net.Validators[0] + ctx := val.ClientCtx + + // Create a keyring and add an account for the gateway to be unstaked + kr := ctx.Keyring + accounts := testutil.CreateKeyringAccounts(t, kr, 1) + gatewayAccount := accounts[0] + + // Update the context with the new keyring + ctx = ctx.WithKeyring(kr) + + // Common args used for all requests + commonArgs := []string{ + fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), + fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), + } + + tests := []struct { + desc string + address string + err *sdkerrors.Error + }{ + { + desc: "unstake gateway: valid", + address: gatewayAccount.Address.String(), + }, + { + desc: "unstake gateway: missing address", + // address: gatewayAccount.Address.String(), + err: types.ErrGatewayInvalidAddress, + }, + { + desc: "unstake gateway: invalid address", + address: "invalid", + err: types.ErrGatewayInvalidAddress, + }, + } + + // Initialize the Gateway Account by sending it some funds from the validator account that is part of genesis + network.InitAccount(t, net, gatewayAccount.Address) + + // Run the tests + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) { + // Wait for a new block to be committed + require.NoError(t, net.WaitForNextBlock()) + + // Prepare the arguments for the CLI command + args := []string{ + fmt.Sprintf("--%s=%s", flags.FlagFrom, tt.address), + } + args = append(args, commonArgs...) + + // Execute the command + outUnstake, err := clitestutil.ExecTestCLICmd(ctx, gateway.CmdUnstakeGateway(), args) + + // Validate the error if one is expected + if tt.err != nil { + stat, ok := status.FromError(tt.err) + require.True(t, ok) + require.Contains(t, stat.Message(), tt.err.Error()) + return + } + require.NoError(t, err) + + // Check the response + var resp sdk.TxResponse + require.NoError(t, net.Config.Codec.UnmarshalJSON(outUnstake.Bytes(), &resp)) + require.NotNil(t, resp) + require.NotNil(t, resp.TxHash) + require.Equal(t, uint32(0), resp.Code) + }) + } +} diff --git a/x/gateway/types/expected_keepers.go b/x/gateway/types/expected_keepers.go index ba51f87b0..10cde1203 100644 --- a/x/gateway/types/expected_keepers.go +++ b/x/gateway/types/expected_keepers.go @@ -16,8 +16,18 @@ type AccountKeeper interface { // BankKeeper defines the expected interface for the Bank module. type BankKeeper interface { - DelegateCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error - UndelegateCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + DelegateCoinsFromAccountToModule( + ctx context.Context, + senderAddr sdk.AccAddress, + recipientModule string, + amt sdk.Coins, + ) error + UndelegateCoinsFromModuleToAccount( + ctx context.Context, + senderModule string, + recipientAddr sdk.AccAddress, + amt sdk.Coins, + ) error } // ParamSubspace defines the expected Subspace interface for parameters. diff --git a/x/gateway/types/message_stake_gateway.go b/x/gateway/types/message_stake_gateway.go index 6b763f0b2..b3f19883c 100644 --- a/x/gateway/types/message_stake_gateway.go +++ b/x/gateway/types/message_stake_gateway.go @@ -4,7 +4,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -var _ sdk.Msg = &MsgStakeGateway{} +var _ sdk.Msg = (*MsgStakeGateway)(nil) func NewMsgStakeGateway(address string, stake sdk.Coin) *MsgStakeGateway { return &MsgStakeGateway{ diff --git a/x/gateway/types/message_unstake_gateway.go b/x/gateway/types/message_unstake_gateway.go index 59e752abf..41bdfca92 100644 --- a/x/gateway/types/message_unstake_gateway.go +++ b/x/gateway/types/message_unstake_gateway.go @@ -4,7 +4,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -var _ sdk.Msg = &MsgUnstakeGateway{} +var _ sdk.Msg = (*MsgUnstakeGateway)(nil) func NewMsgUnstakeGateway(address string) *MsgUnstakeGateway { return &MsgUnstakeGateway{ diff --git a/x/gateway/types/msg_update_params.go b/x/gateway/types/msg_update_params.go index e36d023de..aeed4a633 100644 --- a/x/gateway/types/msg_update_params.go +++ b/x/gateway/types/msg_update_params.go @@ -5,7 +5,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -var _ sdk.Msg = &MsgUpdateParams{} +var _ sdk.Msg = (*MsgUpdateParams)(nil) // ValidateBasic does a sanity check on the provided data. func (m *MsgUpdateParams) ValidateBasic() error { From e3dc8e181bff90631677658fc9200625c9e41cf2 Mon Sep 17 00:00:00 2001 From: Redouane Lakrache Date: Sat, 10 Feb 2024 02:46:54 +0100 Subject: [PATCH 08/10] reconcile: Make changes closer to main --- Makefile | 40 +++++- api/poktroll/gateway/gateway.pulsar.go | 4 +- api/poktroll/gateway/query.pulsar.go | 123 +++++++++--------- go.mod | 2 - proto/poktroll/gateway/gateway.proto | 4 +- proto/poktroll/gateway/params.proto | 1 - proto/poktroll/gateway/query.proto | 2 +- x/gateway/keeper/msg_server_stake_gateway.go | 14 +- .../keeper/msg_server_stake_gateway_test.go | 10 +- .../keeper/msg_server_unstake_gateway.go | 9 +- .../keeper/msg_server_unstake_gateway_test.go | 4 +- x/gateway/keeper/params_test.go | 4 +- x/gateway/keeper/query_gateway.go | 5 +- x/gateway/keeper/query_params_test.go | 4 +- x/gateway/module/genesis_test.go | 2 +- x/gateway/simulation/stake_gateway.go | 4 +- x/gateway/types/genesis.go | 28 +++- x/gateway/types/genesis_test.go | 123 +++++++++++++++++- x/gateway/types/key_gateway.go | 2 +- x/gateway/types/message_stake_gateway.go | 13 +- x/gateway/types/message_stake_gateway_test.go | 12 +- x/gateway/types/message_unstake_gateway.go | 3 +- .../types/message_unstake_gateway_test.go | 7 +- 23 files changed, 291 insertions(+), 129 deletions(-) diff --git a/Makefile b/Makefile index a4f805d5c..a17c4fc84 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,9 @@ .SILENT: -POKTROLLD_HOME := ./localnet/poktrolld -POCKET_NODE = tcp://127.0.0.1:36657 # The pocket rollup node (full node and sequencer in the localnet context) -APPGATE_SERVER = http://localhost:42069 +SHELL = /bin/sh +POKTROLLD_HOME ?= ./localnet/poktrolld +POCKET_NODE ?= tcp://127.0.0.1:36657 # The pocket rollup node (full node and sequencer in the localnet context) +APPGATE_SERVER ?= http://localhost:42069 POCKET_ADDR_PREFIX = pokt #################### @@ -166,7 +167,7 @@ localnet_down: ## Delete resources created by localnet tilt down .PHONY: localnet_regenesis -localnet_regenesis: ## Regenerate the localnet genesis file +localnet_regenesis: acc_initialize_pubkeys_warn_message ## Regenerate the localnet genesis file # NOTE: intentionally not using --home flag to avoid overwriting the test keyring # NB: Currently the stake => power calculation is constant; however, cosmos-sdk # intends to make this parameterizable in the future. @@ -207,7 +208,7 @@ go_imports: check_go_version ## Run goimports on all go files ############# .PHONY: test_e2e -test_e2e: ## Run all E2E tests +test_e2e: acc_initialize_pubkeys_warn_message ## Run all E2E tests export POCKET_NODE=$(POCKET_NODE) && \ export APPGATE_SERVER=$(APPGATE_SERVER) && \ POKTROLLD_HOME=../../$(POKTROLLD_HOME) && \ @@ -369,7 +370,6 @@ app_list: ## List all the staked applications app_stake: ## Stake tokens for the application specified (must specify the APP and SERVICES env vars) poktrolld --home=$(POKTROLLD_HOME) tx application stake-application --config $(POKTROLLD_HOME)/config/$(SERVICES) --keyring-backend test --from $(APP) --node $(POCKET_NODE) -# TODO_IMPROVE(#180): Make sure genesis-staked actors are available via AccountKeeper .PHONY: app1_stake app1_stake: ## Stake app1 (also staked in genesis) APP=app1 SERVICES=application1_stake_config.yaml make app_stake @@ -529,6 +529,32 @@ acc_balance_query_app1: ## Query the balance of app1 acc_balance_total_supply: ## Query the total supply of the network poktrolld --home=$(POKTROLLD_HOME) q bank total --node $(POCKET_NODE) +# NB: Ignite does not populate `pub_key` in `accounts` within `genesis.json` leading +# to queries like this to fail: `poktrolld query account pokt1 --node $(POCKET_NODE). +# We attempted using a `tx multi-send` from the `faucet` to all accounts, but +# that also did not solve this problem because the account itself must sign the +# transaction for its public key to be populated in the account keeper. As such, +# the solution is to send funds from every account in genesis to some address +# (PNF was selected ambigously) to make sure their public keys are populated. + +.PHONY: acc_initialize_pubkeys +acc_initialize_pubkeys: ## Make sure the account keeper has public keys for all available accounts + $(eval ADDRESSES=$(shell make -s ignite_acc_list | grep pokt | awk '{printf "%s ", $$2}' | sed 's/.$$//')) + $(eval PNF_ADDR=pokt1eeeksh2tvkh7wzmfrljnhw4wrhs55lcuvmekkw) + # @printf "Addresses: ${ADDRESSES}" + $(foreach addr, $(ADDRESSES),\ + echo $(addr);\ + poktrolld tx bank send \ + $(addr) $(PNF_ADDR) 1000upokt \ + --yes \ + --home=$(POKTROLLD_HOME) \ + --node $(POCKET_NODE);) + +.PHONY: acc_initialize_pubkeys_warn_message +acc_initialize_pubkeys_warn_message: ## Print a warning message about the need to run `make acc_initialize_pubkeys` + @printf "!!! YOU MUST RUN THE FOLLOWING COMMAND ONCE FOR E2E TESTS TO WORK AFTER THE NETWORK HAS STARTED!!!\n"\ + "\t\tmake acc_initialize_pubkeys\n" + ############## ### Claims ### ############## @@ -656,4 +682,4 @@ act_list: check_act ## List all github actions that can be executed locally with act_reviewdog: check_act check_gh ## Run the reviewdog workflow locally like so: `GITHUB_TOKEN=$(gh auth token) make act_reviewdog` $(eval CONTAINER_ARCH := $(shell make -s detect_arch)) @echo "Detected architecture: $(CONTAINER_ARCH)" - act -v -s GITHUB_TOKEN=$(GITHUB_TOKEN) -W .github/workflows/reviewdog.yml --container-architecture $(CONTAINER_ARCH) + act -v -s GITHUB_TOKEN=$(GITHUB_TOKEN) -W .github/workflows/reviewdog.yml --container-architecture $(CONTAINER_ARCH) \ No newline at end of file diff --git a/api/poktroll/gateway/gateway.pulsar.go b/api/poktroll/gateway/gateway.pulsar.go index edcafe393..76b5d7dff 100644 --- a/api/poktroll/gateway/gateway.pulsar.go +++ b/api/poktroll/gateway/gateway.pulsar.go @@ -532,8 +532,8 @@ type Gateway struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - Stake *v1beta1.Coin `protobuf:"bytes,2,opt,name=stake,proto3" json:"stake,omitempty"` + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // The Bech32 address of the gateway + Stake *v1beta1.Coin `protobuf:"bytes,2,opt,name=stake,proto3" json:"stake,omitempty"` // The total amount of uPOKT the gateway has staked } func (x *Gateway) Reset() { diff --git a/api/poktroll/gateway/query.pulsar.go b/api/poktroll/gateway/query.pulsar.go index dce0a107e..f7318f7e2 100644 --- a/api/poktroll/gateway/query.pulsar.go +++ b/api/poktroll/gateway/query.pulsar.go @@ -2924,72 +2924,71 @@ var file_poktroll_gateway_query_proto_rawDesc = []byte{ 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, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, 0x52, - 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x4c, 0x0a, 0x16, 0x51, 0x75, 0x65, 0x72, 0x79, + 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x32, 0x0a, 0x16, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x32, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, - 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x61, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x54, 0x0a, 0x17, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, - 0x74, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x39, 0x0a, 0x07, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, - 0x65, 0x77, 0x61, 0x79, 0x2e, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, 0x04, 0xc8, 0xde, - 0x1f, 0x00, 0x52, 0x07, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x22, 0x60, 0x0a, 0x16, 0x51, - 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x46, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x31, - 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x9d, 0x01, - 0x0a, 0x17, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, - 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a, 0x07, 0x67, 0x61, 0x74, - 0x65, 0x77, 0x61, 0x79, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6b, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x47, 0x61, - 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x07, 0x67, 0x61, 0x74, - 0x65, 0x77, 0x61, 0x79, 0x12, 0x47, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x62, - 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x32, 0xbd, 0x03, - 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x84, 0x01, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x12, 0x24, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, - 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x74, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x54, 0x0a, 0x17, 0x51, + 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a, 0x07, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x47, 0x61, 0x74, 0x65, 0x77, + 0x61, 0x79, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x07, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, + 0x79, 0x22, 0x60, 0x0a, 0x16, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x47, 0x61, 0x74, + 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x46, 0x0a, 0x0a, 0x70, + 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x26, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, + 0x65, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x22, 0x9d, 0x01, 0x0a, 0x17, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, + 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x39, 0x0a, 0x07, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, + 0x77, 0x61, 0x79, 0x2e, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, 0x04, 0xc8, 0xde, 0x1f, + 0x00, 0x52, 0x07, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x47, 0x0a, 0x0a, 0x70, 0x61, + 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, + 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x32, 0xbd, 0x03, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x84, 0x01, + 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x24, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, - 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x2d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x12, 0x25, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, - 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, - 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x98, - 0x01, 0x0a, 0x07, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x28, 0x2e, 0x70, 0x6f, 0x6b, + 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, + 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, + 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x12, 0x25, 0x2f, + 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x70, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x12, 0x98, 0x01, 0x0a, 0x07, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, + 0x12, 0x28, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, + 0x77, 0x61, 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x47, 0x61, 0x74, 0x65, + 0x77, 0x61, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x51, 0x75, - 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, - 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, - 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x38, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x32, 0x12, 0x30, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, - 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, - 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, - 0x7b, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x7d, 0x12, 0x91, 0x01, 0x0a, 0x0a, 0x47, 0x61, - 0x74, 0x65, 0x77, 0x61, 0x79, 0x41, 0x6c, 0x6c, 0x12, 0x28, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x38, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x32, 0x12, 0x30, 0x2f, + 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x67, 0x61, + 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x7b, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x7d, 0x12, + 0x91, 0x01, 0x0a, 0x0a, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x41, 0x6c, 0x6c, 0x12, 0x28, + 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, + 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, + 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, - 0x79, 0x41, 0x6c, 0x6c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, - 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x47, 0x61, - 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2e, 0x82, - 0xd3, 0xe4, 0x93, 0x02, 0x28, 0x12, 0x26, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, - 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, - 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, 0xa6, 0x01, - 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, - 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 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, + 0x79, 0x41, 0x6c, 0x6c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x28, 0x12, 0x26, 0x2f, 0x70, 0x6f, + 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x67, 0x61, 0x74, 0x65, + 0x77, 0x61, 0x79, 0x42, 0xa6, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, + 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, 0x0a, 0x51, 0x75, + 0x65, 0x72, 0x79, 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 ( diff --git a/go.mod b/go.mod index 6b79eacf7..b545e2745 100644 --- a/go.mod +++ b/go.mod @@ -327,9 +327,7 @@ require ( google.golang.org/api v0.153.0 // indirect google.golang.org/appengine v1.6.8 // indirect google.golang.org/genproto v0.0.0-20240102182953-50ed04b92917 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240116215550-a9fa1716bcac // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240116215550-a9fa1716bcac // indirect - google.golang.org/grpc v1.60.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect gotest.tools/v3 v3.5.1 // indirect diff --git a/proto/poktroll/gateway/gateway.proto b/proto/poktroll/gateway/gateway.proto index 030ae58b9..ff6798ba7 100644 --- a/proto/poktroll/gateway/gateway.proto +++ b/proto/poktroll/gateway/gateway.proto @@ -7,7 +7,7 @@ import "gogoproto/gogo.proto"; import "cosmos/base/v1beta1/coin.proto"; message Gateway { - string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - cosmos.base.v1beta1.Coin stake = 2; + 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 has staked } diff --git a/proto/poktroll/gateway/params.proto b/proto/poktroll/gateway/params.proto index 9a4c44b81..bb7a65110 100644 --- a/proto/poktroll/gateway/params.proto +++ b/proto/poktroll/gateway/params.proto @@ -11,5 +11,4 @@ message Params { option (amino.name) = "poktroll/x/gateway/Params"; option (gogoproto.equal) = true; - } \ No newline at end of file diff --git a/proto/poktroll/gateway/query.proto b/proto/poktroll/gateway/query.proto index 0cf6d43a2..6e000cf4f 100644 --- a/proto/poktroll/gateway/query.proto +++ b/proto/poktroll/gateway/query.proto @@ -43,7 +43,7 @@ message QueryParamsResponse { } message QueryGetGatewayRequest { - string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string address = 1; } message QueryGetGatewayResponse { diff --git a/x/gateway/keeper/msg_server_stake_gateway.go b/x/gateway/keeper/msg_server_stake_gateway.go index daf956530..1a08d0049 100644 --- a/x/gateway/keeper/msg_server_stake_gateway.go +++ b/x/gateway/keeper/msg_server_stake_gateway.go @@ -4,12 +4,16 @@ import ( "context" "fmt" + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/pokt-network/poktroll/x/gateway/types" ) -func (k msgServer) StakeGateway(goCtx context.Context, msg *types.MsgStakeGateway) (*types.MsgStakeGatewayResponse, error) { +func (k msgServer) StakeGateway( + goCtx context.Context, + msg *types.MsgStakeGateway, +) (*types.MsgStakeGatewayResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) logger := k.Logger().With("method", "StakeGateway") @@ -74,13 +78,13 @@ func (k msgServer) updateGateway( ) error { // Checks if the the msg address is the same as the current owner if msg.Address != gateway.Address { - return types.ErrGatewayUnauthorized.Wrapf("msg Address (%s) != gateway address (%s)", msg.Address, gateway.Address) + return sdkerrors.Wrapf(types.ErrGatewayUnauthorized, "msg Address (%s) != gateway address (%s)", msg.Address, gateway.Address) } - if msg.Stake.IsZero() { - return types.ErrGatewayInvalidStake.Wrap("stake amount cannot be 0") + if msg.Stake == nil { + return sdkerrors.Wrapf(types.ErrGatewayInvalidStake, "stake amount cannot be nil") } if msg.Stake.IsLTE(*gateway.Stake) { - return types.ErrGatewayInvalidStake.Wrapf("stake amount %v must be higher than previous stake amount %v", msg.Stake, gateway.Stake) + return sdkerrors.Wrapf(types.ErrGatewayInvalidStake, "stake amount %v must be higher than previous stake amount %v", msg.Stake, gateway.Stake) } gateway.Stake = msg.Stake return nil diff --git a/x/gateway/keeper/msg_server_stake_gateway_test.go b/x/gateway/keeper/msg_server_stake_gateway_test.go index 9645c1a0a..113304ee9 100644 --- a/x/gateway/keeper/msg_server_stake_gateway_test.go +++ b/x/gateway/keeper/msg_server_stake_gateway_test.go @@ -3,7 +3,7 @@ package keeper_test import ( "testing" - "cosmossdk.io/math" + sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" @@ -25,7 +25,7 @@ func TestMsgServer_StakeGateway_SuccessfulCreateAndUpdate(t *testing.T) { require.False(t, isGatewayFound) // Prepare the gateway - initialStake := sdk.NewCoin("upokt", math.NewInt(100)) + initialStake := sdk.NewCoin("upokt", sdkmath.NewInt(100)) stakeMsg := &types.MsgStakeGateway{ Address: addr, Stake: &initialStake, @@ -42,7 +42,7 @@ 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)) + updatedStake := sdk.NewCoin("upokt", sdkmath.NewInt(200)) updateMsg := &types.MsgStakeGateway{ Address: addr, Stake: &updatedStake, @@ -62,7 +62,7 @@ func TestMsgServer_StakeGateway_FailLoweringStake(t *testing.T) { // Prepare the gateway addr := sample.AccAddress() - initialStake := sdk.NewCoin("upokt", math.NewInt(100)) + initialStake := sdk.NewCoin("upokt", sdkmath.NewInt(100)) stakeMsg := &types.MsgStakeGateway{ Address: addr, Stake: &initialStake, @@ -75,7 +75,7 @@ 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)) + updatedStake := sdk.NewCoin("upokt", sdkmath.NewInt(50)) updateMsg := &types.MsgStakeGateway{ Address: addr, Stake: &updatedStake, diff --git a/x/gateway/keeper/msg_server_unstake_gateway.go b/x/gateway/keeper/msg_server_unstake_gateway.go index ebf919477..302c388f2 100644 --- a/x/gateway/keeper/msg_server_unstake_gateway.go +++ b/x/gateway/keeper/msg_server_unstake_gateway.go @@ -5,10 +5,16 @@ import ( "fmt" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/pokt-network/poktroll/x/gateway/types" ) -func (k msgServer) UnstakeGateway(goCtx context.Context, msg *types.MsgUnstakeGateway) (*types.MsgUnstakeGatewayResponse, error) { +// TODO_TECHDEBT(#49): Add un-delegation from delegated apps +// TODO(#73): Determine if a gateway needs an unbonding period after unstaking. +func (k msgServer) UnstakeGateway( + goCtx context.Context, + msg *types.MsgUnstakeGateway, +) (*types.MsgUnstakeGatewayResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) logger := k.Logger().With("method", "UnstakeGateway") @@ -44,6 +50,5 @@ func (k msgServer) UnstakeGateway(goCtx context.Context, msg *types.MsgUnstakeGa // Update the Gateway in the store k.RemoveGateway(ctx, gatewayAddress.String()) logger.Info(fmt.Sprintf("Successfully removed the gateway: %+v", gateway)) - return &types.MsgUnstakeGatewayResponse{}, nil } diff --git a/x/gateway/keeper/msg_server_unstake_gateway_test.go b/x/gateway/keeper/msg_server_unstake_gateway_test.go index 4c977ef3c..8f1dcf351 100644 --- a/x/gateway/keeper/msg_server_unstake_gateway_test.go +++ b/x/gateway/keeper/msg_server_unstake_gateway_test.go @@ -3,7 +3,7 @@ package keeper_test import ( "testing" - "cosmossdk.io/math" + sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" @@ -25,7 +25,7 @@ func TestMsgServer_UnstakeGateway_Success(t *testing.T) { require.False(t, isGatewayFound) // Prepare the gateway - initialStake := sdk.NewCoin("upokt", math.NewInt(100)) + initialStake := sdk.NewCoin("upokt", sdkmath.NewInt(100)) stakeMsg := &types.MsgStakeGateway{ Address: addr, Stake: &initialStake, diff --git a/x/gateway/keeper/params_test.go b/x/gateway/keeper/params_test.go index 7d4c17132..27bf9d53d 100644 --- a/x/gateway/keeper/params_test.go +++ b/x/gateway/keeper/params_test.go @@ -5,12 +5,12 @@ import ( "github.com/stretchr/testify/require" - keepertest "github.com/pokt-network/poktroll/testutil/keeper" + testkeeper "github.com/pokt-network/poktroll/testutil/keeper" "github.com/pokt-network/poktroll/x/gateway/types" ) func TestGetParams(t *testing.T) { - k, ctx := keepertest.GatewayKeeper(t) + k, ctx := testkeeper.GatewayKeeper(t) params := types.DefaultParams() require.NoError(t, k.SetParams(ctx, params)) diff --git a/x/gateway/keeper/query_gateway.go b/x/gateway/keeper/query_gateway.go index 284fbe0fe..06712114c 100644 --- a/x/gateway/keeper/query_gateway.go +++ b/x/gateway/keeper/query_gateway.go @@ -7,9 +7,10 @@ import ( "cosmossdk.io/store/prefix" "github.com/cosmos/cosmos-sdk/runtime" "github.com/cosmos/cosmos-sdk/types/query" - "github.com/pokt-network/poktroll/x/gateway/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + + "github.com/pokt-network/poktroll/x/gateway/types" ) func (k Keeper) GatewayAll(ctx context.Context, req *types.QueryAllGatewayRequest) (*types.QueryAllGatewayResponse, error) { @@ -50,8 +51,6 @@ func (k Keeper) Gateway(ctx context.Context, req *types.QueryGetGatewayRequest) ) if !found { return nil, status.Error(codes.NotFound, fmt.Sprintf("gateway not found: address %s", req.Address)) - } - return &types.QueryGetGatewayResponse{Gateway: val}, nil } diff --git a/x/gateway/keeper/query_params_test.go b/x/gateway/keeper/query_params_test.go index c24ed298a..cca74a59b 100644 --- a/x/gateway/keeper/query_params_test.go +++ b/x/gateway/keeper/query_params_test.go @@ -5,12 +5,12 @@ import ( "github.com/stretchr/testify/require" - keepertest "github.com/pokt-network/poktroll/testutil/keeper" + testkeeper "github.com/pokt-network/poktroll/testutil/keeper" "github.com/pokt-network/poktroll/x/gateway/types" ) func TestParamsQuery(t *testing.T) { - keeper, ctx := keepertest.GatewayKeeper(t) + keeper, ctx := testkeeper.GatewayKeeper(t) params := types.DefaultParams() require.NoError(t, keeper.SetParams(ctx, params)) diff --git a/x/gateway/module/genesis_test.go b/x/gateway/module/genesis_test.go index 2525dcd45..9245a91e4 100644 --- a/x/gateway/module/genesis_test.go +++ b/x/gateway/module/genesis_test.go @@ -5,7 +5,7 @@ import ( keepertest "github.com/pokt-network/poktroll/testutil/keeper" "github.com/pokt-network/poktroll/testutil/nullify" - "github.com/pokt-network/poktroll/x/gateway/module" + gateway "github.com/pokt-network/poktroll/x/gateway/module" "github.com/pokt-network/poktroll/x/gateway/types" "github.com/stretchr/testify/require" ) diff --git a/x/gateway/simulation/stake_gateway.go b/x/gateway/simulation/stake_gateway.go index ebffa84a5..ea7474891 100644 --- a/x/gateway/simulation/stake_gateway.go +++ b/x/gateway/simulation/stake_gateway.go @@ -18,12 +18,12 @@ func SimulateMsgStakeGateway( 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.MsgStakeGateway{ + stakeMsg := &types.MsgStakeGateway{ Address: simAccount.Address.String(), } // TODO: Handling the StakeGateway simulation - return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(msg), "StakeGateway simulation not implemented"), nil, nil + return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(stakeMsg), "StakeGateway simulation not implemented"), nil, nil } } diff --git a/x/gateway/types/genesis.go b/x/gateway/types/genesis.go index e06a6c5cb..5cb161252 100644 --- a/x/gateway/types/genesis.go +++ b/x/gateway/types/genesis.go @@ -1,7 +1,8 @@ package types import ( - "fmt" + sdkerrors "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" ) // DefaultIndex is the default global index @@ -19,15 +20,32 @@ func DefaultGenesis() *GenesisState { // Validate performs basic genesis state validation returning an error upon any // failure. func (gs GenesisState) Validate() error { - // Check for duplicated index in gateway gatewayIndexMap := make(map[string]struct{}) - for _, elem := range gs.GatewayList { - index := string(GatewayKey(elem.Address)) + for _, gateway := range gs.GatewayList { + // Check for duplicated index in gateway + index := string(GatewayKey(gateway.Address)) if _, ok := gatewayIndexMap[index]; ok { - return fmt.Errorf("duplicated index for gateway") + return sdkerrors.Wrap(ErrGatewayInvalidAddress, "duplicated index for gateway") } gatewayIndexMap[index] = struct{}{} + // Validate the stake of each gateway + if gateway.Stake == nil { + return sdkerrors.Wrap(ErrGatewayInvalidStake, "nil stake amount for gateway") + } + stake, err := sdk.ParseCoinNormalized(gateway.Stake.String()) + if !stake.IsValid() { + return sdkerrors.Wrapf(ErrGatewayInvalidStake, "invalid stake amount for gateway %v; (%v)", gateway.Stake, stake.Validate()) + } + if err != nil { + return sdkerrors.Wrapf(ErrGatewayInvalidStake, "cannot parse stake amount for gateway %v; (%v)", gateway.Stake, err) + } + if stake.IsZero() || stake.IsNegative() { + return sdkerrors.Wrapf(ErrGatewayInvalidStake, "invalid stake amount for gateway: %v <= 0", gateway.Stake) + } + if stake.Denom != "upokt" { + return sdkerrors.Wrapf(ErrGatewayInvalidStake, "invalid stake amount denom for gateway %v", gateway.Stake) + } } // this line is used by starport scaffolding # genesis/types/validate diff --git a/x/gateway/types/genesis_test.go b/x/gateway/types/genesis_test.go index 446f2db3b..a6aa2816c 100644 --- a/x/gateway/types/genesis_test.go +++ b/x/gateway/types/genesis_test.go @@ -3,11 +3,21 @@ package types_test import ( "testing" - "github.com/pokt-network/poktroll/x/gateway/types" + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/testutil/sample" + "github.com/pokt-network/poktroll/x/gateway/types" ) func TestGenesisState_Validate(t *testing.T) { + addr1 := sample.AccAddress() + stake1 := sdk.NewCoin("upokt", sdkmath.NewInt(100)) + + addr2 := sample.AccAddress() + stake2 := sdk.NewCoin("upokt", sdkmath.NewInt(100)) + tests := []struct { desc string genState *types.GenesisState @@ -21,13 +31,14 @@ func TestGenesisState_Validate(t *testing.T) { { desc: "valid genesis state", genState: &types.GenesisState{ - GatewayList: []types.Gateway{ { - Address: "0", + Address: addr1, + Stake: &stake1, }, { - Address: "1", + Address: addr2, + Stake: &stake2, }, }, // this line is used by starport scaffolding # types/genesis/validField @@ -35,14 +46,112 @@ func TestGenesisState_Validate(t *testing.T) { valid: true, }, { - desc: "duplicated gateway", + desc: "invalid - duplicated gateway address", + genState: &types.GenesisState{ + GatewayList: []types.Gateway{ + { + Address: addr1, + Stake: &stake1, + }, + { + Address: addr1, + Stake: &stake2, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - nil gateway stake", + genState: &types.GenesisState{ + GatewayList: []types.Gateway{ + { + Address: addr1, + Stake: &stake1, + }, + { + Address: addr2, + Stake: nil, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - missing gateway stake", + genState: &types.GenesisState{ + GatewayList: []types.Gateway{ + { + Address: addr1, + Stake: &stake1, + }, + { + Address: addr2, + // Stake: stake2, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - zero gateway stake", + genState: &types.GenesisState{ + GatewayList: []types.Gateway{ + { + Address: addr1, + Stake: &stake1, + }, + { + Address: addr2, + Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(0)}, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - negative gateway stake", + genState: &types.GenesisState{ + GatewayList: []types.Gateway{ + { + Address: addr1, + Stake: &stake1, + }, + { + Address: addr2, + Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(-100)}, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - wrong stake denom", + genState: &types.GenesisState{ + GatewayList: []types.Gateway{ + { + Address: addr1, + Stake: &stake1, + }, + { + Address: addr2, + Stake: &sdk.Coin{Denom: "invalid", Amount: sdkmath.NewInt(100)}, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - missing denom", genState: &types.GenesisState{ GatewayList: []types.Gateway{ { - Address: "0", + Address: addr1, + Stake: &stake1, }, { - Address: "0", + Address: addr2, + Stake: &sdk.Coin{Denom: "", Amount: sdkmath.NewInt(100)}, }, }, }, diff --git a/x/gateway/types/key_gateway.go b/x/gateway/types/key_gateway.go index aaf7397a5..8fe1e65f7 100644 --- a/x/gateway/types/key_gateway.go +++ b/x/gateway/types/key_gateway.go @@ -5,7 +5,7 @@ import "encoding/binary" var _ binary.ByteOrder const ( - // GatewayKeyPrefix is the prefix to retrieve all Gateway + // GatewayKeyPrefix is the prefix to retrieve all Gateways GatewayKeyPrefix = "Gateway/value/" ) diff --git a/x/gateway/types/message_stake_gateway.go b/x/gateway/types/message_stake_gateway.go index b3f19883c..9f349cf16 100644 --- a/x/gateway/types/message_stake_gateway.go +++ b/x/gateway/types/message_stake_gateway.go @@ -1,6 +1,7 @@ package types import ( + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -16,25 +17,25 @@ func NewMsgStakeGateway(address string, stake sdk.Coin) *MsgStakeGateway { func (msg *MsgStakeGateway) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Address) if err != nil { - return ErrGatewayInvalidAddress.Wrapf("invalid gateway address %s; (%v)", msg.Address, err) + return sdkerrors.Wrapf(ErrGatewayInvalidAddress, "invalid gateway address %s; (%v)", msg.Address, err) } // Validate the stake amount if msg.Stake == nil { - return ErrGatewayInvalidStake.Wrapf("nil gateway stake; (%v)", err) + return sdkerrors.Wrapf(ErrGatewayInvalidStake, "nil gateway stake; (%v)", err) } stake, err := sdk.ParseCoinNormalized(msg.Stake.String()) if !stake.IsValid() { - return ErrGatewayInvalidStake.Wrapf("invalid gateway stake %v; (%v)", msg.Stake, stake.Validate()) + return sdkerrors.Wrapf(ErrGatewayInvalidStake, "invalid gateway stake %v; (%v)", msg.Stake, stake.Validate()) } if err != nil { - return ErrGatewayInvalidStake.Wrapf("cannot parse gateway stake %v; (%v)", msg.Stake, err) + return sdkerrors.Wrapf(ErrGatewayInvalidStake, "cannot parse gateway stake %v; (%v)", msg.Stake, err) } if stake.IsZero() || stake.IsNegative() { - return ErrGatewayInvalidStake.Wrapf("invalid stake amount for gateway: %v <= 0", msg.Stake) + return sdkerrors.Wrapf(ErrGatewayInvalidStake, "invalid stake amount for gateway: %v <= 0", msg.Stake) } if stake.Denom != "upokt" { - return ErrGatewayInvalidStake.Wrapf("invalid stake amount denom for gateway %v", msg.Stake) + return sdkerrors.Wrapf(ErrGatewayInvalidStake, "invalid stake amount denom for gateway %v", msg.Stake) } return nil } diff --git a/x/gateway/types/message_stake_gateway_test.go b/x/gateway/types/message_stake_gateway_test.go index f6b40a403..d1cb20902 100644 --- a/x/gateway/types/message_stake_gateway_test.go +++ b/x/gateway/types/message_stake_gateway_test.go @@ -3,7 +3,7 @@ package types import ( "testing" - "cosmossdk.io/math" + sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" @@ -11,7 +11,7 @@ import ( ) func TestMsgStakeGateway_ValidateBasic(t *testing.T) { - coins := sdk.NewCoin("upokt", math.NewInt(100)) + coins := sdk.NewCoin("upokt", sdkmath.NewInt(100)) tests := []struct { name string msg MsgStakeGateway @@ -35,28 +35,28 @@ func TestMsgStakeGateway_ValidateBasic(t *testing.T) { name: "valid address - zero stake", msg: MsgStakeGateway{ Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(0)}, + Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(0)}, }, err: ErrGatewayInvalidStake, }, { name: "valid address - negative stake", msg: MsgStakeGateway{ Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(-100)}, + Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(-100)}, }, err: ErrGatewayInvalidStake, }, { name: "valid address - invalid stake denom", msg: MsgStakeGateway{ Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "invalid", Amount: math.NewInt(100)}, + Stake: &sdk.Coin{Denom: "invalid", Amount: sdkmath.NewInt(100)}, }, err: ErrGatewayInvalidStake, }, { name: "valid address - invalid stake missing denom", msg: MsgStakeGateway{ Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "", Amount: math.NewInt(100)}, + Stake: &sdk.Coin{Denom: "", Amount: sdkmath.NewInt(100)}, }, err: ErrGatewayInvalidStake, }, { diff --git a/x/gateway/types/message_unstake_gateway.go b/x/gateway/types/message_unstake_gateway.go index 41bdfca92..fc163d022 100644 --- a/x/gateway/types/message_unstake_gateway.go +++ b/x/gateway/types/message_unstake_gateway.go @@ -1,6 +1,7 @@ package types import ( + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -15,7 +16,7 @@ func NewMsgUnstakeGateway(address string) *MsgUnstakeGateway { func (msg *MsgUnstakeGateway) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Address) if err != nil { - return ErrGatewayInvalidAddress.Wrapf("invalid gateway address (%s); (%v)", msg.Address, err) + return sdkerrors.Wrapf(ErrGatewayInvalidAddress, "invalid gateway address %s; (%v)", msg.Address, err) } return nil } diff --git a/x/gateway/types/message_unstake_gateway_test.go b/x/gateway/types/message_unstake_gateway_test.go index 6212bee1c..301ad05ef 100644 --- a/x/gateway/types/message_unstake_gateway_test.go +++ b/x/gateway/types/message_unstake_gateway_test.go @@ -19,11 +19,14 @@ func TestMsgUnstakeGateway_ValidateBasic(t *testing.T) { Address: "invalid_address", }, err: ErrGatewayInvalidAddress, - }, { + }, + { name: "missing address", msg: MsgUnstakeGateway{}, err: ErrGatewayInvalidAddress, - }, {name: "valid address", + }, + { + name: "valid address", msg: MsgUnstakeGateway{ Address: sample.AccAddress(), }, From 4193a45bd5d7b35a2fe432ab8edb7fd93e9c4d05 Mon Sep 17 00:00:00 2001 From: Redouane Lakrache Date: Wed, 14 Feb 2024 00:31:03 +0100 Subject: [PATCH 09/10] reconcile: address review change requests --- Makefile | 2 +- api/poktroll/gateway/genesis.pulsar.go | 60 ++++---- proto/poktroll/gateway/genesis.proto | 2 +- x/gateway/keeper/msg_update_params.go | 2 +- x/gateway/module/genesis_test.go | 182 +++++++++++++++++++++---- x/gateway/module/query_gateway.go | 4 + x/gateway/module/query_params.go | 6 +- x/gateway/module/tx_stake_gateway.go | 2 +- x/gateway/module/tx_unstake_gateway.go | 2 +- x/gateway/types/errors.go | 4 +- x/gateway/types/genesis_test.go | 172 ----------------------- x/gateway/types/msg_update_params.go | 6 +- 12 files changed, 205 insertions(+), 239 deletions(-) delete mode 100644 x/gateway/types/genesis_test.go diff --git a/Makefile b/Makefile index a17c4fc84..1f746e910 100644 --- a/Makefile +++ b/Makefile @@ -169,7 +169,7 @@ localnet_down: ## Delete resources created by localnet .PHONY: localnet_regenesis localnet_regenesis: acc_initialize_pubkeys_warn_message ## Regenerate the localnet genesis file # NOTE: intentionally not using --home flag to avoid overwriting the test keyring -# NB: Currently the stake => power calculation is constant; however, cosmos-sdk +# TODO_TECHDEBT: Currently the stake => power calculation is constant; however, cosmos-sdk # intends to make this parameterizable in the future. @echo "Initializing chain..." @set -e ;\ diff --git a/api/poktroll/gateway/genesis.pulsar.go b/api/poktroll/gateway/genesis.pulsar.go index d8b47995a..d178c96d9 100644 --- a/api/poktroll/gateway/genesis.pulsar.go +++ b/api/poktroll/gateway/genesis.pulsar.go @@ -66,16 +66,16 @@ func (x *_GenesisState_2_list) IsValid() bool { } var ( - md_GenesisState protoreflect.MessageDescriptor - fd_GenesisState_params protoreflect.FieldDescriptor - fd_GenesisState_gatewayList protoreflect.FieldDescriptor + md_GenesisState protoreflect.MessageDescriptor + fd_GenesisState_params protoreflect.FieldDescriptor + fd_GenesisState_gateway_list protoreflect.FieldDescriptor ) func init() { file_poktroll_gateway_genesis_proto_init() md_GenesisState = File_poktroll_gateway_genesis_proto.Messages().ByName("GenesisState") fd_GenesisState_params = md_GenesisState.Fields().ByName("params") - fd_GenesisState_gatewayList = md_GenesisState.Fields().ByName("gatewayList") + fd_GenesisState_gateway_list = md_GenesisState.Fields().ByName("gateway_list") } var _ protoreflect.Message = (*fastReflection_GenesisState)(nil) @@ -151,7 +151,7 @@ func (x *fastReflection_GenesisState) Range(f func(protoreflect.FieldDescriptor, } if len(x.GatewayList) != 0 { value := protoreflect.ValueOfList(&_GenesisState_2_list{list: &x.GatewayList}) - if !f(fd_GenesisState_gatewayList, value) { + if !f(fd_GenesisState_gateway_list, value) { return } } @@ -172,7 +172,7 @@ func (x *fastReflection_GenesisState) Has(fd protoreflect.FieldDescriptor) bool switch fd.FullName() { case "poktroll.gateway.GenesisState.params": return x.Params != nil - case "poktroll.gateway.GenesisState.gatewayList": + case "poktroll.gateway.GenesisState.gateway_list": return len(x.GatewayList) != 0 default: if fd.IsExtension() { @@ -192,7 +192,7 @@ func (x *fastReflection_GenesisState) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { case "poktroll.gateway.GenesisState.params": x.Params = nil - case "poktroll.gateway.GenesisState.gatewayList": + case "poktroll.gateway.GenesisState.gateway_list": x.GatewayList = nil default: if fd.IsExtension() { @@ -213,7 +213,7 @@ func (x *fastReflection_GenesisState) Get(descriptor protoreflect.FieldDescripto case "poktroll.gateway.GenesisState.params": value := x.Params return protoreflect.ValueOfMessage(value.ProtoReflect()) - case "poktroll.gateway.GenesisState.gatewayList": + case "poktroll.gateway.GenesisState.gateway_list": if len(x.GatewayList) == 0 { return protoreflect.ValueOfList(&_GenesisState_2_list{}) } @@ -241,7 +241,7 @@ func (x *fastReflection_GenesisState) Set(fd protoreflect.FieldDescriptor, value switch fd.FullName() { case "poktroll.gateway.GenesisState.params": x.Params = value.Message().Interface().(*Params) - case "poktroll.gateway.GenesisState.gatewayList": + case "poktroll.gateway.GenesisState.gateway_list": lv := value.List() clv := lv.(*_GenesisState_2_list) x.GatewayList = *clv.list @@ -270,7 +270,7 @@ func (x *fastReflection_GenesisState) Mutable(fd protoreflect.FieldDescriptor) p x.Params = new(Params) } return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) - case "poktroll.gateway.GenesisState.gatewayList": + case "poktroll.gateway.GenesisState.gateway_list": if x.GatewayList == nil { x.GatewayList = []*Gateway{} } @@ -292,7 +292,7 @@ func (x *fastReflection_GenesisState) NewField(fd protoreflect.FieldDescriptor) case "poktroll.gateway.GenesisState.params": m := new(Params) return protoreflect.ValueOfMessage(m.ProtoReflect()) - case "poktroll.gateway.GenesisState.gatewayList": + case "poktroll.gateway.GenesisState.gateway_list": list := []*Gateway{} return protoreflect.ValueOfList(&_GenesisState_2_list{list: &list}) default: @@ -608,7 +608,7 @@ type GenesisState struct { // params defines all the parameters of the module. Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` - GatewayList []*Gateway `protobuf:"bytes,2,rep,name=gatewayList,proto3" json:"gatewayList,omitempty"` + GatewayList []*Gateway `protobuf:"bytes,2,rep,name=gateway_list,json=gatewayList,proto3" json:"gateway_list,omitempty"` } func (x *GenesisState) Reset() { @@ -657,27 +657,27 @@ var file_poktroll_gateway_genesis_proto_rawDesc = []byte{ 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x67, 0x61, 0x74, - 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x8e, 0x01, 0x0a, 0x0c, 0x47, + 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x8f, 0x01, 0x0a, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x3b, 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, 0x42, 0x09, 0xc8, 0xde, 0x1f, 0x00, 0xa8, 0xe7, 0xb0, 0x2a, 0x01, - 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x41, 0x0a, 0x0b, 0x67, 0x61, 0x74, 0x65, - 0x77, 0x61, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, - 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, - 0x2e, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0b, - 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x42, 0xa8, 0x01, 0x0a, 0x14, - 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, - 0x65, 0x77, 0x61, 0x79, 0x42, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 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, + 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x42, 0x0a, 0x0c, 0x67, 0x61, 0x74, 0x65, + 0x77, 0x61, 0x79, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, + 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, + 0x79, 0x2e, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, + 0x0b, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x42, 0xa8, 0x01, 0x0a, + 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, + 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 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 ( @@ -700,7 +700,7 @@ var file_poktroll_gateway_genesis_proto_goTypes = []interface{}{ } var file_poktroll_gateway_genesis_proto_depIdxs = []int32{ 1, // 0: poktroll.gateway.GenesisState.params:type_name -> poktroll.gateway.Params - 2, // 1: poktroll.gateway.GenesisState.gatewayList:type_name -> poktroll.gateway.Gateway + 2, // 1: poktroll.gateway.GenesisState.gateway_list:type_name -> poktroll.gateway.Gateway 2, // [2:2] is the sub-list for method output_type 2, // [2:2] is the sub-list for method input_type 2, // [2:2] is the sub-list for extension type_name diff --git a/proto/poktroll/gateway/genesis.proto b/proto/poktroll/gateway/genesis.proto index 88cef7248..728d04961 100644 --- a/proto/poktroll/gateway/genesis.proto +++ b/proto/poktroll/gateway/genesis.proto @@ -13,6 +13,6 @@ option go_package = "github.com/pokt-network/poktroll/x/gateway/types"; message GenesisState { // params defines all the parameters of the module. Params params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; - repeated Gateway gatewayList = 2 [(gogoproto.nullable) = false] ; + repeated Gateway gateway_list = 2 [(gogoproto.nullable) = false] ; } diff --git a/x/gateway/keeper/msg_update_params.go b/x/gateway/keeper/msg_update_params.go index 5a2fffc12..abfd5938d 100644 --- a/x/gateway/keeper/msg_update_params.go +++ b/x/gateway/keeper/msg_update_params.go @@ -14,7 +14,7 @@ func (k msgServer) UpdateParams( req *types.MsgUpdateParams, ) (*types.MsgUpdateParamsResponse, error) { if k.GetAuthority() != req.Authority { - return nil, errorsmod.Wrapf(types.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.GetAuthority(), req.Authority) + return nil, errorsmod.Wrapf(types.ErrGatewayInvalidSigner, "invalid authority; expected %s, got %s", k.GetAuthority(), req.Authority) } ctx := sdk.UnwrapSDKContext(goCtx) diff --git a/x/gateway/module/genesis_test.go b/x/gateway/module/genesis_test.go index 9245a91e4..0d9ac318d 100644 --- a/x/gateway/module/genesis_test.go +++ b/x/gateway/module/genesis_test.go @@ -3,36 +3,170 @@ package gateway_test import ( "testing" - keepertest "github.com/pokt-network/poktroll/testutil/keeper" - "github.com/pokt-network/poktroll/testutil/nullify" - gateway "github.com/pokt-network/poktroll/x/gateway/module" - "github.com/pokt-network/poktroll/x/gateway/types" + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/testutil/sample" + "github.com/pokt-network/poktroll/x/gateway/types" ) -func TestGenesis(t *testing.T) { - genesisState := types.GenesisState{ - Params: types.DefaultParams(), +func TestGenesisState_Validate(t *testing.T) { + addr1 := sample.AccAddress() + stake1 := sdk.NewCoin("upokt", sdkmath.NewInt(100)) - GatewayList: []types.Gateway{ - { - Address: "0", + addr2 := sample.AccAddress() + stake2 := sdk.NewCoin("upokt", sdkmath.NewInt(100)) + + tests := []struct { + desc string + genState *types.GenesisState + valid bool + }{ + { + desc: "default is valid", + genState: types.DefaultGenesis(), + valid: true, + }, + { + desc: "valid genesis state", + genState: &types.GenesisState{ + GatewayList: []types.Gateway{ + { + Address: addr1, + Stake: &stake1, + }, + { + Address: addr2, + Stake: &stake2, + }, + }, + // this line is used by starport scaffolding # types/genesis/validField + }, + valid: true, + }, + { + desc: "invalid - duplicated gateway address", + genState: &types.GenesisState{ + GatewayList: []types.Gateway{ + { + Address: addr1, + Stake: &stake1, + }, + { + Address: addr1, + Stake: &stake2, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - nil gateway stake", + genState: &types.GenesisState{ + GatewayList: []types.Gateway{ + { + Address: addr1, + Stake: &stake1, + }, + { + Address: addr2, + Stake: nil, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - missing gateway stake", + genState: &types.GenesisState{ + GatewayList: []types.Gateway{ + { + Address: addr1, + Stake: &stake1, + }, + { + Address: addr2, + // Stake: stake2, + }, + }, }, - { - Address: "1", + valid: false, + }, + { + desc: "invalid - zero gateway stake", + genState: &types.GenesisState{ + GatewayList: []types.Gateway{ + { + Address: addr1, + Stake: &stake1, + }, + { + Address: addr2, + Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(0)}, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - negative gateway stake", + genState: &types.GenesisState{ + GatewayList: []types.Gateway{ + { + Address: addr1, + Stake: &stake1, + }, + { + Address: addr2, + Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(-100)}, + }, + }, }, + valid: false, }, - // this line is used by starport scaffolding # genesis/test/state + { + desc: "invalid - wrong stake denom", + genState: &types.GenesisState{ + GatewayList: []types.Gateway{ + { + Address: addr1, + Stake: &stake1, + }, + { + Address: addr2, + Stake: &sdk.Coin{Denom: "invalid", Amount: sdkmath.NewInt(100)}, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - missing denom", + genState: &types.GenesisState{ + GatewayList: []types.Gateway{ + { + Address: addr1, + Stake: &stake1, + }, + { + Address: addr2, + Stake: &sdk.Coin{Denom: "", Amount: sdkmath.NewInt(100)}, + }, + }, + }, + valid: false, + }, + // this line is used by starport scaffolding # types/genesis/testcase + } + for _, tc := range tests { + t.Run(tc.desc, func(t *testing.T) { + err := tc.genState.Validate() + if tc.valid { + require.NoError(t, err) + } else { + require.Error(t, err) + } + }) } - - k, ctx := keepertest.GatewayKeeper(t) - gateway.InitGenesis(ctx, k, genesisState) - got := gateway.ExportGenesis(ctx, k) - require.NotNil(t, got) - - nullify.Fill(&genesisState) - nullify.Fill(got) - - require.ElementsMatch(t, genesisState.GatewayList, got.GatewayList) - // this line is used by starport scaffolding # genesis/test/assert } diff --git a/x/gateway/module/query_gateway.go b/x/gateway/module/query_gateway.go index e4d37131e..be7cdaa23 100644 --- a/x/gateway/module/query_gateway.go +++ b/x/gateway/module/query_gateway.go @@ -12,6 +12,10 @@ func CmdListGateway() *cobra.Command { cmd := &cobra.Command{ Use: "list-gateway", Short: "list all gateways", + Long: `List all the gateways that the node being queried has in its state. + +Example: +$ poktrolld q gateway list-gateway --node $(POCKET_NODE) --home=$(POKTROLLD_HOME)`, RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientQueryContext(cmd) if err != nil { diff --git a/x/gateway/module/query_params.go b/x/gateway/module/query_params.go index d3d3a95a9..cdca5a567 100644 --- a/x/gateway/module/query_params.go +++ b/x/gateway/module/query_params.go @@ -12,7 +12,11 @@ func CmdQueryParams() *cobra.Command { cmd := &cobra.Command{ Use: "params", Short: "shows the parameters of the module", - Args: cobra.NoArgs, + Long: `Shows all the parameters related to the Gateway module. + +Example: +$ poktrolld q gateway params --node $(POCKET_NODE) --home=$(POKTROLLD_HOME)`, + Args: cobra.NoArgs, RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientQueryContext(cmd) if err != nil { diff --git a/x/gateway/module/tx_stake_gateway.go b/x/gateway/module/tx_stake_gateway.go index 4f5376ed7..e9e02dcef 100644 --- a/x/gateway/module/tx_stake_gateway.go +++ b/x/gateway/module/tx_stake_gateway.go @@ -25,7 +25,7 @@ func CmdStakeGateway() *cobra.Command { Long: `Stake a gateway with the provided parameters. This is a broadcast operation that will stake the tokens and associate them with the gateway specified by the 'from' address. Example: -$ poktrolld --home=$(POKTROLLD_HOME) tx gateway stake-gateway --config stake_config.yaml --keyring-backend test --from $(GATEWAY) --node $(POCKET_NODE)`, +$ poktrolld tx gateway stake-gateway --config stake_config.yaml --keyring-backend test --from $(GATEWAY) --node $(POCKET_NODE) --home=$(POKTROLLD_HOME)`, Args: cobra.ExactArgs(0), RunE: func(cmd *cobra.Command, _ []string) (err error) { configContent, err := os.ReadFile(flagStakeConfig) diff --git a/x/gateway/module/tx_unstake_gateway.go b/x/gateway/module/tx_unstake_gateway.go index de3e811ff..a5760aa1a 100644 --- a/x/gateway/module/tx_unstake_gateway.go +++ b/x/gateway/module/tx_unstake_gateway.go @@ -21,7 +21,7 @@ func CmdUnstakeGateway() *cobra.Command { Long: `Unstake a gateway. This is a broadcast operation that will unstake the gateway specified by the 'from' address. Example: -$ poktrolld --home=$(POKTROLLD_HOME) tx gateway unstake-gateway --keyring-backend test --from $(GATEWAY) --node $(POCKET_NODE)`, +$ poktrolld tx gateway unstake-gateway --keyring-backend test --from $(GATEWAY) --node $(POCKET_NODE) --home=$(POKTROLLD_HOME)`, Args: cobra.ExactArgs(0), RunE: func(cmd *cobra.Command, _ []string) (err error) { clientCtx, err := client.GetClientTxContext(cmd) diff --git a/x/gateway/types/errors.go b/x/gateway/types/errors.go index 7b15af1d9..298df8889 100644 --- a/x/gateway/types/errors.go +++ b/x/gateway/types/errors.go @@ -8,8 +8,8 @@ import ( // x/gateway module sentinel errors var ( - ErrInvalidSigner = sdkerrors.Register(ModuleName, 1100, "expected gov account as only signer for proposal message") - ErrSample = sdkerrors.Register(ModuleName, 1101, "sample error") + ErrGatewayInvalidSigner = sdkerrors.Register(ModuleName, 1100, "expected gov account as only signer for proposal message") + ErrGatewaySample = sdkerrors.Register(ModuleName, 1101, "sample error") ErrGatewayInvalidAddress = sdkerrors.Register(ModuleName, 1102, "invalid gateway address") ErrGatewayInvalidStake = sdkerrors.Register(ModuleName, 1103, "invalid gateway stake") ErrGatewayUnauthorized = sdkerrors.Register(ModuleName, 1104, "unauthorized signer") diff --git a/x/gateway/types/genesis_test.go b/x/gateway/types/genesis_test.go deleted file mode 100644 index a6aa2816c..000000000 --- a/x/gateway/types/genesis_test.go +++ /dev/null @@ -1,172 +0,0 @@ -package types_test - -import ( - "testing" - - sdkmath "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - "github.com/pokt-network/poktroll/testutil/sample" - "github.com/pokt-network/poktroll/x/gateway/types" -) - -func TestGenesisState_Validate(t *testing.T) { - addr1 := sample.AccAddress() - stake1 := sdk.NewCoin("upokt", sdkmath.NewInt(100)) - - addr2 := sample.AccAddress() - stake2 := sdk.NewCoin("upokt", sdkmath.NewInt(100)) - - tests := []struct { - desc string - genState *types.GenesisState - valid bool - }{ - { - desc: "default is valid", - genState: types.DefaultGenesis(), - valid: true, - }, - { - desc: "valid genesis state", - genState: &types.GenesisState{ - GatewayList: []types.Gateway{ - { - Address: addr1, - Stake: &stake1, - }, - { - Address: addr2, - Stake: &stake2, - }, - }, - // this line is used by starport scaffolding # types/genesis/validField - }, - valid: true, - }, - { - desc: "invalid - duplicated gateway address", - genState: &types.GenesisState{ - GatewayList: []types.Gateway{ - { - Address: addr1, - Stake: &stake1, - }, - { - Address: addr1, - Stake: &stake2, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - nil gateway stake", - genState: &types.GenesisState{ - GatewayList: []types.Gateway{ - { - Address: addr1, - Stake: &stake1, - }, - { - Address: addr2, - Stake: nil, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - missing gateway stake", - genState: &types.GenesisState{ - GatewayList: []types.Gateway{ - { - Address: addr1, - Stake: &stake1, - }, - { - Address: addr2, - // Stake: stake2, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - zero gateway stake", - genState: &types.GenesisState{ - GatewayList: []types.Gateway{ - { - Address: addr1, - Stake: &stake1, - }, - { - Address: addr2, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(0)}, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - negative gateway stake", - genState: &types.GenesisState{ - GatewayList: []types.Gateway{ - { - Address: addr1, - Stake: &stake1, - }, - { - Address: addr2, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(-100)}, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - wrong stake denom", - genState: &types.GenesisState{ - GatewayList: []types.Gateway{ - { - Address: addr1, - Stake: &stake1, - }, - { - Address: addr2, - Stake: &sdk.Coin{Denom: "invalid", Amount: sdkmath.NewInt(100)}, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - missing denom", - genState: &types.GenesisState{ - GatewayList: []types.Gateway{ - { - Address: addr1, - Stake: &stake1, - }, - { - Address: addr2, - Stake: &sdk.Coin{Denom: "", Amount: sdkmath.NewInt(100)}, - }, - }, - }, - valid: false, - }, - // this line is used by starport scaffolding # types/genesis/testcase - } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - err := tc.genState.Validate() - if tc.valid { - require.NoError(t, err) - } else { - require.Error(t, err) - } - }) - } -} diff --git a/x/gateway/types/msg_update_params.go b/x/gateway/types/msg_update_params.go index aeed4a633..597e9f93a 100644 --- a/x/gateway/types/msg_update_params.go +++ b/x/gateway/types/msg_update_params.go @@ -13,9 +13,5 @@ func (m *MsgUpdateParams) ValidateBasic() error { return errorsmod.Wrap(err, "invalid authority address") } - if err := m.Params.Validate(); err != nil { - return err - } - - return nil + return m.Params.Validate() } From ad8086825752a3fab5dbf64e4751801243f1b989 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Wed, 21 Feb 2024 14:50:27 +0100 Subject: [PATCH 10/10] chore: gateway module review improvements --- api/poktroll/gateway/gateway.pulsar.go | 45 +- api/poktroll/gateway/query.pulsar.go | 518 +++++++++--------- api/poktroll/gateway/tx.pulsar.go | 9 +- proto/poktroll/gateway/gateway.proto | 2 +- proto/poktroll/gateway/genesis.proto | 8 +- proto/poktroll/gateway/params.proto | 5 +- proto/poktroll/gateway/query.proto | 18 +- proto/poktroll/gateway/tx.proto | 17 +- testutil/keeper/gateway.go | 6 +- x/gateway/keeper/gateway.go | 31 +- x/gateway/keeper/gateway_test.go | 40 +- x/gateway/keeper/msg_server.go | 4 +- x/gateway/keeper/msg_server_stake_gateway.go | 14 +- .../keeper/msg_server_stake_gateway_test.go | 10 +- x/gateway/keeper/msg_server_test.go | 4 + .../keeper/msg_server_unstake_gateway_test.go | 4 +- x/gateway/keeper/msg_update_params.go | 4 +- x/gateway/keeper/msg_update_params_test.go | 36 +- x/gateway/keeper/params.go | 10 +- x/gateway/keeper/query.go | 4 +- x/gateway/keeper/query_gateway.go | 8 +- x/gateway/keeper/query_gateway_test.go | 72 +-- x/gateway/keeper/query_params.go | 4 +- x/gateway/module/autocli.go | 68 +-- x/gateway/module/config/errors.go | 13 +- .../config/gateway_config_reader_test.go | 36 +- x/gateway/module/genesis.go | 16 +- x/gateway/module/genesis_test.go | 181 +----- x/gateway/module/helpers_test.go | 6 - x/gateway/module/module.go | 6 +- x/gateway/module/query.go | 3 +- x/gateway/module/query_gateway.go | 6 +- x/gateway/module/query_gateway_test.go | 66 +-- x/gateway/module/query_params.go | 2 +- x/gateway/module/tx.go | 9 +- x/gateway/module/tx_stake_gateway.go | 2 +- x/gateway/module/tx_stake_gateway_test.go | 52 +- x/gateway/module/tx_unstake_gateway.go | 2 +- x/gateway/module/tx_unstake_gateway_test.go | 38 +- x/gateway/simulation/stake_gateway.go | 1 + x/gateway/simulation/unstake_gateway.go | 1 + x/gateway/types/errors.go | 13 +- x/gateway/types/expected_keepers.go | 10 +- x/gateway/types/genesis.go | 30 +- x/gateway/types/genesis_test.go | 172 ++++++ x/gateway/types/key_gateway.go | 10 +- x/gateway/types/keys.go | 8 +- x/gateway/types/message_stake_gateway.go | 17 +- x/gateway/types/message_stake_gateway_test.go | 54 +- x/gateway/types/message_unstake_gateway.go | 7 +- .../types/message_unstake_gateway_test.go | 28 +- ...ate_params.go => message_update_params.go} | 0 x/gateway/types/params.go | 4 +- 53 files changed, 868 insertions(+), 866 deletions(-) create mode 100644 x/gateway/types/genesis_test.go rename x/gateway/types/{msg_update_params.go => message_update_params.go} (100%) diff --git a/api/poktroll/gateway/gateway.pulsar.go b/api/poktroll/gateway/gateway.pulsar.go index 76b5d7dff..904d9f9fa 100644 --- a/api/poktroll/gateway/gateway.pulsar.go +++ b/api/poktroll/gateway/gateway.pulsar.go @@ -6,7 +6,6 @@ import ( fmt "fmt" _ "github.com/cosmos/cosmos-proto" runtime "github.com/cosmos/cosmos-proto/runtime" - _ "github.com/cosmos/gogoproto/gogoproto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" @@ -577,29 +576,27 @@ var file_poktroll_gateway_gateway_proto_rawDesc = []byte{ 0x61, 0x79, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 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, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, - 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, - 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x22, 0x6e, 0x0a, 0x07, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x32, - 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, - 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, - 0x73, 0x73, 0x12, 0x2f, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, - 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x52, 0x05, 0x73, 0x74, - 0x61, 0x6b, 0x65, 0x42, 0xa8, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, - 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, 0x0c, 0x47, 0x61, - 0x74, 0x65, 0x77, 0x61, 0x79, 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, + 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x6e, 0x0a, + 0x07, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x32, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, + 0x69, 0x6e, 0x67, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x2f, 0x0a, 0x05, + 0x73, 0x74, 0x61, 0x6b, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x52, 0x05, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x42, 0xa8, 0x01, + 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, + 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, 0x0c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 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 ( diff --git a/api/poktroll/gateway/query.pulsar.go b/api/poktroll/gateway/query.pulsar.go index f7318f7e2..36691c4cf 100644 --- a/api/poktroll/gateway/query.pulsar.go +++ b/api/poktroll/gateway/query.pulsar.go @@ -1665,25 +1665,25 @@ func (x *fastReflection_QueryGetGatewayResponse) ProtoMethods() *protoiface.Meth } var ( - md_QueryAllGatewayRequest protoreflect.MessageDescriptor - fd_QueryAllGatewayRequest_pagination protoreflect.FieldDescriptor + md_QueryAllGatewaysRequest protoreflect.MessageDescriptor + fd_QueryAllGatewaysRequest_pagination protoreflect.FieldDescriptor ) func init() { file_poktroll_gateway_query_proto_init() - md_QueryAllGatewayRequest = File_poktroll_gateway_query_proto.Messages().ByName("QueryAllGatewayRequest") - fd_QueryAllGatewayRequest_pagination = md_QueryAllGatewayRequest.Fields().ByName("pagination") + md_QueryAllGatewaysRequest = File_poktroll_gateway_query_proto.Messages().ByName("QueryAllGatewaysRequest") + fd_QueryAllGatewaysRequest_pagination = md_QueryAllGatewaysRequest.Fields().ByName("pagination") } -var _ protoreflect.Message = (*fastReflection_QueryAllGatewayRequest)(nil) +var _ protoreflect.Message = (*fastReflection_QueryAllGatewaysRequest)(nil) -type fastReflection_QueryAllGatewayRequest QueryAllGatewayRequest +type fastReflection_QueryAllGatewaysRequest QueryAllGatewaysRequest -func (x *QueryAllGatewayRequest) ProtoReflect() protoreflect.Message { - return (*fastReflection_QueryAllGatewayRequest)(x) +func (x *QueryAllGatewaysRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryAllGatewaysRequest)(x) } -func (x *QueryAllGatewayRequest) slowProtoReflect() protoreflect.Message { +func (x *QueryAllGatewaysRequest) slowProtoReflect() protoreflect.Message { mi := &file_poktroll_gateway_query_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1695,43 +1695,43 @@ func (x *QueryAllGatewayRequest) slowProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -var _fastReflection_QueryAllGatewayRequest_messageType fastReflection_QueryAllGatewayRequest_messageType -var _ protoreflect.MessageType = fastReflection_QueryAllGatewayRequest_messageType{} +var _fastReflection_QueryAllGatewaysRequest_messageType fastReflection_QueryAllGatewaysRequest_messageType +var _ protoreflect.MessageType = fastReflection_QueryAllGatewaysRequest_messageType{} -type fastReflection_QueryAllGatewayRequest_messageType struct{} +type fastReflection_QueryAllGatewaysRequest_messageType struct{} -func (x fastReflection_QueryAllGatewayRequest_messageType) Zero() protoreflect.Message { - return (*fastReflection_QueryAllGatewayRequest)(nil) +func (x fastReflection_QueryAllGatewaysRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryAllGatewaysRequest)(nil) } -func (x fastReflection_QueryAllGatewayRequest_messageType) New() protoreflect.Message { - return new(fastReflection_QueryAllGatewayRequest) +func (x fastReflection_QueryAllGatewaysRequest_messageType) New() protoreflect.Message { + return new(fastReflection_QueryAllGatewaysRequest) } -func (x fastReflection_QueryAllGatewayRequest_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_QueryAllGatewayRequest +func (x fastReflection_QueryAllGatewaysRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllGatewaysRequest } // Descriptor returns message descriptor, which contains only the protobuf // type information for the message. -func (x *fastReflection_QueryAllGatewayRequest) Descriptor() protoreflect.MessageDescriptor { - return md_QueryAllGatewayRequest +func (x *fastReflection_QueryAllGatewaysRequest) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllGatewaysRequest } // 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_QueryAllGatewayRequest) Type() protoreflect.MessageType { - return _fastReflection_QueryAllGatewayRequest_messageType +func (x *fastReflection_QueryAllGatewaysRequest) Type() protoreflect.MessageType { + return _fastReflection_QueryAllGatewaysRequest_messageType } // New returns a newly allocated and mutable empty message. -func (x *fastReflection_QueryAllGatewayRequest) New() protoreflect.Message { - return new(fastReflection_QueryAllGatewayRequest) +func (x *fastReflection_QueryAllGatewaysRequest) New() protoreflect.Message { + return new(fastReflection_QueryAllGatewaysRequest) } // Interface unwraps the message reflection interface and // returns the underlying ProtoMessage interface. -func (x *fastReflection_QueryAllGatewayRequest) Interface() protoreflect.ProtoMessage { - return (*QueryAllGatewayRequest)(x) +func (x *fastReflection_QueryAllGatewaysRequest) Interface() protoreflect.ProtoMessage { + return (*QueryAllGatewaysRequest)(x) } // Range iterates over every populated field in an undefined order, @@ -1739,10 +1739,10 @@ func (x *fastReflection_QueryAllGatewayRequest) Interface() protoreflect.ProtoMe // Range returns immediately if f returns false. // While iterating, mutating operations may only be performed // on the current field descriptor. -func (x *fastReflection_QueryAllGatewayRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +func (x *fastReflection_QueryAllGatewaysRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { if x.Pagination != nil { value := protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) - if !f(fd_QueryAllGatewayRequest_pagination, value) { + if !f(fd_QueryAllGatewaysRequest_pagination, value) { return } } @@ -1759,15 +1759,15 @@ func (x *fastReflection_QueryAllGatewayRequest) Range(f func(protoreflect.FieldD // In other cases (aside from the nullable cases above), // a proto3 scalar field is populated if it contains a non-zero value, and // a repeated field is populated if it is non-empty. -func (x *fastReflection_QueryAllGatewayRequest) Has(fd protoreflect.FieldDescriptor) bool { +func (x *fastReflection_QueryAllGatewaysRequest) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "poktroll.gateway.QueryAllGatewayRequest.pagination": + case "poktroll.gateway.QueryAllGatewaysRequest.pagination": return x.Pagination != nil default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewayRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewaysRequest")) } - panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewayRequest does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewaysRequest does not contain field %s", fd.FullName())) } } @@ -1777,15 +1777,15 @@ func (x *fastReflection_QueryAllGatewayRequest) Has(fd protoreflect.FieldDescrip // associated with the given field number. // // Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryAllGatewayRequest) Clear(fd protoreflect.FieldDescriptor) { +func (x *fastReflection_QueryAllGatewaysRequest) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "poktroll.gateway.QueryAllGatewayRequest.pagination": + case "poktroll.gateway.QueryAllGatewaysRequest.pagination": x.Pagination = nil default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewayRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewaysRequest")) } - panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewayRequest does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewaysRequest does not contain field %s", fd.FullName())) } } @@ -1795,16 +1795,16 @@ func (x *fastReflection_QueryAllGatewayRequest) Clear(fd protoreflect.FieldDescr // the default value of a bytes scalar is guaranteed to be a copy. // For unpopulated composite types, it returns an empty, read-only view // of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_QueryAllGatewayRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_QueryAllGatewaysRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "poktroll.gateway.QueryAllGatewayRequest.pagination": + case "poktroll.gateway.QueryAllGatewaysRequest.pagination": value := x.Pagination return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewayRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewaysRequest")) } - panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewayRequest does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewaysRequest does not contain field %s", descriptor.FullName())) } } @@ -1818,15 +1818,15 @@ func (x *fastReflection_QueryAllGatewayRequest) Get(descriptor protoreflect.Fiel // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryAllGatewayRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_QueryAllGatewaysRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "poktroll.gateway.QueryAllGatewayRequest.pagination": + case "poktroll.gateway.QueryAllGatewaysRequest.pagination": x.Pagination = value.Message().Interface().(*v1beta1.PageRequest) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewayRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewaysRequest")) } - panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewayRequest does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewaysRequest does not contain field %s", fd.FullName())) } } @@ -1840,44 +1840,44 @@ func (x *fastReflection_QueryAllGatewayRequest) Set(fd protoreflect.FieldDescrip // It panics if the field does not contain a composite type. // // Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryAllGatewayRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_QueryAllGatewaysRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "poktroll.gateway.QueryAllGatewayRequest.pagination": + case "poktroll.gateway.QueryAllGatewaysRequest.pagination": if x.Pagination == nil { x.Pagination = new(v1beta1.PageRequest) } return protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewayRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewaysRequest")) } - panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewayRequest does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewaysRequest 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_QueryAllGatewayRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_QueryAllGatewaysRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "poktroll.gateway.QueryAllGatewayRequest.pagination": + case "poktroll.gateway.QueryAllGatewaysRequest.pagination": m := new(v1beta1.PageRequest) return protoreflect.ValueOfMessage(m.ProtoReflect()) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewayRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewaysRequest")) } - panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewayRequest does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewaysRequest 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_QueryAllGatewayRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { +func (x *fastReflection_QueryAllGatewaysRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in poktroll.gateway.QueryAllGatewayRequest", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in poktroll.gateway.QueryAllGatewaysRequest", d.FullName())) } panic("unreachable") } @@ -1885,7 +1885,7 @@ func (x *fastReflection_QueryAllGatewayRequest) WhichOneof(d protoreflect.OneofD // GetUnknown retrieves the entire list of unknown fields. // The caller may only mutate the contents of the RawFields // if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_QueryAllGatewayRequest) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_QueryAllGatewaysRequest) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -1896,7 +1896,7 @@ func (x *fastReflection_QueryAllGatewayRequest) GetUnknown() protoreflect.RawFie // An empty RawFields may be passed to clear the fields. // // SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryAllGatewayRequest) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_QueryAllGatewaysRequest) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -1908,7 +1908,7 @@ func (x *fastReflection_QueryAllGatewayRequest) SetUnknown(fields protoreflect.R // message type, but the details are implementation dependent. // Validity is not part of the protobuf data model, and may not // be preserved in marshaling or other operations. -func (x *fastReflection_QueryAllGatewayRequest) IsValid() bool { +func (x *fastReflection_QueryAllGatewaysRequest) IsValid() bool { return x != nil } @@ -1918,9 +1918,9 @@ func (x *fastReflection_QueryAllGatewayRequest) IsValid() bool { // The returned methods type is identical to // "google.golang.org/protobuf/runtime/protoiface".Methods. // Consult the protoiface package documentation for details. -func (x *fastReflection_QueryAllGatewayRequest) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_QueryAllGatewaysRequest) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*QueryAllGatewayRequest) + x := input.Message.Interface().(*QueryAllGatewaysRequest) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1946,7 +1946,7 @@ func (x *fastReflection_QueryAllGatewayRequest) ProtoMethods() *protoiface.Metho } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*QueryAllGatewayRequest) + x := input.Message.Interface().(*QueryAllGatewaysRequest) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1990,7 +1990,7 @@ func (x *fastReflection_QueryAllGatewayRequest) ProtoMethods() *protoiface.Metho }, nil } unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*QueryAllGatewayRequest) + x := input.Message.Interface().(*QueryAllGatewaysRequest) if x == nil { return protoiface.UnmarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2022,10 +2022,10 @@ func (x *fastReflection_QueryAllGatewayRequest) ProtoMethods() *protoiface.Metho fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllGatewayRequest: wiretype end group for non-group") + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllGatewaysRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllGatewayRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllGatewaysRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2099,79 +2099,79 @@ func (x *fastReflection_QueryAllGatewayRequest) ProtoMethods() *protoiface.Metho } } -var _ protoreflect.List = (*_QueryAllGatewayResponse_1_list)(nil) +var _ protoreflect.List = (*_QueryAllGatewaysResponse_1_list)(nil) -type _QueryAllGatewayResponse_1_list struct { +type _QueryAllGatewaysResponse_1_list struct { list *[]*Gateway } -func (x *_QueryAllGatewayResponse_1_list) Len() int { +func (x *_QueryAllGatewaysResponse_1_list) Len() int { if x.list == nil { return 0 } return len(*x.list) } -func (x *_QueryAllGatewayResponse_1_list) Get(i int) protoreflect.Value { +func (x *_QueryAllGatewaysResponse_1_list) Get(i int) protoreflect.Value { return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) } -func (x *_QueryAllGatewayResponse_1_list) Set(i int, value protoreflect.Value) { +func (x *_QueryAllGatewaysResponse_1_list) Set(i int, value protoreflect.Value) { valueUnwrapped := value.Message() concreteValue := valueUnwrapped.Interface().(*Gateway) (*x.list)[i] = concreteValue } -func (x *_QueryAllGatewayResponse_1_list) Append(value protoreflect.Value) { +func (x *_QueryAllGatewaysResponse_1_list) Append(value protoreflect.Value) { valueUnwrapped := value.Message() concreteValue := valueUnwrapped.Interface().(*Gateway) *x.list = append(*x.list, concreteValue) } -func (x *_QueryAllGatewayResponse_1_list) AppendMutable() protoreflect.Value { +func (x *_QueryAllGatewaysResponse_1_list) AppendMutable() protoreflect.Value { v := new(Gateway) *x.list = append(*x.list, v) return protoreflect.ValueOfMessage(v.ProtoReflect()) } -func (x *_QueryAllGatewayResponse_1_list) Truncate(n int) { +func (x *_QueryAllGatewaysResponse_1_list) Truncate(n int) { for i := n; i < len(*x.list); i++ { (*x.list)[i] = nil } *x.list = (*x.list)[:n] } -func (x *_QueryAllGatewayResponse_1_list) NewElement() protoreflect.Value { +func (x *_QueryAllGatewaysResponse_1_list) NewElement() protoreflect.Value { v := new(Gateway) return protoreflect.ValueOfMessage(v.ProtoReflect()) } -func (x *_QueryAllGatewayResponse_1_list) IsValid() bool { +func (x *_QueryAllGatewaysResponse_1_list) IsValid() bool { return x.list != nil } var ( - md_QueryAllGatewayResponse protoreflect.MessageDescriptor - fd_QueryAllGatewayResponse_gateway protoreflect.FieldDescriptor - fd_QueryAllGatewayResponse_pagination protoreflect.FieldDescriptor + md_QueryAllGatewaysResponse protoreflect.MessageDescriptor + fd_QueryAllGatewaysResponse_gateways protoreflect.FieldDescriptor + fd_QueryAllGatewaysResponse_pagination protoreflect.FieldDescriptor ) func init() { file_poktroll_gateway_query_proto_init() - md_QueryAllGatewayResponse = File_poktroll_gateway_query_proto.Messages().ByName("QueryAllGatewayResponse") - fd_QueryAllGatewayResponse_gateway = md_QueryAllGatewayResponse.Fields().ByName("gateway") - fd_QueryAllGatewayResponse_pagination = md_QueryAllGatewayResponse.Fields().ByName("pagination") + md_QueryAllGatewaysResponse = File_poktroll_gateway_query_proto.Messages().ByName("QueryAllGatewaysResponse") + fd_QueryAllGatewaysResponse_gateways = md_QueryAllGatewaysResponse.Fields().ByName("gateways") + fd_QueryAllGatewaysResponse_pagination = md_QueryAllGatewaysResponse.Fields().ByName("pagination") } -var _ protoreflect.Message = (*fastReflection_QueryAllGatewayResponse)(nil) +var _ protoreflect.Message = (*fastReflection_QueryAllGatewaysResponse)(nil) -type fastReflection_QueryAllGatewayResponse QueryAllGatewayResponse +type fastReflection_QueryAllGatewaysResponse QueryAllGatewaysResponse -func (x *QueryAllGatewayResponse) ProtoReflect() protoreflect.Message { - return (*fastReflection_QueryAllGatewayResponse)(x) +func (x *QueryAllGatewaysResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryAllGatewaysResponse)(x) } -func (x *QueryAllGatewayResponse) slowProtoReflect() protoreflect.Message { +func (x *QueryAllGatewaysResponse) slowProtoReflect() protoreflect.Message { mi := &file_poktroll_gateway_query_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -2183,43 +2183,43 @@ func (x *QueryAllGatewayResponse) slowProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -var _fastReflection_QueryAllGatewayResponse_messageType fastReflection_QueryAllGatewayResponse_messageType -var _ protoreflect.MessageType = fastReflection_QueryAllGatewayResponse_messageType{} +var _fastReflection_QueryAllGatewaysResponse_messageType fastReflection_QueryAllGatewaysResponse_messageType +var _ protoreflect.MessageType = fastReflection_QueryAllGatewaysResponse_messageType{} -type fastReflection_QueryAllGatewayResponse_messageType struct{} +type fastReflection_QueryAllGatewaysResponse_messageType struct{} -func (x fastReflection_QueryAllGatewayResponse_messageType) Zero() protoreflect.Message { - return (*fastReflection_QueryAllGatewayResponse)(nil) +func (x fastReflection_QueryAllGatewaysResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryAllGatewaysResponse)(nil) } -func (x fastReflection_QueryAllGatewayResponse_messageType) New() protoreflect.Message { - return new(fastReflection_QueryAllGatewayResponse) +func (x fastReflection_QueryAllGatewaysResponse_messageType) New() protoreflect.Message { + return new(fastReflection_QueryAllGatewaysResponse) } -func (x fastReflection_QueryAllGatewayResponse_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_QueryAllGatewayResponse +func (x fastReflection_QueryAllGatewaysResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllGatewaysResponse } // Descriptor returns message descriptor, which contains only the protobuf // type information for the message. -func (x *fastReflection_QueryAllGatewayResponse) Descriptor() protoreflect.MessageDescriptor { - return md_QueryAllGatewayResponse +func (x *fastReflection_QueryAllGatewaysResponse) Descriptor() protoreflect.MessageDescriptor { + return md_QueryAllGatewaysResponse } // 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_QueryAllGatewayResponse) Type() protoreflect.MessageType { - return _fastReflection_QueryAllGatewayResponse_messageType +func (x *fastReflection_QueryAllGatewaysResponse) Type() protoreflect.MessageType { + return _fastReflection_QueryAllGatewaysResponse_messageType } // New returns a newly allocated and mutable empty message. -func (x *fastReflection_QueryAllGatewayResponse) New() protoreflect.Message { - return new(fastReflection_QueryAllGatewayResponse) +func (x *fastReflection_QueryAllGatewaysResponse) New() protoreflect.Message { + return new(fastReflection_QueryAllGatewaysResponse) } // Interface unwraps the message reflection interface and // returns the underlying ProtoMessage interface. -func (x *fastReflection_QueryAllGatewayResponse) Interface() protoreflect.ProtoMessage { - return (*QueryAllGatewayResponse)(x) +func (x *fastReflection_QueryAllGatewaysResponse) Interface() protoreflect.ProtoMessage { + return (*QueryAllGatewaysResponse)(x) } // Range iterates over every populated field in an undefined order, @@ -2227,16 +2227,16 @@ func (x *fastReflection_QueryAllGatewayResponse) Interface() protoreflect.ProtoM // Range returns immediately if f returns false. // While iterating, mutating operations may only be performed // on the current field descriptor. -func (x *fastReflection_QueryAllGatewayResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if len(x.Gateway) != 0 { - value := protoreflect.ValueOfList(&_QueryAllGatewayResponse_1_list{list: &x.Gateway}) - if !f(fd_QueryAllGatewayResponse_gateway, value) { +func (x *fastReflection_QueryAllGatewaysResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if len(x.Gateways) != 0 { + value := protoreflect.ValueOfList(&_QueryAllGatewaysResponse_1_list{list: &x.Gateways}) + if !f(fd_QueryAllGatewaysResponse_gateways, value) { return } } if x.Pagination != nil { value := protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) - if !f(fd_QueryAllGatewayResponse_pagination, value) { + if !f(fd_QueryAllGatewaysResponse_pagination, value) { return } } @@ -2253,17 +2253,17 @@ func (x *fastReflection_QueryAllGatewayResponse) Range(f func(protoreflect.Field // 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_QueryAllGatewayResponse) Has(fd protoreflect.FieldDescriptor) bool { +func (x *fastReflection_QueryAllGatewaysResponse) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "poktroll.gateway.QueryAllGatewayResponse.gateway": - return len(x.Gateway) != 0 - case "poktroll.gateway.QueryAllGatewayResponse.pagination": + case "poktroll.gateway.QueryAllGatewaysResponse.gateways": + return len(x.Gateways) != 0 + case "poktroll.gateway.QueryAllGatewaysResponse.pagination": return x.Pagination != nil default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewayResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewaysResponse")) } - panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewayResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewaysResponse does not contain field %s", fd.FullName())) } } @@ -2273,17 +2273,17 @@ func (x *fastReflection_QueryAllGatewayResponse) Has(fd protoreflect.FieldDescri // associated with the given field number. // // Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryAllGatewayResponse) Clear(fd protoreflect.FieldDescriptor) { +func (x *fastReflection_QueryAllGatewaysResponse) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "poktroll.gateway.QueryAllGatewayResponse.gateway": - x.Gateway = nil - case "poktroll.gateway.QueryAllGatewayResponse.pagination": + case "poktroll.gateway.QueryAllGatewaysResponse.gateways": + x.Gateways = nil + case "poktroll.gateway.QueryAllGatewaysResponse.pagination": x.Pagination = nil default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewayResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewaysResponse")) } - panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewayResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewaysResponse does not contain field %s", fd.FullName())) } } @@ -2293,22 +2293,22 @@ func (x *fastReflection_QueryAllGatewayResponse) Clear(fd protoreflect.FieldDesc // 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_QueryAllGatewayResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_QueryAllGatewaysResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "poktroll.gateway.QueryAllGatewayResponse.gateway": - if len(x.Gateway) == 0 { - return protoreflect.ValueOfList(&_QueryAllGatewayResponse_1_list{}) + case "poktroll.gateway.QueryAllGatewaysResponse.gateways": + if len(x.Gateways) == 0 { + return protoreflect.ValueOfList(&_QueryAllGatewaysResponse_1_list{}) } - listValue := &_QueryAllGatewayResponse_1_list{list: &x.Gateway} + listValue := &_QueryAllGatewaysResponse_1_list{list: &x.Gateways} return protoreflect.ValueOfList(listValue) - case "poktroll.gateway.QueryAllGatewayResponse.pagination": + case "poktroll.gateway.QueryAllGatewaysResponse.pagination": value := x.Pagination return protoreflect.ValueOfMessage(value.ProtoReflect()) default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewayResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewaysResponse")) } - panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewayResponse does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewaysResponse does not contain field %s", descriptor.FullName())) } } @@ -2322,19 +2322,19 @@ func (x *fastReflection_QueryAllGatewayResponse) Get(descriptor protoreflect.Fie // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryAllGatewayResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_QueryAllGatewaysResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "poktroll.gateway.QueryAllGatewayResponse.gateway": + case "poktroll.gateway.QueryAllGatewaysResponse.gateways": lv := value.List() - clv := lv.(*_QueryAllGatewayResponse_1_list) - x.Gateway = *clv.list - case "poktroll.gateway.QueryAllGatewayResponse.pagination": + clv := lv.(*_QueryAllGatewaysResponse_1_list) + x.Gateways = *clv.list + case "poktroll.gateway.QueryAllGatewaysResponse.pagination": x.Pagination = value.Message().Interface().(*v1beta1.PageResponse) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewayResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewaysResponse")) } - panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewayResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewaysResponse does not contain field %s", fd.FullName())) } } @@ -2348,53 +2348,53 @@ func (x *fastReflection_QueryAllGatewayResponse) Set(fd protoreflect.FieldDescri // It panics if the field does not contain a composite type. // // Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryAllGatewayResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_QueryAllGatewaysResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "poktroll.gateway.QueryAllGatewayResponse.gateway": - if x.Gateway == nil { - x.Gateway = []*Gateway{} + case "poktroll.gateway.QueryAllGatewaysResponse.gateways": + if x.Gateways == nil { + x.Gateways = []*Gateway{} } - value := &_QueryAllGatewayResponse_1_list{list: &x.Gateway} + value := &_QueryAllGatewaysResponse_1_list{list: &x.Gateways} return protoreflect.ValueOfList(value) - case "poktroll.gateway.QueryAllGatewayResponse.pagination": + case "poktroll.gateway.QueryAllGatewaysResponse.pagination": if x.Pagination == nil { x.Pagination = new(v1beta1.PageResponse) } return protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewayResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewaysResponse")) } - panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewayResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewaysResponse 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_QueryAllGatewayResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_QueryAllGatewaysResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "poktroll.gateway.QueryAllGatewayResponse.gateway": + case "poktroll.gateway.QueryAllGatewaysResponse.gateways": list := []*Gateway{} - return protoreflect.ValueOfList(&_QueryAllGatewayResponse_1_list{list: &list}) - case "poktroll.gateway.QueryAllGatewayResponse.pagination": + return protoreflect.ValueOfList(&_QueryAllGatewaysResponse_1_list{list: &list}) + case "poktroll.gateway.QueryAllGatewaysResponse.pagination": m := new(v1beta1.PageResponse) return protoreflect.ValueOfMessage(m.ProtoReflect()) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewayResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: poktroll.gateway.QueryAllGatewaysResponse")) } - panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewayResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message poktroll.gateway.QueryAllGatewaysResponse 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_QueryAllGatewayResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { +func (x *fastReflection_QueryAllGatewaysResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in poktroll.gateway.QueryAllGatewayResponse", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in poktroll.gateway.QueryAllGatewaysResponse", d.FullName())) } panic("unreachable") } @@ -2402,7 +2402,7 @@ func (x *fastReflection_QueryAllGatewayResponse) WhichOneof(d protoreflect.Oneof // 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_QueryAllGatewayResponse) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_QueryAllGatewaysResponse) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -2413,7 +2413,7 @@ func (x *fastReflection_QueryAllGatewayResponse) GetUnknown() protoreflect.RawFi // An empty RawFields may be passed to clear the fields. // // SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_QueryAllGatewayResponse) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_QueryAllGatewaysResponse) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -2425,7 +2425,7 @@ func (x *fastReflection_QueryAllGatewayResponse) SetUnknown(fields protoreflect. // 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_QueryAllGatewayResponse) IsValid() bool { +func (x *fastReflection_QueryAllGatewaysResponse) IsValid() bool { return x != nil } @@ -2435,9 +2435,9 @@ func (x *fastReflection_QueryAllGatewayResponse) IsValid() bool { // The returned methods type is identical to // "google.golang.org/protobuf/runtime/protoiface".Methods. // Consult the protoiface package documentation for details. -func (x *fastReflection_QueryAllGatewayResponse) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_QueryAllGatewaysResponse) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*QueryAllGatewayResponse) + x := input.Message.Interface().(*QueryAllGatewaysResponse) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2449,8 +2449,8 @@ func (x *fastReflection_QueryAllGatewayResponse) ProtoMethods() *protoiface.Meth var n int var l int _ = l - if len(x.Gateway) > 0 { - for _, e := range x.Gateway { + if len(x.Gateways) > 0 { + for _, e := range x.Gateways { l = options.Size(e) n += 1 + l + runtime.Sov(uint64(l)) } @@ -2469,7 +2469,7 @@ func (x *fastReflection_QueryAllGatewayResponse) ProtoMethods() *protoiface.Meth } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*QueryAllGatewayResponse) + x := input.Message.Interface().(*QueryAllGatewaysResponse) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2502,9 +2502,9 @@ func (x *fastReflection_QueryAllGatewayResponse) ProtoMethods() *protoiface.Meth i-- dAtA[i] = 0x12 } - if len(x.Gateway) > 0 { - for iNdEx := len(x.Gateway) - 1; iNdEx >= 0; iNdEx-- { - encoded, err := options.Marshal(x.Gateway[iNdEx]) + if len(x.Gateways) > 0 { + for iNdEx := len(x.Gateways) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.Gateways[iNdEx]) if err != nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2529,7 +2529,7 @@ func (x *fastReflection_QueryAllGatewayResponse) ProtoMethods() *protoiface.Meth }, nil } unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*QueryAllGatewayResponse) + x := input.Message.Interface().(*QueryAllGatewaysResponse) if x == nil { return protoiface.UnmarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2561,15 +2561,15 @@ func (x *fastReflection_QueryAllGatewayResponse) ProtoMethods() *protoiface.Meth fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllGatewayResponse: wiretype end group for non-group") + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllGatewaysResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllGatewayResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryAllGatewaysResponse: 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 Gateway", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Gateways", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2596,8 +2596,8 @@ func (x *fastReflection_QueryAllGatewayResponse) ProtoMethods() *protoiface.Meth if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.Gateway = append(x.Gateway, &Gateway{}) - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Gateway[len(x.Gateway)-1]); err != nil { + x.Gateways = append(x.Gateways, &Gateway{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Gateways[len(x.Gateways)-1]); err != nil { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err } iNdEx = postIndex @@ -2819,7 +2819,7 @@ func (x *QueryGetGatewayResponse) GetGateway() *Gateway { return nil } -type QueryAllGatewayRequest struct { +type QueryAllGatewaysRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -2827,8 +2827,8 @@ type QueryAllGatewayRequest struct { Pagination *v1beta1.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (x *QueryAllGatewayRequest) Reset() { - *x = QueryAllGatewayRequest{} +func (x *QueryAllGatewaysRequest) Reset() { + *x = QueryAllGatewaysRequest{} if protoimpl.UnsafeEnabled { mi := &file_poktroll_gateway_query_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -2836,35 +2836,35 @@ func (x *QueryAllGatewayRequest) Reset() { } } -func (x *QueryAllGatewayRequest) String() string { +func (x *QueryAllGatewaysRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*QueryAllGatewayRequest) ProtoMessage() {} +func (*QueryAllGatewaysRequest) ProtoMessage() {} -// Deprecated: Use QueryAllGatewayRequest.ProtoReflect.Descriptor instead. -func (*QueryAllGatewayRequest) Descriptor() ([]byte, []int) { +// Deprecated: Use QueryAllGatewaysRequest.ProtoReflect.Descriptor instead. +func (*QueryAllGatewaysRequest) Descriptor() ([]byte, []int) { return file_poktroll_gateway_query_proto_rawDescGZIP(), []int{4} } -func (x *QueryAllGatewayRequest) GetPagination() *v1beta1.PageRequest { +func (x *QueryAllGatewaysRequest) GetPagination() *v1beta1.PageRequest { if x != nil { return x.Pagination } return nil } -type QueryAllGatewayResponse struct { +type QueryAllGatewaysResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Gateway []*Gateway `protobuf:"bytes,1,rep,name=gateway,proto3" json:"gateway,omitempty"` + Gateways []*Gateway `protobuf:"bytes,1,rep,name=gateways,proto3" json:"gateways,omitempty"` Pagination *v1beta1.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } -func (x *QueryAllGatewayResponse) Reset() { - *x = QueryAllGatewayResponse{} +func (x *QueryAllGatewaysResponse) Reset() { + *x = QueryAllGatewaysResponse{} if protoimpl.UnsafeEnabled { mi := &file_poktroll_gateway_query_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -2872,25 +2872,25 @@ func (x *QueryAllGatewayResponse) Reset() { } } -func (x *QueryAllGatewayResponse) String() string { +func (x *QueryAllGatewaysResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*QueryAllGatewayResponse) ProtoMessage() {} +func (*QueryAllGatewaysResponse) ProtoMessage() {} -// Deprecated: Use QueryAllGatewayResponse.ProtoReflect.Descriptor instead. -func (*QueryAllGatewayResponse) Descriptor() ([]byte, []int) { +// Deprecated: Use QueryAllGatewaysResponse.ProtoReflect.Descriptor instead. +func (*QueryAllGatewaysResponse) Descriptor() ([]byte, []int) { return file_poktroll_gateway_query_proto_rawDescGZIP(), []int{5} } -func (x *QueryAllGatewayResponse) GetGateway() []*Gateway { +func (x *QueryAllGatewaysResponse) GetGateways() []*Gateway { if x != nil { - return x.Gateway + return x.Gateways } return nil } -func (x *QueryAllGatewayResponse) GetPagination() *v1beta1.PageResponse { +func (x *QueryAllGatewaysResponse) GetPagination() *v1beta1.PageResponse { if x != nil { return x.Pagination } @@ -2911,13 +2911,13 @@ var file_poktroll_gateway_query_proto_rawDesc = []byte{ 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x70, 0x61, - 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, + 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 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, 0x1d, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, - 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, - 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x14, 0x0a, + 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x14, 0x0a, 0x12, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x52, 0x0a, 0x13, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x06, 0x70, 0x61, @@ -2933,62 +2933,62 @@ var file_poktroll_gateway_query_proto_rawDesc = []byte{ 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x07, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, - 0x79, 0x22, 0x60, 0x0a, 0x16, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x47, 0x61, 0x74, - 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x46, 0x0a, 0x0a, 0x70, - 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x26, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, - 0x65, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x22, 0x9d, 0x01, 0x0a, 0x17, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, - 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x39, 0x0a, 0x07, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, - 0x77, 0x61, 0x79, 0x2e, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, 0x04, 0xc8, 0xde, 0x1f, - 0x00, 0x52, 0x07, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x47, 0x0a, 0x0a, 0x70, 0x61, - 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, - 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, - 0x72, 0x79, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x32, 0xbd, 0x03, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x84, 0x01, - 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x24, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, - 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, + 0x79, 0x22, 0x61, 0x0a, 0x17, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x47, 0x61, 0x74, + 0x65, 0x77, 0x61, 0x79, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x46, 0x0a, 0x0a, + 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x26, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, + 0x75, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, + 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xa0, 0x01, 0x0a, 0x18, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, + 0x6c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x3b, 0x0a, 0x08, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x73, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, + 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, 0x04, + 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x08, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x73, 0x12, 0x47, + 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, + 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, + 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x0a, 0x70, 0x61, 0x67, + 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x32, 0xc0, 0x03, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x12, 0x84, 0x01, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x24, 0x2e, 0x70, + 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, + 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, + 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2d, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x27, 0x12, 0x25, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, + 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, + 0x79, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x98, 0x01, 0x0a, 0x07, 0x47, 0x61, 0x74, + 0x65, 0x77, 0x61, 0x79, 0x12, 0x28, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, + 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, + 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, - 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x12, 0x25, 0x2f, - 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x70, 0x61, - 0x72, 0x61, 0x6d, 0x73, 0x12, 0x98, 0x01, 0x0a, 0x07, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, - 0x12, 0x28, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, - 0x77, 0x61, 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x47, 0x61, 0x74, 0x65, - 0x77, 0x61, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x70, 0x6f, 0x6b, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x51, 0x75, - 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x38, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x32, 0x12, 0x30, 0x2f, - 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x67, 0x61, - 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x7b, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x7d, 0x12, - 0x91, 0x01, 0x0a, 0x0a, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x41, 0x6c, 0x6c, 0x12, 0x28, + 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x47, 0x65, 0x74, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, + 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x38, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x32, 0x12, 0x30, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, + 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, + 0x79, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x7b, 0x61, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x7d, 0x12, 0x94, 0x01, 0x0a, 0x0b, 0x41, 0x6c, 0x6c, 0x47, 0x61, 0x74, 0x65, 0x77, + 0x61, 0x79, 0x73, 0x12, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, + 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x47, + 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x6c, 0x6c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, - 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x51, 0x75, 0x65, 0x72, - 0x79, 0x41, 0x6c, 0x6c, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x2e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x28, 0x12, 0x26, 0x2f, 0x70, 0x6f, - 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x67, 0x61, 0x74, 0x65, - 0x77, 0x61, 0x79, 0x42, 0xa6, 0x01, 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, - 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, 0x0a, 0x51, 0x75, - 0x65, 0x72, 0x79, 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, + 0x79, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2e, 0x82, 0xd3, 0xe4, 0x93, + 0x02, 0x28, 0x12, 0x26, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, + 0x6b, 0x2f, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, + 0x61, 0x79, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x42, 0xa6, 0x01, 0x0a, 0x14, 0x63, + 0x6f, 0x6d, 0x2e, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2e, 0x67, 0x61, 0x74, 0x65, + 0x77, 0x61, 0x79, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 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 ( @@ -3005,29 +3005,29 @@ func file_poktroll_gateway_query_proto_rawDescGZIP() []byte { var file_poktroll_gateway_query_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_poktroll_gateway_query_proto_goTypes = []interface{}{ - (*QueryParamsRequest)(nil), // 0: poktroll.gateway.QueryParamsRequest - (*QueryParamsResponse)(nil), // 1: poktroll.gateway.QueryParamsResponse - (*QueryGetGatewayRequest)(nil), // 2: poktroll.gateway.QueryGetGatewayRequest - (*QueryGetGatewayResponse)(nil), // 3: poktroll.gateway.QueryGetGatewayResponse - (*QueryAllGatewayRequest)(nil), // 4: poktroll.gateway.QueryAllGatewayRequest - (*QueryAllGatewayResponse)(nil), // 5: poktroll.gateway.QueryAllGatewayResponse - (*Params)(nil), // 6: poktroll.gateway.Params - (*Gateway)(nil), // 7: poktroll.gateway.Gateway - (*v1beta1.PageRequest)(nil), // 8: cosmos.base.query.v1beta1.PageRequest - (*v1beta1.PageResponse)(nil), // 9: cosmos.base.query.v1beta1.PageResponse + (*QueryParamsRequest)(nil), // 0: poktroll.gateway.QueryParamsRequest + (*QueryParamsResponse)(nil), // 1: poktroll.gateway.QueryParamsResponse + (*QueryGetGatewayRequest)(nil), // 2: poktroll.gateway.QueryGetGatewayRequest + (*QueryGetGatewayResponse)(nil), // 3: poktroll.gateway.QueryGetGatewayResponse + (*QueryAllGatewaysRequest)(nil), // 4: poktroll.gateway.QueryAllGatewaysRequest + (*QueryAllGatewaysResponse)(nil), // 5: poktroll.gateway.QueryAllGatewaysResponse + (*Params)(nil), // 6: poktroll.gateway.Params + (*Gateway)(nil), // 7: poktroll.gateway.Gateway + (*v1beta1.PageRequest)(nil), // 8: cosmos.base.query.v1beta1.PageRequest + (*v1beta1.PageResponse)(nil), // 9: cosmos.base.query.v1beta1.PageResponse } var file_poktroll_gateway_query_proto_depIdxs = []int32{ 6, // 0: poktroll.gateway.QueryParamsResponse.params:type_name -> poktroll.gateway.Params 7, // 1: poktroll.gateway.QueryGetGatewayResponse.gateway:type_name -> poktroll.gateway.Gateway - 8, // 2: poktroll.gateway.QueryAllGatewayRequest.pagination:type_name -> cosmos.base.query.v1beta1.PageRequest - 7, // 3: poktroll.gateway.QueryAllGatewayResponse.gateway:type_name -> poktroll.gateway.Gateway - 9, // 4: poktroll.gateway.QueryAllGatewayResponse.pagination:type_name -> cosmos.base.query.v1beta1.PageResponse + 8, // 2: poktroll.gateway.QueryAllGatewaysRequest.pagination:type_name -> cosmos.base.query.v1beta1.PageRequest + 7, // 3: poktroll.gateway.QueryAllGatewaysResponse.gateways:type_name -> poktroll.gateway.Gateway + 9, // 4: poktroll.gateway.QueryAllGatewaysResponse.pagination:type_name -> cosmos.base.query.v1beta1.PageResponse 0, // 5: poktroll.gateway.Query.Params:input_type -> poktroll.gateway.QueryParamsRequest 2, // 6: poktroll.gateway.Query.Gateway:input_type -> poktroll.gateway.QueryGetGatewayRequest - 4, // 7: poktroll.gateway.Query.GatewayAll:input_type -> poktroll.gateway.QueryAllGatewayRequest + 4, // 7: poktroll.gateway.Query.AllGateways:input_type -> poktroll.gateway.QueryAllGatewaysRequest 1, // 8: poktroll.gateway.Query.Params:output_type -> poktroll.gateway.QueryParamsResponse 3, // 9: poktroll.gateway.Query.Gateway:output_type -> poktroll.gateway.QueryGetGatewayResponse - 5, // 10: poktroll.gateway.Query.GatewayAll:output_type -> poktroll.gateway.QueryAllGatewayResponse + 5, // 10: poktroll.gateway.Query.AllGateways:output_type -> poktroll.gateway.QueryAllGatewaysResponse 8, // [8:11] is the sub-list for method output_type 5, // [5:8] is the sub-list for method input_type 5, // [5:5] is the sub-list for extension type_name @@ -3092,7 +3092,7 @@ func file_poktroll_gateway_query_proto_init() { } } file_poktroll_gateway_query_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryAllGatewayRequest); i { + switch v := v.(*QueryAllGatewaysRequest); i { case 0: return &v.state case 1: @@ -3104,7 +3104,7 @@ func file_poktroll_gateway_query_proto_init() { } } file_poktroll_gateway_query_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryAllGatewayResponse); i { + switch v := v.(*QueryAllGatewaysResponse); i { case 0: return &v.state case 1: diff --git a/api/poktroll/gateway/tx.pulsar.go b/api/poktroll/gateway/tx.pulsar.go index 0c3dff1c9..0a23aed5c 100644 --- a/api/poktroll/gateway/tx.pulsar.go +++ b/api/poktroll/gateway/tx.pulsar.go @@ -2524,6 +2524,7 @@ type MsgUpdateParams struct { // authority is the address that controls the module (defaults to x/gov unless overwritten). Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the x/gateway parameters to update. // NOTE: All parameters must be supplied. Params *Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty"` } @@ -2731,11 +2732,11 @@ var file_poktroll_gateway_tx_proto_rawDesc = []byte{ 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, - 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x70, 0x6f, 0x6b, 0x74, + 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, + 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x70, 0x6f, 0x6b, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2f, 0x70, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, - 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbd, 0x01, 0x0a, 0x0f, 0x4d, 0x73, + 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbd, 0x01, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 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, diff --git a/proto/poktroll/gateway/gateway.proto b/proto/poktroll/gateway/gateway.proto index ff6798ba7..498938b92 100644 --- a/proto/poktroll/gateway/gateway.proto +++ b/proto/poktroll/gateway/gateway.proto @@ -2,8 +2,8 @@ syntax = "proto3"; package poktroll.gateway; option go_package = "github.com/pokt-network/poktroll/x/gateway/types"; + import "cosmos_proto/cosmos.proto"; -import "gogoproto/gogo.proto"; import "cosmos/base/v1beta1/coin.proto"; message Gateway { diff --git a/proto/poktroll/gateway/genesis.proto b/proto/poktroll/gateway/genesis.proto index 728d04961..f3158785f 100644 --- a/proto/poktroll/gateway/genesis.proto +++ b/proto/poktroll/gateway/genesis.proto @@ -1,18 +1,18 @@ syntax = "proto3"; - package poktroll.gateway; +option go_package = "github.com/pokt-network/poktroll/x/gateway/types"; + import "amino/amino.proto"; import "gogoproto/gogo.proto"; + import "poktroll/gateway/params.proto"; import "poktroll/gateway/gateway.proto"; -option go_package = "github.com/pokt-network/poktroll/x/gateway/types"; - // GenesisState defines the gateway module's genesis state. message GenesisState { // params defines all the parameters of the module. - Params params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + Params params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; repeated Gateway gateway_list = 2 [(gogoproto.nullable) = false] ; } diff --git a/proto/poktroll/gateway/params.proto b/proto/poktroll/gateway/params.proto index bb7a65110..8ec48a41b 100644 --- a/proto/poktroll/gateway/params.proto +++ b/proto/poktroll/gateway/params.proto @@ -1,14 +1,13 @@ syntax = "proto3"; package poktroll.gateway; +option go_package = "github.com/pokt-network/poktroll/x/gateway/types"; + import "amino/amino.proto"; import "gogoproto/gogo.proto"; -option go_package = "github.com/pokt-network/poktroll/x/gateway/types"; - // Params defines the parameters for the module. message Params { option (amino.name) = "poktroll/x/gateway/Params"; option (gogoproto.equal) = true; - } \ No newline at end of file diff --git a/proto/poktroll/gateway/query.proto b/proto/poktroll/gateway/query.proto index 6e000cf4f..100070c53 100644 --- a/proto/poktroll/gateway/query.proto +++ b/proto/poktroll/gateway/query.proto @@ -1,17 +1,17 @@ syntax = "proto3"; - package poktroll.gateway; +option go_package = "github.com/pokt-network/poktroll/x/gateway/types"; + import "amino/amino.proto"; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; -import "poktroll/gateway/params.proto"; -import "poktroll/gateway/gateway.proto"; import "cosmos/base/v1beta1/coin.proto"; -option go_package = "github.com/pokt-network/poktroll/x/gateway/types"; +import "poktroll/gateway/params.proto"; +import "poktroll/gateway/gateway.proto"; // Query defines the gRPC querier service. service Query { @@ -27,7 +27,7 @@ service Query { option (google.api.http).get = "/pokt-network/poktroll/gateway/gateway/{address}"; } - rpc GatewayAll (QueryAllGatewayRequest) returns (QueryAllGatewayResponse) { + rpc AllGateways (QueryAllGatewaysRequest) returns (QueryAllGatewaysResponse) { option (google.api.http).get = "/pokt-network/poktroll/gateway/gateway"; } @@ -50,12 +50,12 @@ message QueryGetGatewayResponse { Gateway gateway = 1 [(gogoproto.nullable) = false]; } -message QueryAllGatewayRequest { +message QueryAllGatewaysRequest { cosmos.base.query.v1beta1.PageRequest pagination = 1; } -message QueryAllGatewayResponse { - repeated Gateway gateway = 1 [(gogoproto.nullable) = false]; - cosmos.base.query.v1beta1.PageResponse pagination = 2; +message QueryAllGatewaysResponse { + repeated Gateway gateways = 1 [(gogoproto.nullable) = false]; + cosmos.base.query.v1beta1.PageResponse pagination = 2; } diff --git a/proto/poktroll/gateway/tx.proto b/proto/poktroll/gateway/tx.proto index 0d7312952..194a9d27d 100644 --- a/proto/poktroll/gateway/tx.proto +++ b/proto/poktroll/gateway/tx.proto @@ -1,15 +1,15 @@ syntax = "proto3"; - package poktroll.gateway; +option go_package = "github.com/pokt-network/poktroll/x/gateway/types"; + import "amino/amino.proto"; import "cosmos/msg/v1/msg.proto"; import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; -import "poktroll/gateway/params.proto"; import "cosmos/base/v1beta1/coin.proto"; -option go_package = "github.com/pokt-network/poktroll/x/gateway/types"; +import "poktroll/gateway/params.proto"; // Msg defines the Msg service. service Msg { @@ -23,14 +23,17 @@ service Msg { } // 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"]; - // params defines the module parameters to update. + // 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]; } @@ -40,7 +43,7 @@ message MsgUpdateParams { message MsgUpdateParamsResponse {} message MsgStakeGateway { - option (cosmos.msg.v1.signer) = "address"; + 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) } diff --git a/testutil/keeper/gateway.go b/testutil/keeper/gateway.go index 906a742dd..e7176e11a 100644 --- a/testutil/keeper/gateway.go +++ b/testutil/keeper/gateway.go @@ -1,6 +1,7 @@ package keeper import ( + "context" "testing" "cosmossdk.io/log" @@ -23,7 +24,8 @@ import ( "github.com/pokt-network/poktroll/x/gateway/types" ) -func GatewayKeeper(t testing.TB) (keeper.Keeper, sdk.Context) { +func GatewayKeeper(t testing.TB) (keeper.Keeper, context.Context) { + t.Helper() storeKey := storetypes.NewKVStoreKey(types.StoreKey) db := dbm.NewMemDB() @@ -51,7 +53,7 @@ func GatewayKeeper(t testing.TB) (keeper.Keeper, sdk.Context) { ctx := sdk.NewContext(stateStore, cmtproto.Header{}, false, log.NewNopLogger()) // Initialize params - k.SetParams(ctx, types.DefaultParams()) + require.NoError(t, k.SetParams(ctx, types.DefaultParams())) return k, ctx } diff --git a/x/gateway/keeper/gateway.go b/x/gateway/keeper/gateway.go index a1b8ea56d..eefe312de 100644 --- a/x/gateway/keeper/gateway.go +++ b/x/gateway/keeper/gateway.go @@ -14,30 +14,29 @@ import ( func (k Keeper) SetGateway(ctx context.Context, gateway types.Gateway) { storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.GatewayKeyPrefix)) - b := k.cdc.MustMarshal(&gateway) + gatewayBz := k.cdc.MustMarshal(&gateway) store.Set(types.GatewayKey( gateway.Address, - ), b) + ), gatewayBz) } // GetGateway returns a gateway from its index func (k Keeper) GetGateway( ctx context.Context, address string, - -) (val types.Gateway, found bool) { +) (gateway types.Gateway, found bool) { storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.GatewayKeyPrefix)) - b := store.Get(types.GatewayKey( + gatewayBz := store.Get(types.GatewayKey( address, )) - if b == nil { - return val, false + if gatewayBz == nil { + return gateway, false } - k.cdc.MustUnmarshal(b, &val) - return val, true + k.cdc.MustUnmarshal(gatewayBz, &gateway) + return gateway, true } // RemoveGateway removes a gateway from the store @@ -48,13 +47,11 @@ func (k Keeper) RemoveGateway( ) { storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.GatewayKeyPrefix)) - store.Delete(types.GatewayKey( - address, - )) + store.Delete(types.GatewayKey(address)) } -// GetAllGateway returns all gateway -func (k Keeper) GetAllGateway(ctx context.Context) (list []types.Gateway) { +// GetAllGateways returns all gateway +func (k Keeper) GetAllGateways(ctx context.Context) (gateways []types.Gateway) { storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.GatewayKeyPrefix)) iterator := storetypes.KVStorePrefixIterator(store, []byte{}) @@ -62,9 +59,9 @@ func (k Keeper) GetAllGateway(ctx context.Context) (list []types.Gateway) { defer iterator.Close() for ; iterator.Valid(); iterator.Next() { - var val types.Gateway - k.cdc.MustUnmarshal(iterator.Value(), &val) - list = append(list, val) + var gateway types.Gateway + k.cdc.MustUnmarshal(iterator.Value(), &gateway) + gateways = append(gateways, gateway) } return diff --git a/x/gateway/keeper/gateway_test.go b/x/gateway/keeper/gateway_test.go index 0e77c232e..58d74e7fd 100644 --- a/x/gateway/keeper/gateway_test.go +++ b/x/gateway/keeper/gateway_test.go @@ -22,14 +22,14 @@ func init() { cmd.InitSDKConfig() } -func createNGateway(keeper keeper.Keeper, ctx context.Context, n int) []types.Gateway { - items := make([]types.Gateway, n) - for i := range items { - items[i].Address = strconv.Itoa(i) +func createNGateways(keeper keeper.Keeper, ctx context.Context, n int) []types.Gateway { + gateway := make([]types.Gateway, n) + for i := range gateway { + gateway[i].Address = strconv.Itoa(i) - keeper.SetGateway(ctx, items[i]) + keeper.SetGateway(ctx, gateway[i]) } - return items + return gateway } func TestGatewayModuleAddress(t *testing.T) { @@ -39,37 +39,37 @@ func TestGatewayModuleAddress(t *testing.T) { func TestGatewayGet(t *testing.T) { keeper, ctx := keepertest.GatewayKeeper(t) - items := createNGateway(keeper, ctx, 10) - for _, item := range items { - rst, found := keeper.GetGateway(ctx, - item.Address, + gateways := createNGateways(keeper, ctx, 10) + for _, gateway := range gateways { + foundGateway, found := keeper.GetGateway(ctx, + gateway.Address, ) require.True(t, found) require.Equal(t, - nullify.Fill(&item), - nullify.Fill(&rst), + nullify.Fill(&gateway), + nullify.Fill(&foundGateway), ) } } func TestGatewayRemove(t *testing.T) { keeper, ctx := keepertest.GatewayKeeper(t) - items := createNGateway(keeper, ctx, 10) - for _, item := range items { + gateways := createNGateways(keeper, ctx, 10) + for _, gateway := range gateways { keeper.RemoveGateway(ctx, - item.Address, + gateway.Address, ) _, found := keeper.GetGateway(ctx, - item.Address, + gateway.Address, ) require.False(t, found) } } -func TestGatewayGetAll(t *testing.T) { +func TestGatewaysGetAll(t *testing.T) { keeper, ctx := keepertest.GatewayKeeper(t) - items := createNGateway(keeper, ctx, 10) + gateways := createNGateways(keeper, ctx, 10) require.ElementsMatch(t, - nullify.Fill(items), - nullify.Fill(keeper.GetAllGateway(ctx)), + nullify.Fill(gateways), + nullify.Fill(keeper.GetAllGateways(ctx)), ) } diff --git a/x/gateway/keeper/msg_server.go b/x/gateway/keeper/msg_server.go index fafeff27b..4ee089512 100644 --- a/x/gateway/keeper/msg_server.go +++ b/x/gateway/keeper/msg_server.go @@ -1,8 +1,6 @@ package keeper -import ( - "github.com/pokt-network/poktroll/x/gateway/types" -) +import "github.com/pokt-network/poktroll/x/gateway/types" type msgServer struct { Keeper diff --git a/x/gateway/keeper/msg_server_stake_gateway.go b/x/gateway/keeper/msg_server_stake_gateway.go index 1a08d0049..9f257a98f 100644 --- a/x/gateway/keeper/msg_server_stake_gateway.go +++ b/x/gateway/keeper/msg_server_stake_gateway.go @@ -4,7 +4,6 @@ import ( "context" "fmt" - sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/pokt-network/poktroll/x/gateway/types" @@ -37,12 +36,16 @@ func (k msgServer) StakeGateway( if err = k.updateGateway(ctx, &gateway, msg); err != nil { return nil, err } - coinsToDelegate = (*msg.Stake).Sub(currGatewayStake) + coinsToDelegate, err = (*msg.Stake).SafeSub(currGatewayStake) + if err != nil { + return nil, err + } } // 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 %s", msg.Address)) return nil, err } @@ -50,6 +53,7 @@ func (k msgServer) StakeGateway( // Send the coins from the gateway to the staked gateway pool err = k.bankKeeper.DelegateCoinsFromAccountToModule(ctx, gatewayAddress, types.ModuleName, []sdk.Coin{coinsToDelegate}) if err != nil { + // TODO_TECHDEBT(#384): determine whether to continue using cosmos logger for debug level. logger.Error(fmt.Sprintf("could not send %v coins from %s to %s module account due to %v", coinsToDelegate, gatewayAddress, types.ModuleName, err)) return nil, err } @@ -78,13 +82,13 @@ func (k msgServer) updateGateway( ) error { // Checks if the the msg address is the same as the current owner if msg.Address != gateway.Address { - return sdkerrors.Wrapf(types.ErrGatewayUnauthorized, "msg Address (%s) != gateway address (%s)", msg.Address, gateway.Address) + return types.ErrGatewayUnauthorized.Wrapf("msg Address (%s) != gateway address (%s)", msg.Address, gateway.Address) } if msg.Stake == nil { - return sdkerrors.Wrapf(types.ErrGatewayInvalidStake, "stake amount cannot be nil") + return types.ErrGatewayInvalidStake.Wrapf("stake amount cannot be nil") } if msg.Stake.IsLTE(*gateway.Stake) { - return sdkerrors.Wrapf(types.ErrGatewayInvalidStake, "stake amount %v must be higher than previous stake amount %v", msg.Stake, gateway.Stake) + return types.ErrGatewayInvalidStake.Wrapf("stake amount %v must be higher than previous stake amount %v", msg.Stake, gateway.Stake) } gateway.Stake = msg.Stake return nil diff --git a/x/gateway/keeper/msg_server_stake_gateway_test.go b/x/gateway/keeper/msg_server_stake_gateway_test.go index 113304ee9..9645c1a0a 100644 --- a/x/gateway/keeper/msg_server_stake_gateway_test.go +++ b/x/gateway/keeper/msg_server_stake_gateway_test.go @@ -3,7 +3,7 @@ package keeper_test import ( "testing" - sdkmath "cosmossdk.io/math" + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" @@ -25,7 +25,7 @@ func TestMsgServer_StakeGateway_SuccessfulCreateAndUpdate(t *testing.T) { require.False(t, isGatewayFound) // Prepare the gateway - initialStake := sdk.NewCoin("upokt", sdkmath.NewInt(100)) + initialStake := sdk.NewCoin("upokt", math.NewInt(100)) stakeMsg := &types.MsgStakeGateway{ Address: addr, Stake: &initialStake, @@ -42,7 +42,7 @@ 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", sdkmath.NewInt(200)) + updatedStake := sdk.NewCoin("upokt", math.NewInt(200)) updateMsg := &types.MsgStakeGateway{ Address: addr, Stake: &updatedStake, @@ -62,7 +62,7 @@ func TestMsgServer_StakeGateway_FailLoweringStake(t *testing.T) { // Prepare the gateway addr := sample.AccAddress() - initialStake := sdk.NewCoin("upokt", sdkmath.NewInt(100)) + initialStake := sdk.NewCoin("upokt", math.NewInt(100)) stakeMsg := &types.MsgStakeGateway{ Address: addr, Stake: &initialStake, @@ -75,7 +75,7 @@ func TestMsgServer_StakeGateway_FailLoweringStake(t *testing.T) { require.True(t, isGatewayFound) // Prepare an updated gateway with a lower stake - updatedStake := sdk.NewCoin("upokt", sdkmath.NewInt(50)) + updatedStake := sdk.NewCoin("upokt", math.NewInt(50)) updateMsg := &types.MsgStakeGateway{ Address: addr, Stake: &updatedStake, diff --git a/x/gateway/keeper/msg_server_test.go b/x/gateway/keeper/msg_server_test.go index 64fa7a9d3..c754e676a 100644 --- a/x/gateway/keeper/msg_server_test.go +++ b/x/gateway/keeper/msg_server_test.go @@ -12,11 +12,15 @@ import ( ) func setupMsgServer(t testing.TB) (keeper.Keeper, types.MsgServer, context.Context) { + t.Helper() + k, ctx := keepertest.GatewayKeeper(t) return k, keeper.NewMsgServerImpl(k), ctx } func TestMsgServer(t *testing.T) { + t.Helper() + k, ms, ctx := setupMsgServer(t) require.NotNil(t, ms) require.NotNil(t, ctx) diff --git a/x/gateway/keeper/msg_server_unstake_gateway_test.go b/x/gateway/keeper/msg_server_unstake_gateway_test.go index 8f1dcf351..4c977ef3c 100644 --- a/x/gateway/keeper/msg_server_unstake_gateway_test.go +++ b/x/gateway/keeper/msg_server_unstake_gateway_test.go @@ -3,7 +3,7 @@ package keeper_test import ( "testing" - sdkmath "cosmossdk.io/math" + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" @@ -25,7 +25,7 @@ func TestMsgServer_UnstakeGateway_Success(t *testing.T) { require.False(t, isGatewayFound) // Prepare the gateway - initialStake := sdk.NewCoin("upokt", sdkmath.NewInt(100)) + initialStake := sdk.NewCoin("upokt", math.NewInt(100)) stakeMsg := &types.MsgStakeGateway{ Address: addr, Stake: &initialStake, diff --git a/x/gateway/keeper/msg_update_params.go b/x/gateway/keeper/msg_update_params.go index abfd5938d..029af5719 100644 --- a/x/gateway/keeper/msg_update_params.go +++ b/x/gateway/keeper/msg_update_params.go @@ -3,7 +3,6 @@ package keeper import ( "context" - errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/pokt-network/poktroll/x/gateway/types" @@ -14,10 +13,11 @@ func (k msgServer) UpdateParams( req *types.MsgUpdateParams, ) (*types.MsgUpdateParamsResponse, error) { if k.GetAuthority() != req.Authority { - return nil, errorsmod.Wrapf(types.ErrGatewayInvalidSigner, "invalid authority; expected %s, got %s", k.GetAuthority(), req.Authority) + return nil, types.ErrGatewayInvalidSigner.Wrapf("invalid authority; expected %s, got %s", k.GetAuthority(), req.Authority) } ctx := sdk.UnwrapSDKContext(goCtx) + // NOTE(#322): Omitted parameters will be set to their zero value. if err := k.SetParams(ctx, req.Params); err != nil { return nil, err } diff --git a/x/gateway/keeper/msg_update_params_test.go b/x/gateway/keeper/msg_update_params_test.go index 80ab28696..29bea2bb2 100644 --- a/x/gateway/keeper/msg_update_params_test.go +++ b/x/gateway/keeper/msg_update_params_test.go @@ -3,7 +3,6 @@ package keeper_test import ( "testing" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" "github.com/pokt-network/poktroll/x/gateway/types" @@ -13,49 +12,48 @@ func TestMsgUpdateParams(t *testing.T) { k, ms, ctx := setupMsgServer(t) params := types.DefaultParams() require.NoError(t, k.SetParams(ctx, params)) - wctx := sdk.UnwrapSDKContext(ctx) // default params - testCases := []struct { - name string - input *types.MsgUpdateParams - expErr bool - expErrMsg string + tests := []struct { + desc string + input *types.MsgUpdateParams + shouldError bool + expectedErrMsg string }{ { - name: "invalid authority", + desc: "invalid authority", input: &types.MsgUpdateParams{ Authority: "invalid", Params: params, }, - expErr: true, - expErrMsg: "invalid authority", + shouldError: true, + expectedErrMsg: "invalid authority", }, { - name: "send enabled param", + desc: "send enabled param", input: &types.MsgUpdateParams{ Authority: k.GetAuthority(), Params: types.Params{}, }, - expErr: false, + shouldError: false, }, { - name: "all good", + desc: "all good", input: &types.MsgUpdateParams{ Authority: k.GetAuthority(), Params: params, }, - expErr: false, + shouldError: false, }, } - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - _, err := ms.UpdateParams(wctx, tc.input) + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + _, err := ms.UpdateParams(ctx, test.input) - if tc.expErr { + if test.shouldError { require.Error(t, err) - require.Contains(t, err.Error(), tc.expErrMsg) + require.Contains(t, err.Error(), test.expectedErrMsg) } else { require.NoError(t, err) } diff --git a/x/gateway/keeper/params.go b/x/gateway/keeper/params.go index 7a720a898..5ae1c1146 100644 --- a/x/gateway/keeper/params.go +++ b/x/gateway/keeper/params.go @@ -11,23 +11,23 @@ import ( // GetParams get all parameters as types.Params func (k Keeper) GetParams(ctx context.Context) (params types.Params) { store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) - bz := store.Get(types.ParamsKey) - if bz == nil { + paramsBz := store.Get(types.ParamsKey) + if paramsBz == nil { return params } - k.cdc.MustUnmarshal(bz, ¶ms) + k.cdc.MustUnmarshal(paramsBz, ¶ms) return params } // SetParams set the params func (k Keeper) SetParams(ctx context.Context, params types.Params) error { store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) - bz, err := k.cdc.Marshal(¶ms) + paramsBz, err := k.cdc.Marshal(¶ms) if err != nil { return err } - store.Set(types.ParamsKey, bz) + store.Set(types.ParamsKey, paramsBz) return nil } diff --git a/x/gateway/keeper/query.go b/x/gateway/keeper/query.go index ffa80d00d..034222910 100644 --- a/x/gateway/keeper/query.go +++ b/x/gateway/keeper/query.go @@ -1,7 +1,5 @@ package keeper -import ( - "github.com/pokt-network/poktroll/x/gateway/types" -) +import "github.com/pokt-network/poktroll/x/gateway/types" var _ types.QueryServer = Keeper{} diff --git a/x/gateway/keeper/query_gateway.go b/x/gateway/keeper/query_gateway.go index 06712114c..0b6d2ab2a 100644 --- a/x/gateway/keeper/query_gateway.go +++ b/x/gateway/keeper/query_gateway.go @@ -13,7 +13,7 @@ import ( "github.com/pokt-network/poktroll/x/gateway/types" ) -func (k Keeper) GatewayAll(ctx context.Context, req *types.QueryAllGatewayRequest) (*types.QueryAllGatewayResponse, error) { +func (k Keeper) AllGateways(ctx context.Context, req *types.QueryAllGatewaysRequest) (*types.QueryAllGatewaysResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } @@ -37,7 +37,7 @@ func (k Keeper) GatewayAll(ctx context.Context, req *types.QueryAllGatewayReques return nil, status.Error(codes.Internal, err.Error()) } - return &types.QueryAllGatewayResponse{Gateway: gateways, Pagination: pageRes}, nil + return &types.QueryAllGatewaysResponse{Gateways: gateways, Pagination: pageRes}, nil } func (k Keeper) Gateway(ctx context.Context, req *types.QueryGetGatewayRequest) (*types.QueryGetGatewayResponse, error) { @@ -45,12 +45,12 @@ func (k Keeper) Gateway(ctx context.Context, req *types.QueryGetGatewayRequest) return nil, status.Error(codes.InvalidArgument, "invalid request") } - val, found := k.GetGateway( + gateway, found := k.GetGateway( ctx, req.Address, ) if !found { return nil, status.Error(codes.NotFound, fmt.Sprintf("gateway not found: address %s", req.Address)) } - return &types.QueryGetGatewayResponse{Gateway: val}, nil + return &types.QueryGetGatewayResponse{Gateway: gateway}, nil } diff --git a/x/gateway/keeper/query_gateway_test.go b/x/gateway/keeper/query_gateway_test.go index ff5146f60..c3f4dcf78 100644 --- a/x/gateway/keeper/query_gateway_test.go +++ b/x/gateway/keeper/query_gateway_test.go @@ -20,48 +20,48 @@ var _ = strconv.IntSize func TestGatewayQuerySingle(t *testing.T) { keeper, ctx := keepertest.GatewayKeeper(t) - msgs := createNGateway(keeper, ctx, 2) + gateways := createNGateways(keeper, ctx, 2) tests := []struct { - desc string - request *types.QueryGetGatewayRequest - response *types.QueryGetGatewayResponse - err error + desc string + request *types.QueryGetGatewayRequest + response *types.QueryGetGatewayResponse + expectedErr error }{ { desc: "First", request: &types.QueryGetGatewayRequest{ - Address: msgs[0].Address, + Address: gateways[0].Address, }, - response: &types.QueryGetGatewayResponse{Gateway: msgs[0]}, + response: &types.QueryGetGatewayResponse{Gateway: gateways[0]}, }, { desc: "Second", request: &types.QueryGetGatewayRequest{ - Address: msgs[1].Address, + Address: gateways[1].Address, }, - response: &types.QueryGetGatewayResponse{Gateway: msgs[1]}, + response: &types.QueryGetGatewayResponse{Gateway: gateways[1]}, }, { desc: "KeyNotFound", request: &types.QueryGetGatewayRequest{ Address: strconv.Itoa(100000), }, - err: status.Error(codes.NotFound, fmt.Sprintf("gateway not found: address %s", strconv.Itoa(100000))), + expectedErr: status.Error(codes.NotFound, fmt.Sprintf("gateway not found: address %s", strconv.Itoa(100000))), }, { - desc: "InvalidRequest", - err: status.Error(codes.InvalidArgument, "invalid request"), + desc: "InvalidRequest", + expectedErr: status.Error(codes.InvalidArgument, "invalid request"), }, } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - response, err := keeper.Gateway(ctx, tc.request) - if tc.err != nil { - require.ErrorIs(t, err, tc.err) + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + response, err := keeper.Gateway(ctx, test.request) + if test.expectedErr != nil { + require.ErrorIs(t, err, test.expectedErr) } else { require.NoError(t, err) require.Equal(t, - nullify.Fill(tc.response), + nullify.Fill(test.response), nullify.Fill(response), ) } @@ -71,10 +71,10 @@ func TestGatewayQuerySingle(t *testing.T) { func TestGatewayQueryPaginated(t *testing.T) { keeper, ctx := keepertest.GatewayKeeper(t) - msgs := createNGateway(keeper, ctx, 5) + gateways := createNGateways(keeper, ctx, 5) - request := func(next []byte, offset, limit uint64, total bool) *types.QueryAllGatewayRequest { - return &types.QueryAllGatewayRequest{ + request := func(next []byte, offset, limit uint64, total bool) *types.QueryAllGatewaysRequest { + return &types.QueryAllGatewaysRequest{ Pagination: &query.PageRequest{ Key: next, Offset: offset, @@ -85,41 +85,41 @@ func TestGatewayQueryPaginated(t *testing.T) { } t.Run("ByOffset", func(t *testing.T) { step := 2 - for i := 0; i < len(msgs); i += step { - resp, err := keeper.GatewayAll(ctx, request(nil, uint64(i), uint64(step), false)) + for i := 0; i < len(gateways); i += step { + resp, err := keeper.AllGateways(ctx, request(nil, uint64(i), uint64(step), false)) require.NoError(t, err) - require.LessOrEqual(t, len(resp.Gateway), step) + require.LessOrEqual(t, len(resp.Gateways), step) require.Subset(t, - nullify.Fill(msgs), - nullify.Fill(resp.Gateway), + nullify.Fill(gateways), + nullify.Fill(resp.Gateways), ) } }) t.Run("ByKey", func(t *testing.T) { step := 2 var next []byte - for i := 0; i < len(msgs); i += step { - resp, err := keeper.GatewayAll(ctx, request(next, 0, uint64(step), false)) + for i := 0; i < len(gateways); i += step { + resp, err := keeper.AllGateways(ctx, request(next, 0, uint64(step), false)) require.NoError(t, err) - require.LessOrEqual(t, len(resp.Gateway), step) + require.LessOrEqual(t, len(resp.Gateways), step) require.Subset(t, - nullify.Fill(msgs), - nullify.Fill(resp.Gateway), + nullify.Fill(gateways), + nullify.Fill(resp.Gateways), ) next = resp.Pagination.NextKey } }) t.Run("Total", func(t *testing.T) { - resp, err := keeper.GatewayAll(ctx, request(nil, 0, 0, true)) + resp, err := keeper.AllGateways(ctx, request(nil, 0, 0, true)) require.NoError(t, err) - require.Equal(t, len(msgs), int(resp.Pagination.Total)) + require.Equal(t, len(gateways), int(resp.Pagination.Total)) require.ElementsMatch(t, - nullify.Fill(msgs), - nullify.Fill(resp.Gateway), + nullify.Fill(gateways), + nullify.Fill(resp.Gateways), ) }) t.Run("InvalidRequest", func(t *testing.T) { - _, err := keeper.GatewayAll(ctx, nil) + _, err := keeper.AllGateways(ctx, nil) require.ErrorIs(t, err, status.Error(codes.InvalidArgument, "invalid request")) }) } diff --git a/x/gateway/keeper/query_params.go b/x/gateway/keeper/query_params.go index 8d3afe26d..311c6a70a 100644 --- a/x/gateway/keeper/query_params.go +++ b/x/gateway/keeper/query_params.go @@ -3,18 +3,16 @@ package keeper import ( "context" - sdk "github.com/cosmos/cosmos-sdk/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "github.com/pokt-network/poktroll/x/gateway/types" ) -func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { +func (k Keeper) Params(ctx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } - ctx := sdk.UnwrapSDKContext(goCtx) return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil } diff --git a/x/gateway/module/autocli.go b/x/gateway/module/autocli.go index 8506d3c82..f8551e6ab 100644 --- a/x/gateway/module/autocli.go +++ b/x/gateway/module/autocli.go @@ -10,47 +10,47 @@ import ( func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { return &autocliv1.ModuleOptions{ Query: &autocliv1.ServiceCommandDescriptor{ - Service: modulev1.Query_ServiceDesc.ServiceName, + Service: modulev1.Query_ServiceDesc.ServiceName, RpcCommandOptions: []*autocliv1.RpcCommandOptions{ - { - RpcMethod: "Params", - Use: "params", - Short: "Shows the parameters of the module", - }, - { - RpcMethod: "GatewayAll", - Use: "list-gateway", - Short: "List all gateway", - }, - { - RpcMethod: "Gateway", - Use: "show-gateway [id]", - Short: "Shows a gateway", - PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "address"}}, - }, + // { + // RpcMethod: "Params", + // Use: "params", + // Short: "Shows the parameters of the module", + // }, + // { + // RpcMethod: "AllGateways", + // Use: "list-gateway", + // Short: "List all gateway", + // }, + // { + // RpcMethod: "Gateway", + // Use: "show-gateway [id]", + // Short: "Shows a gateway", + // PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "address"}}, + // }, // this line is used by ignite scaffolding # autocli/query }, }, Tx: &autocliv1.ServiceCommandDescriptor{ Service: modulev1.Msg_ServiceDesc.ServiceName, EnhanceCustomCommand: true, // only required if you want to use the custom command - RpcCommandOptions: []*autocliv1.RpcCommandOptions{ - { - RpcMethod: "UpdateParams", - Skip: true, // skipped because authority gated - }, - { - RpcMethod: "StakeGateway", - Use: "stake-gateway [stake]", - Short: "Send a stake_gateway tx", - PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "stake"}}, - }, - { - RpcMethod: "UnstakeGateway", - Use: "unstake-gateway", - Short: "Send a unstake_gateway tx", - PositionalArgs: []*autocliv1.PositionalArgDescriptor{}, - }, + RpcCommandOptions: []*autocliv1.RpcCommandOptions{ + // { + // RpcMethod: "UpdateParams", + // Skip: true, // skipped because authority gated + // }, + // { + // RpcMethod: "StakeGateway", + // Use: "stake-gateway [stake]", + // Short: "Send a stake_gateway tx", + // PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "stake"}}, + // }, + // { + // RpcMethod: "UnstakeGateway", + // Use: "unstake-gateway", + // Short: "Send a unstake_gateway tx", + // PositionalArgs: []*autocliv1.PositionalArgDescriptor{}, + // }, // this line is used by ignite scaffolding # autocli/tx }, }, diff --git a/x/gateway/module/config/errors.go b/x/gateway/module/config/errors.go index aa01b3a46..690565d36 100644 --- a/x/gateway/module/config/errors.go +++ b/x/gateway/module/config/errors.go @@ -1,10 +1,13 @@ package config -import sdkerrors "cosmossdk.io/errors" +import ( + sdkerrors "cosmossdk.io/errors" + + "github.com/pokt-network/poktroll/x/gateway/types" +) var ( - codespace = "gatewayconfig" - ErrGatewayConfigEmptyContent = sdkerrors.Register(codespace, 1, "empty gateway staking config content") - ErrGatewayConfigUnmarshalYAML = sdkerrors.Register(codespace, 2, "config reader cannot unmarshal yaml content") - ErrGatewayConfigInvalidStake = sdkerrors.Register(codespace, 3, "invalid stake in gateway stake config") + ErrGatewayConfigEmptyContent = sdkerrors.Register(types.ModuleName, 2100, "empty gateway staking config content") + ErrGatewayConfigUnmarshalYAML = sdkerrors.Register(types.ModuleName, 2101, "config reader cannot unmarshal yaml content") + ErrGatewayConfigInvalidStake = sdkerrors.Register(types.ModuleName, 2102, "invalid stake in gateway stake config") ) diff --git a/x/gateway/module/config/gateway_config_reader_test.go b/x/gateway/module/config/gateway_config_reader_test.go index 11c632cc8..6de1f1151 100644 --- a/x/gateway/module/config/gateway_config_reader_test.go +++ b/x/gateway/module/config/gateway_config_reader_test.go @@ -4,7 +4,7 @@ import ( "testing" sdkerrors "cosmossdk.io/errors" - sdkmath "cosmossdk.io/math" + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" @@ -15,7 +15,7 @@ import ( func Test_ParseGatewayStakeConfig(t *testing.T) { tests := []struct { desc string - expectedError *sdkerrors.Error + expectedErr *sdkerrors.Error expectedConfig *config.GatewayStakeConfig inputConfig string }{ @@ -25,57 +25,57 @@ func Test_ParseGatewayStakeConfig(t *testing.T) { inputConfig: ` stake_amount: 1000upokt `, - expectedError: nil, + expectedErr: nil, expectedConfig: &config.GatewayStakeConfig{ - StakeAmount: sdk.NewCoin("upokt", sdkmath.NewInt(1000)), + StakeAmount: sdk.NewCoin("upokt", math.NewInt(1000)), }, }, // Invalid Configs { - desc: "services_test: invalid service config with empty content", - expectedError: config.ErrGatewayConfigEmptyContent, - inputConfig: ``, + desc: "services_test: invalid service config with empty content", + expectedErr: config.ErrGatewayConfigEmptyContent, + inputConfig: ``, }, { desc: "invalid stake denom", inputConfig: ` stake_amount: 1000invalid `, - expectedError: config.ErrGatewayConfigInvalidStake, + expectedErr: config.ErrGatewayConfigInvalidStake, }, { desc: "negative stake amount", inputConfig: ` stake_amount: -1000upokt `, - expectedError: config.ErrGatewayConfigInvalidStake, + expectedErr: config.ErrGatewayConfigInvalidStake, }, { desc: "zero stake amount", inputConfig: ` stake_amount: 0upokt `, - expectedError: config.ErrGatewayConfigInvalidStake, + expectedErr: config.ErrGatewayConfigInvalidStake, }, } - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { - normalizedConfig := yaml.NormalizeYAMLIndentation(tt.inputConfig) + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + normalizedConfig := yaml.NormalizeYAMLIndentation(test.inputConfig) supplierServiceConfig, err := config.ParseGatewayConfig([]byte(normalizedConfig)) - if tt.expectedError != nil { + if test.expectedErr != nil { require.Error(t, err) - require.ErrorIs(t, err, tt.expectedError) - require.Contains(t, err.Error(), tt.expectedError.Error()) + require.ErrorIs(t, err, test.expectedErr) + require.Contains(t, err.Error(), test.expectedErr.Error()) require.Nil(t, supplierServiceConfig) return } require.NoError(t, err) - require.Equal(t, tt.expectedConfig.StakeAmount, supplierServiceConfig.StakeAmount) - require.Equal(t, tt.expectedConfig.StakeAmount.Denom, supplierServiceConfig.StakeAmount.Denom) + require.Equal(t, test.expectedConfig.StakeAmount, supplierServiceConfig.StakeAmount) + require.Equal(t, test.expectedConfig.StakeAmount.Denom, supplierServiceConfig.StakeAmount.Denom) }) } } diff --git a/x/gateway/module/genesis.go b/x/gateway/module/genesis.go index 302f2a1cc..5c192dfea 100644 --- a/x/gateway/module/genesis.go +++ b/x/gateway/module/genesis.go @@ -1,28 +1,30 @@ package gateway import ( - sdk "github.com/cosmos/cosmos-sdk/types" + "context" "github.com/pokt-network/poktroll/x/gateway/keeper" "github.com/pokt-network/poktroll/x/gateway/types" ) // InitGenesis initializes the module's state from a provided genesis state. -func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { +func InitGenesis(ctx context.Context, k keeper.Keeper, genState types.GenesisState) { // Set all the gateway - for _, elem := range genState.GatewayList { - k.SetGateway(ctx, elem) + for _, gateway := range genState.GatewayList { + k.SetGateway(ctx, gateway) } // this line is used by starport scaffolding # genesis/module/init - k.SetParams(ctx, genState.Params) + if err := k.SetParams(ctx, genState.Params); err != nil { + panic(err) + } } // ExportGenesis returns the module's exported genesis. -func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { +func ExportGenesis(ctx context.Context, k keeper.Keeper) *types.GenesisState { genesis := types.DefaultGenesis() genesis.Params = k.GetParams(ctx) - genesis.GatewayList = k.GetAllGateway(ctx) + genesis.GatewayList = k.GetAllGateways(ctx) // this line is used by starport scaffolding # genesis/module/export return genesis diff --git a/x/gateway/module/genesis_test.go b/x/gateway/module/genesis_test.go index 0d9ac318d..e58f2550b 100644 --- a/x/gateway/module/genesis_test.go +++ b/x/gateway/module/genesis_test.go @@ -3,170 +3,37 @@ package gateway_test import ( "testing" - sdkmath "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - + keepertest "github.com/pokt-network/poktroll/testutil/keeper" + "github.com/pokt-network/poktroll/testutil/nullify" "github.com/pokt-network/poktroll/testutil/sample" + gateway "github.com/pokt-network/poktroll/x/gateway/module" "github.com/pokt-network/poktroll/x/gateway/types" + "github.com/stretchr/testify/require" ) -func TestGenesisState_Validate(t *testing.T) { - addr1 := sample.AccAddress() - stake1 := sdk.NewCoin("upokt", sdkmath.NewInt(100)) +func TestGenesis(t *testing.T) { + genesisState := types.GenesisState{ + Params: types.DefaultParams(), - addr2 := sample.AccAddress() - stake2 := sdk.NewCoin("upokt", sdkmath.NewInt(100)) - - tests := []struct { - desc string - genState *types.GenesisState - valid bool - }{ - { - desc: "default is valid", - genState: types.DefaultGenesis(), - valid: true, - }, - { - desc: "valid genesis state", - genState: &types.GenesisState{ - GatewayList: []types.Gateway{ - { - Address: addr1, - Stake: &stake1, - }, - { - Address: addr2, - Stake: &stake2, - }, - }, - // this line is used by starport scaffolding # types/genesis/validField - }, - valid: true, - }, - { - desc: "invalid - duplicated gateway address", - genState: &types.GenesisState{ - GatewayList: []types.Gateway{ - { - Address: addr1, - Stake: &stake1, - }, - { - Address: addr1, - Stake: &stake2, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - nil gateway stake", - genState: &types.GenesisState{ - GatewayList: []types.Gateway{ - { - Address: addr1, - Stake: &stake1, - }, - { - Address: addr2, - Stake: nil, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - missing gateway stake", - genState: &types.GenesisState{ - GatewayList: []types.Gateway{ - { - Address: addr1, - Stake: &stake1, - }, - { - Address: addr2, - // Stake: stake2, - }, - }, + GatewayList: []types.Gateway{ + { + Address: sample.AccAddress(), }, - valid: false, - }, - { - desc: "invalid - zero gateway stake", - genState: &types.GenesisState{ - GatewayList: []types.Gateway{ - { - Address: addr1, - Stake: &stake1, - }, - { - Address: addr2, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(0)}, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - negative gateway stake", - genState: &types.GenesisState{ - GatewayList: []types.Gateway{ - { - Address: addr1, - Stake: &stake1, - }, - { - Address: addr2, - Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(-100)}, - }, - }, + { + Address: sample.AccAddress(), }, - valid: false, }, - { - desc: "invalid - wrong stake denom", - genState: &types.GenesisState{ - GatewayList: []types.Gateway{ - { - Address: addr1, - Stake: &stake1, - }, - { - Address: addr2, - Stake: &sdk.Coin{Denom: "invalid", Amount: sdkmath.NewInt(100)}, - }, - }, - }, - valid: false, - }, - { - desc: "invalid - missing denom", - genState: &types.GenesisState{ - GatewayList: []types.Gateway{ - { - Address: addr1, - Stake: &stake1, - }, - { - Address: addr2, - Stake: &sdk.Coin{Denom: "", Amount: sdkmath.NewInt(100)}, - }, - }, - }, - valid: false, - }, - // this line is used by starport scaffolding # types/genesis/testcase - } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - err := tc.genState.Validate() - if tc.valid { - require.NoError(t, err) - } else { - require.Error(t, err) - } - }) + // this line is used by starport scaffolding # genesis/test/state } + + k, ctx := keepertest.GatewayKeeper(t) + gateway.InitGenesis(ctx, k, genesisState) + got := gateway.ExportGenesis(ctx, k) + require.NotNil(t, got) + + nullify.Fill(&genesisState) + nullify.Fill(got) + + require.ElementsMatch(t, genesisState.GatewayList, got.GatewayList) + // this line is used by starport scaffolding # genesis/test/assert } diff --git a/x/gateway/module/helpers_test.go b/x/gateway/module/helpers_test.go index 45f9c42a8..cb271b445 100644 --- a/x/gateway/module/helpers_test.go +++ b/x/gateway/module/helpers_test.go @@ -6,7 +6,6 @@ import ( "github.com/stretchr/testify/require" - "github.com/pokt-network/poktroll/cmd/poktrolld/cmd" "github.com/pokt-network/poktroll/testutil/network" "github.com/pokt-network/poktroll/x/gateway/types" ) @@ -14,11 +13,6 @@ import ( // Dummy variable to avoid unused import error. var _ = strconv.IntSize -// init initializes the SDK configuration. -func init() { - cmd.InitSDKConfig() -} - // networkWithGatewayObjects creates a network with a populated gateway state of n gateway objects func networkWithGatewayObjects(t *testing.T, n int) (*network.Network, []types.Gateway) { t.Helper() diff --git a/x/gateway/module/module.go b/x/gateway/module/module.go index 0294e85cc..ffa418184 100644 --- a/x/gateway/module/module.go +++ b/x/gateway/module/module.go @@ -141,6 +141,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw // ConsensusVersion is a sequence number for state-breaking change of the module. // It should be incremented on each consensus-breaking change introduced by the module. // To avoid wrong/empty versions, the initial version should be set to 1. +// TODO_TECHDEBT(#395): Make consensus version configurable func (AppModule) ConsensusVersion() uint64 { return 1 } // BeginBlock contains the logic that is automatically triggered at the beginning of each block. @@ -166,10 +167,7 @@ func (am AppModule) IsAppModule() {} // ---------------------------------------------------------------------------- func init() { - appmodule.Register( - &modulev1.Module{}, - appmodule.Provide(ProvideModule), - ) + appmodule.Register(&modulev1.Module{}, appmodule.Provide(ProvideModule)) } type ModuleInputs struct { diff --git a/x/gateway/module/query.go b/x/gateway/module/query.go index 4c3856f0e..f4dc50d24 100644 --- a/x/gateway/module/query.go +++ b/x/gateway/module/query.go @@ -10,7 +10,8 @@ import ( ) // GetQueryCmd returns the cli query commands for this module -func (am AppModule) GetQueryCmd(queryRoute string) *cobra.Command { +// TODO_TECHDEBT(#370): remove if custom query commands are consolidated into AutoCLI. +func (am AppModule) GetQueryCmd() *cobra.Command { // Group gateway queries under a subcommand cmd := &cobra.Command{ Use: types.ModuleName, diff --git a/x/gateway/module/query_gateway.go b/x/gateway/module/query_gateway.go index be7cdaa23..88a39e4eb 100644 --- a/x/gateway/module/query_gateway.go +++ b/x/gateway/module/query_gateway.go @@ -15,7 +15,7 @@ func CmdListGateway() *cobra.Command { Long: `List all the gateways that the node being queried has in its state. Example: -$ poktrolld q gateway list-gateway --node $(POCKET_NODE) --home=$(POKTROLLD_HOME)`, +$ poktrolld q gateway list-gateway --node $(POCKET_NODE) --home $(POKTROLLD_HOME)`, RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientQueryContext(cmd) if err != nil { @@ -29,11 +29,11 @@ $ poktrolld q gateway list-gateway --node $(POCKET_NODE) --home=$(POKTROLLD_HOME queryClient := types.NewQueryClient(clientCtx) - params := &types.QueryAllGatewayRequest{ + params := &types.QueryAllGatewaysRequest{ Pagination: pageReq, } - res, err := queryClient.GatewayAll(cmd.Context(), params) + res, err := queryClient.AllGateways(cmd.Context(), params) if err != nil { return err } diff --git a/x/gateway/module/query_gateway_test.go b/x/gateway/module/query_gateway_test.go index fd2d12d5a..e9b4d07b8 100644 --- a/x/gateway/module/query_gateway_test.go +++ b/x/gateway/module/query_gateway_test.go @@ -21,7 +21,7 @@ import ( var _ = strconv.IntSize func TestShowGateway(t *testing.T) { - net, objs := networkWithGatewayObjects(t, 2) + net, gateways := networkWithGatewayObjects(t, 2) ctx := net.Validators[0].ClientCtx common := []string{ @@ -31,43 +31,43 @@ func TestShowGateway(t *testing.T) { desc string idAddress string - args []string - err error - obj types.Gateway + args []string + expectedErr error + gateway types.Gateway }{ { desc: "found", - idAddress: objs[0].Address, + idAddress: gateways[0].Address, - args: common, - obj: objs[0], + args: common, + gateway: gateways[0], }, { desc: "not found", idAddress: strconv.Itoa(100000), - args: common, - err: status.Error(codes.NotFound, "not found"), + args: common, + expectedErr: status.Error(codes.NotFound, "not found"), }, } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { args := []string{ - tc.idAddress, + test.idAddress, } - args = append(args, tc.args...) + args = append(args, test.args...) out, err := clitestutil.ExecTestCLICmd(ctx, gateway.CmdShowGateway(), args) - if tc.err != nil { - stat, ok := status.FromError(tc.err) + if test.expectedErr != nil { + stat, ok := status.FromError(test.expectedErr) require.True(t, ok) - require.ErrorIs(t, stat.Err(), tc.err) + require.ErrorIs(t, stat.Err(), test.expectedErr) } else { require.NoError(t, err) var resp types.QueryGetGatewayResponse require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) require.NotNil(t, resp.Gateway) require.Equal(t, - nullify.Fill(&tc.obj), + nullify.Fill(&test.gateway), nullify.Fill(&resp.Gateway), ) } @@ -76,7 +76,7 @@ func TestShowGateway(t *testing.T) { } func TestListGateway(t *testing.T) { - net, objs := networkWithGatewayObjects(t, 5) + net, gateways := networkWithGatewayObjects(t, 5) ctx := net.Validators[0].ClientCtx request := func(next []byte, offset, limit uint64, total bool) []string { @@ -96,47 +96,47 @@ func TestListGateway(t *testing.T) { } t.Run("ByOffset", func(t *testing.T) { step := 2 - for i := 0; i < len(objs); i += step { + for i := 0; i < len(gateways); i += step { args := request(nil, uint64(i), uint64(step), false) out, err := clitestutil.ExecTestCLICmd(ctx, gateway.CmdListGateway(), args) require.NoError(t, err) - var resp types.QueryAllGatewayResponse + var resp types.QueryAllGatewaysResponse require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.LessOrEqual(t, len(resp.Gateway), step) + require.LessOrEqual(t, len(resp.Gateways), step) require.Subset(t, - nullify.Fill(objs), - nullify.Fill(resp.Gateway), + nullify.Fill(gateways), + nullify.Fill(resp.Gateways), ) } }) t.Run("ByKey", func(t *testing.T) { step := 2 var next []byte - for i := 0; i < len(objs); i += step { + for i := 0; i < len(gateways); i += step { args := request(next, 0, uint64(step), false) out, err := clitestutil.ExecTestCLICmd(ctx, gateway.CmdListGateway(), args) require.NoError(t, err) - var resp types.QueryAllGatewayResponse + var resp types.QueryAllGatewaysResponse require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.LessOrEqual(t, len(resp.Gateway), step) + require.LessOrEqual(t, len(resp.Gateways), step) require.Subset(t, - nullify.Fill(objs), - nullify.Fill(resp.Gateway), + nullify.Fill(gateways), + nullify.Fill(resp.Gateways), ) next = resp.Pagination.NextKey } }) t.Run("Total", func(t *testing.T) { - args := request(nil, 0, uint64(len(objs)), true) + args := request(nil, 0, uint64(len(gateways)), true) out, err := clitestutil.ExecTestCLICmd(ctx, gateway.CmdListGateway(), args) require.NoError(t, err) - var resp types.QueryAllGatewayResponse + var resp types.QueryAllGatewaysResponse require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) require.NoError(t, err) - require.Equal(t, len(objs), int(resp.Pagination.Total)) + require.Equal(t, len(gateways), int(resp.Pagination.Total)) require.ElementsMatch(t, - nullify.Fill(objs), - nullify.Fill(resp.Gateway), + nullify.Fill(gateways), + nullify.Fill(resp.Gateways), ) }) } diff --git a/x/gateway/module/query_params.go b/x/gateway/module/query_params.go index cdca5a567..1c61165ec 100644 --- a/x/gateway/module/query_params.go +++ b/x/gateway/module/query_params.go @@ -15,7 +15,7 @@ func CmdQueryParams() *cobra.Command { Long: `Shows all the parameters related to the Gateway module. Example: -$ poktrolld q gateway params --node $(POCKET_NODE) --home=$(POKTROLLD_HOME)`, +$ poktrolld q gateway params --node $(POCKET_NODE) --home $(POKTROLLD_HOME)`, Args: cobra.NoArgs, RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientQueryContext(cmd) diff --git a/x/gateway/module/tx.go b/x/gateway/module/tx.go index 3f6b0060a..1792814fa 100644 --- a/x/gateway/module/tx.go +++ b/x/gateway/module/tx.go @@ -2,7 +2,6 @@ package gateway import ( "fmt" - "time" "github.com/cosmos/cosmos-sdk/client" "github.com/spf13/cobra" @@ -10,14 +9,8 @@ import ( "github.com/pokt-network/poktroll/x/gateway/types" ) -var DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) - -const ( - flagPacketTimeoutTimestamp = "packet-timeout-timestamp" - listSeparator = "," -) - // GetTxCmd returns the transaction commands for this module +// TODO_TECHDEBT(#370): remove if custom query commands are consolidated into AutoCLI. func (am AppModule) GetTxCmd() *cobra.Command { cmd := &cobra.Command{ Use: types.ModuleName, diff --git a/x/gateway/module/tx_stake_gateway.go b/x/gateway/module/tx_stake_gateway.go index e9e02dcef..ec259351e 100644 --- a/x/gateway/module/tx_stake_gateway.go +++ b/x/gateway/module/tx_stake_gateway.go @@ -25,7 +25,7 @@ func CmdStakeGateway() *cobra.Command { Long: `Stake a gateway with the provided parameters. This is a broadcast operation that will stake the tokens and associate them with the gateway specified by the 'from' address. Example: -$ poktrolld tx gateway stake-gateway --config stake_config.yaml --keyring-backend test --from $(GATEWAY) --node $(POCKET_NODE) --home=$(POKTROLLD_HOME)`, +$ poktrolld tx gateway stake-gateway --config stake_config.yaml --keyring-backend test --from $(GATEWAY) --node $(POCKET_NODE) --home $(POKTROLLD_HOME)`, Args: cobra.ExactArgs(0), RunE: func(cmd *cobra.Command, _ []string) (err error) { configContent, err := os.ReadFile(flagStakeConfig) diff --git a/x/gateway/module/tx_stake_gateway_test.go b/x/gateway/module/tx_stake_gateway_test.go index 5a2f82f21..583189dc1 100644 --- a/x/gateway/module/tx_stake_gateway_test.go +++ b/x/gateway/module/tx_stake_gateway_test.go @@ -6,7 +6,7 @@ import ( "testing" sdkerrors "cosmossdk.io/errors" - sdkmath "cosmossdk.io/math" + "cosmossdk.io/math" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/testutil" clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" @@ -30,6 +30,9 @@ func TestCLI_StakeGateway(t *testing.T) { accounts := testutil.CreateKeyringAccounts(t, kr, 1) gatewayAccount := accounts[0] + // Initialize the Gateway Account by sending it some funds from the validator account that is part of genesis + network.InitAccount(t, net, gatewayAccount.Address) + // Update the context with the new keyring ctx = ctx.WithKeyring(kr) @@ -37,14 +40,14 @@ func TestCLI_StakeGateway(t *testing.T) { commonArgs := []string{ fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, math.NewInt(10))).String()), } tests := []struct { - desc string - address string - inputConfig string - expectedError *sdkerrors.Error + desc string + address string + inputConfig string + expectedErr *sdkerrors.Error }{ { desc: "stake gateway: invalid address", @@ -52,7 +55,7 @@ func TestCLI_StakeGateway(t *testing.T) { inputConfig: ` stake_amount: 1000upokt `, - expectedError: types.ErrGatewayInvalidAddress, + expectedErr: types.ErrGatewayInvalidAddress, }, { desc: "stake gateway: missing address", @@ -60,7 +63,7 @@ func TestCLI_StakeGateway(t *testing.T) { inputConfig: ` stake_amount: 1000upokt `, - expectedError: types.ErrGatewayInvalidAddress, + expectedErr: types.ErrGatewayInvalidAddress, }, { desc: "stake gateway: invalid stake amount (zero)", @@ -68,7 +71,7 @@ func TestCLI_StakeGateway(t *testing.T) { inputConfig: ` stake_amount: 0upokt `, - expectedError: types.ErrGatewayInvalidStake, + expectedErr: types.ErrGatewayInvalidStake, }, { desc: "stake gateway: invalid stake amount (negative)", @@ -76,7 +79,7 @@ func TestCLI_StakeGateway(t *testing.T) { inputConfig: ` stake_amount: -1000upokt `, - expectedError: types.ErrGatewayInvalidStake, + expectedErr: types.ErrGatewayInvalidStake, }, { desc: "stake gateway: invalid stake denom", @@ -84,7 +87,7 @@ func TestCLI_StakeGateway(t *testing.T) { inputConfig: ` stake_amount: 1000invalid `, - expectedError: types.ErrGatewayInvalidStake, + expectedErr: types.ErrGatewayInvalidStake, }, { desc: "stake gateway: invalid stake missing denom", @@ -92,13 +95,13 @@ func TestCLI_StakeGateway(t *testing.T) { inputConfig: ` stake_amount: 1000 `, - expectedError: types.ErrGatewayInvalidStake, + expectedErr: types.ErrGatewayInvalidStake, }, { - desc: "stake gateway: invalid stake missing stake", - address: gatewayAccount.Address.String(), - inputConfig: ``, - expectedError: types.ErrGatewayInvalidStake, + desc: "stake gateway: invalid stake missing stake", + address: gatewayAccount.Address.String(), + inputConfig: ``, + expectedErr: types.ErrGatewayInvalidStake, }, { desc: "stake gateway: valid", @@ -109,32 +112,29 @@ func TestCLI_StakeGateway(t *testing.T) { }, } - // Initialize the Gateway Account by sending it some funds from the validator account that is part of genesis - network.InitAccount(t, net, gatewayAccount.Address) - // Run the tests - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { // Wait for a new block to be committed require.NoError(t, net.WaitForNextBlock()) // write the stake config to a file - configPath := testutil.WriteToNewTempFile(t, yaml.NormalizeYAMLIndentation(tt.inputConfig)).Name() + configPath := testutil.WriteToNewTempFile(t, yaml.NormalizeYAMLIndentation(test.inputConfig)).Name() t.Cleanup(func() { os.Remove(configPath) }) // Prepare the arguments for the CLI command args := []string{ fmt.Sprintf("--config=%s", configPath), - fmt.Sprintf("--%s=%s", flags.FlagFrom, tt.address), + fmt.Sprintf("--%s=%s", flags.FlagFrom, test.address), } args = append(args, commonArgs...) // Execute the command outStake, err := clitestutil.ExecTestCLICmd(ctx, gateway.CmdStakeGateway(), args) - if tt.expectedError != nil { - stat, ok := status.FromError(tt.expectedError) + if test.expectedErr != nil { + stat, ok := status.FromError(test.expectedErr) require.True(t, ok) - require.Contains(t, stat.Message(), tt.expectedError.Error()) + require.Contains(t, stat.Message(), test.expectedErr.Error()) return } require.NoError(t, err) diff --git a/x/gateway/module/tx_unstake_gateway.go b/x/gateway/module/tx_unstake_gateway.go index a5760aa1a..d5bc25018 100644 --- a/x/gateway/module/tx_unstake_gateway.go +++ b/x/gateway/module/tx_unstake_gateway.go @@ -21,7 +21,7 @@ func CmdUnstakeGateway() *cobra.Command { Long: `Unstake a gateway. This is a broadcast operation that will unstake the gateway specified by the 'from' address. Example: -$ poktrolld tx gateway unstake-gateway --keyring-backend test --from $(GATEWAY) --node $(POCKET_NODE) --home=$(POKTROLLD_HOME)`, +$ poktrolld tx gateway unstake-gateway --keyring-backend test --from $(GATEWAY) --node $(POCKET_NODE) --home $(POKTROLLD_HOME)`, Args: cobra.ExactArgs(0), RunE: func(cmd *cobra.Command, _ []string) (err error) { clientCtx, err := client.GetClientTxContext(cmd) diff --git a/x/gateway/module/tx_unstake_gateway_test.go b/x/gateway/module/tx_unstake_gateway_test.go index fb2e1cc07..0a240ca4f 100644 --- a/x/gateway/module/tx_unstake_gateway_test.go +++ b/x/gateway/module/tx_unstake_gateway_test.go @@ -5,7 +5,7 @@ import ( "testing" sdkerrors "cosmossdk.io/errors" - sdkmath "cosmossdk.io/math" + "cosmossdk.io/math" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/testutil" clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" @@ -28,6 +28,9 @@ func TestCLI_UnstakeGateway(t *testing.T) { accounts := testutil.CreateKeyringAccounts(t, kr, 1) gatewayAccount := accounts[0] + // Initialize the Gateway Account by sending it some funds from the validator account that is part of genesis + network.InitAccount(t, net, gatewayAccount.Address) + // Update the context with the new keyring ctx = ctx.WithKeyring(kr) @@ -35,13 +38,13 @@ func TestCLI_UnstakeGateway(t *testing.T) { commonArgs := []string{ fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), + fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, math.NewInt(10))).String()), } tests := []struct { - desc string - address string - err *sdkerrors.Error + desc string + address string + expectedErr *sdkerrors.Error }{ { desc: "unstake gateway: valid", @@ -49,28 +52,25 @@ func TestCLI_UnstakeGateway(t *testing.T) { }, { desc: "unstake gateway: missing address", - // address: gatewayAccount.Address.String(), - err: types.ErrGatewayInvalidAddress, + // address explicitly omitted + expectedErr: types.ErrGatewayInvalidAddress, }, { - desc: "unstake gateway: invalid address", - address: "invalid", - err: types.ErrGatewayInvalidAddress, + desc: "unstake gateway: invalid address", + address: "invalid", + expectedErr: types.ErrGatewayInvalidAddress, }, } - // Initialize the Gateway Account by sending it some funds from the validator account that is part of genesis - network.InitAccount(t, net, gatewayAccount.Address) - // Run the tests - for _, tt := range tests { - t.Run(tt.desc, func(t *testing.T) { + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { // Wait for a new block to be committed require.NoError(t, net.WaitForNextBlock()) // Prepare the arguments for the CLI command args := []string{ - fmt.Sprintf("--%s=%s", flags.FlagFrom, tt.address), + fmt.Sprintf("--%s=%s", flags.FlagFrom, test.address), } args = append(args, commonArgs...) @@ -78,10 +78,10 @@ func TestCLI_UnstakeGateway(t *testing.T) { outUnstake, err := clitestutil.ExecTestCLICmd(ctx, gateway.CmdUnstakeGateway(), args) // Validate the error if one is expected - if tt.err != nil { - stat, ok := status.FromError(tt.err) + if test.expectedErr != nil { + stat, ok := status.FromError(test.expectedErr) require.True(t, ok) - require.Contains(t, stat.Message(), tt.err.Error()) + require.Contains(t, stat.Message(), test.expectedErr.Error()) return } require.NoError(t, err) diff --git a/x/gateway/simulation/stake_gateway.go b/x/gateway/simulation/stake_gateway.go index ea7474891..d7a818c5b 100644 --- a/x/gateway/simulation/stake_gateway.go +++ b/x/gateway/simulation/stake_gateway.go @@ -6,6 +6,7 @@ import ( "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" ) diff --git a/x/gateway/simulation/unstake_gateway.go b/x/gateway/simulation/unstake_gateway.go index 69bc3233b..0f1f2f29c 100644 --- a/x/gateway/simulation/unstake_gateway.go +++ b/x/gateway/simulation/unstake_gateway.go @@ -6,6 +6,7 @@ import ( "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" ) diff --git a/x/gateway/types/errors.go b/x/gateway/types/errors.go index 298df8889..54bf3f388 100644 --- a/x/gateway/types/errors.go +++ b/x/gateway/types/errors.go @@ -2,16 +2,13 @@ package types // DONTCOVER -import ( - sdkerrors "cosmossdk.io/errors" -) +import sdkerrors "cosmossdk.io/errors" // x/gateway module sentinel errors var ( ErrGatewayInvalidSigner = sdkerrors.Register(ModuleName, 1100, "expected gov account as only signer for proposal message") - ErrGatewaySample = sdkerrors.Register(ModuleName, 1101, "sample error") - ErrGatewayInvalidAddress = sdkerrors.Register(ModuleName, 1102, "invalid gateway address") - ErrGatewayInvalidStake = sdkerrors.Register(ModuleName, 1103, "invalid gateway stake") - ErrGatewayUnauthorized = sdkerrors.Register(ModuleName, 1104, "unauthorized signer") - ErrGatewayNotFound = sdkerrors.Register(ModuleName, 1105, "gateway not found") + ErrGatewayInvalidAddress = sdkerrors.Register(ModuleName, 1101, "invalid gateway address") + ErrGatewayInvalidStake = sdkerrors.Register(ModuleName, 1102, "invalid gateway stake") + ErrGatewayUnauthorized = sdkerrors.Register(ModuleName, 1103, "unauthorized signer") + ErrGatewayNotFound = sdkerrors.Register(ModuleName, 1104, "gateway not found") ) diff --git a/x/gateway/types/expected_keepers.go b/x/gateway/types/expected_keepers.go index 10cde1203..ca22179fc 100644 --- a/x/gateway/types/expected_keepers.go +++ b/x/gateway/types/expected_keepers.go @@ -1,7 +1,7 @@ -package types - //go:generate mockgen -destination ../../../testutil/gateway/mocks/expected_keepers_mock.go -package mocks . AccountKeeper,BankKeeper +package types + import ( "context" @@ -29,9 +29,3 @@ type BankKeeper interface { amt sdk.Coins, ) error } - -// ParamSubspace defines the expected Subspace interface for parameters. -type ParamSubspace interface { - Get(context.Context, []byte, interface{}) - Set(context.Context, []byte, interface{}) -} diff --git a/x/gateway/types/genesis.go b/x/gateway/types/genesis.go index 5cb161252..6ec98e8bf 100644 --- a/x/gateway/types/genesis.go +++ b/x/gateway/types/genesis.go @@ -1,12 +1,6 @@ package types -import ( - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -// DefaultIndex is the default global index -const DefaultIndex uint64 = 1 +import sdk "github.com/cosmos/cosmos-sdk/types" // DefaultGenesis returns the default genesis state func DefaultGenesis() *GenesisState { @@ -20,31 +14,31 @@ func DefaultGenesis() *GenesisState { // Validate performs basic genesis state validation returning an error upon any // failure. func (gs GenesisState) Validate() error { - gatewayIndexMap := make(map[string]struct{}) + gatewayAddrMap := make(map[string]struct{}) for _, gateway := range gs.GatewayList { - // Check for duplicated index in gateway - index := string(GatewayKey(gateway.Address)) - if _, ok := gatewayIndexMap[index]; ok { - return sdkerrors.Wrap(ErrGatewayInvalidAddress, "duplicated index for gateway") + // Check for duplicated address in gateway + address := string(GatewayKey(gateway.Address)) + if _, ok := gatewayAddrMap[address]; ok { + return ErrGatewayInvalidAddress.Wrap("duplicated index for gateway") } - gatewayIndexMap[index] = struct{}{} + gatewayAddrMap[address] = struct{}{} // Validate the stake of each gateway if gateway.Stake == nil { - return sdkerrors.Wrap(ErrGatewayInvalidStake, "nil stake amount for gateway") + return ErrGatewayInvalidStake.Wrap("nil stake amount for gateway") } stake, err := sdk.ParseCoinNormalized(gateway.Stake.String()) if !stake.IsValid() { - return sdkerrors.Wrapf(ErrGatewayInvalidStake, "invalid stake amount for gateway %v; (%v)", gateway.Stake, stake.Validate()) + return ErrGatewayInvalidStake.Wrapf("invalid stake amount for gateway %v; (%v)", gateway.Stake, stake.Validate()) } if err != nil { - return sdkerrors.Wrapf(ErrGatewayInvalidStake, "cannot parse stake amount for gateway %v; (%v)", gateway.Stake, err) + return ErrGatewayInvalidStake.Wrapf("cannot parse stake amount for gateway %v; (%v)", gateway.Stake, err) } if stake.IsZero() || stake.IsNegative() { - return sdkerrors.Wrapf(ErrGatewayInvalidStake, "invalid stake amount for gateway: %v <= 0", gateway.Stake) + return ErrGatewayInvalidStake.Wrapf("invalid stake amount for gateway: %v <= 0", gateway.Stake) } if stake.Denom != "upokt" { - return sdkerrors.Wrapf(ErrGatewayInvalidStake, "invalid stake amount denom for gateway %v", gateway.Stake) + return ErrGatewayInvalidStake.Wrapf("invalid stake amount denom for gateway %v", gateway.Stake) } } // this line is used by starport scaffolding # genesis/types/validate diff --git a/x/gateway/types/genesis_test.go b/x/gateway/types/genesis_test.go new file mode 100644 index 000000000..357176de1 --- /dev/null +++ b/x/gateway/types/genesis_test.go @@ -0,0 +1,172 @@ +package types_test + +import ( + "testing" + + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/testutil/sample" + "github.com/pokt-network/poktroll/x/gateway/types" +) + +func TestGenesisState_Validate(t *testing.T) { + addr1 := sample.AccAddress() + stake1 := sdk.NewCoin("upokt", math.NewInt(100)) + + addr2 := sample.AccAddress() + stake2 := sdk.NewCoin("upokt", math.NewInt(100)) + + tests := []struct { + desc string + genState *types.GenesisState + valid bool + }{ + { + desc: "default is valid", + genState: types.DefaultGenesis(), + valid: true, + }, + { + desc: "valid genesis state", + genState: &types.GenesisState{ + GatewayList: []types.Gateway{ + { + Address: addr1, + Stake: &stake1, + }, + { + Address: addr2, + Stake: &stake2, + }, + }, + // this line is used by starport scaffolding # types/genesis/validField + }, + valid: true, + }, + { + desc: "invalid - duplicated gateway address", + genState: &types.GenesisState{ + GatewayList: []types.Gateway{ + { + Address: addr1, + Stake: &stake1, + }, + { + Address: addr1, + Stake: &stake2, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - nil gateway stake", + genState: &types.GenesisState{ + GatewayList: []types.Gateway{ + { + Address: addr1, + Stake: &stake1, + }, + { + Address: addr2, + Stake: nil, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - missing gateway stake", + genState: &types.GenesisState{ + GatewayList: []types.Gateway{ + { + Address: addr1, + Stake: &stake1, + }, + { + Address: addr2, + // Stake: stake2, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - zero gateway stake", + genState: &types.GenesisState{ + GatewayList: []types.Gateway{ + { + Address: addr1, + Stake: &stake1, + }, + { + Address: addr2, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(0)}, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - negative gateway stake", + genState: &types.GenesisState{ + GatewayList: []types.Gateway{ + { + Address: addr1, + Stake: &stake1, + }, + { + Address: addr2, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(-100)}, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - wrong stake denom", + genState: &types.GenesisState{ + GatewayList: []types.Gateway{ + { + Address: addr1, + Stake: &stake1, + }, + { + Address: addr2, + Stake: &sdk.Coin{Denom: "invalid", Amount: math.NewInt(100)}, + }, + }, + }, + valid: false, + }, + { + desc: "invalid - missing denom", + genState: &types.GenesisState{ + GatewayList: []types.Gateway{ + { + Address: addr1, + Stake: &stake1, + }, + { + Address: addr2, + Stake: &sdk.Coin{Denom: "", Amount: math.NewInt(100)}, + }, + }, + }, + valid: false, + }, + // this line is used by starport scaffolding # types/genesis/testcase + } + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + err := test.genState.Validate() + if test.valid { + require.NoError(t, err) + } else { + require.Error(t, err) + } + }) + } +} diff --git a/x/gateway/types/key_gateway.go b/x/gateway/types/key_gateway.go index 8fe1e65f7..7ddecd943 100644 --- a/x/gateway/types/key_gateway.go +++ b/x/gateway/types/key_gateway.go @@ -6,17 +6,15 @@ var _ binary.ByteOrder const ( // GatewayKeyPrefix is the prefix to retrieve all Gateways - GatewayKeyPrefix = "Gateway/value/" + GatewayKeyPrefix = "Gateway/address/" ) // GatewayKey returns the store key to retrieve a Gateway from the index fields -func GatewayKey( - address string, -) []byte { +func GatewayKey(gatewayAddr string) []byte { var key []byte - addressBytes := []byte(address) - key = append(key, addressBytes...) + gatewayAddrBz := []byte(gatewayAddr) + key = append(key, gatewayAddrBz...) key = append(key, []byte("/")...) return key diff --git a/x/gateway/types/keys.go b/x/gateway/types/keys.go index 4d65ff460..1cc1ef654 100644 --- a/x/gateway/types/keys.go +++ b/x/gateway/types/keys.go @@ -11,10 +11,6 @@ const ( MemStoreKey = "mem_gateway" ) -var ( - ParamsKey = []byte("p_gateway") -) +var ParamsKey = []byte("p_gateway") -func KeyPrefix(p string) []byte { - return []byte(p) -} +func KeyPrefix(p string) []byte { return []byte(p) } diff --git a/x/gateway/types/message_stake_gateway.go b/x/gateway/types/message_stake_gateway.go index 9f349cf16..7bdf8dfbc 100644 --- a/x/gateway/types/message_stake_gateway.go +++ b/x/gateway/types/message_stake_gateway.go @@ -1,9 +1,6 @@ package types -import ( - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" -) +import sdk "github.com/cosmos/cosmos-sdk/types" var _ sdk.Msg = (*MsgStakeGateway)(nil) @@ -17,25 +14,25 @@ func NewMsgStakeGateway(address string, stake sdk.Coin) *MsgStakeGateway { func (msg *MsgStakeGateway) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Address) if err != nil { - return sdkerrors.Wrapf(ErrGatewayInvalidAddress, "invalid gateway address %s; (%v)", msg.Address, err) + return ErrGatewayInvalidAddress.Wrapf("invalid gateway address %s; (%v)", msg.Address, err) } // Validate the stake amount if msg.Stake == nil { - return sdkerrors.Wrapf(ErrGatewayInvalidStake, "nil gateway stake; (%v)", err) + return ErrGatewayInvalidStake.Wrapf("nil gateway stake; (%v)", err) } stake, err := sdk.ParseCoinNormalized(msg.Stake.String()) if !stake.IsValid() { - return sdkerrors.Wrapf(ErrGatewayInvalidStake, "invalid gateway stake %v; (%v)", msg.Stake, stake.Validate()) + return ErrGatewayInvalidStake.Wrapf("invalid gateway stake %v; (%v)", msg.Stake, stake.Validate()) } if err != nil { - return sdkerrors.Wrapf(ErrGatewayInvalidStake, "cannot parse gateway stake %v; (%v)", msg.Stake, err) + return ErrGatewayInvalidStake.Wrapf("cannot parse gateway stake %v; (%v)", msg.Stake, err) } if stake.IsZero() || stake.IsNegative() { - return sdkerrors.Wrapf(ErrGatewayInvalidStake, "invalid stake amount for gateway: %v <= 0", msg.Stake) + return ErrGatewayInvalidStake.Wrapf("invalid stake amount for gateway: %v <= 0", msg.Stake) } if stake.Denom != "upokt" { - return sdkerrors.Wrapf(ErrGatewayInvalidStake, "invalid stake amount denom for gateway %v", msg.Stake) + return ErrGatewayInvalidStake.Wrapf("invalid stake amount denom for gateway %v", msg.Stake) } return nil } diff --git a/x/gateway/types/message_stake_gateway_test.go b/x/gateway/types/message_stake_gateway_test.go index d1cb20902..cda4abbaf 100644 --- a/x/gateway/types/message_stake_gateway_test.go +++ b/x/gateway/types/message_stake_gateway_test.go @@ -3,7 +3,7 @@ package types import ( "testing" - sdkmath "cosmossdk.io/math" + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" @@ -11,56 +11,56 @@ import ( ) func TestMsgStakeGateway_ValidateBasic(t *testing.T) { - coins := sdk.NewCoin("upokt", sdkmath.NewInt(100)) + coins := sdk.NewCoin("upokt", math.NewInt(100)) tests := []struct { - name string - msg MsgStakeGateway - err error + desc string + msg MsgStakeGateway + expectedErr error }{ { - name: "invalid address - no stake", + desc: "invalid address - no stake", msg: MsgStakeGateway{ Address: "invalid_address", // Stake explicitly nil }, - err: ErrGatewayInvalidAddress, + expectedErr: ErrGatewayInvalidAddress, }, { - name: "valid address - nil stake", + desc: "valid address - nil stake", msg: MsgStakeGateway{ Address: sample.AccAddress(), // Stake explicitly nil }, - err: ErrGatewayInvalidStake, + expectedErr: ErrGatewayInvalidStake, }, { - name: "valid address - zero stake", + desc: "valid address - zero stake", msg: MsgStakeGateway{ Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(0)}, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(0)}, }, - err: ErrGatewayInvalidStake, + expectedErr: ErrGatewayInvalidStake, }, { - name: "valid address - negative stake", + desc: "valid address - negative stake", msg: MsgStakeGateway{ Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "upokt", Amount: sdkmath.NewInt(-100)}, + Stake: &sdk.Coin{Denom: "upokt", Amount: math.NewInt(-100)}, }, - err: ErrGatewayInvalidStake, + expectedErr: ErrGatewayInvalidStake, }, { - name: "valid address - invalid stake denom", + desc: "valid address - invalid stake denom", msg: MsgStakeGateway{ Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "invalid", Amount: sdkmath.NewInt(100)}, + Stake: &sdk.Coin{Denom: "invalid", Amount: math.NewInt(100)}, }, - err: ErrGatewayInvalidStake, + expectedErr: ErrGatewayInvalidStake, }, { - name: "valid address - invalid stake missing denom", + desc: "valid address - invalid stake missing denom", msg: MsgStakeGateway{ Address: sample.AccAddress(), - Stake: &sdk.Coin{Denom: "", Amount: sdkmath.NewInt(100)}, + Stake: &sdk.Coin{Denom: "", Amount: math.NewInt(100)}, }, - err: ErrGatewayInvalidStake, + expectedErr: ErrGatewayInvalidStake, }, { - name: "valid address - valid stake", + desc: "valid address - valid stake", msg: MsgStakeGateway{ Address: sample.AccAddress(), Stake: &coins, @@ -68,11 +68,11 @@ func TestMsgStakeGateway_ValidateBasic(t *testing.T) { }, } - 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) + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + err := test.msg.ValidateBasic() + if test.expectedErr != nil { + require.ErrorIs(t, err, test.expectedErr) return } require.NoError(t, err) diff --git a/x/gateway/types/message_unstake_gateway.go b/x/gateway/types/message_unstake_gateway.go index fc163d022..e4e6142f2 100644 --- a/x/gateway/types/message_unstake_gateway.go +++ b/x/gateway/types/message_unstake_gateway.go @@ -1,9 +1,6 @@ package types -import ( - sdkerrors "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" -) +import sdk "github.com/cosmos/cosmos-sdk/types" var _ sdk.Msg = (*MsgUnstakeGateway)(nil) @@ -16,7 +13,7 @@ func NewMsgUnstakeGateway(address string) *MsgUnstakeGateway { func (msg *MsgUnstakeGateway) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Address) if err != nil { - return sdkerrors.Wrapf(ErrGatewayInvalidAddress, "invalid gateway address %s; (%v)", msg.Address, err) + return ErrGatewayInvalidAddress.Wrapf("invalid gateway address %s; (%v)", msg.Address, err) } return nil } diff --git a/x/gateway/types/message_unstake_gateway_test.go b/x/gateway/types/message_unstake_gateway_test.go index 301ad05ef..9e343dbad 100644 --- a/x/gateway/types/message_unstake_gateway_test.go +++ b/x/gateway/types/message_unstake_gateway_test.go @@ -9,34 +9,34 @@ import ( func TestMsgUnstakeGateway_ValidateBasic(t *testing.T) { tests := []struct { - name string - msg MsgUnstakeGateway - err error + desc string + msg MsgUnstakeGateway + expectedErr error }{ { - name: "invalid address", + desc: "invalid address", msg: MsgUnstakeGateway{ Address: "invalid_address", }, - err: ErrGatewayInvalidAddress, + expectedErr: ErrGatewayInvalidAddress, }, { - name: "missing address", - msg: MsgUnstakeGateway{}, - err: ErrGatewayInvalidAddress, + desc: "missing address", + msg: MsgUnstakeGateway{}, + expectedErr: ErrGatewayInvalidAddress, }, { - name: "valid address", + desc: "valid address", msg: MsgUnstakeGateway{ Address: 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) + for _, test := range tests { + t.Run(test.desc, func(t *testing.T) { + err := test.msg.ValidateBasic() + if test.expectedErr != nil { + require.ErrorIs(t, err, test.expectedErr) return } require.NoError(t, err) diff --git a/x/gateway/types/msg_update_params.go b/x/gateway/types/message_update_params.go similarity index 100% rename from x/gateway/types/msg_update_params.go rename to x/gateway/types/message_update_params.go diff --git a/x/gateway/types/params.go b/x/gateway/types/params.go index 4f3215e35..95b0cf8a2 100644 --- a/x/gateway/types/params.go +++ b/x/gateway/types/params.go @@ -1,8 +1,6 @@ package types -import ( - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" -) +import paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" var _ paramtypes.ParamSet = (*Params)(nil)